R F C 2 REMOTE DESTIONATIONS


You maintain the RFC sideinfo table RFCDES using Transaction SM59.Depending on the remote system, maintain one destination for the corresponding type.If you want to connect to another SAP System, you need a destination with type 3. Note that the name of a type 3 destination is case-sensitive.

If you want to ensure that the RFC logon is to a particular application server, set the Load distribution option to No. In this case, you must specify the R/3 application server using the target host and system number parameters.


If you do want to use load distribution when you log on, set the Load distribution option to Yes. In this case, you must specify the system ID, the message server, and the required server group. You can find out this information in the R/3 target system from Transactions SM51 (overview of R/3 servers) and SMLG (overview of logon groups). The message server of an SAP System is contained in the profile parameter rdisp/mshosou. You can display this using Transaction RZ11 or report RSPFPAR.

In the destination, you must enter the logon data for the user created in the target system (type 'dialog' or 'CPIC'). When the destination is used, the logon to the target system occurs automatically.If the logon language is not entered in an RFC destination, the logon language of the current caller is used.If the logon data is not complete or is faulty, a logon screen from the target system appears at runtime.

If you want to connect to an R/2 system, you need a destination with type 2. In the destination you need to specify the logon data of an R/2 user with the type 'CPIC'. You must also specify the SNA gateway (for IBM-R/2) or the host gateway (for Siemens R/2) through which the connection is made.

Note that the destination name (here, it is K50) for a type 2 destination cannot be chosen at random. It must match the name of the corresponding destination in the gateway sideinfo table .For connections to external RFC server programs, you need a destination with the type T. there are 2 variations of the T type:

1. Start: The external program is started when communication is being established.
a) On the application server: The external program is started on the current R/3 application server. You must give the complete program path including the program names.
b) On the explicit host: The external program is started on the specified host.
You must specify the following:
- Host name --> Name of the machine where the external program is located
- Path --> Complete path including program names on an external host
c) Front end workstation: The external program is started on the current front end at runtime via the SAPgui. You must enter the compete (absolute) path of the program including program names.

2. Registration: These destination variations let you access a program that has already started, which has registered itself on a gateway. This program must be started manually beforehand and registers itself using an RFC call with a program ID on a gateway (see the online documentation). With this variant, the start time is not required. It is suited to starting a program frequently. You must specify the following:
- Program-ID --> ID under which the external server program registered on the SAP gateway
- Gateway --> Host and TCP/IP service of the gateway where the external
program registered (If the gateway is the one for the current application server, this information is not required.)

These destinations are predefined standard destinations with have the following meanings:
- SPACE: Local call of a function module
- NONE: Also a local call, but the cal request is sent to the default gateway of the current application server and is handled there like an external call request. This destination is suited to the RFC test if you only have one system to test.
- BACK: You can use this destination if you want to start a function module from the called function module in the current system.
(This only functions with synchronous RFC.)


You cannot use this destination from R/2 systems.
Destination BACK cannot be used for R/3-R/2 connections.

RELATED POSTS

RFC PART 3
Analytical SAP CRm Overview
SAP CRM Solution Monitoring
CRM Backup Restoring System

REMOTE FUNCTION CALL 1

REMOTE FUNCTION CALL:

The character conversion of the data to be transmitted is performed automatically.

Both single parameters and structures are supported for conversion.

The logon for remote SAP partner systems is automatic. The user and password are stored in the table RFCDES.

RFC calls in C are available for communicating with external programs (RFC-SDK). The RFC Generator also helps you when generating RFC programs in C.


If a function module is called remotely, it runs in its own work process (its own SAP LUW) if the remote system is an R/3 System.

The remote destination can be another application server in the same or a different R/3 System, an When you call a function module locally, it runs in the same work process as the calling program.

R/2 System, or an non-SAP system.

Note that the calling program is rolled out for each remote function call, which triggers an implicit database-commit.

You maintain RFC destinations that must specify an ABAP program when calling remote function modules in the RFC sideinfo table RFCDES using Transaction SM59.
For each partner system, you need to maintain one entry in the sideinfo table.


SAP delivers the RFC Library for all current external platforms, in which RFC calls are contained for C programs. After installing the RFC Library on your external platform, you can implement RFC client or RFC server programs using RFC calls.


With synchronous RFC, processing stops in the calling program until the called remote function is processed and its output is returned. Then in the calling program, the processing continues after the call.

In an asynchronous Remote Function Call, the called remote function is started and then continues processing on its own immediately in the calling program. Remote function processing is separate from the calling program. The function output can be received later in the program.

Asynchronous RFC is intended for parallel processing of processes.


Whereas with synchronous and asynchronous RFC each call makes up a single logical unit of work (LUW) in the remote system, you can use transactional RFC to bundle several remote functions into one LUW (with an automatic rollback mechanism in case of error).
With tRFC, generated LUWs are processed independently of each other. This means, the order in which they are processed is not always the order in which they are generated.

