Page 1 of 1

Change sales text item in VA01 or VA02

PostPosted: Fri Jun 23, 2017 9:31 am
by hterras
Hi Friends ,

Its a simple question but I don’t know why it is not working in this scenario .

In VA01 or VA02 I need change the sales text in item.

I try change the text in MV45AFZZ (form userexit_save_document_prepare).

If xvbap-updkz = 'U' I can change the text but if xvbap-updkz = 'I' I can´t change.

Abap:



loop at xvbap where updkz eq 'I' or updkz eq 'U'.



if sy-tcode = 'VA01'.

concatenate 'XXXXXXXXXX' xvbap-posnr into i_name.

else.

concatenate xvbap-vbeln xvbap-posnr into i_name.

endif.



x_header-tdobject = 'VBBP'.

x_header-tdname = i_name.

x_header-tdid = '0001'.

x_header-tdspras = linguagem.

if xvbap-updkz = 'U'. ->>> Change

call function 'SAVE_TEXT'

EXPORTING

header= x_header

savemode_direct = 'X'

TABLES

lines= ztexto1.


else.

->>> Don’t Change

call function 'SAVE_TEXT'

EXPORTING

header= x_header

savemode_direct = 'X'

TABLES

lines= ztexto1.

endif.



endloop.


Please help me if some one had used this function module in this type of scenario .
Thanks in advance.

Best regards .

Henrique Terras

Re: Change sales text item in VA01 or VA02

PostPosted: Mon Jul 03, 2017 6:51 pm
by Frank Lai
Hi

First off is that when tcode is VA01 you are concatenating string of XXXXXX along with posnr into the i_name. Given that you are trying to write a sales order line text, I can't see how XXXXXXX010 as sales order and item number combination could work. Whereas in VA02 you are concatenating the sales order number and item together to form a proper text object value.

Second thing is that if the update indicator is an I and you are not supposed to change the text, then you don't really have to do anything because text determination would have/should have gotten the text for you. If you leave it alone at that time, standard SAP code should go and save it for you anyway.

Frank