Script document

Embed Size (px)

DESCRIPTION

sap abap

Citation preview

Printing internal table contents dynamically in SAPScriptBy C.Lakshmi Prasanna, Stride SoftwareHere is a Script in which an internal table is displayed with each record enclosed with a box and can grow according to the no of records given as the input.Scenario: 1Here the input is given as 4 recordsAnd the Script is displaying the 4 records with each record enclosed in a Box

Scenario: 2Here the no of records chosen is 12Observe that now 12 records are enclosed with the boxes.And now follows the listing of the code which is the Driver program for the above Script*&-------------------------------------------------------------**& Report ZSCRIPT*&-------------------------------------------------------------*REPORT ZSCRIPT.data:begin of itab occurs 0, matnr type matnr, maktx type maktx, end of itab.PARAMETERS:P_SNO TYPE I.data:i type i.move p_sno to i.select matnr maktx from makt into table itab up to i rows.CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZSCRIPT_NEW' EXCEPTIONS CANCELED = 1 DEVICE = 2 FORM = 3 OPTIONS = 4 UNCLOSED = 5 MAIL_OPTIONS = 6 ARCHIVE_ERROR = 7 INVALID_FAX_NUMBER = 8 MORE_PARAMS_NEEDED_IN_BATCH = 9 SPOOL_ERROR = 10 CODEPAGE = 11 OTHERS = 12 .IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.loop at itab.CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'ELEMENT ' FUNCTION = 'SET' TYPE = 'BODY' WINDOW = 'MAIN' EXCEPTIONS ELEMENT = 1 FUNCTION = 2 TYPE = 3 UNOPENED = 4 UNSTARTED = 5 WINDOW = 6 BAD_PAGEFORMAT_FOR_PRINT = 7 SPOOL_ERROR = 8 CODEPAGE = 9 OTHERS = 10 .IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.endloop.CALL FUNCTION 'CLOSE_FORM' .IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.Now the details of the LAYOUTThe Script is designed with two pages FIRST andNEXTwith a Main window laid on it(I have not enclosed the details of the steps involved in creating the Pages)In the following Text element I have used two Box commands one enclosing MATNR and one enclosing MAKTX but as they are both laid next to each other the out come is a single BOX enclosing MATNR and MAKTX with a vertical separatorLine1:Sapscript-counter_0 is the variable which iam using to dynamically increase the YPOS for drawing the BOX around each record as and when the internal table growsLine2:Element beginsLine3:the first BOX command which is enclosing the MATNR,,observe that here the sapscript_counter is incremented by 1 which is achieved by &SAPSCRIPT-COUNTER_0(+)&Line4: again the sapscript-counter value is reinitialized to its previous value as the nextBOXenclosing MAKTX has to be at the same YPOS as that of theBOXenclosing MATNRLine5: another BOX command this time to enclose MAKTXLine6: writing of the internal table variables MATNR and MAKTX to enable them to be displayed on the outputText ElementMAIN1.DEFINE &SAPSCRIPT-COUNTER_0& = -12.ELEMENT3.BOX YPOS &SAPSCRIPT-COUNTER_0(+)& LN WIDTH '2' CM HEIGHT '1' LNFRAME 10 TW DEFINE 4.&SAPSCRIPT-COUNTER_0& = &SAPSCRIPT-COUNTER_0(-)&5.BOX YPOS &SAPSCRIPT-COUNTER_0(+)& LNXPOS '2'CM WIDTH '10' CM HEIGHT '1'LNFRAME 10 TW6.&itab-matnr&&itab-maktx&I am also giving the screen shot for the text elementMAINin Character editorI have omitted all the regular steps involved to build the LAYOUT(like creation of PAGES,PAGEWINDOWS,WINDOWS,PARAGRAPH ,CHARACTER) to come out as an entity just to avoid the clutter and focus on the utilization of SAPSCRIPT-COUNTER variable.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Passing table data to the layout without changing the driver programBy Joyjit Ghosh, IBM IndiaI have seen a typical requirement from client that SAP script layout need to be changed (additional data need to be displayed) without modifying the driver program (mainly standard SAP program). This tip will show us how to pass table data (multiple records at a time) to layout without changing the driver program.Step1. Create a standard text from SO10.Create a blank standard text. This will store the table dataStep2. Create a subroutine pool and a routine in it that can be called from SAP script.From transaction SE38 create a subroutine pool.Now create subroutine with proper interface to fetch the data from the table.Step3. Within this routine write the logic to fetch the table data and populate the standard text.**************************************************************** Fetch table data and upload the data in proper format to the* standard text*************************************************************** DATA: i_zemployee TYPE STANDARD TABLE OF zemployee INITIAL SIZE 0, w_zemployee TYPE zemployee, i_text TYPE STANDARD TABLE OF tline INITIAL SIZE 0, w_header LIKE thead, w_text TYPE tline. CONSTANTS: c_par TYPE char2 VALUE ',,'. " Sign for tabs* Fetch data for employee SELECT * FROM zemployee INTO TABLE i_zemployee. IF sy-subrc = 0.* Create text table LOOP AT i_zemployee INTO w_zemployee.* Store default paragraph format w_text-tdformat = '*'.* Add all the required fields separated by tab CONCATENATE w_zemployee-empno w_zemployee-empname INTO w_text-tdline SEPARATED BY c_par.* Store table data APPEND w_text TO i_text. ENDLOOP. check sy-subrc = 0.* Populate header info* Text object w_header-tdobject = 'TEXT'.* Standard text name w_header-tdname = 'Z_TABLE_DATA'.* Text id w_header-tdid = 'ST'.* Language w_header-tdspras = 'E'.* Populate the standard text with table data CALL FUNCTION 'SAVE_TEXT' EXPORTING header = w_header insert = 'X' savemode_direct = 'X' TABLES lines = i_text EXCEPTIONS id = 1 language = 2 name = 3 object = 4 OTHERS = 5 . IF sy-subrc 0. ENDIF. ENDIF.

