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

Submit + LIST_FROM_MEMORY in background mode

Former Member
0 Likes
2,174

Hi,

I need to capture the output results from standard program RFKORK00 and hence I designed a wrapper program that calls the standard program.

RFKORK00 generates a report output and I am able to capture the results correctly using the FM LIST_FROM_MEMORY and FM LIST_FROM_ASCI in foreground mode. But when I try to run the same job in background, the FM LIST_FROM_MEMORY does not return any results (I have checked the log by inserting information messages at various points in the program).

I have searched for similar contexts here on SDN and everyone is in agreement that LIST_FROM_MEMORY would work well even in the background mode too but I am unable to find the fault in this case. Could you please help, attached is the code -

SUBMIT RFKORK00
      USING SELECTION-SET c_variant
      EXPORTING LIST TO MEMORY
      AND RETURN.

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

    IF sy-subrc = 0.

      CALL FUNCTION 'LIST_TO_ASCI'
        EXPORTING
          list_index         = '-1'
          with_line_break    = ' '
        TABLES
          listasci           = lt_vlist[]
          listobject         = lt_abaplist[]
        EXCEPTIONS
          empty_list         = 1
          list_index_invalid = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

      MESSAGE i099(z1) WITH 'LIST TO ASCI CALL'.

   ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,295

maybe totally off the wall, but in background why wouldn't we let the report spool, then when we see that the spool exists, import the spool content?

5 REPLIES 5
Read only

Former Member
0 Likes
1,296

maybe totally off the wall, but in background why wouldn't we let the report spool, then when we see that the spool exists, import the spool content?

Read only

0 Likes
1,295

Well, RFKORK00 is indeed a print program that triggers spool in the background.

I gave up playing around memory id, instead I am using the following code to check whether a spool was created in table TSP03.

CLEAR r_rqcretime[].
    r_rqcretime-sign    = 'I'.
    r_rqcretime-option  = 'BT'.

    CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
      EXPORTING
        i_datlo     = sy-datlo
        i_timlo     = sy-uzeit
        i_tzone     = 'EST'
      IMPORTING
        e_timestamp = v_tzntstmps.

    r_rqcretime-low = v_tzntstmps.

**Submit job with changed variant
    SUBMIT (p_prog)
      USING SELECTION-SET c_variant
      EXPORTING LIST TO MEMORY
      AND RETURN.

    WAIT UP TO 5 SECONDS.

**Fetch the spool number generated by the program
    CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
      EXPORTING
        i_datlo     = sy-datlo
        i_timlo     = sy-uzeit
        i_tzone     = 'EST'
      IMPORTING
        e_timestamp = v_tzntstmps.

    r_rqcretime-high = v_tzntstmps.

    CONDENSE: r_rqcretime-low,r_rqcretime-high.
    CONCATENATE r_rqcretime-low   '00' INTO r_rqcretime-low.
    CONCATENATE r_rqcretime-high  '00' INTO r_rqcretime-high.

    APPEND r_rqcretime.

    SELECT SINGLE rqident FROM tsp01
                  INTO v_rqident
                 WHERE rqowner = sy-uname
                   AND rqcretime IN r_rqcretime.

Read only

Former Member
0 Likes
1,295

I think RFKORK00 is a print program - not sure if it has any restrictions for abckground execution

Are you getting any report output in spool?

Read only

Clemenss
Active Contributor
0 Likes
1,295

Hi Grame,

insert before SUBMIT:

SY-SUBRC = 3.
WHILE SY-SUBRC ÍS NOT INITIAL.
ENDWHILE.

This triggers an endless loop. You can Capture the job in job overview or debug the process from SM50 process view. In debugger, clear SY-SUBRC and then step thru relevant codes sections.

First thing you may do is checking if correct parameters are used as expected.

Hope that way you find a solution.

Regards,

Clemens

Read only

Former Member
0 Likes
1,295

Hi Grame,

Not that this will help you but I noticed a lot of unanswered questions with the excat same problem statement on this site and others. So unfortunately it appears not to be as straightforward as one thinks :-).

[Submit exporting list to memory and return; background execution|;

[Submit ALV report in Background & exporting list to memory and return |;

Reading the various posts, it seems that the one thing they have in common is that in case the output is an ALV list the exporting list to memory option does not work in background, only classical lists (see last link).

Maybe this is the case for RFKORK00?.

Regards,

Robert