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: 

Update Long Text in Prd Order

anuradha_wijesinghe
Participant
0 Kudos

Hi Experts,

Please let me know how to update the Long Text in Production order in Program Level (ABAP).

Is there any BAPI/FM to Update it.. Or please provide me a sample code.

Thanks,

Anuradha.

1 ACCEPTED SOLUTION

anuradha_wijesinghe
Participant
0 Kudos

Thanks All.

I found the Solution.

Use bellow function module to do this.

   clear wa_header.

   wa_header-tdid                = 'KOPF'.

   wa_header-tdspras          = sy-langu.

   concatenate sy-mandt vaufnr into wa_header-tdname.

   wa_header-tdobject           = 'AUFK'.

   wa_header-TDLINESIZE   = 1024.

   wa_lines-tdformat = '*'.

   wa_lines-tdline = 'Test'.

   append wa_lines to it_lines.

   call function 'SAVE_TEXT'

     exporting

      CLIENT = SY-MANDT

      header = wa_header

      INSERT = 'X'

      SAVEMODE_DIRECT       = 'X'

     tables

       lines  it_lines.

Please make sure bellow Statement before using above function module.

UPDATE AUFK SET LTEXT = 'E' WHERE AUFNR EQ vaufnr.

5 REPLIES 5

Former Member
0 Kudos

You could use Function Modules READ_TEXT and SAVE_TEXT.

Do a where used on these Function Modules to see examples of how they are used.

Former Member
0 Kudos

SAP is using SAVE_TEXT to update long text in CO02 transaction. You can use the same function module in your custom ABAP program to update the text.

Code from CO02 programs is here for sample.

-> gs_textedit_header-TDOBJECT  =  'AUFK'

-> gs_textedit_header-TDID              = 'KOPF'

-> To get the "gs_textedit_header-TDNAME" use the funtion module CO_ZF_GET_TEXT_FOR_OBJECT

-> Append your

         CALL FUNCTION 'SAVE_TEXT'
             EXPORTING
                  header = gs_textedit_header
             TABLES
                  lines  = lt_tlines.


anuradha_wijesinghe
Participant
0 Kudos

Thanks All.

I found the Solution.

Use bellow function module to do this.

   clear wa_header.

   wa_header-tdid                = 'KOPF'.

   wa_header-tdspras          = sy-langu.

   concatenate sy-mandt vaufnr into wa_header-tdname.

   wa_header-tdobject           = 'AUFK'.

   wa_header-TDLINESIZE   = 1024.

   wa_lines-tdformat = '*'.

   wa_lines-tdline = 'Test'.

   append wa_lines to it_lines.

   call function 'SAVE_TEXT'

     exporting

      CLIENT = SY-MANDT

      header = wa_header

      INSERT = 'X'

      SAVEMODE_DIRECT       = 'X'

     tables

       lines  it_lines.

Please make sure bellow Statement before using above function module.

UPDATE AUFK SET LTEXT = 'E' WHERE AUFNR EQ vaufnr.

0 Kudos

I took too long to respond (too many details and links)

NB: Also better use UPDATE AUFK SET LTEXT = SY-LANGU WHERE AUFNR EQ vaufnr. (be ready for international)

raymond_giuseppi
Active Contributor
0 Kudos

If a long text already exists (check with READ_TEXT) you can use SAVE_TEXT. But if there is currently no long text, you will save a text that won't be displayed in transactions cause the flag "long text exists" will not be set...

In KBA 1982719 - Texts cannot be displayed - Usage of function module SAVE_TEXT SAP has even written:


In general, SAP doesn't recommned the usage of SAVE_TEXT to created long texts for standard objects. These fields will never be updated and you should create a report to update them directly.

NB: Inr old versions the PM/CS BAPI_ALM_ORDER_MAINTAIN (which allows long texts) could be also called for production order but not since 1275923 - BAPI_ALM_ORDER_MAINTAIN: Error message IX019 as explained in 1694267 - BAPI_ALM_ORDER_MAINTAIN not for work orders. In some case raising a message to get allowed to OSS note 1636321 can be useful, but just updating the long text flag should not mess the database.

Regards,

Raymond