Step4. Call the routine and standard text from the SAP script layout.Note: For the sake of simplicity this tip is shown in a custom layout that is called from a custom report./* Call the routine/: PERFORM FETCH_TABLE_DATA IN PROGRAM Z_SUBROUTINE_POOL/: USING &INVAR1&/: CHANGING &OUTVAR1&/: ENDPERFORM/* Now call the standard text/: INCLUDE Z_TABLE_DATA OBJECT TEXT ID ST LANGUAGE EN

Step5. Test the SAP script formActivate the SAP script debugger

Click here to continue...Passing table data to the layout without changing the driver program...PreviousRun the custom report to test the SAPscript layout.*&---------------------------------------------------------------**& Report Z_TEST_SAPCSRIPT **&---------------------------------------------------------------*REPORT Z_TEST_SAPCSRIPT .start-of-selection.CALL FUNCTION 'OPEN_FORM' EXPORTING DEVICE = 'PRINTER' DIALOG = 'X' FORM = 'Z_DEMO_LAYOUT' LANGUAGE = SY-LANGU EXCEPTIONS CANCELED = 1 DEVICE = 2 FORM = 3 OPTIONS = 4 UNCLOSED = 5 MAIL_OPTIONS = 6 ARCHIVE_ERROR = 7 INVALID_FAX_NUMBER = 8 MORE_PARAMS_NEEDED_IN_BATCH = 9 SPOOL_ERROR = 10 CODEPAGE = 11 OTHERS = 12 .IF sy-subrc = 0.CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = '001' FUNCTION = 'SET' TYPE = 'BODY' WINDOW = 'MAIN'* IMPORTING* PENDING_LINES = EXCEPTIONS ELEMENT = 1 FUNCTION = 2 TYPE = 3 UNOPENED = 4 UNSTARTED = 5 WINDOW = 6 BAD_PAGEFORMAT_FOR_PRINT = 7 SPOOL_ERROR = 8 CODEPAGE = 9 OTHERS = 10 .IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF. CALL FUNCTION 'CLOSE_FORM' EXCEPTIONS UNOPENED = 1 BAD_PAGEFORMAT_FOR_PRINT = 2 SEND_ERROR = 3 SPOOL_ERROR = 4 CODEPAGE = 5 OTHERS = 6 . IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.ENDIF.After execution of this report SAPscript debugger is triggered.As shown below layout is calling the code written in the routineStandard text is populated with the data fetched from tableOutput of SAP script:Table entries:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

etting up a new page format in SAP Script1.Go to SPAD2.Click on Full administration. You would observe extra tabs that are added. Click on Device Types tab.3.Now click on Page Formats.

4.Click on Change button to get the create option.Click on CREATE5.Enter the necessary values.6.Click on SAVE.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Why Scripts are client dependent and Smart Forms are notBy Sirisha Vennelakanti, YASH TechnologiesThis blog is to understand why Sap scripts are client dependent and smart forms client independent.To output documents using the programming interface, R/3 application programs makes use of scripts or smart forms.By design sap script is a word processing tool which displays data on the form with the help of text elements where the logic of those is written in the print program and Forms were designed to be driven from print program, hence are often termed as client dependent. Smart forms are client independent. Bcoz it doesnt use any text elements. it will be executed through a function module. When a print program calls a Smart Form, the form itself takes over to produce output, without any further direction from print program.Steps for creationCreation of Script

Print program will determine the output document, the areas values, and the frequency of the output. The database access will be made in the print program which will insert them in the corresponding fields of the form. Script needs direction from the print program to print output.Scripts uses layout set that describes the layout of the individual print pages and uses text elements to supply definable output blocks, which a print program can call.Creation of smart form

Design the formForm Activation which returns Function moduleApplication program for data retrieval & calling Smart form.Application program calls the function module, the Smart Form uses the modules interface (which corresponds to the form interface) to transfer any table data previously selected and to print the form according to the form description. In addition form can have additional data selections. Further when you downloaded a script with the sap utility programRSTXSCRP,You can see a script has repeated transfer of control SAP script texts are usually allocated to an object from an SAP application. For example, there are texts on customers, vendors, and materials, whose data is client dependent and whereas smart forms uses call to the function module only once and all form processing is handled using the Function module.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Address printing in SAP ScriptBy Jayapradha NeeliThis scenario shows address printing in scripts.Step1: Go totransactionSE71(FORM PAINTER). Give a name and create.Step2:Go to pages tab, by default first page is there. In the standard attributes give the page as first, give meaning to that and next page also as first.Step3:Go to windows tab and create windows. To create a new window edit->create element->window. Give the window name and meaning. Please observe that we have created 9 main windows here. Also, align the windows properly. In this example, we have taken 3 main windows in a row.Step4:Go to page windows tab and double click on the main window and select text elements (F9)Write the code as/E address/: BOX WIDTH '5' CM HEIGHT '5' CM FRAME 10 TW/: ENDPROTECT/: ADDRESS/: ADDRESSNUMBER &FS_ADRC-ADDRNUMBER&/: ENDADDRESS/: NEW-WINDOW/: PROTECT.

Address printing in SAP Script...PreviousStep5: Save the form and activate.The print preview for the layout will be as shown below.

Step6:Go totransactionSE38and write the print program for the form. Here is the code for that.

REPORTZDEMO.TABLES: adrc.SELECT-OPTIONS: s_addrno FOR adrc-addrnumber.TYPES: BEGIN OF type_s_adrc, addrnumber TYPE adrc-addrnumber, END OF type_s_adrc.DATA: fs_adrc TYPE type_s_adrc.DATA: t_adrc LIKE STANDARD TABLE OF fs_adrc.SELECT addrnumber INTO TABLE t_adrc FROM adrc WHERE addrnumber IN s_addrno.PERFORM open_form.LOOP AT t_adrc INTO fs_adrc. PERFORM write_form." USING 'ADDRESS' 'APPEND' 'MAIN'.ENDLOOP. "LOOP AT T_ADRCPERFORM close_form.*&---------------------------------------------------------------------**& Form OPEN_FORM*&---------------------------------------------------------------------*

FORM open_form . CALL FUNCTION 'OPEN_FORM' EXPORTING* APPLICATION = 'TX'* ARCHIVE_INDEX =* ARCHIVE_PARAMS =* DEVICE = 'PRINTER'* DIALOG = 'X' form = 'Y_ADDRESS'* LANGUAGE = SY-LANGU* OPTIONS =* MAIL_SENDER =* MAIL_RECIPIENT =* MAIL_APPL_OBJECT =* RAW_DATA_INTERFACE = '*'* SPONUMIV =* IMPORTING* LANGUAGE =* NEW_ARCHIVE_PARAMS =* RESULT =* EXCEPTIONS* CANCELED = 1* DEVICE = 2* FORM = 3* OPTIONS = 4* UNCLOSED = 5* MAIL_OPTIONS = 6* ARCHIVE_ERROR = 7* INVALID_FAX_NUMBER = 8* MORE_PARAMS_NEEDED_IN_BATCH = 9* SPOOL_ERROR = 10* CODEPAGE = 11* OTHERS = 12 . IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. " If sy-subrc 0ENDFORM. "FORM OPEN_FORM*&---------------------------------------------------------------------**& Form WRITE_FORM*&---------------------------------------------------------------------*

FORM write_form . CALL FUNCTION 'WRITE_FORM' EXPORTING element = 'ADDRESS'* FUNCTION = 'SET'* TYPE = 'BODY' window = 'MAIN'* IMPORTING* PENDING_LINES = EXCEPTIONS element = 1 function = 2 type = 3 unopened = 4 unstarted = 5 window = 6 bad_pageformat_for_print = 7 spool_error = 8 codepage = 9 OTHERS = 10 . IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. " If sy-subrc 0ENDFORM. "FORM WRITE_FORM*&---------------------------------------------------------------------**& FormCLOSE_FORM*&---------------------------------------------------------------------*

FORM close_form . CALL FUNCTION 'CLOSE_FORM'* IMPORTING* RESULT =* RDI_RESULT =* TABLES* OTFDATA =* EXCEPTIONS* UNOPENED = 1* BAD_PAGEFORMAT_FOR_PRINT = 2* SEND_ERROR = 3* SPOOL_ERROR = 4* CODEPAGE = 5* OTHERS = 6 . IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. " If sy-subrc 0ENDFORM. " FORM CLOSE_FORM

Address printing in SAP Script...PreviousThe output would be as follows:Select the range of address in the selection screen

Then execute it, output as shown below

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Printing Total, Carry forward amount and Grand total in SAP ScriptBy Kiran SakaThis Scenario explains about how to add and print thepage total,Carry forward amountfor each page and also theGrand totalat the last page. It also calls different Page orientation likePORTRAITandLANDSCAPEFormat achieved by using SCRIPTS.Step1:Designing the Form layout inPORTRAITFormat usingSE71.In the basic settings of the form painter, select the orientation PORTRAITFormat as shown below.Creating the page as shown belowCreating the page as shown belowCreate the windows for the page. In this scenario created windows for theFooter-Displaying the Continue pageHeaders-Displaying the heading for selected SFLIGHT details.Main-Displaying the SFLIGHT RecordsVar-Displaying the Page HeaderVar1 -Displaying the Date and TimeVar3 -Displaying the PagesParagraph Settings for Above Windows:Create the page windows:In the Page Window, set the Dimensions of windows.

Click here to continue...Printing Total, Carry forward amount and Grand total in SAP Script...PreviousIn the text editor of main window, we have added the logic to display the number of records for a page (In this scenario 5 records per page) and also for each page displaying thepage total,Carry forward totalas shown in below. And also it printsGrand totalat the last page. In the text editor of theHeader Window- Displaying the heading for selected SFLIGHT details.In the text editor of theVar Window- Displaying the Page HeaderIn the text editor of theVar1 Window- Displaying the Date and TimeIn the text editor of theVar3 Window- Displaying the PagesStep 2: Designing the Form layout inLANDSCAPEFormat.In the basic settings of the form painter select the orientation LANDSCAPEFormat as shown below.This Format is used to print the instructions in landscape format.In the main window of the landscape format include the text as shown below.

Click here to continue...Printing Total, Carry forward amount and Grand total in SAP Script...PreviousStep 3: Calling the Print Program using SE38.*"Table declarations...................................................tables:sflight. "Flight Details*"--------------------------------------------------------------------** Type declaration of the structure to hold ** FLIGHT CONNECTION DETAILS ** from TABLE SFLIGHT **"--------------------------------------------------------------------*types: begin of type_s_sflight, carrid type sflight-carrid, " Airline code connid type sflight-connid, " Flight connection number fldate type sflight-fldate, " Flight date planetype type sflight-planetype, " Plane Type price type sflight-price, " Airfare end of type_s_sflight.*"--------------------------------------------------------------------** Field string declaration of the structure to hold ** FLIGHT CONNECTION DETAILS from TABLE ** SFLIGHT **"--------------------------------------------------------------------*data fs_sflight type type_s_sflight.*"--------------------------------------------------------------------** Internal table to hold Flight details **"--------------------------------------------------------------------*data t_sflight like standard table of fs_sflight.*"Selection screen elements...........................................select-options: s_carrid for sflight-carrid. " Airline code*" Data declarations...................................................*"--------------------------------------------------------------------** Work variables **"--------------------------------------------------------------------*data: w_index type n value 1, " Serial number w_sum type p decimals 2. " Sum variable*"--------------------------------------------------------------------** START-OF-SELECTION EVENT **"--------------------------------------------------------------------*start-of-selection.*&---------------------------------------------------------------------**& Subroutines for displaying the data **&---------------------------------------------------------------------* perform getsflightrecords. perform open_form. perform start_form using 'Z_SCRIPTS'. perform main_window. perform end_form. perform start_form using 'Z_SCRI_LAND'. perform landscape_format. perform end_form. perform close_form.*&---------------------------------------------------------------------**& Form GETSFLIGHTRECORDS*&---------------------------------------------------------------------** This subroutine gets the Flight records from the table SFLIGHT*----------------------------------------------------------------------** There are no interface parameters to be passed to this subroutine.*----------------------------------------------------------------------*form getsflightrecords . select carrid " Airline code connid " Flight connection number fldate " Flight date planetype " Plane type price " Airfare from sflight into table t_sflight where carrid in s_carrid. if sy-subrc ne 0. message 'Records Not Found'(001) type 'S'. endif.endform. " GETSFLIGHTRECORDS*&---------------------------------------------------------------------**& Form OPEN_FORM*&---------------------------------------------------------------------** This subroutine opens the script form Z_SCRIPTS*----------------------------------------------------------------------** There are no interface parameters to be passed to this subroutine.*----------------------------------------------------------------------*form open_form . call function 'OPEN_FORM' exporting* APPLICATION = 'TX'* ARCHIVE_INDEX =* ARCHIVE_PARAMS =* DEVICE = 'PRINTER'* DIALOG = 'X' form = 'Z_SCRIPTS' language = sy-langu* OPTIONS =* MAIL_SENDER =* MAIL_RECIPIENT =* MAIL_APPL_OBJECT =* RAW_DATA_INTERFACE = '*'* SPONUMIV =* IMPORTING* LANGUAGE =* NEW_ARCHIVE_PARAMS =* RESULT = exceptions canceled = 1 device = 2 form = 3 options = 4 unclosed = 5 mail_options = 6 archive_error = 7 invalid_fax_number = 8 more_params_needed_in_batch = 9 spool_error = 10 codepage = 11 others = 12. 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. " OPEN_FORM*&---------------------------------------------------------------------**& Form MAIN_WINDOW*&---------------------------------------------------------------------** This subroutine prints the SFLIGHT records in a MAIN window*----------------------------------------------------------------------** There are no interface parameters to be passed to this subroutine.*----------------------------------------------------------------------*form main_window . loop at t_sflight into fs_sflight. call function 'WRITE_FORM' exporting element = 'SFLIGHT'* FUNCTION = 'SET'* TYPE = 'BODY' window = 'MAIN'* IMPORTING* PENDING_LINES = exceptions element = 1 function = 2 type = 3 unopened = 4 unstarted = 5 window = 6 bad_pageformat_for_print = 7 spool_error = 8 codepage = 9 others = 10. if sy-subrc 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif.*&---------------------------------------------------------------------**& This statement is used to display the grand total for the last page *&---------------------------------------------------------------------* at last. call function 'WRITE_FORM' exporting element = 'GRAND_TOTAL'* FUNCTION = 'SET'* TYPE = 'BODY' window = 'MAIN'* IMPORTING* PENDING_LINES = exceptions element = 1 function = 2 type = 3 unopened = 4 unstarted = 5 window = 6 bad_pageformat_for_print = 7 spool_error = 8 codepage = 9 others = 10. if sy-subrc 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. exit. endat. w_index = w_index + 1. if w_index eq 6. call function 'WRITE_FORM' exporting element = 'PAGE_TOTAL'* FUNCTION = 'SET'* TYPE = 'BODY' window = 'MAIN'* IMPORTING* PENDING_LINES = exceptions element = 1 function = 2 type = 3 unopened = 4 unstarted = 5 window = 6 bad_pageformat_for_print = 7 spool_error = 8 codepage = 9 others = 10. if sy-subrc 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. call function 'CONTROL_FORM' exporting command = 'NEW-PAGE' exceptions unopened = 1 unstarted = 2 others = 3. if sy-subrc 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. w_index = 1. endif. endloop.endform. " MAIN_WINDOW " WRITE_FORM*&---------------------------------------------------------------------**& Form CLOSE_FORM*&---------------------------------------------------------------------** This subroutine closes the form Z_SCRIPTS*----------------------------------------------------------------------** There are no interface parameters to be passed to this subroutine.*----------------------------------------------------------------------*form close_form . call function 'CLOSE_FORM'* IMPORTING* RESULT =* RDI_RESULT =* TABLES* OTFDATA = exceptions unopened = 1 bad_pageformat_for_print = 2 send_error = 3 spool_error = 4 codepage = 5 others = 6. 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. " CLOSE_FORM*&---------------------------------------------------------------------**& Form LANDSCAPE_FORMAT*&---------------------------------------------------------------------** This subroutine prints the instructions on the landscape page*----------------------------------------------------------------------** There are no interface parameters to be passed to this subroutine.*----------------------------------------------------------------------*form landscape_format . call function 'WRITE_FORM' exporting element = 'INSTRUCTIONS'* FUNCTION = 'SET'* TYPE = 'BODY' window = 'MAIN'* IMPORTING* PENDING_LINES = exceptions element = 1 function = 2 type = 3 unopened = 4 unstarted = 5 window = 6 bad_pageformat_for_print = 7 spool_error = 8 codepage = 9 others = 10. 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. " LANDSCAPE_FORMAT*&---------------------------------------------------------------------**& Form START_FORM*&---------------------------------------------------------------------** This subroutine fetches the form Z_SCRIPTS*----------------------------------------------------------------------** -->P_0068 -- Z_SCRIPTS*----------------------------------------------------------------------*form start_form using value(p_0068). call function 'START_FORM' exporting* ARCHIVE_INDEX = form = p_0068* LANGUAGE = ' '* STARTPAGE = ' '* PROGRAM = ' '* MAIL_APPL_OBJECT =* IMPORTING* LANGUAGE = exceptions form = 1 format = 2 unended = 3 unopened = 4 unused = 5 spool_error = 6 codepage = 7 others = 8. 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. " START_FORM*&---------------------------------------------------------------------**& Form END_FORM*&---------------------------------------------------------------------** This subroutine ends the form Z_SCRI_LAND*----------------------------------------------------------------------** There are no interface parameters to be passed to this subroutine.*----------------------------------------------------------------------*form end_form . call function 'END_FORM'* IMPORTING* RESULT = exceptions unopened = 1 bad_pageformat_for_print = 2 spool_error = 3 codepage = 4 others = 5. 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. " END_FORMPrinting Total, Carry forward amount and Grand total in SAP Script...PreviousStep 4: Output for the Layout based on the User selection.Output for the Print Preview:Second Page:

Last Page:ThisInstruction pageprints in the landscape format.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

How to give Shades in SAPScript?By Shweta Chavan, Hitachi ConsultingIntroductionThis Document will elaborate you how to shade your table in SAPScript? Normally it is very easy to maintain document shading in Smartform & Adobe forms. But in SAPScript it is manual activity to do such things. We have to write down the code for getting such tables or shades.In SAP Script Release 3.0A, text commands were introduced for drawing borders, lines, and shading. Parameters can be set for position, size, border thickness, and shading. Within a layout set, individual windows or specific text passages within a window can therefore be output with a border or shading.How are the borders defined in the layout set?Using the following new text commands:1. /: BOX [XPOS][YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]2. /: POSITION[XORIGIN] [YORIGIN] [WINDOW] [PAGE]3. /: SIZE[WIDTH] [HEIGHT] [WINDOW] [PAGE]1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]Effect: Draws a box at this position with the specified size.Additional: XPOS, YPOS, WIDTH, HEIGHT and FRAME always requireExamples/: BOX FRAME 10 TWDraws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT)/: BOX INTENSITY 10Shades the window background with a density (gray shade) of 10 %/: BOX HEIGHT 0 TW FRAME 10 TWDraws a horizontal line at the upper window border over the entire window width/: BOX WIDTH 0 TW FRAME 10 TW

Draws a vertical line at the left window border over the entire window height/: 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 TWDraws two rectangles and two lines to construct a three-column table with a highlighted heading line

Output Output of above blue lines will be like follow:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++====ssign Standard Texts to the transport requestBy Jayshree Santosh Mahajan, Cognizant Technology SolutionsIntroduction:When we create\modify the standard text using the transaction code SO10, it does not ask for the transport request unlike other objects. We need to assign the standard texts to the transport request so that they will be migrated to the other systems along with other objects.Lets see the steps to achieve this, using standard report RSTXTRAN.Steps:1.Execute the report RSTXTRAN

2.Pass the Name of correction (task number and not the request number) and TEXT Key- name as below (we can pass multiple standard texts as well or we can specify key name pattern like ZTEST_*).

3.Execute the report and the screen would look like,

4.Press enter and you will see the below screen.

5.Now press Trsfr texts to corr. Button as shown below.

6.Confirmation popup will appear as below.

7.Once you confirm you will see the below message.

Output:As you can see below the standard text is attached to the transport request.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Uploading TIFF files and using them in SAP scriptBy Prasanna, InfosysIntroduction:The report RSTXLDMC allows a TIFF graphics file to be uploaded from the file system of the R/3 GUI to a standard text in the R/3 word processor SAP script.Step 1:Go to transaction SE38Enter the program name RSTXLDMC

Choose execute buttonStep 3:Selection screen will be displayed.Specify the TIFF file path and type as shown below.And enter the Name of the standard text to be generated

Choose execute buttonStep 4:The details of the upload will be displayed as below.

Step 5:Now include this in Script window as stated belowINCLUDE ZHEX-MACRO-LOGO OBJECT GRAPHICS ID BMON LANGUAGE EN.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Create the page windows:In the Page Window, set the Dimensions of windows.

Click here to continue...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++