To ensure that tRFC-LUWs are processed in the same order as they were generated, you can use qRFC as an extension of tRFC.

qRFC is available as of Release 4.6A and can be used in R/3-R/3 connections as well as R/3-external connections.

RELATED POSTS

RFC PART 2

SAP SCRIPT 20


CONTROL_FORM

Use CONTROL_FORM to pass SAPscript control statements to the layout set.


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 layout set function could not be executed, since the layout set output was no yet initialized using OPEN_FORM.

UNSTARTED No layout set was opened yet.Possible reasons:

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

• The last used layout set was closed using END_FORM, but no new layout set was opened using START_FORM.

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

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


AND THIS IS THE END OF SCRIPT SERIES.

RELATED POSTS

SAP SCRIPTS PART 1

SAP SCRIPT 19


ELEMENT

The parameter ELEMENT contains the name of a layout set element that the system could not find.Possible reasons:

• The element does not exist. An element refers to a window, and the specified window does not contain the element. If no window is specified, the system searches for the element in the main window.

• The specified element is not defined in the layout set.

• The layout set version that contains the text element in the specified layout set window is not active.
FUNCTION The function specified in parameter FUNCTION is unknown.For this parameter, the following values are allowed:SETAPPENDDELETE


TYPE The type of window area specified in parameter TYPE is invalid.Depending on the window type, these entries are valid:• BODY: for all windows• TOP: only for the main window• BOTTOM: only for the main window


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

UNSTARTED No layout set was opened yet.Possible reasons:

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

• The last used layout set was closed using END_FORM, but no new layout set was opened using START_FORM.

• The last filled page of the current layout set has no subsequent page. In this case, the system automatically terminates layout set printing after this page. You need no explicit END_FORM call.• In the current layout set, no page contains a main window, but a text element shall be output in the main window.


WINDOW The layout set window specified in parameter WINDOW does not exist in the current layout set.Possible reasons:

• A wrong window name was specified.

• The layout set version, which contains the specified window, is not active.

Neither this documentation nor any part of it may be copied or reproduced in any form or by any means or translated into another language, without the prior consent of SAP AG.

END_FORM

END_FORM ends the currently open layout set and executes the required termination processing. After calling this function module, no more layout set is active. For further output, you must start a new layout set using START_FORM.

END_FORM does not replace CLOSE_FORM, that is, you must always close any SAPscript output using CLOSE_FORM.

Function call:

CALL FUNCTION 'END_FORM'
IMPORTING RESULT =
EXCEPTIONS UNOPENED =

Import parameters:

RESULT The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.Structure: ITCPP


Exceptions:

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




RELATED POSTS

SAP SCRIPT CONTROLS 6
SAP SCRIPT CONTROLS 5
SAP SCRIPT CONTROLS 4
SAP SCRIPT CONTROLS 3
SAP SCRIPT CONTROLS 2
SAP SCRIPT CONTROLS 1
SAP SCRIPTS PART 20
SAP SCRIPTS PART 18
SAP SCRIPTS PART 17
SAP SCRIPTS PART 16
SAP SCRIPTS PART 15
SAP SCRIPTS PART 14
SAP SCRIPTS PART 13
SAP SCRIPTS PART 12
SAP SCRIPTS PART 11
SAP SCRIPTS PART 10
SAP SCRIPTS PART 9
SAP SCRIPTS PART 8
SAP SCRIPTS PART 7
SAP SCRIPTS PART 6
SAP SCRIPTS PART 5
SAP SCRIPTS PART 4
SAP SCRIPTS PART 3
SAP SCRIPTS PART 2
SAP SCRIPTS PART 1

Part Seven

SAP CRM Technology Overview
CRM Data Exchange with SAP R/3 CRM Data Exchange via AdapterCRM E commerce Introduction
CRM Interaction Center System ArchitectureCRM Field Sales
People Centric SAP CRM
Analytical SAP CRm Overview
SAP CRM Solution MonitoringCRM Backup Restoring System
Part Eight

MySAP CRM Marketing Introduction Marketing and Advertizing in CRMMySAP CRM Marketing CalenderSAP CRM Marketing AnalyticsSAP CRM Marketing Personalized E mailSAP CRM Marketing SegmentationCRM Marketing Proposals
CRM Marketing and lead management

SAP SCRIPT 18

START FORM

Usually a print program does not print only one urging letter or one account statement, but several layout sets for different customers. To have the output for each customer begin with the start page of the layout set, you must start the current layout set again and again.
To start a layout set again, you must first end the current layout set and then open the layout set again. Within one print request, first call the function module END_FORM. It executes the final processing for the current layout set. Then start the layout set again using START_FORM. Output then begins again on the start page of the desired layout set.

