Application Development 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: 

Creating Material text in va02 item lines using Bapi

Former Member
0 Kudos

Dear all,

I want to add Material Sales Text in Text Tab of Tab Control on VA02 line items.

ie when I open a sales order in va02. And I click on the line item in the sales order, I want to add on Material text in , Text Tab.

I am using BAPI_SALESORDER_CHANGE AND table ORDER_TEXT for updating the text.

I am not sure if order_text is the right table to update the text.

My code is

REPORT zapo_ranjan_test .

DATA:order_header_inx LIKE bapisdh1x.

DATA:return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA:order_item_in LIKE bapisditm OCCURS 0 WITH HEADER LINE.

DATA:order_item_inx LIKE bapisditmx OCCURS 0 WITH HEADER LINE.

DATA : test1 like BAPISDTEXT occurs 0 with header line.

order_header_inx-updateflag = 'U'.

order_item_in-itm_number = '000003'.

APPEND order_item_in.

order_item_inx-itm_number = '000003'.

order_item_inx-updateflag = 'U'.

append order_item_inx.

test1-doc_number = '2292443'.

test1-itm_number = '000003'.

test1-text_id = '0001'.

test1-text_line = 'Phone Number'.

append test1.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = '0002292443'

  • ORDER_HEADER_IN =

order_header_inx = order_header_inx

  • SIMULATION =

  • BEHAVE_WHEN_ERROR = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

  • LOGIC_SWITCH =

TABLES

return = return

order_item_in = order_item_in

order_item_inx = order_item_inx

  • PARTNERS =

  • PARTNERCHANGES =

  • PARTNERADDRESSES =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CFGS_VK =

  • ORDER_CFGS_REFINST =

  • SCHEDULE_LINES =

  • SCHEDULE_LINESX =

ORDER_TEXT = test1

  • ORDER_KEYS =

  • CONDITIONS_IN =

  • CONDITIONS_INX =

  • EXTENSIONIN =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

COMMIT WORK.

Write : / 'Done.'.

My bapi returns documnet changed successfully.

Look forwad to get any clue or help .

regards,

Ranjan A

3 REPLIES 3

Former Member
0 Kudos

Hi Ranjan,

For creating text in Va02, you may use "SAVE_TEXT" FM instead of BAPI.

you need to know the text object and text id before using this FM.

Below is a sample code for that:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_success-vbeln

IMPORTING

output = wa_success-vbeln.

i_header-tdobject = 'VBBK'.

i_header-tdname = wa_success-vbeln.

i_header-tdid = '0001'.

i_header-tdspras = 'E'.

APPEND i_header.

CLEAR v_text.

CONCATENATE 'GEO DN# ' wa_success-donum INTO v_text.

i_tline-tdformat = '*'.

i_tline-tdline = v_text.

APPEND i_tline.

CLEAR v_text.

CONCATENATE 'CUSTOM INV# ' wa_success-ivnum INTO v_text.

i_tline-tdformat = '*'.

i_tline-tdline = v_text.

APPEND i_tline.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = i_header

insert = ' '

savemode_direct = 'X'

TABLES

lines = i_tline "I_TAB

EXCEPTIONS

id = 01.

Best Regards,

Pradeep.

0 Kudos

Dear Pradeep,

Thanks for prompt reply.. will try the same and let you know.

regards and happy gudi padwa...

Ranjan

0 Kudos

Thanks for the reply dost....

Changing the parameter as per my need helped a lot..

Thanks a lot.

regards,

Ranjan A