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

Call transaction in update task

Former Member
0 Likes
2,140

Hi,

I'm trying to call t-code V_V2 on update task but the update terminates with error "POSTING_ILLEGAL_STATEMENT". I've tried the same below code but without "In update task" and it worked correctly. Can anyone help me please?

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

"Open the 1st screen of transaction V_V2...

CLEAR bdcdata.

bdcdata-program = 'SDV03V02'.

bdcdata-dynpro = '1000'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

"Position the cursor on the material number field...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'S_MATNR-LOW'.

APPEND bdcdata.

"Enter the material number on its field...

CLEAR bdcdata.

bdcdata-fnam = 'S_MATNR-LOW'.

bdcdata-fval = matnr.

APPEND bdcdata.

"Position the cursor on the plant field...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'S_WERKS-LOW'.

APPEND bdcdata.

"Enter the plant on its field...

CLEAR bdcdata.

bdcdata-fnam = 'S_WERKS-LOW'.

bdcdata-fval = plant.

APPEND bdcdata.

"Position the cursor on the simulation checkbox field...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'P_SIMUL'.

APPEND bdcdata.

"Clear the simulation checkbox field...

CLEAR bdcdata.

bdcdata-fnam = 'P_SIMUL'.

bdcdata-fval = ' '.

APPEND bdcdata.

"Execute the program...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = 'ONLI'.

APPEND bdcdata.

"A popup window will raise for change confirmation...

CLEAR bdcdata.

bdcdata-program = 'SAPLSPO1'.

bdcdata-dynpro = '100'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

"Position the cursor on this popup window...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'SPOP-OPTION1'.

APPEND bdcdata.

"Press the "YES" button...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = 'YES'.

APPEND bdcdata.

CALL FUNCTION 'ABAP4_CALL_TRANSACTION_VB' IN UPDATE TASK

EXPORTING

tcode = 'V_V2'

  • SKIP_SCREEN = ' '

MODE_VAL = 'N'

UPDATE_VAL = 'S'

TABLES

USING_TAB = bdcdata

  • SPAGPA_TAB =

  • MESS_TAB =

EXCEPTIONS

CALL_TRANSACTION_DENIED = 1

TCODE_INVALID = 2

OTHERS = 3.

Hi,

I'm trying to call t-code V_V2 on update task but the update terminates with error "POSTING_ILLEGAL_STATEMENT". I've tried the same below code but without "In update task" and it worked correctly. Can anyone help me please?

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

"Open the 1st screen of transaction V_V2...

CLEAR bdcdata.

bdcdata-program = 'SDV03V02'.

bdcdata-dynpro = '1000'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

"Position the cursor on the material number field...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'S_MATNR-LOW'.

APPEND bdcdata.

"Enter the material number on its field...

CLEAR bdcdata.

bdcdata-fnam = 'S_MATNR-LOW'.

bdcdata-fval = matnr.

APPEND bdcdata.

"Position the cursor on the plant field...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'S_WERKS-LOW'.

APPEND bdcdata.

"Enter the plant on its field...

CLEAR bdcdata.

bdcdata-fnam = 'S_WERKS-LOW'.

bdcdata-fval = plant.

APPEND bdcdata.

"Position the cursor on the simulation checkbox field...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'P_SIMUL'.

APPEND bdcdata.

"Clear the simulation checkbox field...

CLEAR bdcdata.

bdcdata-fnam = 'P_SIMUL'.

bdcdata-fval = ' '.

APPEND bdcdata.

"Execute the program...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = 'ONLI'.

APPEND bdcdata.

"A popup window will raise for change confirmation...

CLEAR bdcdata.

bdcdata-program = 'SAPLSPO1'.

bdcdata-dynpro = '100'.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

"Position the cursor on this popup window...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_CURSOR'.

bdcdata-fval = 'SPOP-OPTION1'.

APPEND bdcdata.

"Press the "YES" button...

CLEAR bdcdata.

bdcdata-fnam = 'BDC_OKCODE'.

bdcdata-fval = 'YES'.

APPEND bdcdata.

CALL FUNCTION 'ABAP4_CALL_TRANSACTION_VB' IN UPDATE TASK

EXPORTING

tcode = 'V_V2'

  • SKIP_SCREEN = ' '

MODE_VAL = 'N'

UPDATE_VAL = 'S'

TABLES

USING_TAB = bdcdata

  • SPAGPA_TAB =

  • MESS_TAB =

EXCEPTIONS

CALL_TRANSACTION_DENIED = 1

TCODE_INVALID = 2

OTHERS = 3.

3 REPLIES 3
Read only

Former Member
0 Likes
1,021

Hi,

use the following stmt. instead of calling FM ''ABAP4_CALL_TRANSACTION_VB'

CALL TRANSACTION 'V_V2' USING BDCDATA MODE 'N' UPDATE 'S'......

Hope it will work.

Read only

Former Member
0 Likes
1,021

Hi Mohamed,

Use like this.

Call Transaction 'V_V2' using Bdcdata mode 'A' update 'A' messages into bdcmsgcoll.

Regards,

Vijay

Read only

Former Member
0 Likes
1,021

If you read the abap help for Update task in notes section you will find following sentence.

"While an update function module is processed in an update work process, you are not allowed to execute the statements SUBMIT, CALL DIALOG, CALL SCREEN, CALL TRANSACTION, COMMIT WORK, ROLLBACK WORK and all other statements that provoke a database commit."