CALL FUNCTION 'OPEN_FORM'
:
CALL FUNCTION 'START_FORM'
:
CALL FUNCTION 'END_FORM'
:
CALL FUNCTION 'START_FORM'
:
CALL FUNCTION 'END_FORM'

:
CALL FUNCTION CLOSE_FORM


If you use START_FORM and END_FORM, you must not specify a layout set for OPEN_FORM. However, in this case you can use the SAPscript output functions only after opening a layout set with START_FORM.

Neither this documentation nor any part of it may be copied or reproduced in any form or by any means or translated into another language, without the prior consent of SAP AG.

WRITE_FORM

The system outputs the layout set element specified in parameter ELEMENT into the currently opened layout set.
In the parameter WINDOW you can specify the name of a window for the output. Remember that the layout set element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas.


Function call:

CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = SPACE
WINDOW = 'MAIN'
FUNCTION = 'SET'
TYPE = 'BODY'
IMPORTING PENDING_LINES =
EXCEPTIONS ELEMENT =
FUNCTION =
TYPE =
UNOPENED =
UNSTARTED =
WINDOW =


Export parameters:

ELEMENT Specify the name of the text element you want to output into the layout set window specified in the parameter WINDOW. The element must be defined in that layout set window. If you specify no element, the system uses the default element, if one is defined in the layout set.Default value: SPACE
WINDOW Specify the name of the window into which you want to output the layout set element specified in the parameter ELEMENT.Default value: 'MAIN'
FUNCTION The parameter determines how to output the text element into the respective window. The output type depends on the window type and area:Window type MAIN, area BODY:'SET' append to previous output 'APPEND' same as SET'DELETE' no effectWindow type MAIN, areas TOP and BOTTOM;all other windows:'SET' delete old window or area contents and output the element 'APPEND' append the element to the existing elements 'DELETE' delete the specified element from the window or areaDELETE in the TOP area (headings) takes effect only on the next page. You can no longer delete any heading from the TOP area after outputting text to the BODY area.Default value: 'SET'
TYPE The system interprets this parameter only for output to the main window.The parameter determines the area of the main window into which you want to output the element. Possible values:'TOP' header area'BODY' main area'BOTTOM' footer areaDefault value: 'BODY'
Import parameters:

PENDING_LINES If a text is output to the BOTTOM area of the main window (TYPE = 'BOTTOM'), there may be not enough space left on the current output page. The system then internally flags this text for output into the BOTTOM area of the next page. The actual output is pending.If output is pending, the parameter PENDING_LINES contains 'X', and the print program can react accordingly. For example, an explicit page break at the text end (NEW-PAGE) could implicitly trigger the pending BOTTOM output on the next page.


RELATED POSTS

SAP SCRIPTS PART 19

SAP SCRIPT 16

If you want to see the paragraph format in the editor, request it using the parameter SHOWTPFM.
Possible values:

'X' display format of template lines
' ' suppress format information of template lines
APP_NEXT: activate menu function Next text

The calling program tells the SAPscript editor that a subsequent text àexists for the current text. This activates the menu function Goto Next text in the editor.
Possible values:

'X' subsequent text exists
' ' no subsequent text exists
This field applies only to texts edited on the TA interface.

APP_PREV: activate menu function Previous text

The calling program tells the SAPscript editor that a previous text exists Previousàfor the current text. This activates the menu function Goto text in the editor.
Possible values:

'X' previous text exists
' ' no previous text exists
This field applies only to texts edited on the TA interface.

RETURN PARAMETER OF THE EDITOR

After leaving the SAPscript editor, you can use the parameter RESULT to evaluate status information. The editor returns this information in the structure ITCER.

FUNCTION: change information on the text module

This field indicates the function executed on the transferred text module.
Possible values:

'D' The transferred text was deleted.
'I' The system transferred an empty lines table into which text lines were inserted.
'U' An existing text was changed and saved.
' ' The text remained unchanged.
USEREXIT: exit status of the editor

he field contains the function which the user chose to leave the SAPscript editor.
Possible values:

'C' user chose function Cancel
'B' user chose function Back
'E' user chose function Exit
'N' user chose function Next text
'P' user chose function Previous text

SAPSCRIPT FUNCTION MODULES

This section contains a detailed description of the function modules used by SAPscript.
For easier navigation, click on the individual function modules to open another window.

