SAP SCRIPT 13

FIND TEXTS
This topic tells you how to find out which texts belong to an application object.
The name of SAPscript texts (field TDNAME) should correspond to the key of the application object to which the text is allocated. Different text types among the texts of an application object are determined by the text ID (field TDID) and by the language of the text.


If the text name corresponds to the key of the application object, you can identify all texts belonging to that object by the key. You need not store fields in the data record of the application object that contain the text name.


If an application transaction wants to know which texts exist for a material or a customer, it calls the function module SELECT_TEXT to find out. The function module in a result table returns the headers of all texts that match the selection criteria.


The function module selects texts not only from the text database, but also from the text memory.
You want to find all texts that belong to customer 4711 (centrally). The allocated text object is KNA1. The system returns the text headers of the found texts in table CUSTOMER_TEXTS:


DATA: CUSTOMER_TEXTS LIKE THEAD OCCURS 10.
CALL FUNCTION 'SELECT_TEXT'
EXPORTING OBJECT = 'KNA1'
NAME = '0000004711'
ID = '*'
LANGUAGE = '*'
TABLES SELECTIONS = CUSTOMER_TEXTS.

If you want to search for the texts of a customer in the company code 0001, use the following parameters of the function module SELECT_TEXT:

CALL FUNCTION 'SELECT_TEXT'
EXPORTING OBJECT = 'KNB1'
NAME = '00000047110001'
ID = '*'
LANGUAGE = '*'
TABLES SELECTIONS = CUSTOMER_TEXTS.

If you do not know the structure of the text name, use the corresponding application transaction to display one of the texts in the text editor Header. The textàand request information on the text by choosing Goto name of this text appears, from which you can now easily determine the text name structure.

COPY TEXTS

To copy SAPscript text, proceed like this:

1. Read the text you want to copy using READ_TEXT.
2. Rename the text by entering the new values into the fields TDOBJECT, TDNAME, TDID in the text header.
3. Save the text using SAVE_TEXT.

Use this procedure if the text to be copied is a model only and will be modified before saving, either from within the program or by the user in the text editor.


The disadvantage of this procedure is that the entire text is read into the internal work areas and then rewritten to the text database, possibly without any changes. The performance of this procedure is bad, especially so, if you want to copy a lot of texts in one transaction and store them using the update task.


In such a case, you better use the function module COPY_TEXTS: Enter the key of the texts to be copies and their new names into a table. The system then copies the texts by copying only the required data records.

INSERT LINES INTO APPLICATION SCREENS

In many cases, it is superfluous to call the SAPscript fullscreen editor for editing transaction texts. It may be sufficient to offer only the first text lines on the screen. This allows you to display several texts on one screen, even together with other data of the application object. If all text lines fit into this reserved area, the user can even change the text directly on the application screen. You must call the editor only if you allow the user to enter more than one line.


If a text contains more lines than are reserved on the application screen, you can display a flag, The user then knows that the text displayed on the screen is not complete.


This procedure is called inline processing. SAPscript supports it only in parts. For inline processing, you use the function modules READ_TEXT_INLINE and EDIT_TEXT_INLINE, which have the same functionality as READ_TEXT and EDIT_TEXT.


READ_TEXT_INLINE transfers the first few text lines into a second internal table (INLINES). The application program must then transfer these lines at the event PBO into the corresponding screen fields. The application must decide whether to display the character formats on the inline screen.

If not, it may be necessary for the application program to include a paragraph format. At the PAI event, the application program must retransfer the corresponding screen fields into the table INLINES and call the function module EDIT_TEXT_INLINE. It merges the text lines in table INLINES with the text lines in table LINES, reformats the text, and places the first few text lines back into table INLINES.


To automatically branch to the fullscreen editor after merging the texts, use another parameter. To determine, whether a text consists of more lines that fit onto the inline screen, and to display the corresponding flag to the user, compare the number of lines of table LINES with the number of lines of table INLINES.
In contrast to editing texts in the fullscreen editor, inline processing encounters some restrictions:

