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

submitting vf44 (SDRRAV01) program via selection screen inputs

Former Member
0 Likes
1,692

Hi experts, I am submitting vf44 (SDRRAV01) program via selection screen inputs, my z program should run in both fore ground as well as background, even i have used sy-batch  eq X  but still  i am unable to execute in background.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,320

What is the exact problem. Do you want the program to automatically execute in background, I hope youd did not expect to much of a SY-BATCH = 'X' statement ? (Read some documentation like SUBMIT - job_options.)

Regards,

Raymond

11 REPLIES 11
Read only

Former Member
0 Likes
1,320

Refer following thread

http://scn.sap.com/message/5357623

Read only

0 Likes
1,320

hi hawkins,

this steps i need to skip when i submit (SDRRAV01).

In the selection screen :After filling the screen fields press F9.

A screen appears requesting U to print the Background Parameters

*Enter the output device(Eg HPLJ /SAP2 etc)

*In the spool options Uncheck Print immedietly,Uncheck delete after output,and new spool request.

Press enter.

Another screen appears with heading start time .U can press start immly ,then save

Now the Background job is scheduled for the given program .

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,321

What is the exact problem. Do you want the program to automatically execute in background, I hope youd did not expect to much of a SY-BATCH = 'X' statement ? (Read some documentation like SUBMIT - job_options.)

Regards,

Raymond

Read only

0 Likes
1,320

hi raymond,

here is the sample code of my requirement,

IF sy-batch = 'X'.

     SUBMIT  sdrrav01 VIA SELECTION-SCREEN

     WITH sbukrs   IN lt_bukrs

     WITH sauart   IN lt_auart

     WITH paccgrad EQ gc_paccgrad

     WITH ppostdat EQ sy-datum

     WITH prlkz    EQ gc_prlkz

     WITH svbeln   IN lt_vbeln

     WITH ppoper_h EQ bkpf-monat

     WITH pgjahr_h EQ bkpf-gjahr

                         AND RETURN.


ELSE.
* Run the program (ZOTC_R_VEHREVREC) in foreground
     SUBMIT sdrrav01
                     VIA SELECTION-SCREEN
     WITH sbukrs   IN lt_bukrs

     WITH sauart   IN lt_auart

     WITH paccgrad EQ gc_paccgrad

     WITH ppostdat EQ sy-datum

     WITH prlkz    EQ gc_prlkz

     WITH svbeln   IN lt_vbeln

     WITH ppoper_h EQ bkpf-monat

     WITH pgjahr_h EQ bkpf-gjahr


                         AND RETURN.

Read only

0 Likes
1,320

hi raymond,

What i needed is when i submit i get selection screen in that i will be using execute button for fore ground and job button for background, so what should i write in the submit statement to make it in background

Read only

0 Likes
1,320

It looks like you are populating all the data in the selection screen from your program itself. What is the need of via selection screen? are you changing any values in the selection screen?

You can just use submit for forground and submit via job for background.

thanks.

Read only

0 Likes
1,320

can we submit program via background, if u dont mind can u please tell me the syntax for submitting in the background

Read only

0 Likes
1,320

First open a job using

CALL FUNCTION 'JOB_OPEN'
     EXPORTING
       jobname          = lv_jobname
       jobgroup         = 'INVOICE'   "select the appropriate job group.
     IMPORTING
       jobcount         = gv_jobcount

then submit the program using

SUBMIT programname
            VIA JOB lv_jobname
            NUMBER gv_jobcount
            WITH p_vkorg  = p_sorg
             ...............
            AND RETURN.

then close the job using

CALL FUNCTION 'JOB_CLOSE'
     EXPORTING
       jobname              = lv_jobname "JOBNAME'
       jobcount             = gv_jobcount
       strtimmed            = zif_sd_constants=>gc_true
     EXCEPTIONS
       cant_start_immediate = 01
       invalid_startdate    = 02
       jobname_missing      = 03

closing the job will start the job immediately or at a specified time depending on the parameters selected in job_close

Read only

0 Likes
1,320

i have done this for single sales document its running fine for  multiple sales document the job is not doing,

here is my code for job can you please tell me what mistake i have done

IF sy-batch = 'X'.

DATA: number           TYPE tbtcjob-jobcount,
       name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
       print_parameters TYPE pri_params.


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.

   SUBMIT sdrrav01

     WITH sbukrs   IN lt_bukrs

     WITH sauart   IN lt_auart

     WITH paccgrad EQ gc_paccgrad

     WITH ppostdat EQ sy-datum

     WITH prlkz    EQ gc_prlkz

     WITH svbeln   IN lt_vbeln

     WITH ppoper_h EQ bkpf-monat

     WITH pgjahr_h EQ bkpf-gjahr
                     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.

Read only

0 Likes
1,320

Remove the VIA SELECTION-SCREEN and as I already written (click on the links) use the VIA JOB job NUMBER n. between JOB_OPEN and JOB_CLOSE, look at the sample provided by SAP using the link I provided above. Also use the FM GET_PRINT_PARAMETER to fill the print parameter.

In your last posted code, if you are already in background, then you create another background job ?

Regards,

Raymond

Read only

0 Likes
1,320

Thanks Raymond,

I am facing 1 more problem from the same program,

when i execute in the foreground i am getting selection screen with inputs but further executing i m not getting any output, after analysing i came to know there is problem with the multiple screen option for sales document, what is happening is when i open multiple screen of sales document to see the entries and scrolling upto last and closing its saying do you want to save the changes, if i save and execute i will get the output if i dont save i wont get the output.

I am struck with this problem please i need help.