Database
READ_TEXT Reads a text module and passes it to the specified work areas.
READ_TEXT_INLINE Like READ_TEXT. In addition, it passes the first few text lines to a second lines table.
READ_REFERENCE_LINES Reads the text lines of a reference text and passes them to the specified lines table.
SAVE_TEXT Saves a text.
DELETE_TEXT Deletes a text.
COPY_TEXTS Copies a text.
SELECT_TEXT Finds the texts for an application object.
Administration
REFER_TEXT Creates a reference to another text.
RENAME_TEXT Renames the text in the text memory.
COMMIT_TEXT Creates for all texts in the text memory the call of an appropriate update module.
INIT_TEXT Initializes the internal work areas for a text.
Editor call
EDIT_TEXT Calls the text editor.
EDIT_TEXT_INLINE Merges the inline lines with the other text lines and calls the text editor.
Consistency check
CHECK_TEXT_AUTHORITY Checks the authorization for standard texts.
CHECK_TEXT_ID Checks whether the specified text ID is valid.
CHECK_TEXT_LANGUAGE Checks whether the specified text language is valid.
CHECK_TEXT_OBJECT Checks whether the specified text object is valid.
CHECK_TEXT_NAME Checks whether the specified text name is valid.
Editing functions
TEXT_SYMBOL_COLLECT Finds the variable symbols that occur in a text.
TEXT_SYMBOL_PARSE Checks whether a character string is a SAPscript symbol.
TEXT_SYMBOL_REPLACE Replaces symbols in a text with their values.
TEXT_SYMBOL_SETVALUE Defines the value of a text symbol.
TEXT_CONTROL_REPLACE Replaces control statements in a text (IF, CASE ...).
TEXT_INCLUDE_REPLACE Replaces INCLUDE control statements by the text lines of the corresponding text.
Print
PRINT_TEXT Formats a text for output.
PRINT_TEXT_ITF Prints a text in the internal ITF format.
Layout set functions
OPEN_FORM Opens the layout set output.
CLOSE_FORM Ends the layout set output.
START_FORMprog06e.doc030>howto Starts a new layout set.
WRITE_FORM Calls a layout set element.
WRITE_FORM_LINES Writes text lines into a layout set.
END_FORM Ends the current layout set.
CONTROL_FORM Sends a control statement to the layout set.
READ_FORM_ELEMENTS Finds the elements of a layout set.
READ_FORM_LINES Passes the lines of a layout set elements into an internal lines table.
Conversion
CONVERT_TEXT Converts texts between different formats.
CONVERT_TEXT_R2 Converts texts between R/3 format (SAPscript) and R/2 format.
CONVERT_OTF_MEMORY Converts the formatted text (OTF format).
EXCHANGE_ITF Exchanges the paragraph and character formats of a text with those of another style or layout set.
Transfer
IMPORT_TEXT Imports texts.
EXPORT_TEXT Exports texts.
TRANSFER_TEXT Uploads/Downloads texts.



RELATED POSTS

SAP SCRIPTS PART 17

MySAP CRM Marketing Introduction
 Marketing and Advertizing in CRM
MySAP CRM Marketing CalenderSAP CRM

SAP SCRIPT 17


OPEN_FORM

The function module OPEN_FORM opens layout set printing. You must call this function module before you can use any other layout set function (WRITE_FORM, START_FORM, CONTROL_FORM ...).
You need not specify a layout set name. If you omit the name, you must use the function module START_FORM to open a layout set before starting the output.
You must end layout set printing by using the function module CLOSE_FORM. Otherwise, the system does not print or display anything.
Within a program, you can use several OPEN_FORM .. CLOSE_FORM pairs. This allows you to write output to several different spool requests from within one program.

Function call:

CALL FUNCTION 'OPEN_FORM'
EXPORTING FORM = SPACE
LANGUAGE = SY-LANGU
DEVICE = 'PRINTER'
DIALOG = 'X'
OPTIONS = SPACE
APPLICATION = 'TX'
ARCHIVE_INDEX = SPACE
ARCHIVE_PARAMS = SPACE
IMPORTING LANGUAGE =
RESULT =
NEW_ARCHIVE_PARAMS =
EXCEPTIONS CANCELED =
DEVICE =
FORM =
OPTIONS =
UNCLOSED =


Export parameters:

FORM You can enter the name of a layout set here, which then controls output formatting. After calling OPEN_FORM, you can immediately output texts to the layout set using other function modules.If you leave the parameter blank, you must call START_FORM with a valid layout set name before starting any output functions.Default value: SPACE
LANGUAGE Layout sets are language-dependent. Enter the desired language. If a layout set does not exist in this language, the system tries to call the layout set in its original language.Reference field: THEAD-TDSPRASDefault value: SY-LANGU
LANGUAGE The parameter tells you which language variant of the layout set the system actually used.Reference field: THEAD-TDSPRAS
RESULT The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.Structure: ITCPP
NEW_ARCHIVE_PARAMS The parameter contains results of the archiving process, including the archive parameters the user changed on the print control screen. The parameter has the ABAP/4 Dictionary structure ARC_PARAMS.Structure: ARC_PARAMS
Exceptions:

