2007 Jul 10 9:59 AM
Hi friends,
With th following code im able to append the text in different lines to Po-Header.If i want to change the text for another PO,then the old of PO is also getting appended.To avoid this what i have to do ::
&----
*& Report Z_PO_CHANGE
*&
&----
*&
*&
&----
REPORT z_po_change.
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 with header line.
DATA : t_res TYPE STANDARD TABLE OF bapimepotext WITH HEADER LINE.
DATA : e_text TYPE bapimepotext.
DATA return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
PARAMETER v_text(100) TYPE c.
To read the text *****
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = sy-langu
name = 'Append'
object = 'EKKO'
TABLES
lines = t_res.
*
e_text-po_number = '4500008082'.
e_text-text_id = 'F02'.
e_text-text_form = '*'.
e_text-text_line = v_text.
APPEND e_text TO t_res.
CLEAR e_text.
clear t_res.
Sav the new text in a tabe *****
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = 'F02'
flanguage = sy-langu
fname = 'Append'
fobject = 'EKKO'
TABLES
flines = t_res.
To change the PO-Header *****
clear t_res.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '4500008082'
TABLES
return = return
potextheader = t_res.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
LOOP AT return.
WRITE : return-message.
ENDLOOP.
2007 Jul 10 10:09 AM
remove below code from your program
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = sy-langu
name = 'Append'
object = 'EKKO'
TABLES
lines = t_res.
Hi friends,
With th following code im able to append the text in different lines to Po-Header.If i want to change the text for another PO,then the old of PO is also getting appended.To avoid this what i have to do ::
&----
*& Report Z_PO_CHANGE
*&
&----
*&
*&
&----
REPORT z_po_change.
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 with header line.
DATA : t_res TYPE STANDARD TABLE OF bapimepotext WITH HEADER LINE.
DATA : e_text TYPE bapimepotext.
DATA return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
PARAMETER v_text(100) TYPE c.
To read the text *****
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = sy-langu
name = 'Append'
object = 'EKKO'
TABLES
lines = t_res.
*
e_text-po_number = '4500008082'.
e_text-text_id = 'F02'.
e_text-text_form = '*'.
e_text-text_line = v_text.
APPEND e_text TO t_res.
CLEAR e_text.
clear t_res.
Sav the new text in a tabe *****
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = 'F02'
flanguage = sy-langu
fname = 'Append'
fobject = 'EKKO'
TABLES
flines = t_res.
To change the PO-Header *****
clear t_res.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '4500008082'
TABLES
return = return
potextheader = t_res.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
LOOP AT return.
WRITE : return-message.
ENDLOOP.
2007 Jul 10 10:02 AM
hi,
clear this 't_res' after the write statement.
reward points if helpful,
regards,
seshu.
2007 Jul 10 10:15 AM
Hi,
Still im unable to change the other PO header text.
Thanks,
Asmitha.
2007 Jul 10 10:09 AM
remove below code from your program
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = sy-langu
name = 'Append'
object = 'EKKO'
TABLES
lines = t_res.
2007 Jul 12 9:58 AM
Thanks all,This helps me a lot.But i had given points to more than one person.I dont know wethet it works or not.shall i assign the points to more than one person.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |