SAP Script Graphics


This is the most exciting part in SAP Script , as all of us knows that working with sap script is so complicated and consumes a lot of time .

To Draw a Line in SAP Script write the following Code in the Script :

POSITION WINDOW
BOX HEIGHT 0 CM WIDTH 21 CM FRAME 10 TW
POSITION XORIGIN +10 CM
To draw  framed and shaded rectangle , write the following code :

POSITION WINDOW

POSITION XORIGIN +6 MM YORIGIN +30 MM
SIZE WIDTH ‘8’ CM HEIGHT ’30’ MM
BOX FRAME 40 TW
BOX INTENSITY 10

– you can invent more shapes and do more designs …Enjoy.!

How to download and upload sap script ?


1- Run program “RSTXSCRP “ from transaction se38

*** To Download the form ,enter form name and choose EXPORT Mode as shown below ,then press execute, a new window will appear asking you to save the form ,enter the name you want and click save (ex.Z_TEST.FOR)****

**** To Import the form do the following :

In Object Name : Enter your form name (Z_TEST)

Mode : IMPORT

File Name : don’t change the given path and add to it your exported form name as shown below :

after execution a new window will appear asking you to select the form name , select your form name and press open .

DONE.!


Copying SAP Script Form from Client to Client .


1- Run Program ” RSTXFCPY “ from Transaction SE38.


2- Enter the Desired form you want to copy from and enter the source client , then enter your form name and execute.

3- If your form is copied with original language DE, you can convert its language to EN by doing the following :

– Open your form with language DE , then from utilities choose Convert Original Language,and choose your target language as seen below:

4- then open your form with Converted language and activate.

DONE .!

Reading Text Through Infoset Queries


I was working on an infoset query where i needed to read a text from DB.

Here’s the following code which i wrote in the query divided by areas :

==================================================

*” At the free coding area type the following function”


FORM Read_TEXT_ID USING ID TNAME TDOBJECT CHANGING text.
CALL FUNCTION ‘READ_TEXT’
EXPORTING
id       = id
language = sy-langu
name     = TNAME
object   = TDOBJECT
TABLES
lines    = li_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6.
IF sy-subrc = 4.
header-ld_txt1 = ‘ ‘.
ELSE.
READ TABLE li_lines INDEX 1.
IF sy-subrc = 0.
header-ld_txt1 = li_lines-tdline .
ENDIF.
READ TABLE li_lines INDEX 2.
IF sy-subrc = 0.
header-ld_txt2 = li_lines-tdline .
ENDIF.
READ TABLE li_lines INDEX 3.
IF sy-subrc = 0.
header-ld_txt3 = li_lines-tdline.
ENDIF.
ENDIF.
CALL FUNCTION ‘STRING_CONCATENATE_3’
EXPORTING
STRING1   = header-ld_txt1
STRING2   = header-ld_txt2
STRING3   = header-ld_txt3
IMPORTING
STRING    = text
EXCEPTIONS
TOO_SMALL = 1
OTHERS    = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.

________________________________________________________________

*” At the data area type the following code :

DATA :
BEGIN OF header OCCURS 0,
ld_txt1(200),
ld_txt2(200),
ld_txt3(200),
END OF header,
li_lines LIKE STANDARD TABLE OF tline WITH HEADER LINE,
ID like THEAD-TDID,
TNAME LIKE THEAD-TDNAME,
TDOBJECT like THEAD-TDOBJECT,
d_str(800),
d_str1(800),
text(800),
Doc_No type c LENGTH 10 ,
ID_Text TYPE c LENGTH 6,
TEXTNAME TYPE c LENGTH 16.

_______________________________________________________

*”At the record processing area”

TNAME = (“Add Text Name Here , ex. “LIKP-VBELN”).
TDOBJECT = (“Add Text Object Here , ex.”VBBK”)

OR

” Get TextName Example
Doc_No = VBAP-VBELN. “Sales Document Number
ID_Text = VBAP-POSNR. ” ITEM Number
CONCATENATE Doc_No ID_TEXT into TEXTNAME.
TNAME = TEXTNAME.
TDOBJECT = ‘VBBP’.

_______________________________________________________

*”At Field Code write the  following code in order to call the “Read_Text” Function.”


ID = (“Type Text ID Here , ex.’D003′).

PERFORM Read_TEXT_ID USING ID TNAME TDOBJECT CHANGING text.
(“Field Name”) = text
. (ex,ANA_CERT = text.)