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

how to modify VBKD

Former Member
0 Likes
4,421

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
Read only

Former Member
0 Likes
2,878

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

Read only

Former Member
0 Likes
2,878

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

Read only

Former Member
0 Likes
2,878

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

Read only

0 Likes
2,878

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

Read only

satsrockford
Active Participant
0 Likes
2,878

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

Read only

0 Likes
2,878

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

Have you any ideas ?

Read only

0 Likes
2,878

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

instead of USEREXIT_SAVE_DOCUMENT

regards,

Advait

Read only

0 Likes
2,878

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.

Read only

0 Likes
2,878

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

Read only

0 Likes
2,878
MODIFY xvbkd TRANSPORTING field.

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

Read only

0 Likes
2,878

Could you paste your code ?

regards,

Advait

Read only

0 Likes
2,878

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.

Read only

0 Likes
2,878

change your code to below in save_document_prepare user exit

loop at xvbkd.

move t_cond_pagamento to xvbkd-zterm.

MODIFY xvbkd.

endllop..

Read only

0 Likes
2,878

>

> 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?

Read only

0 Likes
2,878

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

Read only

0 Likes
2,878

Now it works fine.

Thanks a lot.