CANCELED When starting SAPscript print formatting, the system displayed a selection screen, on which the user can enter settings for the output, such as: • Printer name• Information on the cover page• Page selection• Number of copiesThe user did not call any subsequent actions allowed on this screen, but canceled the output formatting instead. The function module was ended without further action. No layout set is open for output anymore.

DEVICE The parameter DEVICE contains an invalid device type.
FORM The parameter FORM contains the name of a layout set that the system could not find.Possible reasons:• The layout set does not exist.• There is no active version of this layout set.SAPscript first searches for the layout set in the current client and in the specified language. If the layout set does not exist there, it tries the original language of the layout set. If the layout set is still not found, it searches in client 0, first in the specified language, than in the original layout set language.

OPTIONS The parameter OPTIONS contains invalid values for the formatting options.Possible errors:• The output device specified in field TDDEST does not exist.• The field TDPAGESLCT for selecting the pages to be printed contains invalid characters.
UNCLOSED The system was told to open a new layout set even though an old layout set is still active. The old layout set must be closed first (CLOSE_FORM or END_FORM).

CLOSE_FORM

The function module closes the layout set opened using OPEN_FORM. The system executes any terminating processing steps for the last opened layout set.
You must use this function module to close layout set printing. Otherwise, no output appears on printer or screen.

Function call:

CALL FUNCTION 'CLOSE_FORM'
IMPORTING RESULT =
TABLES OTFDATA = ?...
EXCEPTIONS UNOPENED =


Import parameters:

RESULT The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.Structure: ITCPPAmong others, the structure ITCPP contains a field with the name of USEREXIT. This field tells you how the user left the print view:Characters E, B, or C:EXIT <-> EBACK <-> BCANCEL <-> C
Table parameters:
OTFDATA If in the parameter OPTIONS the field TDGETOTF contains 'X', the system returns the formatted output in the OTF format in the optional table parameter OTFDATA.In this case, the system does not output anything to printer, screen or fax/telex/teletex.Structure: ITCOO
Exceptions:
UNOPENED The system could not execute the current layout set function, since the layout set output was not yet initialized using OPEN_FORM.




RELATED POSTS

SAP SCRIPT CONTROLS 6
SAP SCRIPT CONTROLS 5
SAP SCRIPT CONTROLS 4
SAP SCRIPT CONTROLS 3
SAP SCRIPT CONTROLS 2
SAP SCRIPT CONTROLS 1
SAP SCRIPTS PART 20
SAP SCRIPTS PART 19
SAP SCRIPTS PART 18
SAP SCRIPTS PART 16
SAP SCRIPTS PART 15
SAP SCRIPTS PART 14
SAP SCRIPTS PART 13
SAP SCRIPTS PART 12
SAP SCRIPTS PART 11
SAP SCRIPTS PART 10
SAP SCRIPTS PART 9
SAP SCRIPTS PART 8
SAP SCRIPTS PART 7
SAP SCRIPTS PART 6
SAP SCRIPTS PART 5
SAP SCRIPTS PART 4
SAP SCRIPTS PART 3
SAP SCRIPTS PART 2
SAP SCRIPTS PART 1

Part Seven

SAP CRM Technology Overview
CRM Data Exchange with SAP R/3 CRM Data Exchange via AdapterCRM E commerce Introduction
CRM Interaction Center System ArchitectureCRM Field Sales
People Centric SAP CRM
Analytical SAP CRm Overview
SAP CRM Solution MonitoringCRM Backup Restoring System
Part Eight

MySAP CRM Marketing Introduction Marketing and Advertizing in CRMMySAP CRM Marketing CalenderSAP CRM Marketing AnalyticsSAP CRM Marketing Personalized E mailSAP CRM Marketing SegmentationCRM Marketing Proposals
CRM Marketing and lead management

SAP SCRIPT 15


At the interface to its function modules, SAPscript implicitly always checks whether the specified text object, text name, text ID, and text language are valid. To execute such a check independent of a SAPscript processing function, the system provides function modules that allow you to explicitly check the validity of these specifications.

PRINT TEXTS To print a text, you can use the function module PRINT_TEXT. However, you can format only one text with this function module. Formatting occurs according to the formatting information specified in the text header (style and layout set). If no layout set is defined for a text, the system implicitly underlays the layout set SYSTEM. During formatting, the system


• formats the individual text paragraphs according to the definitions in the style or layout set, • replaces variables with their current values,

• interprets and executes the control statements contained in the text, • automatically triggers page breaks according to the page layout specified in the layout set. The function module automatically opens the layout set and closes it after formatting the text lines.

All text lines transferred appear in the main window of the layout set (MAIN). If you want to output a text module in such a way that you can view it in the text editor in ITF format, use the function module PRINT_TEXT_ITF.

