2007 Sep 10 9:57 AM
Hi,
I have an abap program which starts off a background job. How do I pass an internal table to the background job?
2007 Sep 10 10:05 AM
Please explain your requirement .
If you want to pass some data to the program you can do following
1, add a selection parameter file path in the report
2. store your file in the apllication server in some path
3. use Open dataset command to open the file in app server from the report
4. use read dataset to access each records.
NB: in the variant you have to use the same file path where u stored stored your data.
In case your requirement is to pass data between two programs that are independet, you can try EXPORT / IMPORT commands and you can store data in abap memory and retrieve later
Reward for useful answer**
Hi,
I have an abap program which starts off a background job. How do I pass an internal table to the background job?
2007 Sep 10 10:04 AM
Hi
you are able to EXPORT/IMPORT to pass internal table into background job.
2007 Sep 10 10:05 AM
Please explain your requirement .
If you want to pass some data to the program you can do following
1, add a selection parameter file path in the report
2. store your file in the apllication server in some path
3. use Open dataset command to open the file in app server from the report
4. use read dataset to access each records.
NB: in the variant you have to use the same file path where u stored stored your data.
In case your requirement is to pass data between two programs that are independet, you can try EXPORT / IMPORT commands and you can store data in abap memory and retrieve later
Reward for useful answer**
2007 Sep 10 10:08 AM
Hi,
You cant pass internal table to background job directly.
Trace the name of the background job program & open that program & modify accordingly..
Regards
2007 Sep 10 10:18 AM
Hi
We can do this by Creating a background Job dynamically and using the ABAP Memory (Export / Import).
You can try to SUBMIT to this program in the background using a JOB.
SAMPLE CODE:
DATA: print_parameters TYPE pri_params,
valid_flag TYPE c LENGTH 1.
START-OF-SELECTION.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_parameters = print_parameters
valid = valid_flag
EXCEPTIONS
invalid_print_params = 2
OTHERS = 4.
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.
EXPORT ITAB TO MEMORY ID 'ABC'.
SUBMIT ZREP2 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.
REWARD IF HELPFUL.