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

Pass parameter to program (with LDB) submitted in background

former_member189059
Active Contributor
0 Likes
1,135

Hello,

For a particular requirement, I need to submit the program RPLPAY00 in background.

I need to extract data for the 'Current Year' which appears as a radiobutton on screen

However, it comes from the logical database PNP

I have written code as follows

*&---------------------------------------------------------------------*
*& Report  ZRUN_RPLPAY00
*&
*&---------------------------------------------------------------------*
*& Author  : Kris Donald
*& Date    : 15-05-2009
*& Purpose :
*&---------------------------------------------------------------------*

REPORT  ZRUN_RPLPAY00.

DATA: LV_JOB_NAME         LIKE TBTCO-JOBNAME,
LV_JOB_NR           LIKE TBTCO-JOBCOUNT,
LV_JOB_RELEASED     TYPE C,
LV_JOB_START_SOFORT TYPE C,
LV_PRINT_PARAMETERS TYPE PRI_PARAMS.
LV_JOB_NAME = 'RPLPAY00'.

CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      JOBNAME          = LV_JOB_NAME
    IMPORTING
      JOBCOUNT         = LV_JOB_NR
    EXCEPTIONS
      CANT_CREATE_JOB  = 1
      INVALID_JOB_DATA = 2
      JOBNAME_MISSING  = 3
      OTHERS           = 4.
  IF SYST-SUBRC = 0.
*submit job with all the selection screen params...
    SUBMIT (LV_JOB_NAME)
        WITH PNPTIMR1 = ''
        WITH PNPTIMR3 = 'X'
        with PNPBEGDA = ''
        with PNPBEGPS = ''
        with ALV_LIST = 'X'
        USER sy-uname
       VIA JOB LV_JOB_NAME NUMBER LV_JOB_NR AND RETURN.
    IF SY-SUBRC = 0.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          JOBCOUNT             = LV_JOB_NR
          JOBNAME              = LV_JOB_NAME
          STRTIMMED            = 'X'
        IMPORTING
          JOB_WAS_RELEASED     = LV_JOB_RELEASED
        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 SYST-SUBRC <> 0.
        MESSAGE I162(00) WITH
        'An error occured while closing the background job.'.
        STOP.
      ENDIF.
    ENDIF.
  ENDIF.
  SKIP 1.

1 ACCEPTED SOLUTION
Read only

former_member189059
Active Contributor
0 Likes
860

However when I check the output log it shows the following message

'Pay scale grpg for allowances for 00040011 is not defined on 20040728'

If 'Current year' was selected properly, it would have read as

'Pay scale grpg for allowances for 00040011 is not defined on 20090101'

Does anyone know how I can pass the parameters properly to the program in background ?

4 REPLIES 4
Read only

former_member189059
Active Contributor
0 Likes
861

However when I check the output log it shows the following message

'Pay scale grpg for allowances for 00040011 is not defined on 20040728'

If 'Current year' was selected properly, it would have read as

'Pay scale grpg for allowances for 00040011 is not defined on 20090101'

Does anyone know how I can pass the parameters properly to the program in background ?

Read only

0 Likes
860

I guess it is not the problem with program but related to HR configuration.

Read only

0 Likes
860

Hello Gautham,

I tried scheduling the program RPLPAY00 in background from SE38 directly (Program -> Execute in Background) and that works fine. So I don't think it could be config related

Read only

0 Likes
860

Hi Kris,

You can use the submit with variant(by creating a variant for the program).

I think it helps you..