Make your own free website on Tripod.com

SAP PM & ABAP Code Niraj Visnoi

SAPScript Explained

Home
What is SAP ?
SAP LSMW Explained with example
SAP PM T-Codes
PM BRD/COR Maintenance
Add Your URL
User Exits & Enhancements
Best Of SAP Links
BDC Code
My Resume
SAP SmartForms Step by Step
SAP ABAP ALV Grid Explained with Example
Useful Tips
Contact Information Guest Book and Consultants List
ABAP Code
ABAP System Fields
SAPScript
SAPScript Graphics
SAPScript Print Program
ABAP ListViewer
Dialog Programming
SAP Tables
SAP ALE and IDOC
Recommended SAP ABAP Coding guidelines
SAP General ABAP
Submit Your Code
SAP Books For consultants
Free Website Submission and ROR Sitemap generator
Free Domain Search
Free HoroScope

SAPScript explained in detail .

Transaction Codes Used
 
SE71  : Form Painter
SE72  : Style Maintenance
SE73  : Font Maintenance
SE78  : Sapscript Graphics Management
RSTXLDMC : Import graphics as text .
 
SYMBOLS
 
Symbols are place holder for values in the forms and are filled during
print formatting e.g. &DATE& ,&KNA1-NAME& . They are case insensitive
and are surrounded by &.
There are 3 types of symbols
 
1) System Symbols
        System symbols are system maintained and their value is provided
        by the system. These are as follow:
  DATE            
  TIME             
  HOURS 
  MINUTES 
  SECONDS 
  PAGE
  NEXTPAGE
  DAY
  MONTH 
  YEAR 
  NAME_OF_DAY 
  SPACE 
  DEVICE
 
2)Standard Symbols
         Standard sumbols are user maintained by using transaction SM30 .These symbols are stored in table TTDG e.g &MFG& which
stands for ' Your's Faithfully ' .
 
3)Program Symbols
         Program  symbols are placeholder for database fields and global program symbols in the print program e.g &KNA1-NAME1& here the table
KNA1 has alreadty been declared in the print program using TABLES statement.
 

CONTROL COMMANDS
     Control Commands are used to change text output , these are used with
the format key /: in the format column
e.g. INCLUDE MYTEXT OBJECT TEXT ID ST
      These are:
INCLUDE
DEFINE
ADDRESS  ... ENDADDRESS
PROTECT   ... ENDPROTECT 
NEW-PAGE
IF ... ENDIF
CASE .... ENDCASE
PERFORM ... USING
 
INCLUDE name OBJECT name ID name PARAGRAPH name LANGUAGE   name
 Include command is used to include standard text in a form.the text 
 should be already defined by using transaction SO10.
 Here name is the name of text
 ID is used to classify text e.g. SDVD (SD related text) , ST (Standard text)
 OBJECT is used to specify type of object it an be TEXT , DOKU
 LANGUAGE is used to specify language like EN ,if ommited than logon
  language is used
 PARAGRAPH is used to specify the paragraph like C
 
 e.g. /:INCLUDE mytext OBJECT TEXT ID ST LANGUAGE EN
         Here the standard text created in SO10 with name mytext is
         included in the form in language EN (English)
 
DEFINE
          Define is used to define a symbol in the form i.e defining a variable and
          giving it a value . e.g. /:DEFINE &NAME& = 'Niraj Visnoi'
                                         /:DEFINE &SPECIAL& = ' 14 TH APRIL'
ADDRESS ... ENDADDRESS
          ADDRESS and ENDADDRESS is used to specify the address which will 
           be formatted according to the target country i.e the recipient country.
           e.g. /:ADDRESS sales PARAGRAPH C
                  /:NAME &KNA1-NAME1&   
                  /:STREET &KNA1-STRAS&
                  /:POSTCODE &KNA1-PSTLZ&
                  /:CITY &KNA1-ORT01&
                  /:COUNTRY &KNA1-LAND1& 
                  /:FROMCOUNTRY 'DE'
                  /:ENDADDRESS
 
 

PROTECT .... ENDPROTECT
      The text which we want to be printed without any  break i.e printed completely in a page is
inserted between PROTECT  and  ENDPROTECT . If sapscript finds that the text cannot be printed on that page completely a implicit page break occurs and the text is printed on the next page
 
NEW-PAGE
     NEW-PAGE is used to insert a page break ,it can be conditional if used between IF..ENDIF
     e.g. /:IF &KNA1-NAME1& = 'NIRAJ'
            /:NEW-PAGE
            /:ENDIF
IF ... ENDIF
     IF ... ENDIF is used in the same way as in ABAP , a condition is tested and if it is true
     all the statements between IF and ELSE are executed otherwise statements between ELSE  
    and ENDIF are executed, ELSE is optioonal.
     /:IF condition
     ..
      ..
     /:ENDIF
      or
     /:IF condition
     ..
     ELSE
       ..
     /:ENDIF
 
CASE ... ENDCASE
      It si similar to multiple IF.. ENDIF's but is much cleaner.
      /:CASE condition
      /:WHEN value1
      ...
      /:WHEN value2
      ...
      ...
      /:ENDCASE
 
TIME/DATE/COUNTRY Formats
      These commands are used for specifying the format of date and
       time and setting the default country.
     /:SET DATE MASK = 'MM.DD.YYYY'
     /:SET TIME MASK = 'HH:MM'
     /:SET COUNTRY 'DN'
 
PERFORM ... IN PROGRAM .... USING.. CHANGING ..  
ENDPERFORM
 
      To call ABAP subroutines from within  a form we use the  
     PERFORM... IN PROGRAM ... statement , the advantage of    
     using it  is that the print program is not required to cahnge and we 
     can get the new data from the subroutine which is placed in a Z  
     report . To pass and get the values from th subroutine the  
     parameters are passed which are of  type structure ITCSY.
 
     e.g. /:PERFORM get_date IN PROGRAM zreport
            /:USING &SALESORDER&
            /:CHANGING &S_DATE&
            /:ENDPERFORM   
            The date &S_DATE& ....
 
           The  ABAP Code would be
 
           REPORT zreport.
           TABLES ztab.
 
           FORM get_date TABLES in_tab STRUCTURE ITCSY out_tab
           STRUCTURE ITCSY .
 
           READ TABLE in_tab INDEX 1.
           SELECT some_date FROM ztab WHERE salesorder = in_tab-value.
 
           IF sy-subrc EQ 0.
           READ TABLE out-tab INDEX 1.
           MOVE ztab-somedate TO out_tab-value
           MODIFY out_tab INDEX 1.
           ENDIF.
           ENDFORM.
           
            In the above code USING is used to pass the value to the
          subroutine while changing is used to recieve the value from th
          subroutine ,for further paramters we can use either USING or
           CHANGING .
           In the subroutine the type of paramter is always an internal table of
           type ITCSY  irrespective of the value passed.The VALUE field 
           of the internal table is used to fill and recieve the values   .     
 
 

http://sap.niraj.tripod.com

Search http://sap.niraj.tripod.com Search www

 http://sap.niraj.tripod.com      Niraj Visnoi *INDIA * niraj_visnoi@consultant.com      
 CELL No. 91 9911413767       Copyright 2006 all rights reserved