2011 Jan 31 7:19 PM
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.
2011 Jan 31 8:25 PM
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?
2011 Jan 31 8:25 PM
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?
2011 Feb 01 6:38 PM
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.
2011 Jan 31 8:45 PM
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?
2011 Jan 31 8:59 PM
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
2011 Feb 01 12:23 AM
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