Creating ABAP based web services and consuming the same in ABAP

...Previous

Generating the proxy object-Consuming in ABAP 

Login to SAP system.

Go to SE80 create proxy object,

Path: create-> enterprise web service->proxy object 

 

Select the option “local File” and select the wsdl saved on local pc in earlier step.

Specify the package & prefix (z) save it.

         

Creating RFC destination for Yhsapi01. 

Create RFC destination of type “H”

 

 

If needed configure the proxy settings

For configuring proxy settings click on Global Configuration” 

 

Save the settings 

 

Creating Logical port

Go to lpconfig 

 

 

 

 

 

Creating Client Application-> report 

*&---------------------------------------------------------------------*
*& Report  ZXI3
*& AUTHOR: chandra dasari
*&---------------------------------------------------------------------*
REPORT  ZXI3.
*&----------------------------------------------------------------*&
*& Data Declaration
*&----------------------------------------------------------------*&
tables : spfli.
DATA: proxy TYPE REF TO zco_zgetflightdet19_wsd,
      OUTPUT type ZZGETSFLIGHTDETRESPONSE ,
      INPUT type ZZGETSFLIGHTDET .
Data : sys_fault type ref to cx_ai_system_fault,
       app_fault type ref to cx_ai_application_fault.
Data : itab type spfli.
*&----------------------------------------------------------------*&
*& UI Declaration
*&----------------------------------------------------------------*&
parameters : p_carrid type spfli-carrid,
             p_connid type spfli-connid.
*&----------------------------------------------------------------*&
*& Application logic
*&----------------------------------------------------------------*&
start-of-selection.
TRY.
    CREATE OBJECT proxy
      exporting
        LOGICAL_PORT_NAME = 'ZCO_ZGETFLIGHTDET19_WSD'        .
  CATCH cx_ai_system_fault .
   create object sys_fault.
      write :/ 'error at level 1', sys_fault->errortext.
   exit.
ENDTRY.
TRY.
 input-carrid = p_carrid.
 input-connid = p_connid.
CALL METHOD proxy->zgetsflightdet
  EXPORTING
    input  = input
  IMPORTING
    OUTPUT = output
    .
 CATCH CX_AI_SYSTEM_FAULT .
     create object sys_fault.
     write :/ 'error at level 2', sys_fault->errortext.
   exit.
 CATCH ZCX_EXCEPTION00 .
 CATCH CX_AI_APPLICATION_FAULT .
    write : 'error 3'.
   exit.
ENDTRY.
write : / 'TEST RESULTS OF CLIENT APPLICATION RUNNING ON YHSAPX05'.
WRITE : / 'THE CLIENT APPLICATION CALLS THE WEBSERVICE LOCATED ON YHSAPI01 SYSTEM'.
SKIP.
write :/ output-carrid,
       / output-connid,
       / output-currency,
       / output-planetype,
       / output-price,
       / output-seatsmax,
       / output-seatsocc.

Performing test from client application. 

Execute the application.

Input screen:

 

Output:

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image