Application Development and Automation 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: 
Read only

save_text function module

Former Member
0 Likes
2,521

Hi,

I want to save the header text for table kna1. I know how to use this function module, the thing is in transaction

xd02(after specifying customer number) -> extras -> texts,

I am able to view many text description.eg: ( accounting note,custom note etc. ) as table control view in document window. I have to create a text for custom note description item through function module save_text.By which parameter i can get my requirement satisfied.

Thanks in advance,

Anand muthu

8 REPLIES 8
Read only

Former Member
0 Likes
1,902

hi check this..

http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db771494511d182b70000e829fbfe/frameset.htm

use the tables STXH , STXL for the header text data and item text data and use the read_text for getting saved texts..

regards,

venkat.

Read only

0 Likes
1,902

hi venkat,

my requirement is not to read the text but to save the text for the corresponding item description line in table control.

Read only

0 Likes
1,902

then I would suggest to use the save_text function module (same function group).

Read only

0 Likes
1,902

in which parameter of save_text i can pass the value to select the particular item description line displaying under xdo2->extras->texts. eg: custom notes item decription from avail item descriptions of ( accounting note,custom note etc.)

Read only

0 Likes
1,902

When displaying the text, you can go to the header via the menu. In this pop-up you will see the Text ID, Text object, etc. everything you need to use the save_text function module

Read only

0 Likes
1,902

can u tell me in which import ,export parameter of the function module save_text i have to fill the values to get my req. satisfied. it will be more helpful

Read only

0 Likes
1,902

Lets take an example which we can call both. Go to transaction SE71. In settings use the graphical form painter (checkbox). And then on SAP Script screen choose radiobutton layout.

enter demoform S_CA930_DEMO_1 and press display (not available in client XXX, so will be retrieved from client 000).

In menu choose EDIT->WINDOWS->TEXT-ELEMENTS. (text will be displayed).

In menu of next screen GO TO->HEADER.

In pop-up you will see the information you need like text name, language, text id and text object.

FM SAVE_TEXT has header structure type THEAD:

TDOBJECT = TEXT OBJECT

TDNAME = TEXT NAME

TDID = TEXT ID

TDSPRAS = LANGUAGE.

At least these are mandatory, rest you will have to find out.

Other parameters, look at the documentation of the function module....

Good luck.

Read only

Former Member
0 Likes
1,902

HI,

Try the below code

DATA: BEGIN OF XTHEAD.

INCLUDE STRUCTURE THEAD.

DATA: END OF XTHEAD.

DATA: BEGIN OF ZZTLINE OCCURS 10.

INCLUDE STRUCTURE TLINE.

DATA: END OF ZZTLINE.

XTHEAD-TDID = 'ZPPM'. "TEXT-ID

XTHEAD-TDSPRAS = SY-LANGU. "Language

XTHEAD-TDNAME = 'ZTKF'. "identification

CONCATENATE SY-TCODE(5) ITAB0300POS-AUFNR

INTO XTHEAD-TDNAME.

XTHEAD-TDOBJECT = 'TEXT'. "Object type top/position

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = XTHEAD-TDID

LANGUAGE = XTHEAD-TDSPRAS

NAME = XTHEAD-TDNAME

OBJECT = XTHEAD-TDOBJECT

IMPORTING

HEADER = XTHEAD

TABLES

LINES = ZZTLINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

IF SY-SUBRC = 0.

REFRESH ZZTLINE.

ZZTLINE-TDLINE = ITAB0300POS-BEM.

APPEND ZZTLINE.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

HEADER = XTHEAD

IMPORTING

FUNCTION = ZFUNCTION

NEWHEADER = XTHEAD

TABLES

LINES = ZZTLINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

ELSE.

XTHEAD-TDID = 'ZPPM'. "TEXT-ID

XTHEAD-TDSPRAS = SY-LANGU. "Language

XTHEAD-TDNAME = 'ZTKF'. "identification

CONCATENATE SY-TCODE(5) ITAB0300POS-AUFNR

INTO XTHEAD-TDNAME.

XTHEAD-TDOBJECT = 'TEXT'. "Object type top/position

REFRESH ZZTLINE.

ZZTLINE-TDLINE = ITAB0300POS-BEM.

APPEND ZZTLINE.

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

FID = XTHEAD-TDID

FLANGUAGE = XTHEAD-TDSPRAS

FNAME = XTHEAD-TDNAME

FOBJECT = XTHEAD-TDOBJECT

TABLES

FLINES = ZZTLINE

EXCEPTIONS

NO_INIT = 01

NO_SAVE = 02.

ENDIF.

Regards

Sreeni