08-31-2015 11:37 AM
HI All,
I have a ZTEST1 report which I will execute in foreground and I select the file from presentation server and upload using FM WS_UPLOAD and internal table t_objectid contains the records from the uploaded file.
In debug mode(I change the value of SY-BATCH to 'X' for ZTEST2) and I am getting the ALV LIST DISPLAY with some records.
If the execute ztest1 using F8, and goto SM37 I can see the spool number generated. But in the spool it is showing List contains no data.
Am I missing anything. Please help me.
Below is my code.
report ZTEST1.
start-of-selection.
perform open_file.
export t_objectid to memory id 'ZBGR'.
perform job_open.
perform sel_opt.
export t_selection to memory id 'ZBGR1'.
perform submit_report.
perform close_job.
submit ztest2
with selection-table t_selection
with p_tcode = p_tcode
with p_fname = p_fname
user sy-uname
via job jobname
number jobcount
and return.
---------------------------------------------------
Below is my code for ZTEST2report.
start-of-selection.
if sy-batch = 'X'.
import t_objectid to t_objectid from memory id 'ZBGR'.
import t_selection to t_selection from memory id 'ZBGR1'.
refresh s_udate.
loop at t_selection into wa_selection.
move-corresponding wa_selection to s_udate.
append s_udate.
endloop.
perform fetch_cdhdr.
perform fetch_cdpos.
perform final_table.
perform build_fcat.
perform build_events.
perform display_data.
endif.
Thanks,
Haritha
08-31-2015 2:10 PM
Hi Haritha.
The EXPORT TO MEMORY command writes the data to the ABAP-Memory. The ABAP-Memory exists only in your actual mode. That is the reason, why it works in debug mode and it does not work in the batch-Job, which has its own mode.
Regards,
Peer
08-31-2015 12:31 PM
In perform open_file, did you manage the returned sy-subrc when calling WS_UPLOAD (obsolete) in background, I guess no ?
Regards,
Raymond
08-31-2015 1:45 PM
Hello Haritha,
Try using TO SAP-SPOOL in the Submit statement.
Regards,
Thanga
08-31-2015 2:10 PM
Hi Haritha.
The EXPORT TO MEMORY command writes the data to the ABAP-Memory. The ABAP-Memory exists only in your actual mode. That is the reason, why it works in debug mode and it does not work in the batch-Job, which has its own mode.
Regards,
Peer