SAP Abap programming & SAP Modules SD,MM,HR,PP...
Search this site
Monday, April 2, 2012
Abap query transaction
Sapscript example code in Abap
REPORT ZDEMO_SAPSCRIPT_PERFORM.
*----------------------------------------------------------------------
* TABLES: VBAP. TABLES: ITCPO. " optional for setting default print parameters PARAMETERS: FORM LIKE RSSCF-TDFORM DEFAULT 'YDEMO_PERFORM'.
START-OF-SELECTION.
************************************************************************
* Open the SapScript Form with the "form" * ************************************************************************
CLEAR ITCPO .
* itcpo-tddest = 'ZHTM'.
ITCPO-TDIMMED = 'X'.
ITCPO-TDDELETE = 'X'.
ITCPO-TDNEWID = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING FORM = FORM " name of form (SE71)
OPTIONS = ITCPO
EXCEPTIONS CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
OTHERS = 7. ************************************************************************ *
* Execute the element "HELLO" in window MAIN *
- Nothing happens if /E HELLO is not declared in MAIN ************************************************************************
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'HELLO' "execute element /E HELLO * FUNCTION = 'SET'
TYPE = 'BODY' "normal output
EXCEPTIONS ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
OTHERS = 8. ************************************************************************
* Close the current SapScript Form ************************************************************************
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
OTHERS = 3.
FORM CALLED_FROM_SAPSCRIPT TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY.
DATA: TABIX LIKE SY-TABIX.
TABLES: KNA1.
BREAK-POINT.
READ TABLE IN_TAB WITH KEY NAME = 'KUNNR'.
KNA1-KUNNR = IN_TAB-VALUE.
READ TABLE OUT_TAB WITH KEY NAME = 'NAME'.
TABIX = SY-TABIX.
OUT_TAB-NAME = 'NAME'.
SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ KNA1-KUNNR.
IF SY-SUBRC EQ 0.
CONCATENATE KNA1-NAME1 KNA1-ORT01 INTO OUT_TAB-VALUE SEPARATED BY SPACE.
ELSE.
CONCATENATE KNA1-KUNNR 'not found' INTO OUT_TAB-VALUE SEPARATED BY SPACE.
ENDIF.
MODIFY OUT_TAB INDEX TABIX.
ENDFORM.
SapScript Coding
....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. /E PERFORM_ABAP /: PERFORM CALLED_FROM_SAPSCRIPT IN PROGRAM zsapscriptexits /: USING &invar1& /: USING &invar2& ... /: CHANGING &outvar1& /: CHANGING &outvar2& ... /: ENDPERFORM
(Refer from site idocs.de)
Sunday, April 1, 2012
How to debug Sapscript ABAP
- Go to SE71 transaction.
- Click on Utilities menu -> Activate Debugger.
Sapscript tcode
SE71 - SAPscript form Basis - SAPscript
SE73 - SAPscript Font Maintenance Basis - SAPscript
SE75 - SAPscript Settings Basis - SAPscript
SE72 - SAPscript Styles Basis - SAPscript
SE76 - SAPscript: Form Translation Basis - SAPscript
SE74 - SAPscript format conversion Basis - SAPscript
SE77 - SAPscript Styles Translation Basis - SAPscript
PBAT - Choose SAPscript or WinWord Personnel Mgmt - Recruitment
J2I7 - CIN: SAPScript reporting customizing FI - Localization
PM20 - Statements with SAPscript Payroll - Reuse Services for Country Development
BRFU01 - BRF: Compare SAPscript Texts Cross Application - Business Rule Framework
Sapscript command abap
Command | Use |
New-page | Prints the text following this command on a new page (when a page name is specified then that page is taken as the next page) |
Protect ….. Endprotect | This acts like a conditional page break. Putting the text within this command prevents the breaking of the text across multiple pages. If there is not enough space for the entire paragraph to be printed in the space remaining on the page, then the entire paragraph is printed on the next page |
Box Position Size | The BOX command draws a box as per the specifications. The x y co-ordinates are for the upper left corner relative to the values in the position command. POSITION command is used to set the x y co-ordinates with respect to the start position of the window. SIZE command is used to specify the size of the box that we need to draw. Varying these parameters also helps to draw a line instead of a box. |
IF ….. END IF | This allows the conditional printing of the text on the output document. The various conditional operators that can be used are as follows = EQ Equal to <> > GT Greater than <= LE Less than or equal to >= GE greater than or equal to <> NE not equal to The logical operators that can be used are as follows NOT, AND, OR |