Skip to Content
author's profile photo Former Member
Former Member

background job

Hi,

I have an abap program which starts off a background job. How do I pass an internal table to the background job?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 09: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**

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 09:04 AM

    Hi

    you are able to EXPORT/IMPORT to pass internal table into background job.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2007 at 09: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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.