You are on page 1of 15

SAP SCRIPT

SAP Script Navigations


• Trans. Code Description Navigation Through Menu Selection from SE71 Screen
• SE71 Forms maintenance
• SE72 Style maintenance Environment ➤ Style
• SE73 Font maintenance Environment ➤ Administration ➤ Font
• SO10 Standard text maintenance Environment ➤ Standard Text
• SE74 Format conversion Environment ➤ Administration ➤ Format Conversion
• SE75 SAP script settings Environment ➤ Administration ➤ Settings
• SE78 Import graphics Environment ➤ Administration ➤ Graphics
• SE76 SAP script form translation
• SE77 SAP script style conversion
Components of SAP Scripts:
• Header
• Pages
• Windows
• Page Windows
• Paragraph Format
• Character Format
Function Modules in SAP Scripts
• OPEN_FORM: This is used to open a form for execution by loading it
into memory
• WRITE_FORM: It is used to write some information on the SAP Script
form using Text Element.
• CLOSE_FORM: It is used to close the form which is opened by open
form
• START_FORM: It is used to call another SAP Script into current SAP
Script (Nested Scripts).
• END_FORM: It is used to end the form which started by START_FORM.
Draw Box
• /: BOX
• The intensity is the grey scale of the box as %. The frame parameters is the thickness of the frame. Default is 0.
• Each of the paramteters ypos, xpos, width, height and frame muts be followed of the measurement unit:
• TW (twip), PT (point), IN (inch), MM (millimeter), CM (centimeter), LN (line), CH (character)., Examples:
• /: BOX XPOS '11.21' MM YPOS '5.31' MM HEIGHT '10' MM WIDTH '20' MM INTENSITY 10 FRAME 0 TW
• /: BOX FRAME 10 TW
• Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
• /: BOX INTENSITY 10
• Fills the window background with shading having a gray scale of 10 %.
• /: BOX HEIGHT 0 TW FRAME 10 TW
• Draws a horizontal line across the complete top edge of the window.
• /: BOX WIDTH 0 TW FRAME 10 TW
• Draws a vertical line along the complete height of the left hand edge of the window.
• /: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
• /: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
• Draws two rectangles and two lines to construct a table of three columns with a highlighted heading section.
Symbols
• DATE Date
• DAY Day
• NAME_OF_DAY Name of day
• MONTH Month
• YEAR Year
• TIME Time
• HOURS Hours
• MINUTES Minutes
• SECONDS Seconds
• PAGE Page number
• NEXTPAGE Number of next pagre
• DEVICE Output device
• SPACE Blank space
• ULINE Underline
• VLINE Vertical line
Format Column Value Explanation
• * Apply to the contents, default paragraph assigned at form/window level
• <para name> Apply to the contents, the paragraph specified (2-character paragraph
name) Continuous text
• = Extended line (line extending from previous line(s))
• ( Raw line
• / Line feed—generate a blank line
• /= Line feed and extended line
• /( Line feed and raw line
• /: Command line—any of the SAP script control commands can be entered in
the command/info area
• /* Comment line—text entered in the command/info area will be treated as
comment
• /E Text element—text element name or identification will be specified in the command/info area
TABLES:LFA1, EKKO, EKPO, ADRC.
*Vendor Master, Purchasing Document Header, Purchasing Document Item, Addresses
TYPES:BEGIN OF TY_EKPO,
EBELP TYPE EBELP, "Item Number of Purchasing Document
MATNR TYPE MATNR, "Material Number
MENGE TYPE BSTMG, "Purchase Order Quantity
MEINS TYPE BSTME, "Purchase Order Unit of Measure
NETPR TYPE BPREI, "Net Price in Purchasing Document
END OF TY_EKPO.

DATA:BEGIN OF LS_EKKO,
EBELN TYPE EBELN, "Order number
AEDAT TYPE ERDAT, "Order Date
ZTERM TYPE DZTERM,"Payment mode
LIFNR TYPE LIFNR, "Vendor Account Number
END OF LS_EKKO,
BEGIN OF LS_LFA1,
LIFNR TYPE LIFNR, "Account Number of Vendor
ADRNR TYPE ADRNR, "Address
END OF LS_LFA1,
BEGIN OF LS_ADRC,
ADDRNUMBER TYPE AD_ADDRNUM, "Address number
END OF LS_ADRC,
LS_EKPO TYPE TY_EKPO,
LT_EKPO TYPE TABLE OF TY_EKPO,
V_TOTAL TYPE P DECIMALS 2.

SELECT SINGLE EBELN AEDAT ZTERM LIFNR FROM EKKO INTO LS_EKKO WHERE EBELN EQ P_EBELN.

SELECT SINGLE LIFNR ADRNR FROM LFA1 INTO LS_LFA1 WHERE LIFNR = LS_EKKO-LIFNR.

SELECT SINGLE ADDRNUMBER FROM ADRC INTO LS_ADRC WHERE ADDRNUMBER = LS_LFA1-ADRNR.

SELECT EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE LT_EKPO WHERE EBELN = LS_EKKO-EBELN.
CALL FUNCTION 'OPEN_FORM’ LOOP AT LT_EKPO INTO LS_EKPO.
EXPORTING V_TOTAL = V_TOTAL + LS_EKPO-NETPR.
FORM = 'ZYFORM_PO’ CALL FUNCTION 'WRITE_FORM'
LANGUAGE = SY-LANGU. EXPORTING ELEMENT = 'ITEM_DATA'
WINDOW = 'MAIN'.
CALL FUNCTION 'START_FORM’
EXPORTING FORM = 'ZYFORM_PO’ AT LAST.
LANGUAGE = SY-LANGU.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'TOTAL'
WINDOW = 'MAIN'. ENDAT.

CALL FUNCTION 'WRITE_FORM'


EXPORTING ELEMENT = 'ELE1'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'NEXT_PAGE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'CLOSE_FORM'.

You might also like