Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

VA02: BDC Issue

We have upgraded the SAP system from 4.6C to ECC6, a piece of BDC code which was working before in 4.6C has stopped functioning. When run in FOREGROUND mode, program executes fine and changes the sales order, but when the program is executed in BACKGROUND with the same inputs, it fails to function. i.e. Sales order is not changed.

I had tried to see the SQL Trace and it seems like in background mode the order processing is going through some extra checks based on fields SY-BATCH and SY-BINPT. (Seems like in background mode ECC6 is not changing the pricing data).

Here is my code, it has few fields taken from Z tables, but the logic of screens flow is all there.

Expect full points on reply.

form update_va02_qw.

if nobill = space and x_nobill = space.

refresh bdcdata.

clear bdcdata.

perform bdc_dynpro using 'SAPMV45A' '0102'.

perform bdc_field using 'VBAK-VBELN' i8c-vbeln.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_dynpro using 'SAPMV45A' '4001'.

if i8c-edatu <> i8c-compl or x_pn00 = 1 or

x_tek05 <> x_aek05 or x_tek06 <> x_aek06.

perform bdc_field using 'BDC_OKCODE' '=POPO'.

perform bdc_dynpro using 'SAPMV45A' '0251'.

perform bdc_field using 'RV45A-POSNR' i8c-posnr.

perform bdc_field using 'BDC_OKCODE' '=POSI'.

perform bdc_dynpro using 'SAPMV45A' '4001'.

if i8c-edatu <> i8c-compl.

write i8c-compl to x_datex dd/mm/yy.

perform bdc_field using 'RV45A-ETDAT(01)' x_datex.

endif.

if x_pn00 = 1 or x_tek05 <> x_aek05 or x_tek06 <> x_aek06.

perform bdc_field using 'RV45A-VBAP_SELKZ(01)' 'X'.

perform bdc_field using: 'BDC_OKCODE' '=PKO1'.

perform bdc_dynpro using 'SAPMV45A' '5003'.

clear: x_cnt.

if x_ek05 = 1 and x_tek05 <> x_aek05.

perform bdc_field using 'RV61A-SELKZ(09)' 'X'.

x_cnt = 1.

endif.

if x_ek06 = 1 and x_tek06 <> x_aek06.

x_cnt = 1.

if x_ek05 = 1.

perform bdc_field using 'RV61A-SELKZ(10)' 'X'.

else.

perform bdc_field using 'RV61A-SELKZ(09)' 'X'.

endif.

endif.

if x_pn00 = 1.

x_cnt = 1.

if x_ek05 = 1.

if x_ek06 = 1.

perform bdc_field using 'RV61A-SELKZ(12)' 'X'.

else.

perform bdc_field using 'RV61A-SELKZ(11)' 'X'.

endif.

else.

perform bdc_field using 'RV61A-SELKZ(10)' 'X'.

endif.

endif.

if x_cnt = 1.

perform bdc_field using 'BDC_OKCODE' '=V69A_KOLO'.

endif.

perform bdc_dynpro using 'SAPMV45A' '5003'.

perform bdc_field using 'BDC_OKCODE' '=V69A_KOAN'.

perform bdc_dynpro using 'SAPMV45A' '5003'.

perform bdc_field using 'KOMV-KSCHL(02)' 'EK05'. "Metrix Cost

write: x_tek05 to x_amntx.

perform bdc_field using 'KOMV-KBETR(02)' x_amntx.

perform bdc_dynpro using 'SAPMV45A' '5003'.

perform bdc_field using 'BDC_OKCODE' '=V69A_KOAN'.

perform bdc_dynpro using 'SAPMV45A' '5003'.

perform bdc_field using 'KOMV-KSCHL(02)' 'EK06'. "Metrix Cost

write: x_tek06 to x_amntx.

perform bdc_field using 'KOMV-KBETR(02)' x_amntx.

perform bdc_dynpro using 'SAPMV45A' '5003'.

perform bdc_field using 'BDC_OKCODE' '/EBACK'.

endif.

endif.

perform bdc_dynpro using 'SAPMV45A' '4001'.

if vbak-lifsk <> space.

perform bdc_field using 'VBAK-LIFSK' ' '.

endif.

if vbak-faksk <> space.

perform bdc_field using 'VBAK-FAKSK' ' '.

endif.

perform bdc_field using: 'BDC_OKCODE' '=KBES'.

perform bdc_dynpro using 'SAPMV45A' '4002'.

perform bdc_field using 'VBKD-IHREZ' x_ihrez.

perform bdc_field using: 'BDC_OKCODE' '/11'.

if x_batch = 'X'.

perform bdc_insert using 'VA02'.

else.

opt-dismode = 'E'.

call transaction 'VA02' using bdcdata options from opt

messages into itab.

sort itab.

loop at itab where msgtyp = 'E'.

if nodel = space.

message id itab-msgid type 'E' number itab-msgnr with

itab-msgv1 itab-msgv2 itab-msgv3 itab-msgv4 into x_emsg.

write: / 'Update VA02 Error - zs8c', reqid, x_emsg.

endif.

endloop.

if sy-subrc = 0.

endif.

endif.

endif.

endform.

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question