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

Problem in submiting standard program via job

Former Member
0 Likes
1,406

Hi Experts ,

I have developed programs for creating and posting return lots and payment lots for multiple incoming files. For this i have submited standard program of FPB3 and FPB5 transaction . What happened is , if the child program fails due to some reason for one file , it is not coming back to the mother program and as a result other files remain unprocessed . So for this i tried with submiting the child program Via job so that if child program fails , only that job will fail and the mother program will not fail , so rest files will be processed .

But the problem is the child program (standard program of FPB3/FPB5 ) is not working by this i.e. the lots are not getting created adn.

Awaiting for any respone .

9 REPLIES 9
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,241

Hello,

Did you use SUBMIT ... AND RETURN initially? If possible paste the code for your SUBMIT statement.

BR,

Suhas

Read only

Former Member
0 Likes
1,241

Hi Suhas,

ya .. i have written the return part . Kindly look into the junk of code of submit .

SUBMIT rfkkze00 "rfkkze00

WITH p_runid = lv_lotid

WITH r_norm = 'X'

WITH as_fname = l_file

WITH r_err = space "to check

WITH r_rst = space "

WITH p_xprot = 'X'

WITH p_xclos = 'X'

WITH p_xbuch = 'X'

WITH p_xsofst = 'X'

WITH p_xcont = space

WITH p_strdt = sy-datum

WITH p_strtm = sy-uzeit

WITH p_xpara = 'X'

WITH p_xfltr = space "check data at execution only..try with X

WITH p_xlist = 'X'

WITH p_xprot = 'X'

VIA JOB gc_job_name NUMBER l_c_number

AND RETURN.

The VIA JOB part is added later .

Read only

Former Member
0 Likes
1,241

Hi,

If you are using Submit via Job, you need to use JOB_OPEN and JOB_CLOSE FM's.

JOB_OPEN : Create a new job and return you the job number which you use in Submit

JOB_CLOSE: Will set the release conditions of the job.

Example:

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 submitable 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.

Regards,

Jovito

Read only

Former Member
0 Likes
1,241

Hi ,

Thanks for your respone .

But actually i had the job_open and job_close already in my code as you ahve mentioned .

Forgot to add those in the junk of code .

Still it is not working .

Can not we submit standard program via job ?

Read only

Former Member
0 Likes
1,241

Hi

Try to create 2 distinct jobs

Max

Read only

Former Member
0 Likes
1,241

Hi Max ,

I have 2 different programs for FPB3 and FPB5 .

In each program for different files even i am passing different job name by concatenating sy-uzeit and filename

Read only

Former Member
0 Likes
1,241

Perhaps I don't understand your problem

Can you explain it again?

Max

Read only

Former Member
0 Likes
1,241

Hi Max ,

My requirement is accept the payment files from application server and post it in FICA .

For this i have written a program to process files . For posting i am submitting the program of standard transaction FPB3 .

So everything going fine .

Now the problem is if there is some error in the child program for one file , then it is not coming back to the mother program .

So to resolve this problem i tried wih Via job (with different job name for different files) so that only that job will fail and will come back to the main program .

But now the problem is with addition of Via JOB the the child program is not behaving properly , i mean posting is not happening .

If i am commenting the via job part , then its working fine .

So just wondering what could be the problem ....

Hope u got the point .....

Read only

Former Member
0 Likes
1,241

Hi Goldy,

Instead of using the via job, try this :

If the child fails, it will create a session in SM35 which can be processed later.

CALL TRANSACTION 'FPB3' USING it_bdcdata
                          MODE 'N'
                          UPDATE 'S'.

  IF sy-subrc NE 0.
     do nothing.

Regards,

Jovito