The system ignores the style and layout set specifications in the text header and uses the layout set SAPSCRIPT_ITF instead. With each application program, you can specify different formatting parameters by using the parameter OPTIONS.

The user gets a dialog window, in which he can change the default values of certain parameters. You can evaluate these changes by comparing the fields of the parameter OPTION with the corresponding fields of the return parameter RESULT of the program.


The function module PRINT_TEXT internally calls the function modules OPEN_FORM, WRITE_FORM_LINES, and CLOSE_FORM. Therefore, you cannot call PRINT_TEXT after a layout set has been opened using OPEN_FORM. The system then ends the function module with the exception UNCLOSED. If the text module you want to print is not in ITF format, that is, the field TDTEXTTYPE of the text header is not empty, you cannot use the SAPscript composer to format this text. Instead, the system calls the function module PRINT_TEXT_FORMAT_xxx, which calls the word processing program appropriate for processing the specified text format. If this is impossible, PRINT_TEXT ends with an exception.

SAPSCRIPT CONTROL TABLES AND STRUCTURES This topic introduces the control tables SAPscript employs. You also find an overview of the structures used. Control tables: TTXOB Definition of the text objects TTXOT Descriptions of the text objects TTXID Definition of the text IDs TTXIT Descriptions of the text IDs To maintain the above tables, use transaction SE75.

To call Settings SAPscriptà Word processing àthe transaction, choose Tools structures THEAD Structure for storing the text header TLINE Structure for storing a text line ITCPO Control parameter for output formatting ITCPP Return parameter from output formatting ITCED Control parameter for the text editor ITCER Return parameter from the text editor ITCST Structure of the result table that gathers all the symbols appearing in a text ITCWE Structure of the result table that lists all the elements appearing in a layout set CONTROL PRINT OUTPUT With the function modules PRINT_TEXT and OPEN_FORM, you can set output formatting and print control using the parameter OPTIONS.

The data you pass to this parameter must have the structure ITCPO. The fields of this structure come from the areas SAPscript, the spool, and SAPcomm. Some of these fields can be changed by the user on the selection screen, if you requested it using the parameter DIALOG with the above function modules.


RELATED POSTS

SAP SCRIPTS PART 16

SAP SCRIPT 14

PROCESS TEXTS FROM WITHIN PROGRAMS

SAPscript texts are stored in the lines table in ITF format. This format consists of readable characters only and does not contain any hexadecimal codes <>LOOP, READ, INSERT, DELETE). Since the fields of structure TLINE are of type C, you can use all ABAP/4 statements available for processing type C fields. SAPscript offers a number of function modules to modify the text lines table, taking into account the syntax and semantics of the SAPscript ITF format.

COVERT SAPSCRIPT TEXTS SAPscript texts are stored in Interchange Text Format (ITF). As interface to other word processing programs, SAPscript offers conversion programs to the text file formats Rich Text Format (RTF) and ASCII as well as migration for R/2 texts. RTF files RTF files contain the entire formatting information of a text and can be interpreted as well as created by all common word processing programs. RTF files created from SAPscript texts largely contain the character and paragraph formats from the style or layout set of the original text. They can easily be read into modern word processing programs;


RELATED POSTS

SAP SCRIPTS PART 15


Mobile Scenarios in SAP CRM 
Connecting Mobile Clients to SAP CRM
dministering Sites for Mobile Users in CRMCRM
Middle ware for Mobile Replication 
CRM Mobile Replication Architecture 
CRM Middle ware Monitors 
CRM Middle ware replication Modeling
CRM Middle ware Software Distribution

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

SAP SCRIPT 12

special character

Use this format to output a character that you cannot enter via the keyboard. Replace 'x' with the number of the SAP character. All characters valid in the SAP system have a unique number. However, you can print or display this character only, if it is defined in the system character set and if the character set of the corresponding output device also contains it.

Variables (or symbols) are placeholders for values that you set at the moment of actually formatting the text for output. To recognize variables, they must have a certain structure:

• Variables must be included in & characters.
• The variable name must not contain blanks.
• The entire variable must fit into the field TDLINE.


Example: Create work areas in the program

To define the work area for the text header, use a structure like THEAD:

DATA LIKE THEAD.

To define the work area of the lines table, use an internal table with the line structure TLINE:

DATA LIKE TLINE OCCURS WITH HEADER LINE.

You can use the above short forms for declaring work areas only, if you use release 3.0 or higher. They have the same effects as


DATA BEGIN OF .
INCLUDE STRUCTURE THEAD.
DATA END OF .
or
DATA BEGIN OF OCCURS .
INCLUDE STRUCTURE TLINE.
DATA END OF .

SAPSCRIPTS IN DETAIL

This section offers further details on some SAPscript areas. Besides a list of the control tables used, more information on how to control the printout and the editor is provided.
Integrate word processing into application programs
SAPscript control tables and structures
Control print output
Editor control