• The system cannot automatically concatenate words that are split by the end of the line.
• Inline processing does not support the editing functions offered by the fullscreen editor. You can use only the elementary editing functions for screen fields, which are generally available.
• You cannot scroll the text.

You only see the beginning of the text lines. If they are wider than the screen fields, you must use the fullscreen editor to edit the hidden part of a line.

• If you suppress the format field of the SAPscript text line in the display, you must use the fullscreen editor to enter control statements.


• The system stores changes to the text lines immediately in the original lines table of the text, automatically using function Save of the editor. Thus, you cannot restore the original version of the text, unless you cancel the update task and reset all changes made by the entire transaction.

INSERT OTHER TEXTS

SAPscript supports two procedure to insert texts from other text modules into a text, depending on the purpose behind it.
Include texts
Refer to texts

INCLUDE TEXTS

To include a text into any text module, the user enters the INCLUDE control statement in the SAPscript editor. When formatting the text for print output, the system reads the text lines of the specified text and inserts them in the current text printout.


In each text, several INLCUDE statements can appear together with other text lines. In the SAPscript editor, you can see only the INCLUDE statement, not the lines of the text you include. With an INCLUDE statement, you always include all lines of the specified text. You can nest INCLUDE statements.
If you change a text, these changes effect all texts that include it. If you delete a text, a corresponding INCLUDE statement is without effect.


To change text lines of an included text, you must resolve the INCLUDE Expandà Selected area àstatement. In the text editor, choose Edit INCLUDE. The system now copies the text lines into the current text and deletes the INCLUDE statement. Afterwards, there is no more link to the text originally specified in the INCLUDE statement. This means, that changes to the original text no longer effect the current text.


You cannot INCLUDE any texts, but are restricted to texts of certain text objects and text IDs, depending on the text environment the INCLUDE statement appears in. When including a standard text, SAPscript checks whether the user has the display authorization for this text.

REFER TO TEXTS

You use text references, if you also want to refer to the allocated application object. You use this procedure, for example, when creating an order and a similar order already exists, part of whose data you can reuse.

You refer to texts from within the program; that is, to establish a text reference the application program must call the SAPscript function module REFER_TEXT. A text that refers to another text module may itself not contain any further text lines.

The reference is established by storing the referred text in the fields TDREFOBJ, TDREFNAME, and TDREFID of the text header of the current text. The system automatically sets the language of the referred text to the language of the current text.


For text references, the system stores only the text header. The text lines are filled when the system reads the reference text. A reference can extend over several levels, that is, a referred text can itself refer to another text. In this case, when reading the texts, the system works through the entire reference chain and uses the text lines of the text at the end of the chain.

For text references, there are no restrictions concerning the text object, text ID or text name. The application program that establishes the reference must make sure that it refers to the correct texts. SAPscript does not execute an authorization check.

As for including texts, for printing or displaying the reference text in the editor the system always uses the current text version. In contrast to INCLUDE texts, the SAPscript editor displays all lines of the referred text. However, the text area in the editor is input-disabled, so that you can neither change the text nor insert other text lines.

If you want to change the text, you must first unlock it. In the editor choose Unlock. The system then resolves the reference and copies theàText lines, as for including, into the current text module. The text lines of the editor are now input-enabled, but there is no more link to the original reference text.


If you want to resolve a reference from within the program, you must first make sure that the text lines of the reference text are stored in the corresponding lines table. Then simply delete the fields TDREFOBJ, TDREFNAME, and TDREFID in the text header.


If a reference text no longer exists, the system ends the corresponding function module, for example, READ_TEXT with the exception REFERENCE_CHECK. The SAPscript composer ignores missing reference texts when formatting a text for printing.


Function modules:
REFER_TEXT
READ_REFERENCE_LINES
READ_TEXT


RELATED POSTS

SAP SCRIPTS PART 14
CRM Middle ware Data Flow
 CRM Middle ware Modelling 
CRM Adapter Overview 
CRM Software Logistics and support

No comments :

Post a Comment