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: 

How to WRITE TEXT in SalesOrder header level ?

Former Member
0 Kudos

Hi,

Normally we fetch free text using READ_TEXT function module but i need to write text in the SO header level ?

Is there any function module by using it we can directly add in to the text ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Kinjal,

You can Use FM SAVE_TEXT same as READ_TEXT to insert the long text in the text editor.

Below is the example code to use the SAVE_TEXT

here you have to pass it to THEAD all the parms...

thead-tdid = 'KOPF'.

thead-tdobject = 'AUFK'.

THEAD-TDSPRAS = 'EN'.

thead-tdname = '050000020633761'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = thead

SAVEMODE_DIRECT = 'X'

insert = ' '

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = it_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.

ENDIF.

Regards,

Satish

7 REPLIES 7

Former Member
0 Kudos

Use SAVE_TEXT..

Other options would be

COPY_TEXTS

EDIT_TEXT

Etc.

check the FG

STXD

Amandeep

0 Kudos

which parameters i have to pass into this function module ?

can u plz provide with sme example ?

0 Kudos
FUNCTION ZSAVE_NOTES_SAVE.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(OBJECT_ID) TYPE CRMT_OBJECT_ID
*" VALUE(OBJECT_TYPE) TYPE CRMT_SUBOBJECT_CATEGORY
*" REFERENCE(HEADER) TYPE THEAD OPTIONAL
*" REFERENCE(TEXT) TYPE TDTXTLINES
*" TABLES
*" LINES STRUCTURE TLINE
*"----------------------------------------------------------------------

TYPES : BEGIN OF STRUC,
GUID TYPE CRMD_ORDERADM_H-GUID,
END OF STRUC.
DATA : WA_STRUC TYPE STRUC,
IT_STRUC LIKE TABLE OF WA_STRUC.
TYPES : BEGIN OF STRUC1,
TDOBJECT TYPE STXH-TDOBJECT,
TDNAME TYPE STXH-TDNAME,
TDID TYPE STXH-TDID,
TDSPRAS TYPE STXH-TDSPRAS,
TDTITLE TYPE STXH-TDTITLE,
TDLINE TYPE STXH-TDTXTLINES,
END OF STRUC1.
DATA : WA_STRUC1 TYPE STRUC1,
IT_STRUC1 LIKE TABLE OF WA_STRUC1.

SELECT SINGLE GUID FROM CRMD_ORDERADM_H INTO WA_STRUC WHERE
OBJECT_ID = OBJECT_ID AND OBJECT_TYPE = OBJECT_TYPE.


SELECT SINGLE TDOBJECT TDNAME TDID TDSPRAS TDTITLE TDTXTLINES FROM STXH
INTO WA_STRUC1 WHERE TDNAME = WA_STRUC-GUID.

APPEND WA_STRUC1 TO IT_STRUC1.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = HEADER
INSERT = ' I '
SAVEMODE_DIRECT = ' X '
OWNER_SPECIFIED = ' SAPUSER '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER = HEADER
TABLES
LINES = 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.
ENDIF.

COMMIT WORK.

ENDFUNCTION.

Have alook at the follolwing threads

there are many more examples.

Former Member
0 Kudos

Hi Kinjal,

You can Use FM SAVE_TEXT same as READ_TEXT to insert the long text in the text editor.

Below is the example code to use the SAVE_TEXT

here you have to pass it to THEAD all the parms...

thead-tdid = 'KOPF'.

thead-tdobject = 'AUFK'.

THEAD-TDSPRAS = 'EN'.

thead-tdname = '050000020633761'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = thead

SAVEMODE_DIRECT = 'X'

insert = ' '

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = it_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.

ENDIF.

Regards,

Satish

0 Kudos

HI SATISH,

where do we add our Text description details.

for example i have tdname,tdid,tdobject but where i can my free text ?

0 Kudos

i am trying to add in SO

Tdname: SO number

Tdid : Z110

tobject : VBBK

SPRAS: EN

but in SO header i cant see the update

0 Kudos

Hi,

You should have some text to place in SO Long text right?

Data: LT_LINES TYPE TABLE OF TLINE.
         WA_LINES TYPE TLINE.

Pass some text to the Work Area
wa_lines -tdformat = '*'.
wa_lines-tdline = 'Test Description'

Append wa_lines to lt_lines.

Pass this Internal table to the Tables Parameter of the SAVE_TEXT.

Regards,

Satish