INTEGRATED WORD PROCESSING INTO APPLICATION PROGRAMS

This section deals with the explicit integration of word processing into application programs. Examples are used to clarify the explanations. Special tips may help you with problems.

Read texts
Save texts
Delete texts
Call the editor
Find texts
Copy texts
Insert text lines into application screens
Insert other texts
Process texts from within programs
Convert SAPscript texts
Consistency checks
Print texts

READ TEXTS

You can process texts only if they are stored in the internal work areas of the program. Therefore, you must first transfer a text into the work areas.
To transfer the text header of a text into the specified structure and the text lines into the specified lines table, use the function module READ_TEXT.


Usually, the system reads a text from the text file. However, for texts with storage in the update task, the system first looks into the text memory to see whether it contains a currently processed version. If so, the system reads this version of the text into the work area, otherwise the text version from the text file.


To read a text version stored in the archive, use the parameter ARCHIVE_HANDLE.


If the desired text does not exist, READ_TEXT ends with the exception NOT_FOUND. The contents of the work areas for text header and text lines are then undefined. To be able to use these work areas for another text, you must first initialize them with INIT_TEXT.


The function module READ_TEXT also handles text references. It reads the reference chain to its end and supplies the text lines of this text in the lines table as well.

SAVE TEXTS

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 updat 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'.

DELETE TEXTS

To explicitly delete texts from the text file, use DELETE_TEXT and specify the key of the desired text. You must not read the text first.


With DELETE_TEXT, you can specify the text name, text ID, and text language generically as well. This allows you to delete, for example, all texts belonging to an application object, in one call.

Delete all texts with company code 0001 for customer 4711.


CALL FUNCTION 'DELETE_TEXT'
EXPORTING OBJECT = 'KNB1'
NAME = '00000047110001'
ID = '*'
LANGUAGE = '*'.

Delete all company code-related texts of customer 4711.
CALL FUNCTION 'DELETE_TEXT'
EXPORTING OBJECT = 'KNB1'
NAME = '0000004711*'
ID = '*'
LANGUAGE = '*'.

The texts are deleted from the text file immediately, if the text object of the text(s) is set to direct storage. If it is set to storage in update task, the deletion request is stored in the text memory first. The function module COMMIT_WORK then transfers the request to the log file, from where it is executed with the next COMMIT WORK.


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

CALL THE EDITOR

Use the function module EDIT_TEXT to branch to a (fullscreen) text editor that allows you to edit the transferred text. Depending on the text format in the text header (TDTEXTTYPE), the system calls the corresponding editor. If the format field is empty, it calls the SAPscript editor. Otherwise it internally calls the function module EDIT_TEXT_FORMAT_xxx, which is responsible for establishing the link to the text editor that can process texts in the format xxx.


The SAPscript editor offers several functions.
The editor interface, that is, the activated functions in the editor menus, are determined by the text interface allocated to the text object in table TTXOB. In addition, you can set certain attributes of the interface using the parameters CONTROL, DISPLAY, and EDITOR_TITLE when calling the function module EDIT_TEXT.

Call the editor without navigation

If you want to edit only one text in the editor, you should specify the interface TN for the corresponding text object in table TTXOB. After editing the text, you leave the editor and return to the application screen.

Call the editor with navigation

If you want to select several texts from the application screen and must, therefore, navigate in the text editor in this selection list, you must use the interface TA. This interface offers the functions Next text and Previous text in the Goto menu.

You can use them to move among the selected texts without having to leave the editor.
From within the program, you must call the function module in a loop. After editing one text, you end the function module and return to the calling program.

The program decides, depending on the parameter RESULT, field USEREXIT, which function the user used to leave the text editor, and then, depending on that function, either calls the text editor with another text or leaves the loop.
How to proceed:

1. Provide the desired text of the selection list by placing the text header and the text lines into the appropriate work areas.
2. Use the parameter CONTROL to specify which function Next text or Previous text you want to activate:

APP_NEXT = 'X', if the text passed for the subsequent editor call is not the last text in the selection list,
APP_PREV = 'X', if the text passed for the subsequent editor call is not the first in the selection list.

3. Call the text editor.
4. Check the return parameter RESULT, field USEREXIT to determine the next step:

- Go to the beginning of the loop if the value of the field is either 'N' (Next text) or 'P' (Previous text).
- Otherwise leave the loop.




RELATED POSTS

SAP SCRIPTS PART 13
CRM Middle ware System Architecture
CRM Middle ware Enhancement
CRM Middle ware Data Flow

SAP SCRIPT 11


STRUCTURE TLINE OF LINES TABLE

The lines table contains the lines of a text module. Its structure is determined by the structure TLINE. All text lines passed to SAPscript across the interfaces of function modules must have this line structure.


