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

Save_text not working when material changes

Former Member
0 Likes
1,608

Hi,

I am working on a sales order exit. The requirement is to keep the text of the line items intact evn if material number changes. Let's assume tht there is a material 'A' on line item 10 which is having text ' This is test' maintained. If the user changes the material on lineitem 10 from 'A' to 'B', the text 'This is test' shoud remain intact. I am using Userexit_read_document to read the text maintained in the line item 10 for 'A' and then using Userexit_save_document to save the text for material 'b'.

The problem is that the texts are not getting saved. I am using Read_text to get the texts and then using save_text in the userexit_save_document to save the chanes. The text name, id, object are same for both cases. Save_text does not give any exception and the sy-subrc is 0 but still the changes are not getting reflect on material 'B'. Am i missing something?Can some one help?

I have attached my save_text code along with this.

l_thead-tdobject = 'VBBP'

l_thead-tdname(10) = vbak-vbeln .

l_thead-tdname+10 = w_lines_all-posnr .

l_thead-tdid = 'ZEDI'

l_thead-tdspras = sy-langu .

l_thead-mandt = sy-mandt .

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = l_thead

savemode_direct = 'X'

TABLES

lines = tbl_lines

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

Regards,

Venkat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,333

Hi,

Check whether the field w_lines_all-posnr is having a proper value. Have to used proper conversion exits, to chage the format of POSNR (line item 10 should be converted to 000010). Also check whether the values are updated in STXH table after the order is saved.

But, I don't think you should use SAVE_TEXT with SAVE_MODE_DIRECT = 'X' in the user exit. (Does this triggeres an explicity commit during user exit processing ? Any comments ?)

Regards

Vinod

5 REPLIES 5
Read only

Former Member
0 Likes
1,333

you are missing the call of the FM COMMIT_TEXT.

Read only

0 Likes
1,333

Thanks for the reply but i have also tried commit_text . Still it does not get reflected.

Read only

Former Member
0 Likes
1,334

Hi,

Check whether the field w_lines_all-posnr is having a proper value. Have to used proper conversion exits, to chage the format of POSNR (line item 10 should be converted to 000010). Also check whether the values are updated in STXH table after the order is saved.

But, I don't think you should use SAVE_TEXT with SAVE_MODE_DIRECT = 'X' in the user exit. (Does this triggeres an explicity commit during user exit processing ? Any comments ?)

Regards

Vinod

Read only

Former Member
0 Likes
1,333

Hi

You should not use save text in sales order user exit. When material A is entered how this text is populated ?

Please try VOFM-- Data transfer for solution.

Read only

0 Likes
1,333

Thanks all . It works. I removed the 'X' for savemode_direct from save_text and it started working. Strange, i never thought that could be the reason for trouble. Anyway it works.

Regards,

Venkat Varadan