Skip to Content
0

Changing Item_Text when create PO by adopting PR

Jan 30, 2017 at 09:08 AM

143

avatar image
Former Member

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.

po-1.jpg (202.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jürgen L
Jan 30, 2017 at 10:04 AM
0

You function module is updating the database, however, when you create the PO the text is not yet saved to the database, this will happen after the user clicked save, so you can't update it there.

Why is that field at all grayed? this is not SAP standard.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for your reply.

Indeed i have disabled the field, and that is exactly why i need to update it on the fly.
We have create a customer field (on Customer Data tab), and user need to choose the 'fixed' text on Dropdown List instead of writing it on his own.
And while user can write anything on the PR, i need to change it to fixed one once it became a PO.

Regarding when the text is saved, actually i also have put that code (FM Save_Text) on BADI ME_PROCESS_PO_CUST~Check/Post/Close but still can't change it if it was adopted from PR.

Is there any other way to do it?
Thanks.

0
Raymond Giuseppi
Jan 30, 2017 at 01:46 PM
0

Could you check in your Customizing, the rules of copy of text for your 'F90' ID. Did your company/customer set a 'N' or '*' in the 'Fix' field of 'Define Copying Rules for Item Texts' in 'Text linkages' from some PR text, so text cannot be changed if 'N', or text must first be adopted if '*'.

Regards,
Raymond

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for your reply.

I have checked on SPRO for Text Linkages of the Text on both PR and PO, and both of them is set as empty.
Which means "Text automatically adopted in target object".

Thanks.

0

So there must be another reason for the grayey text. When you later call ME22N on this PO is the text always gray out?

Also check compliance of your requirement with this Customizing, why copy text from PR if you then overwrite it?

Regards,
Raymond

0
Former Member
Raymond Giuseppi

Hi Raymond,

As per what i explained to Jurgen also, indeed i have block user for type anything to it and instead we have create a customer field (on Customer Data tab), and user need to choose the 'fixed' text on Dropdown List instead of writing it on his own.
And while user can write anything on the PR, i need to change it to fixed one once it became a PO.

And this customization is required since there is many type of PO which allow user to write anything, but on certain type of PO (like this one), we require user to choose from the dropdown list, and i will replace the text afterwards / on the fly.

So its not about the grayed field, but more about i can't replace the text if the PO is adopting PR (.
Sorry for the confusion caused :)

0