Skip to Content
0
Jan 13, 2019 at 11:48 AM

Updating Payment Term while creating SO based on Material Price Group

119 Views

Hello Gurus,

Business want to update the Payment Term at item level in Sales order creation. I have implemented the user exit

USEREXIT_MOVE_FIELD_TO_VBKD in MV45AFZZ. I checked in the debug mode in exit, there is no item number exist in XVBKD and which is the reason why it is not updating Payment Term at item level. I tried in SAVE_DOCUMENT exit also. When I checked in debug only header item is showing in XVBKD. Is there any way to update the payment term at item level? Below is my code.

* To get the payment term that is to be updated
SELECT SINGLE mandt auart vkorg kondm zterm
FROM zsd_t_pay_term
INTO ls_zsd_t_pay_term
WHERE auart = vbak-auart
AND vkorg = vbak-vkorg
AND kondm = vbap-kondm.
IF sy-subrc IS INITIAL.
IF t180-trtyp = 'H'. " Create mode
READ TABLE xvbkd ASSIGNING <ls_xvbkd> WITH KEY posnr = xvbap-posnr.
IF sy-subrc IS INITIAL.
<ls_xvbkd>-zterm = ls_zsd_t_pay_term-zterm. " Payment term updated
ENDIF.
ELSEIF t180-trtyp = 'V'. " Change mode
READ TABLE xvbkd ASSIGNING <ls_xvbkd> WITH KEY vbeln = xvbap-vbeln
posnr = xvbap-posnr.
IF sy-subrc IS INITIAL.
<ls_xvbkd>-zterm = ls_zsd_t_pay_term-zterm.
ENDIF.
ENDIF.
ENDIF.

Please help me here.

Thanks and Regards,

Muralikrishna Peravali