Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SAVE_TEXT problem

Hello All,

I am copying text from sales order and inserting into the production order.

I have used read_text, save_text and commit text.

In the debuggin i can see all the data getting populated, even iam getting sy-subrc = 0 in the save_text FM. <b>However text is not copied into the production order.</b>

Also i have a entry in STXH table.

I have posted my code for your reference

FORM ADD_LONG_TEXT1.

DATA: ID LIKE THEAD-TDID VALUE 'KOPF',

LANGUAGE LIKE THEAD-TDSPRAS,

NAME LIKE THEAD-TDNAME,

OBJECT LIKE THEAD-TDOBJECT VALUE 'AUFK'.

DATA: TLINES LIKE TLINE OCCURS 0 WITH HEADER LINE.

DATA: IT_THEAD LIKE THEAD OCCURS 0 WITH HEADER LINE.

*Prepare text criteria

CONCATENATE SY-MANDT txt-aufnr INTO NAME.

LANGUAGE = SY-LANGU.

*Begin of insert

MOVE id TO IT_THEAD-TDID.

MOVE language to IT_THEAD-TDSPRAS.

MOVE NAME to IT_THEAD-TDNAME.

MOVE OBJECT to IT_THEAD-TDOBJECT.

append it_thead.

*clear it_thead.

*End of insert

*First read text for existing data

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = ID

LANGUAGE = LANGUAGE

NAME = NAME

OBJECT = OBJECT

TABLES

LINES = TLINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

*Append/Insert new text data

LOOP AT txt-tline INTO wa_bdc.

CLEAR TLINES.

TLINES-TDFORMAT = '*'.

TLINES-TDLINE = wa_bdc-tdline.

APPEND TLINES.

ENDLOOP.

  • Secondly append new text data to existing data

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = it_thead

INSERT = ' '

SAVEMODE_DIRECT = 'X'

    • OWNER_SPECIFIED = ' '

    • LOCAL_CAT = ' '

    • IMPORTING

    • FUNCTION =

    • NEWHEADER =

TABLES

LINES = TLINES

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.

ENDIF.

CALL FUNCTION 'COMMIT_TEXT'

    • EXPORTING

    • OBJECT = OBJECT

    • NAME = NAME

    • ID = ID

    • LANGUAGE = LANGUAGE

    • SAVEMODE_DIRECT = 'X'

    • KEEP = ' '

    • LOCAL_CAT = ' '

    • IMPORTING

    • COMMIT_COUNT =

    • TABLES

    • T_OBJECT =

    • T_NAME =

    • T_ID =

    • T_LANGUAGE =

.

ENDFORM. "ADD_LONG_TEXT

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question