Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

calling two sap standard programs using 'SUBMIT' statement

venkatasap
Participant
0 Likes
2,661

Hi SapAll.

i have got a requirement in SAP-GTS(GLOBAL TRADE SERVICES) where i need to call a standard program '/SAPSLL/CON_BLOCKED_DOCS_IMP ' and pass the output into Internal table.submitting this internal table to another SAP Standard Program'/SAPSLL/CUHD_MASS_REFRESH_IMP' and get the detailed output.

so my question here is can i implement the above requirement with 'SUBMIT' option ,if so which options must i use in the 'SUBMIT' types

will be waiting for your response.

regards.

Varma

1 ACCEPTED SOLUTION
Read only

christian_wohlfahrt
Active Contributor
0 Likes
1,857

Hi Varma,

have a look at F1-help of submit - list-options - EXPORTING LIST TO MEMORY

With this, you can get an output of a report, coding example from SAP:

DATA list_tab TYPE TABLE OF abaplist. 

SUBMIT report EXPORTING LIST TO MEMORY 
              AND RETURN. 

CALL FUNCTION 'LIST_FROM_MEMORY' 
  TABLES 
    listobject = list_tab 
  EXCEPTIONS 
    not_found  = 1 
    OTHERS     = 2. 

IF sy-subrc = 0. 
  CALL FUNCTION 'WRITE_LIST' 
    TABLES 
      listobject = list_tab. 
ENDIF. 

I don't have access to a SAP-GTS system - you might need to convert "list_tab"; extract relevant information, generate new import variables for 2nd report. Maybe not easy work, but you can at least try.

BR,

Christian

17 REPLIES 17
Read only

christian_wohlfahrt
Active Contributor
0 Likes
1,858

Hi Varma,

have a look at F1-help of submit - list-options - EXPORTING LIST TO MEMORY

With this, you can get an output of a report, coding example from SAP:

DATA list_tab TYPE TABLE OF abaplist. 

SUBMIT report EXPORTING LIST TO MEMORY 
              AND RETURN. 

CALL FUNCTION 'LIST_FROM_MEMORY' 
  TABLES 
    listobject = list_tab 
  EXCEPTIONS 
    not_found  = 1 
    OTHERS     = 2. 

IF sy-subrc = 0. 
  CALL FUNCTION 'WRITE_LIST' 
    TABLES 
      listobject = list_tab. 
ENDIF. 

I don't have access to a SAP-GTS system - you might need to convert "list_tab"; extract relevant information, generate new import variables for 2nd report. Maybe not easy work, but you can at least try.

BR,

Christian

Read only

0 Likes
1,857

Hi mr Christian.

thanks fo ryou response.

but the requrement is slightly changed now ,here first i have to call a SAP Standard function module and then iam getting the output of SAP FM to an internal table with two variables in it.so now i have to pass these two variables of internal table(having multiple values in them) to the other SAP Standard program selection screen while Submitting.then i have to get the resulting list to another itab to display.

so how i can the achieve above mentioned using the SUBMIT Statement.

i hope you understand my requirement now.

waiitng for your response.

regards.

Varma

Read only

0 Likes
1,857

Hi,

You can make use of structure RSPARAMS to pass your internal table to another program.


DATA: it_rsparams TYPE TABLE OF rsparams,
      wa_rsparams LIKE LINE OF it_rsparams.

SUBMIT PROGRAM WITH SELECTION-TABLE it_rsparams[] AND RETURN.

Regards,

Danish.

Read only

0 Likes
1,857

Hi Danish.

that SAP Standard program is got the Selection screen with various Selection parameters but i need to pass only 2 itab fields to the respective fields of SAP Program selection screen and that SAP Program has also got two check boxes which i need to enable to display the log?(output) otherwise i dont see the log.

so how i can catch the out put by only passing two required itab-field values and also enabling the 2 check boxes.

regards.

Varma

Read only

0 Likes
1,857

Hi,

Suppose the fieldnames for your checkboxes for the target program are p_ch1 and p_ch2.


CLEAR wa_rsparams.
wa_rsparams-selname = 'P_CH1'.
wa_rsparams-kind    = 'P'.
wa_rsparams-sign    = 'I'.
wa_rsparams-option  = 'EQ'.
wa_rsparams-low     = 'X'.
APPEND wa_rsparams TO it_rsparams.

" Repeat the same for P_CH2.

Refer this thread for a much detailed solution.

