Application Development 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: 

Calling Standard Program Using Keyworkd 'SUBMIT'.

Former Member
0 Kudos

Hi All,

I have the requirement where i have to capture the output of Tcode: MC.5 into an internal table and then i have to manupulate that data.

I have used 'submit' keyword with the proper addition keywords to transfer the output into the memory and then picking it from the memory using FM 'LIST_FROM_MEMORY' and then converting it into the ASCI format using FM

'LIST_TO_ASCI'.

I am getting the output with null values but when i am executing the MC.5 with the same selection there are no values for the output fields.Please help me in this ....

Attached is the code which i have used....

selpr-selname = 'SL_WERKS'.

selpr-kind = 'S'.

selpr-sign = 'I'.

selpr-option = 'EQ'.

selpr-low = '1100'.

append selpr.

clear selpr.

selpr-selname = 'SL_MATNR'.

selpr-kind = 'S'.

selpr-sign = 'I'.

selpr-option = 'EQ'.

selpr-low = '100000005'.

append selpr.

clear selpr.

selpr-selname = 'SL_SPMON'.

selpr-kind = 'S'.

selpr-sign = 'I'.

selpr-option = 'EQ'.

selpr-low = '082007'.

selpr-high = '082007'.

append selpr.

clear selpr.

selpr-selname = 'SLV_NO'.

selpr-kind = 'P'.

selpr-sign = 'I'.

selpr-option = 'EQ'.

selpr-low = 'Z001'.

*selpr-high = '082007'.

append selpr.

clear selpr.

submit rmcb0100

with selection-table selpr

and return

exporting list to memory.

clear: ws_list, it_asc.

call function 'LIST_FROM_MEMORY'

tables

listobject = ws_list

exceptions

not_found = 1

others = 2.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

  • IF SY-SUBRC = 0.

"convert it to ASCI

call function 'LIST_TO_ASCI'

tables

listasci = it_asc

listobject = ws_list

exceptions

empty_list = 1

list_index_invalid = 2

others = 3.

Thanks in Advance

Ganga B

1 REPLY 1

former_member223537
Active Contributor
0 Kudos

Submit to spool & read the spool data into internal table using FM "RSPO_RETURN_ABAP_SPOOLJOB".


DATA: number           TYPE tbtcjob-jobcount, 
      name             TYPE tbtcjob-jobname VALUE 'JOB_TEST', 
      print_parameters TYPE pri_params. 

... 

CALL FUNCTION 'JOB_OPEN' 
  EXPORTING 
    jobname          = name 
  IMPORTING 
    jobcount         = number 
  EXCEPTIONS 
    cant_create_job  = 1 
    invalid_job_data = 2 
    jobname_missing  = 3 
    OTHERS           = 4. 
IF sy-subrc = 0. 
  SUBMIT submitable TO SAP-SPOOL 
                    SPOOL PARAMETERS print_parameters 
                    WITHOUT SPOOL DYNPRO 
                    VIA JOB name NUMBER number 
                    AND RETURN. 
  IF sy-subrc = 0. 
    CALL FUNCTION 'JOB_CLOSE' 
      EXPORTING 
        jobcount             = number 
        jobname              = name 
        strtimmed            = 'X' 
      EXCEPTIONS 
        cant_start_immediate = 1 
        invalid_startdate    = 2 
        jobname_missing      = 3 
        job_close_failed     = 4 
        job_nosteps          = 5 
        job_notex            = 6 
        lock_failed          = 7 
        OTHERS               = 8. 
    IF sy-subrc <> 0. 
      ... 
    ENDIF. 
  ENDIF. 
ENDIF.