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: 

Bapi Update LongText in Prod Order

anuradha_wijesinghe
Participant
0 Kudos

Hi Experts,

     I need to add something to the Long Text Field in the Production Order from my ABAP Program. So anyone know to how to do that, by using a BAPI or Function Module .

5 REPLIES 5

former_member191761
Active Participant
0 Kudos

Hi Anuradha,

Please check this below link :

You can use SAVE_TEXT and COMMIT_TEXT Funtion Modules

Regards

Sri

0 Kudos

Hi Srilakshmi Godavarthi...

What are the import parameter should I passed ?

0 Kudos

Hi,

refer below code. Please note, TDID will differ based on what text you need to update. You can check the text ID (TDID) in your standard transaction and write the code accordingly.

  CONCATENATE sy-mandt l_aufnr INTO l_header-tdname.

    l_header-tdid = 'KOPF'.

    l_header-tdobject = 'AUFK'.

    l_header-tdspras = sy-langu.

      wa_lines-tdline = ls_good-value.

      wa_lines-tdformat = '*'.

      APPEND wa_lines TO li_lines.

      CLEAR wa_lines.

    CALL FUNCTION 'SAVE_TEXT'

      EXPORTING

        header                = l_header

   savemode_direct       = 'X'

        lines                 = li_lines

EXCEPTIONS

   id                    = 1

   language              = 2

   name                  = 3

   object                = 4

   OTHERS                = 5

0 Kudos

Hi anuradha,

The above link has all the details in it.

The below things highlighted in Green can be used with out any changes. Where ever it is highlighted in Red , please replace with your values like production order and  your text text.

DATA: es_header TYPE thead,

es_lines TYPE tline,

et_lines LIKE TABLE OF es_lines,

wa_aufk TYPE aufk.

CONCATENATE sy-mandt '000012345678' INTO es_header-tdname.

es_header-tdobject = 'AUFK'.

es_header-tdid = 'KOPF'.

es_header-tdspras = sy-langu.

es_lines-tdformat = '*'.

es_lines-tdline = 'Sample text line one'.

APPEND es_lines TO et_lines.

es_lines-tdformat = '*'.

es_lines-tdline = 'Sample text line two'.

APPEND es_lines TO et_lines.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

* CLIENT = SY-MANDT

header = es_header

* insert = ''

savemode_direct       = ' '

* OWNER_SPECIFIED       = ' '

* LOCAL_CAT = ' '

* IMPORTING

* FUNCTION =

* NEWHEADER =

TABLES

lines = et_lines

* EXCEPTIONS

* ID = 1

* LANGUAGE = 2

* NAME = 3

* OBJECT = 4

* OTHERS = 5

.

IF sy-subrc <> 0.

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

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

  1. ENDIF.

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

object = es_header-tdobject

name = es_header-tdname

id = es_header-tdid

language = es_header-tdspras

savemode_direct       = ' '

* KEEP = ' '

* LOCAL_CAT = ' '

* IMPORTING

* COMMIT_COUNT          =

* TABLE

* T_OBJECT =

* T_NAME =

* T_ID =

* T_LANGUAGE            =

.

COMMIT WORK AND WAIT.

Regards

Sri

0 Kudos

Hi Anuradha,

Your problem solved?

regards

sri