cancel
Showing results for 
Search instead for 
Did you mean: 

Use of Read_text, Save_text, Control_form

Former Member
0 Kudos

Hi,

Can anyvody explain me how to use FM Read_text, Save_text, Control_form in Forms ?Can we use both in Script and Smartforms ?

Whats its purpose ?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

The function module CONTROL_FORM can be used to pass the control

commands to FORM THROUGH ABAP/4 PROGRAM.

Function Call

CALL FUNCTION 'CONTROL_FORM'

EXPORTING COMMAND = ?...

EXCEPTIONS UNOPENED =

UNSTARTED =

Export parameters:

COMMAND

Enter the SAPscript statement you want to execute in ITF format, but without the statement paragraph attribute '/:'.

Exceptions:

UNOPENED

The current form function could not be executed, since the form output was no yet initialized using OPEN_FORM.

UNSTARTED

No form was opened yet.

Possible reasons:

The form processing was started using OPEN_FORM without specifying a form name, but no form was opened yet using START_FORM.

The last used form was closed using END_FORM, but no new form was opened using START_FORM.

The last filled page of the current form has no subsequent page. In this case, the system automatically terminates form printing after this page. You need no explicit END_FORM call.

In the current form, no page contains a main window, but a text element shall be output in the main window.

Regards,

Former Member
0 Kudos

To re-transfer texts from the internal work areas to the text file, use the function module SAVE_TEXT.

The application program does not know whether the text is new or a changed version of an existing text. To be able to find this out, the program must read the text file first.

If a text exists, the transferred text lines overwrite the old version. If it does not exist, the system creates it. If you know from the beginning that the text is new, you can suppress this read process using the parameter INSERT and thus improve performance.

A text you want to store in the text file must consist of at least one line whose paragraph format or line contents is unequal to SPACE. Otherwise the system automatically deletes this text from the text file.

Changes to the text file are valid at once if the text object of the text is set to direct storage. If it is set to storage in update task, the text changes are temporarily stored in the text memory. The function module COMMIT_WORK then transfers them to the log file, from where they are updated with the next COMMIT WORK.

The function module SAVE_TEXT can handle only texts that are eventually stored in the text file, that is, text with storage mode 'D' or 'V'.

Also check this thread for sample code.

Sample:

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.

Former Member
0 Kudos

READ_TEXT :

function module is used to bring the long texts (PO or SO) wherever you need it, but provided u know the TDID, TDOBJECT, SPRAS, and TDNAME.

Read text is used in two ways:

To read the standard text that is stored via SO10 into an internal table which is used later for printing.

To read the text that is stored in text objects(i.e. any dynamic text that is entered on some screen) into an internal table.

So the text that is read can be printed via scripts.

STXH table stores all these standard texts with a combination of Text object, Standard text name, Text ID and Language.