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

Problem in Text (BAPI_SALEORDER_ CREATEFROMDAT2)

Former Member
0 Likes
722

Hi,

I am using a BAPI to transfer sales order from one system to other. My problem is that while transferring text only the first line of the sales text is transferred to the sales order.

for example

if the header note has text like: <b>Martin

sdn.sap.com</b>

only <b>Martin</b> is transferred to the new sales order.

i am using the read_text for reading the text in the old sales order. and using the Lines from in i am populating the Order_text in BAPI.

Thanks & Regards,

Martin

6 REPLIES 6
Read only

Former Member
0 Likes
647

after reading the text which is present in internal table u have to pass the whole internal table data to order_text of BAPI...Mostly the BAPI is taking only first line into consideration....then u might need to use CREATE_TEXT & COMMIT_TEXT.

Read only

0 Likes
647

Hi Ramesh,

Actually i need to transfer order from one system to another... But unfortunately create_text and save_text are normal FM so it cannot be done....

Thanks & Regards

Martin

Read only

Former Member
0 Likes
647

hi

good

try this process

Table: ORDER_TEXT can be used for inserting texts in a sales document while creating.

Values to be populated:

For Header Texts:

TEXT_ID

LANGU

TEXT_LINE

For Item Texts:

Apart from the above, populate the ITM_NUMBER with the item number we use for ORDER_ITEMS_IN structure.

Below code can give you some idea, though am using SD_SALESDOCUMENT_CREATE, the structure for Texts is the same in both BAPI's.

&----


*& Form ADD_TEXT

&----


FORM ADD_TEXT USING P_TID LIKE THEAD-TDID

P_TEXT LIKE THEAD-TLINE.

      • Sales Document Header Texts

CLEAR: IBAPISDTEXT.

IBAPISDTEXT-TEXT_ID = P_TID.

IBAPISDTEXT-LANGU = SY-LANGU.

IBAPISDTEXT-TEXT_LINE = P_TEXT.

APPEND IBAPISDTEXT.

ENDFORM. " ADD_TEXT

&----


*& Form ORDER_CRE

&----


FORM ORDER_CRE .

DATA: L_WAIT LIKE BAPITA-WAIT VALUE '2'.

DATA: LT_BAPIRET2 LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'

EXPORTING

  • SALESDOCUMENT =

SALES_HEADER_IN = IBAPISDHD1

SALES_HEADER_INX = IBAPISDHD1X

  • BUSINESS_OBJECT = ' '

IMPORTING

SALESDOCUMENT_EX = IBAPIVBELN

TABLES

RETURN = IBAPIRET2

SALES_ITEMS_IN = IBAPISDITM

SALES_ITEMS_INX = IBAPISDITMX

SALES_PARTNERS = IBAPIPARNR

SALES_SCHEDULES_IN = IBAPISCHDL

SALES_SCHEDULES_INX = IBAPISCHDLX

SALES_CONDITIONS_IN = IBAPICOND

SALES_CONDITIONS_INX = IBAPICONDX

SALES_TEXT = IBAPISDTEXT.

thanks

mrutyun^

Read only

0 Likes
647

Hi Mrityun,

have a look at the code.. I am pretty much doing the same thing u have mentioned but only the first line of the text got transfered.

CONCATENATE gt_vbak-vbeln gt_vbap-posnr INTO g_name.

LOOP AT gt_stxh WHERE tdname = g_name AND tdobject = 'VBBP'.

PERFORM text_read.

LOOP AT gt_line.

MOVE gt_vbap-posnr TO gs_text-itm_number.

MOVE gt_stxh-tdid TO gs_text-text_id.

MOVE gt_stxh-tdspras TO gs_text-langu.

MOVE gt_line-tdformat TO gs_text-format_col.

MOVE gt_line-tdline TO gs_text-text_line.

APPEND gs_text TO gt_text.

CLEAR: gs_text,

gt_stxh,

gt_line.

ENDLOOP.

REFRESH: gt_line.

ENDLOOP.

Thanks & Regards,

Martin

Read only

0 Likes
647

Hi Martin

I guess the problem is with this statement:

<b>MOVE gt_vbap-posnr TO gs_text-itm_number.</b>

Please check.

Kind Regards

Eswar

Read only

0 Likes
647

Hi Eswar,

I dont think that statement will have problem because i am using the same code for transferring the Header Text in Sales Order but without the statement u mentioned to be problematic.

But still i am getting only the first line of the text.

Thanks & Regards

Martin