SAPscript has its own format for text lines, the ITF format. A text line in this format consists of two fields, the format field and the actual line contents. These two fields form the structure TLINE. The ITF format also determines the meaning and the typing of the control information allowed in the format and line fields.


You can use SAPscript to administer texts that have other formats that ITF. The information on the text format is stored in the text header.

To pass texts with other formats to SAPscript via function modules, you must also use the structure TLINE. SAPscript, however, does not interpret the contents of the text lines but passes them on to the function modules, which call the interface to the external word processing program.

TDFORMAT: format field

The format column contains format keys that determine the output formatting of the text or start control statements. A format key determines the beginning of a new text paragraph and its formatting.

All subsequent text lines, which contain blanks in this field, belong to the same paragraph. These lines are treated as texts with automatic line feed. The SAPscript editor formats these lines by fitting as many words as possible into one editor line, always considering blanks between words.


The formatting in the editor is independent of the formatting for output. Output formatting of a text is visible only when the text is actually printed or displayed on the screen. For output editing, the layout specifications of the paragraph format are evaluated. The possible format keys and their meanings are determined in styles or layout sets.


If you allocate a style or layout set to a text module, you can use the paragraph formats specified there for the text layout. Format keys which the user can define consist of one or two characters. The letters from A to Z and the numbers from 0 to 9 are allowed.

The paragraph format must begin with a letter. If a format key is not part of the allocated style or layout set, the system uses the default paragraph of that style or layout set.

Some format keys are predefined by SAPscript. You can use them in all texts:

* default paragraph

For output formatting of the subsequent paragraph, the system uses the formatting specifications that correspond to the paragraph defined as default paragraph in the allocated style or layout set.

/ new line

For output formatting, the subsequent text appears on a new line. The formatting specifications of the last paragraph format apply.

/: command line

The system interprets the characters in the actual text line as control statements rather than text. Control statements are interpreted and executed when the test is formatted for output. The entire control statement must fit into one line; spreading it over subsequent lines is not allowed. The SAPscript editor does not format control statement lines.

/* comment line

When formatting a text for output, the system does not output this line.

= long line

This line is not subjected to line formatting in the SAPscript editor. The system appends the text in this line directly to the last character of the previous line. If you want some space in the output between the first and the second line, you must start the long line with at least one blank.

/= long line with line feed

This line is treated just as = (long line), but when formatting for output, the subsequent text appears in a new line.

( raw line

The SAPscript composer does not interpret the subsequent line when formatting the text for output. This means that any character formats, variables, tabs, mask characters, or hypertext links contained in this line are not evaluated and reach the output device unchanged. In addition, the text in this line is directly appended to the last character of the previous text line. If you want some space in the output between the first and the second line, you must start the raw line with at least one blank.

/( raw line with line feed

This line is treated just as ( (raw line), but when formatting for output, the subsequent text appears on a new line.

>x fix line

This line in input-disabled in the SAPscript editor. You cannot delete or split it. You can create a fix line only from within the program, for example, to allocate a fixed structure to a text, which the user cannot change. Replace the 'x' with any number or any letter to distinguish, for example, between different subtitles.


If several fix lines with the same identifier appear in sequence, the SAPscript editor considers them as a unit. You cannot insert anything in-between in the editor. For output formatting, SAPscript interprets the first two characters of the line contents of a fix line as paragraph format. Either specify the desired paragraph format in these two characters or leave them blank.

TDLINE: text line

The field TDLINE contains the actual text. Depending on the format field of the line, the system interprets the line contents as

• text
• control statement
• comment

The control statement contained in a SAPscript text line must consist of readable characters. You cannot use hexadecimal codes, which cannot be displayed on the screen. If you do use hexadecimal codes, using SAPscript function modules may present unwanted results.


Beside the actual text, text lines can contain character formats and variables.
Character formats define the formatting of individual characters or character strings within a paragraph. They begin with the escape symbol and end with the characters . If you leave out the end sequence, the system uses the character format until the end of the paragraph. You can nest character formats.


'z' is the name of the character format, which is defined either in the allocated style or layout set. Character formats defined by the user consist of one or two characters. Allowed are the letters from A to Z and the numbers from 0 to 9. The name must start with a letter. If a character format appears in the text that is defined neither in the style nor in the layout set, SAPscript ignores it.

Apart from the character formats the user can define, there are some formats predefined by SAPscript, which can be used in all texts:

<(> ... <)> raw character

The characters in-between this character format are output unchanged. This allows you to pass certain character sequences and SAPscript variables to the output. This character format corresponds to the paragraph format 'raw line'.



RELATED POSTS

SAP SCRIPTS PART 12

CRM Middle ware System Architecture
CRM Middle ware Enhancement
CRM Middle ware Data Flow 
CRM Middle ware Modelling