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: 

PO-header text(urgent)

Former Member
0 Kudos

Hi all,

I had written the report program to update the heder text of PO.It is working fine but my problem is when i give the new text it gets replacing with old text,but the new text should have to append with old next.The following is the code for which i had done.What modifications i have to do to append new text and old text.

data : i_poheader like BAPIMEPOHEADER occurs 0 with header line.

data : i_poheaderx like BAPIMEPOHEADERX occurs 0 with header line.

data : i_result like BAPIMEPOHEADER occurs 0 with header line.

data : po_num(15) type n value '4500008083'.

DATA : t_text TYPE STANDARD TABLE OF bapimepotext.

DATA : wa_text TYPE bapimepotext.

data return like BAPIRET2 occurs 0 with header line.

parameter v_text(100) type c.

wa_text-po_number = '4500008083'.

wa_text-text_id = 'F02'.

wa_text-text_form = '*'.

wa_text-text_line = v_text.

APPEND wa_text TO t_text.

CLEAR wa_text.

CALL FUNCTION 'CREATE_TEXT'

EXPORTINg

fid = 'F02'

flanguage = sy-langu

fname = 'Append'

fobject = 'EKKO'

SAVE_DIRECT = 'X'

FFORMAT = '*'

tables

flines = t_text.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = '4500008083'

TABLES

return = return

POTEXTHEADER = t_text.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

loop at return.

write : return-message.

endloop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Ashmitha,

use call function 'READ_TEXT'

to read the existing text in the header then concatenate the new text with the previous and then proceed further.

Regards,

Neelambari

6 REPLIES 6

kiran_k8
Active Contributor
0 Kudos

Asmitha,

Just append t_text in the loop.Try,it may work.

K.Kiran.

former_member150733
Contributor
0 Kudos

Before the CREATE_TEXT use a READ_TEXT to get the currently availble text from the PO.

The new text can be appended to the old text available in the Internal table t_text.

Former Member
0 Kudos

Hello Ashmitha,

use call function 'READ_TEXT'

to read the existing text in the header then concatenate the new text with the previous and then proceed further.

Regards,

Neelambari

0 Kudos

This will sovle ur problem

select * into corresponding fields of table itab_stxh from stxh where

tdname = po.

loop at itab_stxh.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = itab_stxh-tdid

language = sy-langu

name = itab_stxh-tdname

object = itab_stxh-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

tables

lines = wa_text

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at wa_text.

MOVE wa_TEXT-TDLINE TO IT_text-TDLINE .

move itab_stxh-tdid to it_text-tdid.

APPEND IT_text .

endloop.

break-point.

write : / itab_stxh-tdid, itab_stxh-tdobject.

endloop.

loop at it_text.

write : / it_text-tdid, it_text-tdline.

endloop.

Former Member
0 Kudos

Asmitha,

You can also use SAVE_TEXT to save your text to the database. Do, READ_TEXT fm to read the text for that PO.

Regards,

Hari krishna

0 Kudos

Hi all,

Thankyou very much.With your valuable suggestion my problem get solved.