[;

Regards,

Danish.

Read only

0 Likes
1,857

Create a system variant (transport) with the other parameters (checkboxes and other default values) and

LOOP AT gt_itab1 ASSIGNING <recd1>.
  refresh lt_itab2
* ...
  SUBMIT reportname
    USING SELECTION-SET 'CUS&XXX' " create a system variant with default value (you can also use selection variable)
    WITH parameter1 = <recd1>-field1 " pass also the two parameters
    WITH parameter2 = <recd1>-field2.
* ...
  APPEND LINES OF lt_itab2 TO gt_itab2.
ENDLOOP.

Using a WITH parameter1 IN itab1 WITH parmeter2 IN itab2 where itab1 and itab2 would be ranges of values, may cause problem as you wont get the list of original couples of parametesr but a bunch with all the couples generated from every available values from original couples, (1, 1) (2, 2) will become (1, 1) (1, 2) (2, 1) (2, 2)...

Regards,

Raymond

Read only

0 Likes
1,857

Hi Danish.

here i need to submit two fileds from the Internal table and i also need to enable two check boxes of the calling program .so in total i need to pass 4 fields (two selection fields,two check boxes) to the calling program while submitting.

so can you please give me some idea on how to pass the internal table with all the above mentioned values to the calling program.

regards.

Varma

Read only

0 Likes
1,857

Hi mr raymond.

i have done the coding as you said,please have a look at the below section for the code :

TYPES : BEGIN OF jtab,

ref_no LIKE /SAPSLL/CORREF_LEGAL_S-REFNO,

year Like /SAPSLL/CUHD-COYEAR,

disp_log TYPE c LENGTH 1,

save_log TYPE c LENGTH 1.

TYPES : END OF jtab.

DATA : it_jtab TYPE TABLE OF jtab WITH HEADER LINE,

wa_jtab LIKE LINE OF it_jtab,

Logic :

IF sy-subrc = 0.

LOOP AT t_et_data INTO wa_et_data.

wa_jtab-ref_no = wa_et_data-refno.

wa_jtab-year = wa_et_data-coyear.

wa_jtab-disp_log = 'X'.

wa_jtab-save_log = 'X'.

APPEND wa_jtab TO it_jtab.

ENDLOOP.

ENDIF.

SUBMIT /SAPSLL/CUHD_MASS_REFRESH_IMP USING SELECTION-SET'ZVAR' with S_REFNO-LOW = wa_jtab-ref_no with S_COYEAR-LOW = wa_jtab-year with P_APPLOG = wa_jtab-disp_log

with P_APPL = wa_jtab-save_log .

IF sy-subrc NE 0.

write :'not sucess'.

ENDIF.

when i ran the program iam getting an information message saying 'No data found; change the selection criteria'.(from the sap standard program )

can you help me in this.

regards.

Varma

Read only

0 Likes
1,857

Hi mr Danish.

i have tried as you said but the output of the program says as 'No data found; change the selection criteria' (the message from the standard SAP Program '/SAPSLL/CUHD_MASS_REFRESH_IMP' to which i have submitted' ,the input is as follows :

IF sy-subrc = 0.

LOOP AT t_et_data INTO wa_et_data.

wa_rsparams-selname = 'S_REFNO-LOW'.

wa_rsparams-kind = 'S'.

wa_rsparams-sign = 'I'.

wa_rsparams-option = 'EQ'.

wa_rsparams-low = wa_et_data-refno .

APPEND wa_rsparams TO it_rsparams.

wa2_rsparams-selname = 'S_COYEAR-LOW'.

wa2_rsparams-kind = 'S'.

wa2_rsparams-sign = 'I'.

wa2_rsparams-option = 'EQ'.

wa2_rsparams-low = wa_et_data-coyear.

APPEND wa2_rsparams TO it2_rsparams.

wa_jtab-ref_no = wa_rsparams.

"wa_jtab-year = wa_et_data-coyear.

wa_jtab-year = wa2_rsparams.

wa_jtab-disp_log = 'X'.

wa_jtab-save_log = 'X'.

APPEND wa_jtab TO it_jtab.

ENDLOOP.

ENDIF.

SUBMIT /SAPSLL/CUHD_MASS_REFRESH_IMP USING SELECTION-SET'ZVAR' with S_REFNO-LOW = wa_jtab-ref_no with S_COYEAR-LOW = wa_jtab-year with P_APPLOG = wa_jtab-disp_log.

IF sy-subrc NE 0.

write :'not sucess'.

ENDIF.

*************While debugging the data in internal table is as follows :

WA_JTAB-REF_NO = S_REFNO-SIEQ0000000000000000000000000000

WA_JTAB-YEAR = S_COYEARSIEQ2011

WA_JTAB-DISP_LOG = 'X'.

will be waiting for your response.

regards.

Varma

Read only

0 Likes
1,857

Hi,

Just change the contents of wa_rsparams-selname.

Instead of using S_REFNO-LOW and S_COYEAR-LOW, use S_REFNO and S_COYEAR.

Regards,

Danish.

Read only

0 Likes
1,857

Thanks,it is working Danish.

regards.

Varma

Read only

0 Likes
1,857

Hi Mr Christian.

when i tried with the code that you have mentioned and executed the report,iam getting

the output as 'Typ Message text , List contains no data'

while debugging the values are as below :

LIST_TAB

LINE-1-,RFCSIXE[I940]-1-,RFCRECORDX[1000]-700236000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

LINE-2-,RFCSIXE[I940]-691-RFCRECORDX[1000]-FF06020102028000343130330000000039190000121F9D0269CF6A769B0682F038EB94C001091077F780C4857708D05FE4B6A181CA904851552254091A2

waiitng for your solution .

regards.

Varma

Read only

0 Likes
1,857

Hi Danish.

just a quick question,iam submitting the Work Area just for testing but now i want to submit the whole internal table instead of work area so how i can do that ?,the following below is the code which iam currently using :

LOOP AT t_et_data INTO wa_et_data.

wa_jtab-ref_no = wa_et_data-refno.

wa_jtab-year = wa_et_data-coyear.

wa_jtab-disp_log = 'X'.

wa_jtab-save_log = 'X'.

APPEND wa_jtab TO it_jtab.

SUBMIT /SAPSLL/CUHD_MASS_REFRESH_IMP USING SELECTION-SET'ZVAR' with S_REFNO = wa_jtab-ref_no with S_COYEAR = wa_jtab-year with P_APPL = wa_jtab-save_log EXPORTING LIST TO MEMORY AND RETURN.

note : i want to submit the whole itab instead of WA ,the reason being i dont want to call the SAP PROGRAM multiple times rahter call once using the SUBMIT stmt.

regards.

Varma

Read only

Former Member
0 Likes
1,857

Call the standard FM and get the output internal table.

From that internal table , pull the required variables.

Use the addition, WITH SELECTION TABLE to the SUBMIT statement in ABAP. Pass the variable values which you have retrived in the above step with their corresponding selection screen name in the report which you are going to submit. The selection table will have the staructure of RSPARAMS .

Hope this is helpful you. Please let me know if you face any issues.

Thanks,

Selva.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,857

If one of the report displays an ALV grid, then you can get the internal table (and layout information if required) from this report without displaying the grid using cl_salv_bs_runtime_info class. (*)

Regards,

Raymond

(*) Read this blog [Gain Programmatic Access to Data of SAPGUI ALV Reports|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/24944] [original link is broken];

Read only

Former Member
0 Likes
1,857

Hi Varma,

If you have multiple values from the internal table and you have selection option in report selection, you use range.

Loop the internal table and append the data with range and pass the range to submit program, and for check box use 'X' as a values. So the check box will be ticked.

Regards

Rajesh V

Read only

0 Likes
1,857

Hi Rajesh.

as you said i have used range as below

LOOP AT t_et_data INTO wa_et_data.

  • For Company Code

wa_rsparams-sign = 'I'.

wa_rsparams-option = 'EQ'.

wa_rsparams-low = wa_et_data-refno .

APPEND wa_rsparams TO it_rsparams.

wa_rsparams-sign = 'I'.

wa_rsparams-option = 'EQ'.

wa_rsparams-low = wa_et_data-coyear.

APPEND wa_rsparams TO it_rsparams.

wa_rsparams-sign = 'I'.

wa_rsparams-option = 'EQ'.

wa_rsparams-low = 'X' .

APPEND wa_rsparams TO it_rsparams.

wa_rsparams-sign = 'I'.

wa_rsparams-option = 'EQ'.

wa_rsparams-low = 'X' .

APPEND wa_rsparams TO it_rsparams.

so now which SUBMIT statement must i use in this scenario as i have got multiple options like SELECTion set ,VARIANT etc.

regards.

Varma