Application Development 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: 

how to modify VBKD

Former Member
0 Kudos

Hi at all,

i need to change "Terms of Payment Key", so I'm editing the "userexit_save_document" .

When I run VA02 I modify VBKD-ZTERM with posnr = '00000' and vbeln = vbak-vbeln, it runs well.

When I run VA01 I can't modify VBKD because the record with vbak-vbeln doesn't exist so the value ZTERM in VBKD is override from KNVV .

How can I modify the vbkd in VA01 ?

16 REPLIES 16

Former Member
0 Kudos

Hi,

I think you can use the XVBAK structure in MV45AFZZ user exit include in that main program SAPMV45A. Please note that VBAK and XVBAK structures alternate in holding the data.

So first check if VBAK is initial if so use XVBAK.

Regards,

Pramod

Former Member
0 Kudos

Hi,

Why you need to consider VBELN. Whatever you want to change will be applicable to only the sales order you are creating/changing. There are no other sales orders available here. Hence you can directly modify ZTERM value here.

Regards,

Ramesh

Former Member
0 Kudos

you can use 'XXXXXXXXXX' as vbeln and 'XXXXXX' for posnr.

0 Kudos

you can use 'XXXXXXXXXX' as vbeln and 'XXXXXX' for posnr.

It doesn't work fine.

Edited by: Domenico Petronella on Oct 10, 2008 12:24 PM

satsrockford
Active Participant
0 Kudos

Hi,

Try FM 'VS_BT_VBKD_MODIFY' to modify the table VBKD.

OR

try the FM 'J_1B_SD_SA_VBKD_COPY'.

Hope it helps...

regards

Satish

0 Kudos

FM 'VS_BT_VBKD_MODIFY' modify the table VBKD but it doesn't insert any row ..

Have you any ideas ?

0 Kudos

I think you are using the wrong User exit. write your code in USEREXIT_SAVE_DOCUMENT_PREPARE

instead of USEREXIT_SAVE_DOCUMENT

regards,

Advait

0 Kudos

READ TABLE xvbkd 
    WITH KEY vbeln = vbak-vbeln "or xvbak-vbeln
             posnr = '000000'.
IF sy-subrc NE 0.
  READ TABLE xvbkd WITH KEY posnr = '000000'.
ENDIF
MODIFY xvbkd TRANSPORTING field.

Use something similar to above code.

I think you are using the wrong User exit. write your code in USEREXIT_SAVE_DOCUMENT_PREPARE

instead of USEREXIT_SAVE_DOCUMENT

Correct.

Regards,

Valter Oliveira.

0 Kudos

I've just tried to use the prepare user exit.

it doesn't work fine

Edited by: Domenico Petronella on Oct 10, 2008 3:09 PM

0 Kudos
MODIFY xvbkd TRANSPORTING field.

Which line in the internal table? You're missing the index.

0 Kudos

Could you paste your code ?

regards,

Advait

0 Kudos

READ TABLE xvbkd

WITH KEY vbeln = vbak-vbeln "or xvbak-vbeln

posnr = '000000'

TRANSPORTING NO FIELDS. .

idx = sy-tabix.

IF sy-subrc NE 0.

READ TABLE xvbkd WITH KEY posnr = '000000'

TRANSPORTING NO FIELDS. .

idx = sy-tabix.

ENDIF.

move t_cond_pagamento to wa_xvbkd-zterm.

MODIFY xvbkd index idx from wa_xvbkd

TRANSPORTING zterm.

0 Kudos

change your code to below in save_document_prepare user exit

loop at xvbkd.

move t_cond_pagamento to xvbkd-zterm.

MODIFY xvbkd.

endllop..

0 Kudos

>

> READ TABLE xvbkd

> WITH KEY vbeln = vbak-vbeln "or xvbak-vbeln

> posnr = '000000'

> TRANSPORTING NO FIELDS. .

> idx = sy-tabix.

> IF sy-subrc NE 0.

> READ TABLE xvbkd WITH KEY posnr = '000000'

> TRANSPORTING NO FIELDS. .

> idx = sy-tabix.

> ENDIF.

> move t_cond_pagamento to wa_xvbkd-zterm.

> MODIFY xvbkd index idx from wa_xvbkd

> TRANSPORTING zterm.

Does that work or doesn't it?

0 Kudos

Hi,

READ TABLE xvbkd

WITH KEY vbeln = vbak-vbeln "or xvbak-vbeln

posnr = '000000'

TRANSPORTING NO FIELDS.

idx = sy-tabix.

IF sy-subrc NE 0.

READ TABLE xvbkd WITH KEY posnr = '000000'

TRANSPORTING NO FIELDS.

idx = sy-tabix.

ENDIF.

move t_cond_pagamento to wa_xvbkd-zterm.

MODIFY xvbkd index idx from wa_xvbkd

TRANSPORTING zterm.

The program generally runs for one sales order at a time, so using the vbak-vbeln for seraching the record is really not needed here and only posnr = '000000' should be enough for VA01 as well as VA02.

If it still doesn't work then you try to loop at xvbkd as mentioned above.

regards,

Advait

0 Kudos

Now it works fine.

Thanks a lot.