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

Submit via Job- problem in code

Former Member
0 Likes
507

I need to convert the PR to PO automatically, we can do this by me59n, so iam scheduling the job for the me59n program. here iam using Badi's, iam getting the PR, plant, vendor from IM_Eban from the method of Badi, reading this in internal table, zeban. now when the execute the transaction(va01) and saving, PR shouls be converted to PO. i would like to have guys look into the code, and pl correct this.

method IF_EX_ME_REQ_POSTED~POSTED .

DATA: ACTUAL_JOBNAME type tbtcjob-JOBNAME value 'Z_TEST2',

JOBCOUNT type tbtcjob-JOBCOUNT,

MSG(60) TYPE C,

STIME TYPE SY-UZEIT.

DATA: ZEBAN TYPE UEBAN.

DATA: P_BANFN(10) TYPE N.

read table IM_EBAN into Zeban index 1.

*Open the Job

CALL FUNCTION 'JOB_OPEN' " OPENING JOB

EXPORTING

JOBNAME = ACTUAL_JOBNAME " JOB NAME

IMPORTING

JOBCOUNT = JOBCOUNT.

DATA SELTAB type table of RSPARAMS.

data : sel_wa type rsparams.

  • Populate internal table.

MOVE: 'S_EKGRP' TO SEL_wa-SELNAME,

'I' TO SEL_WA-SIGN,

'EQ' TO SEL_WA-OPTION,

'S' TO SEL_wa-KIND,

Zeban-ekgrp TO sel_wa-LOW.

APPEND sel_wa to SELTAB.

CLEAR SEL_WA.

MOVE: 'S_FLIEF' TO SEL_wa-SELNAME,

'I' TO SEL_WA-SIGN,

'EQ' TO SEL_WA-OPTION,

'S' TO SEL_wa-KIND,

Zeban-flief TO sel_wa-LOW.

APPEND sel_wa to SELTAB.

CLEAR SEL_WA.

MOVE: 'S_WERKS' TO SEL_wa-SELNAME,

'I' TO SEL_WA-SIGN,

'EQ' TO SEL_WA-OPTION,

'S' TO SEL_wa-KIND,

Zeban-werks TO sel_wa-LOW.

APPEND sel_wa to SELTAB.

CLEAR SEL_WA.

MOVE: 'P_GBANFN' TO SEL_WA-SELNAME,

'P' TO SEL_WA-KIND,

'X' TO SEL_WA-LOW.

APPEND SEL_WA TO SELTAB.

CLEAR SEL_WA.

MOVE: ZEBAN-BANFN TO P_BANFN.

MOVE: 'S_BANFN' TO SEL_WA-SELNAME,

'I' TO SEL_WA-SIGN,

'EQ' TO SEL_WA-OPTION,

'S' TO SEL_WA-KIND,

P_BanfN TO SEL_WA-LOW,

SPACE TO SEL_WA-HIGH.

APPEND SEL_WA TO SELTAB.

  • CLEAR SEL_WA.

  • MOVE: 'P_VRTYPK' TO SEL_WA-SELNAME,

  • 'P' TO SEL_WA-KIND,

  • 'X' TO SEL_WA-LOW.

  • APPEND SEL_WA TO SELTAB.

*

SUBMIT RM06BB30 VIA JOB ACTUAL_JOBNAME

NUMBER JOBCOUNT

  • TO SAP-SPOOL DESTINATION 'NULL'

  • WITHOUT SPOOL DYNPRO

WITH SELECTION-TABLE SELTAB

AND RETURN.

  • STIME = SY-UZEIT + 900.

*Schedule the job after 15 min and Close the job.

CALL FUNCTION 'JOB_CLOSE' " CLOSING JOB

EXPORTING

JOBNAME = ACTUAL_JOBNAME

JOBCOUNT = JOBCOUNT

STRTIMMED = 'X'

TARGETSYSTEM = SY-HOST.

  • LASTSTRTTM = STIME.

endmethod.

1 REPLY 1
Read only

Former Member
0 Likes
426

Hi,

Could you please let us know, what is the error you are getting.

Best regards,

Prashant