10-10-2008 10:52 AM
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 ?
10-10-2008 11:03 AM
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
10-10-2008 11:05 AM
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
10-10-2008 11:05 AM
10-10-2008 11:24 AM
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
10-10-2008 11:11 AM
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
10-10-2008 1:56 PM
FM 'VS_BT_VBKD_MODIFY' modify the table VBKD but it doesn't insert any row ..
Have you any ideas ?
10-10-2008 2:01 PM
I think you are using the wrong User exit. write your code in USEREXIT_SAVE_DOCUMENT_PREPARE
instead of USEREXIT_SAVE_DOCUMENT
regards,
Advait
10-10-2008 2:05 PM
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.
10-10-2008 2:07 PM
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
10-10-2008 2:14 PM
MODIFY xvbkd TRANSPORTING field.
Which line in the internal table? You're missing the index.
10-10-2008 2:19 PM
10-10-2008 3:19 PM
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.
10-10-2008 7:53 PM
change your code to below in save_document_prepare user exit
loop at xvbkd.
move t_cond_pagamento to xvbkd-zterm.
MODIFY xvbkd.
endllop..
10-10-2008 8:00 PM
>
> 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?
10-12-2008 11:27 AM
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
10-13-2008 11:53 AM