Skip to Content
0
Former Member
Jan 30, 2017 at 09:08 AM

Changing Item_Text when create PO by adopting PR

415 Views Last edit Jan 30, 2017 at 09:10 AM 2 rev

Dear Experts,

I have a situation where i need to change PO's item text whenever user create and save the PO.
The problem occur when user create PO by adopting PR, which cause item text to adopted from PR also, and i can't change it on the fly via ABAP
(but success when it already saved as PO's item text and edited later on).


I have tried using FM SAVE_TEXT and if_longtexts_mm~set_text without success.

//Using Save_Text
CONCATENATE lv_ebeln lv_ebelp INTO ls_header-tdname.
ls_header-tdid     = 'F90'.
ls_header-tdobject = 'EKPO'.
ls_header-tdspras  = 'EN'.

REFRESH: li_lines.
ls_line-tdline   = lv_color.
APPEND ls_line TO li_lines.

CALL FUNCTION 'SAVE_TEXT'
  EXPORTING
    header          = ls_header
    savemode_direct = 'X'
  TABLES
    lines           = li_lines.
// Using Object's save_text
li_item = im_header->get_items( ).
LOOP AT li_item INTO ls_item.
  ls_textlines-tdid     = 'F90'.
  ls_textlines-tdobject = 'EKPO'.
  ls_textlines-tdformat = '*'.
  ls_textlines-tdline   = gw_color_temp-color.
  APPEND ls_textlines TO li_textlines.

  CALL METHOD ls_item-item->if_longtexts_mm~set_text
    EXPORTING
      im_tdid      = 'F90'
      im_textlines = li_textlines.
ENDLOOP.


Please kindly suggest what other methods i can use for this case.
Many Thanks.

Attachments

po-1.jpg (202.3 kB)