Friday 11 June 2021

Calling the Submit Report/ Program through the Odata Service

All of you know the Alv report and OData service individually. Coming to this scenario some of the members don’t aware how to use the Report through Submit in OData service.

So I am trying to explain how do we use Submit report in Netweaver gate way services.

More info: C_TAW12_750 Key Points

Note: Please follow the following steps

Create the custom program:

Step1:  Go to t-code SE38

Step2 : Create one sample report with the required fields like below.

REPORT zsubmit_demo81.

** Data declarations

DATA:  lv_vbeln TYPE vbeln_va,

o_alv TYPE REF TO cl_salv_table.

** Select options

SELECT-OPTIONS: s_vbeln FOR lv_vbeln.

** Get data

SELECT vbeln, posnr, matnr

FROM vbap

UP TO 10 rows

INTO TABLE @DATA(lt_vbap)

WHERE vbeln IN @s_vbeln  .

** Assign internal table to method

cl_salv_table=>factory(

IMPORTING

r_salv_table = oval

CHANGING

t_table = lt_vbap ).

**   Display Data

o_alv->display( ).

Execute :

SAP ABAP Career, SAP ABAP Preparation, SAP ABAP Exam Prep, SAP ABAP Learning, SAP ABAP Tutorial and Materials

Output:

SAP ABAP Career, SAP ABAP Preparation, SAP ABAP Exam Prep, SAP ABAP Learning, SAP ABAP Tutorial and Materials


Use the Report in OData service through SUBMIT  :

Step3: Create the project with t-code ‘SEGW’.

Step4: Create the method and redefine it

Step5: Use the already created program SUBMIT as like below.

METHOD sales_detailset_get_entityset.

** Data declarations
DATA:  lt_seltab TYPE TABLE OF rsparams,
ls_seltab LIKE LINE OF lt_seltab,
list_tab TYPE TABLE OF abaplist,
ls_data TYPE REF TO data.
FIELD-SYMBOLS: <lt_data> TYPE table.

** Passing the values
ls_seltab-selname = ‘S_VBELN’.
ls_seltab-kind = ‘S’.
ls_seltab-sign = ‘I’.
ls_seltab-option = ‘EQ’.
ls_seltab-low = ‘4970’.

** Disable the display and metadata
cl_salv_bs_runtime_info=>set(
display = abap_false
metadata = abap_false
data = abap_true ).

** Passing the i/p values to internal table
APPEND ls_seltab TO lt_seltab.

** Using the report through Submit
SUBMIT zsubmit_demo81 WITH SELECTION-TABLE lt_seltab EXPORTING LIST TO MEMORY AND RETURN.

IF sy-subrc = 0.

**  Getting the internal table data
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = ls_data ).

ASSIGN ls_data->* TO <lt_data>.
MOVE-CORRESPONDING <lt_data> TO et_entityset.

ENDIF.

ENDMETHOD.

Step6: Go to the maintain services T-code ‘/n/iwfnd/maint_services‘ and execute it.

Step7: Find the project and execute it.

SAP ABAP Career, SAP ABAP Preparation, SAP ABAP Exam Prep, SAP ABAP Learning, SAP ABAP Tutorial and Materials

Note : Here we displayed the same data as like got the data in report

Source: sap.com

No comments:

Post a Comment