Reports in SAPScripts

Please anybody tell me how to call reports in SAP Scripts?

Hi,
  You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting data, and so on.
PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.
The system does not execute the PERFORM command within SAPscript replace modules, such as TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE. The replace modules can only replace symbol values or resolve include texts, but not interpret SAPscript control commands.
Syntax in a form window:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
/: ENDPERFORM
INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:
FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
ENDFORM.
The values of the SAPscript symbols passed with /: USING... are now stored in the internal table IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to access the variables.
The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. These parameters are local text symbols, that is, character fields. See the example below on how to return the variables within the subroutine.
From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program QCJPERFO is called. Then the simple barcode contained there (‘First page’, ‘Next page’, ‘Last page’) is printed as local variable symbol.
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/ &BARCODE&
Coding of the calling ABAP program:
REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next page
READ TABLE IN_PAR WITH KEY ‘PAGE’.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE OUT_PAR WITH KEY ‘BARCODE’.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = ‘|’. "First page
ELSE.
OUT_PAR-VALUE = ‘||’. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = ‘L’. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
Regards,
Vara

Similar Messages

  • Equivalent command in Reports like Sapscripts's PROTECT and ENDPROTECT

    Hi,
    What is the equivalent command in Reports like Sapscripts's PROTECT and ENDPROTECT?
    - Selva

    Hi,
    I don't think you have any particular command for that in reports. but if you are talking about headers / footers then you may use the events TOP-OF-PAGE and END-OF-PAGE.
    Regards,
    Anand Mandalika.

  • Get the current line no.(similar to sy-linno in report) in  Sapscript form

    Hi everyone,
    In ABAP reporting, you can use sy-linno to determine the current line no.
    But if in sapscript form,
    does any system field to get the currect line no. or y-origin. ?
    Just say the program is now runing and have written several lines in a window of the form.
    AS         This is the first line
    AS         This is the second line
    AS         This is the third line
    how to get the current line = 3 or  yorigin '+3'  LN?
    Thanks for reply in advance.

    Hi,
    you can also chk the sy-linno directly in your script.
    Regards
    Subramanian

  • Print variable from report to Sapscript that is send as a message(Nast)

    Hi there!
    I want to print an internal local table on a sapscriptform which is printed as a message from a PurchaseOrder.
    So i created a new entry in NACE for a new Messagetype, which calls a Programm (Z_PROGRAM) and a subroutine (Z_ENTRY) and a formular (Z_FORM) That works, i got a breakpoint here.
    Problem: every variable that is filled in the programm is still empty on the formular! i have defined a gv_test in Z_PROGRAM (global) and in the form (using form-debugger) i can see that the gv_test is empty.
    My Process.. I create the message using me22n. I start it using ME9f. Then my Breakpoint in Z_ENTRY pops up. There i fill the gv_test. Then i call open_form start_form write_form and close_form.
    My ZPROGRAM
    REPORT  zmelief01.
    data: gv_test type char4.
    FORM entry_zlif USING ent_retco ent_screen.
    BREAK-POINT.
    gv_test = 'SIMSALABIM'.
    CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          dialog   = space
          form     = 'Z11_ZLIEF1'
          language = 'D'
          OPTIONS  = itcpo.
      CALL FUNCTION 'START_FORM'
      exporting
          form      = 'Z11_ZLIEF1'
          language  = 'D'
          startpage = 'MAIN'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          window = 'MAIN'.
      CALL FUNCTION 'END_FORM'.
      CALL FUNCTION 'CLOSE_FORM'.
    My Form:
    Window: Main
    Page: Main
    Language: DE
    ST  |  Print my variable: &gv_test&.

    HI BonsaiKo,
    Thank you for visiting Apple Support Communities.
    It sounds like the Chrome application is unresponsive on your Mac. The rainbow disc you see is called the "wait cursor," which spins when your computer is processing something.
    If the cursor does not stop spinning, you may have to force Chrome to quit using these steps:
    OS X: How to quit an unresponsive application using Force Quit
    Using the Force Quit feature of OS X makes an application close, even when it is not responsive.
    Important: Normally you should not need to force quit an app to close it. When an app is forced to quit, any unsaved changes to open documents are not saved, so try these methods to normally close the app first:
    Choose Quit from the app menu. For example, in Safari, choose Safari > Quit Safari.
    Choose Quit by right-clicking or control-clicking on an app's icon in the Dock.
    Thank you for participating in Apple Support Communities.
    Best Regards,
    Jeremy

  • Barcodes on reports (NOT SAPSCRIPT)

    Hello everybody in this forum,
    does anybody know, how to print a barcode on a simple ABAP-report?
    I recently read the docu about PRINT-CONTROL but I was not able to benefit of the explanations given in the way that the solution is clear now.
    I tried with our own SPAD-device type and checked the table entries on TSP03 and T022D. As entries exist, I received an hexcode like '1B28733370323437303054'
    WRITE : /.
    PRINT-CONTROL FUNCTION 'SBP01'.
    WRITE : '123456789'.
    PRINT-CONTROL FUNCTION 'SBS01'.
    But how to continue? Or maybe this ain't work in that way!
    Thank you very much in advance.
    Regards
    Markus

    hai markus,
    here is a sample program to print barcode using report.
    Sample ABAP Program:
    DATA: BAR_CODE1(16) VALUE `ABC01230123A01'
    NEW-PAGE PRINT ON IMMEDIATELY `X'.
    FORMAT COLOR OFF INTENSIFIED OFF.
    If the barcode is the first element on the page, the following Write
    statement is needed (otherwise you get a date in the first print
    control.
    WRITE:/
    Turn on the barcode font, print the data, and switch back to the
    printer's default font. Be sure to use NO-GAP to avoid unwanted
    characters or CR/LF.
    PRINT-CONTROL FUNCTION `BCPFX'
    WRITE: BAR_CODE1 NO-GAP
    PRINT-CONTROL FUNCTION `BCSFX'
    Add a Write statement to prevent insertion of CR/LF into the barcode.
    WRITE:/
                                       (or)
    data: begin of precom9, "command for  printer language PRESCRIBE
       con1(59) value
    '!R!SCF;SCCS;SCU;SCP;FONT62;UNITD;MRP0,-36;BARC21,N,''123456''',
        con3(55) value
       ',40,40,2,7,7,7,4,9,9,9;MRP0,36;RPP;RPU;RPCS;RPF;EXIT,E;',
          end of precom9.
    *replace 123456 of precom9+52(06) with the actual material number..
    new-page print on.    "barcode printer
    Write: 'material number', precom9.      "barcode for matnr
    new-page print off.
    hope this is helpful.
    regards,
    praba.

  • Smartform : How do i append o/p of  a report(ZA3C) as Smartform Pages

    Dear all
    I have three smartform pages with a Driver prog .
    Now i want 2 append the o/p of mere a report(not   SapScript) as smartform pages .
    I m trying 2 achieve that by the following BOLD part of my code .
      Throw some light on this
    Thnx in Advance
    Moni
    Have look at my code plz
    *Printing of Export Invoice, Packing List,Enclosure to Packing List & Case Marking in one SMART FORMS layout                                *
    REPORT ZSD_REP_MULTI_PRINT.
    TABLES :
        VBAK,
        VBAP,
        VBFA,
        LIKP,
        LIPS,
        KONV,
        t005t,
        KNA1,
        t001w,
        T001,
        ADRC.
    DATA: FM_NAME1  TYPE RS38L_FNAM,
          FM_NAME2  TYPE RS38L_FNAM,
          FM_NAME3  TYPE RS38L_FNAM,
          FM_NAME4  TYPE RS38L_FNAM,
          P_E_DEVTYPE TYPE RSPOPTYPE,
          P_JOB_OUTPUT_INFO TYPE SSFCRESCL OCCURS 2000 WITH HEADER LINE,
          T_OTF LIKE ITCOO OCCURS 0 WITH HEADER LINE,
          T_OTF2 TYPE SSFCRESCL OCCURS 2000 WITH HEADER LINE,
          P_OUTPUT_OPTIONS TYPE SSFCOMPOP OCCURS 0 WITH HEADER LINE,
          P_CONTROL_PARAMETERS TYPE SSFCTRLOP OCCURS 0 WITH HEADER LINE ,
          P_DOC  LIKE DOCS OCCURS 2000 WITH HEADER LINE,
          P_LINES LIKE TLINE OCCURS 200,
          P_BIN_FILESIZE TYPE I,
          P_LANGUAGE TYPE SFLANGU,
          P_BIN_FILE TYPE XSTRING,
          OK_CODE LIKE SY-UCOMM.
    DATA: T_ITEM   TYPE  ZSD_TABL_LITEM,
          WA_ITEM  TYPE  ZSD_STRUCT_LITEM,
          T_ADRS   LIKE  ZSD_STRUCT_ADRS  OCCURS 0 WITH HEADER LINE,
          MSLINES  LIKE  TLINE OCCURS 1 WITH HEADER LINE,
          TIDNO    LIKE STXL-TDID,
          TNAME    LIKE STXL-TDNAME,
          TOBJT    LIKE STXL-TDOBJECT,
          SSORD    LIKE VBAK-VBELN,
          TOT      LIKE VBAK-NETWR,
          WORD     LIKE SPELL,
          ITNO     LIKE VBAP-POSNR.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS: P_DELNO LIKE  LIKP-VBELN OBLIGATORY,
                P_INVNO LIKE  VBRK-VBELN OBLIGATORY,
                P_DATE  LIKE  SY-DATUM.
    SELECTION-SCREEN END   OF BLOCK blk1.
    AT SELECTION-SCREEN.
      CLEAR T_ADRS.
      REFRESH T_ITEM.
      T_ADRS-INVNO = P_INVNO.
      T_ADRS-INVDAT = P_DATE.
      SELECT SINGLE VBELV INTO  VBFA-VBELV
                             FROM  VBFA
                             WHERE VBELN = P_DELNO
                               AND VBTYP_N = 'J'  .
      SSORD = VBFA-VBELV.
    *Exporter's  Address
      SELECT SINGLE BUKRS_VF INTO  VBAK-BUKRS_VF
                             FROM  VBAK
                             WHERE VBELN = VBFA-VBELV.
      SELECT SINGLE   ADRNR
                      INTO T001-ADRNR
                      FROM T001
                      WHERE BUKRS = VBAK-BUKRS_VF.
      SELECT SINGLE NAME1 STREET CITY1 POST_CODE1 COUNTRY
             INTO (T_ADRS-NAME1,T_ADRS-STREET,T_ADRS-CITY1,
                   T_ADRS-POST_CODE1, ADRC-COUNTRY)
             FROM  ADRC
             WHERE ADDRNUMBER EQ T001-ADRNR.
      SELECT SINGLE LANDX
                    INTO T_ADRS-COUNTRY
                    FROM T005T
                    WHERE     SPRAS = 'EN'
                          AND LAND1 = ADRC-COUNTRY.
    *Consignee Address & Buyer Other Than Consignee
      SELECT SINGLE KUNNR KUNAG INTO (LIKP-KUNNR, LIKP-KUNAG)
                                FROM LIKP WHERE VBELN = P_DELNO.
      IF LIKP-KUNNR = LIKP-KUNAG.
        SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR
                  INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,
                        T_ADRS-CCITY,  T_ADRS-CPCODE, T_ADRS-CREGIO,
                        T_ADRS-CTELF1, KNA1-ADRNR)
                  FROM  KNA1
                  WHERE KUNNR = LIKP-KUNNR.
        SELECT SINGLE COUNTRY INTO  ADRC-COUNTRY
                              FROM  ADRC
                              WHERE ADDRNUMBER EQ KNA1-ADRNR.
        SELECT SINGLE LANDX
                    INTO T_ADRS-CCOUNTRY
                    FROM T005T
                    WHERE     SPRAS = 'EN'
                          AND LAND1 = ADRC-COUNTRY.
        T_ADRS-ONAME1   =  T_ADRS-CNAME1 .
        T_ADRS-ONAME2   =  T_ADRS-CNAME2 .
        T_ADRS-OSTREET  =  T_ADRS-CSTREET .
        T_ADRS-OCITY    =  T_ADRS-CCITY.
        T_ADRS-OPCODE   =  T_ADRS-CPCODE .
        T_ADRS-OREGIO   =  T_ADRS-CREGIO.
        T_ADRS-OTELF1   =  T_ADRS-CTELF1 .
        T_ADRS-OCOUNTRY =  T_ADRS-CCOUNTRY.
      ELSE.
        SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR
                  INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,
                        T_ADRS-CCITY,  T_ADRS-CPCODE, T_ADRS-CREGIO,
                        T_ADRS-CTELF1, KNA1-ADRNR)
                  FROM  KNA1
                  WHERE KUNNR = LIKP-KUNNR.
        SELECT SINGLE COUNTRY INTO ADRC-COUNTRY
                              FROM  ADRC
                              WHERE ADDRNUMBER EQ KNA1-ADRNR.
        SELECT SINGLE LANDX
                    INTO T_ADRS-CCOUNTRY
                    FROM T005T
                    WHERE     SPRAS = 'EN'
                          AND LAND1 = ADRC-COUNTRY.
    *Buyer Other than Consignee
        SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR
                   INTO (T_ADRS-ONAME1, T_ADRS-ONAME2, T_ADRS-OSTREET,
                         T_ADRS-OCITY,  T_ADRS-OPCODE, T_ADRS-OREGIO,
                         T_ADRS-OTELF1, KNA1-ADRNR)
                   FROM  KNA1
                   WHERE KUNNR = LIKP-KUNAG.
        SELECT SINGLE COUNTRY INTO  ADRC-COUNTRY
                              FROM  ADRC
                              WHERE ADDRNUMBER EQ KNA1-ADRNR.
        SELECT SINGLE LANDX
                    INTO T_ADRS-OCOUNTRY
                    FROM T005T
                    WHERE     SPRAS = 'EN'
                          AND LAND1 = ADRC-COUNTRY.
      ENDIF.
    *Other's Ref
      TIDNO = 'Z071'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-OREF = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Buyer's Order No  Ref
      TIDNO = 'Z023'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-BUYER = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Exporter Ref
      TIDNO = 'Z072'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-XPREF = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Pre-Carraige By
      TIDNO = 'Z074'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-PCRG = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Place Of reciept by Pre-Carraige
      TIDNO = 'Z073'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-PLPCRG = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Vessel/Flight No
      TIDNO = 'Z075'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-VFNO = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Port Of Loading
      TIDNO = 'Z077'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-PLOAD = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Port Of Discharge
      TIDNO = 'Z076'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-PDISG = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Final Destination
      TIDNO = 'Z070'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-FDEST = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    *Terms Of Delivery & Payment
      TIDNO = 'Z080'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-TERMS = mslines-tdline(50).
        EXIT.
      ENDLOOP.
    APPEND T_ADRS.
    *BODY SECTION FOR LINE ITEMS
      SELECT POSNR KWMENG VRKME WAERK
             INTO  (VBAP-POSNR, VBAP-KWMENG, VBAP-VRKME, VBAP-WAERK)
             FROM  VBAP
             WHERE VBELN = SSORD.
    *Mark/Case No
        TIDNO = '0002'.
        CONCATENATE SSORD
                    VBAP-POSNR
        INTO        TNAME.
        TOBJT = 'VBBP'.
        PERFORM FINDTEXT.
        LOOP AT MSLINES.
          WA_ITEM-MARKNO = mslines-tdline(40).
          EXIT.
        ENDLOOP.
    *Packing Type
        TIDNO = '0003'.
        CONCATENATE SSORD
                    VBAP-POSNR
        INTO        TNAME.
        TOBJT = 'VBBP'.
        PERFORM FINDTEXT.
        LOOP AT MSLINES.
          WA_ITEM-PACKTYP = mslines-tdline(40).
          EXIT.
        ENDLOOP.
    *Goods Description
        TIDNO = '0001'.
        CONCATENATE SSORD
                    VBAP-POSNR
        INTO        TNAME.
        TOBJT = 'VBBP'.
        PERFORM FINDTEXT.
        LOOP AT MSLINES.
          WA_ITEM-GDESC = mslines-tdline(40).
          EXIT.
        ENDLOOP.
    *Goods Quantity
        WA_ITEM-QTY = VBAP-KWMENG.
        WA_ITEM-VRKME = VBAP-VRKME.
    *Goods Rate
        SELECT SINGLE KNUMV INTO VBAK-KNUMV FROM VBAK WHERE VBELN = SSORD.
        SELECT SINGLE KBETR WAERS
                      INTO  (WA_ITEM-RATE, WA_ITEM-WAERS)
                      FROM  KONV
                      WHERE KNUMV = VBAK-KNUMV
                        AND KPOSN = VBAP-POSNR
                        AND KSCHL = 'PR00'.
    *Item Remarks
        TIDNO = 'ZREM'.
        CONCATENATE SSORD
                    VBAP-POSNR
        INTO        TNAME.
        TOBJT = 'VBBP'.
        PERFORM FINDTEXT.
        LOOP AT MSLINES.
          WA_ITEM-REMARK = mslines-tdline(40).
          EXIT.
        ENDLOOP.
    *Goods Amount
        WA_ITEM-AMOUNT = WA_ITEM-QTY * WA_ITEM-RATE.
        WA_ITEM-WAERK = VBAP-WAERK.
        TOT = TOT + WA_ITEM-AMOUNT.
        ITNO = VBAP-POSNR.
        APPEND WA_ITEM TO T_ITEM.
      ENDSELECT.
      T_ADRS-TOT = TOT.
      CALL FUNCTION 'SPELL_AMOUNT'
       EXPORTING
         AMOUNT          = TOT
         CURRENCY        = VBAP-WAERK
      FILLER          = ' '
         LANGUAGE        = SY-LANGU
       IMPORTING
         IN_WORDS        = WORD
       EXCEPTIONS
         NOT_FOUND       = 1
         TOO_LARGE       = 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.
    *Gross Wieght
      TIDNO = 'Z078'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-GWT = mslines-tdline(40).
        EXIT.
      ENDLOOP.
    *Net Wieght
      TIDNO = 'Z079'.
      TNAME = SSORD.
      TOBJT = 'VBBK'.
      PERFORM FINDTEXT.
      LOOP AT MSLINES.
        T_ADRS-NWT = mslines-tdline(40).
        EXIT.
      ENDLOOP.
      T_ADRS-TOT_WORDS = WORD-WORD.
      APPEND T_ADRS.
    START-OF-SELECTION.
      P_LANGUAGE = 'EN'.
      CALL   FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          I_LANGUAGE    = P_LANGUAGE
          I_APPLICATION = 'SAPDEFAULT'
        IMPORTING
          E_DEVTYPE     = P_E_DEVTYPE.
      P_OUTPUT_OPTIONS-XSFCMODE = 'X'.
      P_OUTPUT_OPTIONS-XSF = SPACE.
      P_OUTPUT_OPTIONS-XDFCMODE = 'X'.
      P_OUTPUT_OPTIONS-XDF = SPACE.
      P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.
      P_OUTPUT_OPTIONS-TDDEST = 'LOHP'.
      APPEND P_OUTPUT_OPTIONS.
      P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
      P_CONTROL_PARAMETERS-GETOTF = 'X'.
      P_CONTROL_PARAMETERS-NO_CLOSE = SPACE.
      APPEND  P_CONTROL_PARAMETERS.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = 'ZSD_REP_MULTI_PRINT1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
          FM_NAME                  = FM_NAME1
       EXCEPTIONS
          NO_FORM                  = 1
          NO_FUNCTION_MODULE       = 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.
      CALL FUNCTION FM_NAME1
       EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = P_CONTROL_PARAMETERS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        OUTPUT_OPTIONS             = P_OUTPUT_OPTIONS
        USER_SETTINGS              = 'X'
      IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = P_JOB_OUTPUT_INFO
      JOB_OUTPUT_OPTIONS         =
      TABLES
        T_ADRS                     = T_ADRS
        T_ITEM                     = T_ITEM
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 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.
      LOOP AT P_JOB_OUTPUT_INFO-OTFDATA INTO T_OTF.
        APPEND T_OTF.
      ENDLOOP.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = 'ZSD_REP_MULTI_PRINT2'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
          FM_NAME                  = FM_NAME2
       EXCEPTIONS
          NO_FORM                  = 1
          NO_FUNCTION_MODULE       = 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.
      CALL FUNCTION FM_NAME2
       EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = P_CONTROL_PARAMETERS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        OUTPUT_OPTIONS             = P_OUTPUT_OPTIONS
        USER_SETTINGS              = 'X'
      IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = P_JOB_OUTPUT_INFO
      JOB_OUTPUT_OPTIONS         =
      TABLES
        T_ADRS                     = T_ADRS
        T_ITEM                     = T_ITEM
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 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.
      LOOP AT P_JOB_OUTPUT_INFO-OTFDATA INTO T_OTF.
        APPEND T_OTF.
      ENDLOOP.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = 'ZSD_REP_MULTI_PRINT3'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
          FM_NAME                  = FM_NAME4
       EXCEPTIONS
          NO_FORM                  = 1
          NO_FUNCTION_MODULE       = 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.
      CALL FUNCTION FM_NAME4
       EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = P_CONTROL_PARAMETERS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        OUTPUT_OPTIONS             = P_OUTPUT_OPTIONS
       USER_SETTINGS              = 'X'
      IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = P_JOB_OUTPUT_INFO
      JOB_OUTPUT_OPTIONS         =
      TABLES
        T_ADRS                     = T_ADRS
        T_ITEM                     = T_ITEM
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 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.
      LOOP AT P_JOB_OUTPUT_INFO-OTFDATA INTO T_OTF.
        APPEND T_OTF.
      ENDLOOP.
    <b>*for capturing the o/p pages from ZPL3 and consolidating into table T_OTF to get single PDF
    SET PARAMETER  ID: 'AUN' FIELD SSORD ,
                       'APO' FIELD ITNO.
    CALL TRANSACTION 'ZPL3' AND SKIP FIRST SCREEN.
    IF SY-SUBRC NE 0.
       MESSAGE E001(ZQOTBANK).
    ENDIF.
    IMPORT (T_OTF2) FROM  MEMORY ID 'MEMID'.
    LOOP AT T_OTF2-OTFDATA INTO T_OTF.
        APPEND T_OTF.
    ENDLOOP.</b>
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
      EXPORTING
        USE_OTF_MC_CMD               = 'X'
      ARCHIVE_INDEX                =
    IMPORTING
        BIN_FILESIZE                 = P_BIN_FILESIZE
    TABLES
        OTF                          = T_OTF
        DOCTAB_ARCHIVE               = P_DOC
        LINES                        = P_LINES
    EXCEPTIONS
       ERR_CONV_NOT_POSSIBLE        = 1
       ERR_OTF_MC_NOENDMARKER       = 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.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        BIN_FILESIZE                    = P_BIN_FILESIZE
        FILENAME                        = 'C:\SD6.pdf'
        FILETYPE                        = 'BIN'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
    IMPORTING
       FILELENGTH                      = P_BIN_FILESIZE
      TABLES
        DATA_TAB                        = P_LINES
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *&      Form  FINDTEXT
          text
    FORM FINDTEXT.
      REFRESH mslines.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                  = sy-mandt
          id                      = tidno
          language                = sy-langu
          name                    = tname
          object                  = tobjt
        TABLES
          lines                   = mslines
        EXCEPTIONS
          id                      = 1
          language                = 2
          name                    = 3
          not_found               = 4
          object                  = 5
          reference_check         = 6
          wrong_access_to_archive = 7
          OTHERS                  = 8.
      DELETE mslines WHERE tdline IS INITIAL.
    ENDFORM.                    "FINDTEXT

    Hello,
    You can find out the Spool Request w.r.t the Program by FM RSPO_FIND_SPOOL_REQUESTS.
    This Spool Request could be converted to PDF by FM CONVERT_ABAPSPOOLJOB_2_PDF.
    P.S.: The Import parameter 'NO_DIALOG' in FM CONVERT_ABAPSPOOLJOB_2_PDF is to be initial. You will be getting a Popup seeking the Path and name of the file to be created. This is because you can direct the Spool list to be created in the same PDF file by appending it into earlier created SSF/SAPScript PDF outputs.
    I hope this helps you.
    Regards, Murugesh AS

  • ALV Programming and Sapscript...

    Hi,
    Till date i have only worked in standard reports, now i have to work on ALV report and Sapscript, so if any one have any basic tutorial on ALV and Sapscript, pls email me.
    Thanks in advance.

    Hi arup,
    1. This is the most simple form of alv.
    2. Minimum, this much coding is required for a normal alv.
    The two main FMs for any alv programming are.
    <b>REUSE_ALV_LIST_DISPLAY
    REUSE_ALV_FIELDCATALOG_MERGE</b>
    3. just copy paste to get a taste of it.
    4.
    report abc.
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvfcwa TYPE slis_fieldcat_alv.
    data : begin of itab occurs 0.
            include structure usr02.
    data : end of itab.
    START-OF-SELECTION.
      select * from usr02
      into table itab.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_internal_tabname     = 'ITAB'
          i_inclname             = sy-repid
        CHANGING
          ct_fieldcat            = alvfc
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
    IMPORTANT
      LOOP AT ALVFC INTO ALVFCWA.
        IF ALVFCWA-FIELDNAME = 'USTYP'.
          ALVFCWA-NO_CONVEXT = 'X'.
          MODIFY ALVFC FROM ALVFCWA.
        ENDIF.
      ENDLOOP.
    Display
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_fieldcat   = alvfc
        TABLES
          t_outtab      = itab
        EXCEPTIONS
          program_error = 1
          OTHERS        = 2.
    regards,
    amit m.

  • Barcode printing on report

    Hi,
    have any one tried printing a barcode in a classical abap report? if yes, then send procedure & piece of code for it

    hi ginni,
    refer the following thread it contains the sample code of printing barcode in reports:
    Re: Barcodes on reports (NOT SAPSCRIPT)
    it will definately help u
    regards
    rahul

  • Result of report on a script

    Hi all,
    how can i get the result of the report on a script.
    Thanks in advance
    Santosh

    Hi
    First write the report code with proper data fetching
    Don't write the WRITE statements
    design a Script layout in SE71 tcode with the data fields of this internal tables data of the report
    then call the script in the report using the fun module OPEN_FORM and pass the parameter of the SCript name to it.
    And use the fun modules WRITE_FORM in the loop of the internal table to print the data of the report in the script
    and finally after loop call the fun module CLOSE_FORM
    see the sample program code and do accordingly
    *& Report  ZTEST12121
    *& SAPScripts Example 1
    REPORT  ztest12121.
    *DATABASE TABLES
    TABLES: ekko,ekpo,lfa1.
    *INTERNAL TABLES AND STRUCTURES
    DATA i_ekko LIKE ekko.
    DATA i_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
    DATA i_lfa1 LIKE lfa1.
    *PARAMETERS
    PARAMETERS: p_ebeln LIKE ekko-ebeln.
    *VARIABLES
    DATA MAT TYPE STRING VALUE 'MAT NO'.
    DATA iTe TYPE STRING VALUE 'ITEM NO'.
    DATA QTY TYPE STRING VALUE 'QTY'.
    DATA UOM TYPE STRING VALUE 'UOM'.
    DATA NET TYPE STRING VALUE 'NET PRICE'.
    Data var type integer value 0.
    *DATABASE SELECTS
    *Header data
    SELECT SINGLE * FROM ekko INTO i_ekko WHERE ekko~ebeln = p_ebeln.
    IF sy-subrc = 0.
    *Item Data
      SELECT * FROM ekpo INTO  TABLE i_ekpo WHERE ekpo~ebeln = p_ebeln.
      IF sy-subrc NE 0.
        WRITE 'PURCHASE DOCUMENT ITEM DATA ERROR'.
      ELSE.
    *Vendor Details
        SELECT SINGLE * FROM lfa1 INTO i_lfa1 WHERE lfa1~lifnr = i_ekko-lifnr.
        IF sy-subrc NE 0.
          WRITE 'VENDOR DOCUMENT ITEM DATA ERROR'.
        ENDIF.
      ENDIF.
    ELSE.
      WRITE 'THIS PURCHASE DOCUMENT NUMBER DOESNOT EXISTS'.
    ENDIF.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      APPLICATION                       = 'TX'
      ARCHIVE_INDEX                     =
      ARCHIVE_PARAMS                    =
      DEVICE                            = 'PRINTER'
      DIALOG                            = 'X'
        form                              = 'ZSCRIPT_1'
        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.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'OFFICEAD'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'OFFICEAD'
    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 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'PODET'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'PODET'
    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 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'TOP'
       FUNCTION                       = 'SET'
       TYPE                           = 'TOP'
       WINDOW                         = 'MAIN'
    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 I_EKPO.
    var = i_ekpo-netpr * i_ekpo-menge.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'BODY'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'MAIN'
    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'
    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.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Sendig email about a few pages of a SAPScript

    Hi!
    I would like to know, is it possible to send via email some pages of a SAPScript.
    I've created a report, with SAPScript output. The report is collecting a lot of data, and is grouping the data by customer.
    So at the end of the report run, I have 5 pages, with a grouping like this:
    1. Customer A / Deliveries 1,2,3
    2. Customer B / Deliveries 4,5
    3. Customer C / Deliveries 6,7,8,9
    4. Customer D / Deliveries 10
    5. Customer E / Deliveries 11,12
    In the B, D customer master data exist an email address, so I have to send the 2nd page to the email address of B (for example [email protected]) and the 4th page to the email address of D (f.e.: [email protected]).
    How can I solve this?
    Thanx
    Tamá

    Hi
    Let the people know how the issue is resolved. So that, they can refer to this post when faced with a similar situation.
    Regards,
    Raj

  • REG: Page protection in Reports

    Hi,
        I want to diplay particular contents in the same page without any page break. i.e Any equivalent command for Reports like SAPSCRIPT's PROTECT and ENDPROTECT?
    or what is the equivalent command SAPSCRIPT's PROTECT and ENDPROTECT in reports?
    Thanks in Advance
    - Selva

    Hai
    go through the following Code
    REPORT  ZSSSS1  LINE-SIZE 120
                    LINE-COUNT 25(3)
                    MESSAGE-ID ZSAN.
      S T A R T - O F - S E L E C T I O N                            *
    START-OF-SELECTION.
      T O P - O F - P A G E                                          *
    TOP-OF-PAGE.
      PERFORM WRITE_HEADER.
      E N D - O F - P A G E                                          *
    END-OF-PAGE.
      PERFORM WRITE_FOOTER.
    *&      Form  WRITE_HEADER
            HEADER DISPLAY
    form WRITE_HEADER.
    FORMAT COLOR 3.
    WRITE:/1 SY-VLINE,
                (10) 'PUR.ORDER',
                  SY-VLINE,
                (10) 'VENDOR',
                  SY-VLINE,
                (15) 'NAME',
                   SY-VLINE,
                (10) 'COMP.CODE',
                  SY-VLINE,
                (15) 'COMP.DESC',
                 75 SY-VLINE.
    WRITE:/1(75) SY-ULINE.
    FORMAT COLOR OFF.
    endform.                    " WRITE_HEADER
    *&      Form  WRITE_FOOTER
    FOOTER OF LIST
    form WRITE_FOOTER.
    FORMAT COLOR 4.
    WRITE: /1 'USER:',SY-UNAME,
            45 'DATE:', SY-DATUM.
    FORMAT COLOR OFF.
    endform.                    " WRITE_FOOTER
    Thanks & regards
    Sreenivasulu P

  • Sending email for some pages of a report

    Hi!
    I would like to know, is it possible to send via email some pages of a SAPScript.
    I've created a report, with SAPScript output. The report is collecting a lot of data, and is grouping the data by customer.
    So at the end of the report run, I have 5 pages, with a grouping like this:
    1. Customer A / Deliveries 1,2,3
    2. Customer B / Deliveries 4,5
    3. Customer C / Deliveries 6,7,8,9
    4. Customer D / Deliveries 10
    5. Customer E / Deliveries 11,12
    In the B, D customer master data exist an email address, so I have to send the 2nd page to the email address of B (for example [email protected]) and the 4th page to the email address of D (f.e.: [email protected]).
    How can I solve this?
    Thanx
    Tamá

    Hi!
    The following coding provides the SAPScript list, now. This is what I would like to extend with the email sending.
    The table it_fuvar contains the data of the customers and deliveries. I think I have to enter the email sending between the END_FORM and START_FORM function modules.
    My problems are:
    - is the OTF ready and convertable to PDF at this moment (after an END_FORM)?
    - if it is, then how identify it to convert  and how to send the converted PDF via attachment?
      DESCRIBE TABLE it_fuvar LINES fcount.
      IF fcount = 0.
        WRITE:/ 'Nincsen nyomtatható adat.'.
        EXIT.
      ENDIF.
      SET LANGUAGE sy-langu.
      CLEAR wa_itcpo.
      MOVE 'X' TO wa_itcpo-tdimmed.
      MOVE 'X' TO wa_itcpo-tdnewid.
      MOVE sy-repid TO wa_itcpo-tdsuffix2.
      MOVE sy-title TO wa_itcpo-tdtitle.
    * open form
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          OPTIONS       = wa_itcpo
          dialog        = 'X'
          form          = gc_formname
          language      = sy-langu
        EXCEPTIONS
          canceled      = 1
          device        = 2
          form          = 3
          OPTIONS       = 4
          unclosed      = 5
          mail_options  = 6
          archive_error = 7
          OTHERS        = 8.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      MOVE 1 TO fcount.
      SORT it_fuvar.
      LOOP AT it_fuvar INTO wa_fuvar.
        AT NEW vstel_bez.
    * spedit&#337;r címadatok kiírása a scriptbe
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              window = 'M_SPEDIT'
            EXCEPTIONS
              OTHERS = 1.
    * cím, téma, számlázási cím kiírása a scriptbe
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              window = 'M_INFO'
            EXCEPTIONS
              OTHERS = 1.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'M_SZALLITASI_CIM'
            EXCEPTIONS
              OTHERS  = 1.
        ENDAT.
        AT NEW tknum.
          SUM.
    * kocsik (transzportok) kiírása a scriptbe
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'M_KOCSI'
            EXCEPTIONS
              OTHERS  = 1.
          fcount = fcount + 1.
        ENDAT.
    *   print item line
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'M_ARUFOGADO'.
        AT END OF vstel_bez.
    * footer
          MOVE 1 TO fcount.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              window  = 'M_BOTTOM'
              element = 'NEW_PAGE'.
          CALL FUNCTION 'END_FORM'
            EXCEPTIONS
              unopened                 = 1
              bad_pageformat_for_print = 2
              spool_error              = 3
              codepage                 = 4
              OTHERS                   = 5.
          IF sy-subrc <> 0.
          ENDIF.
    * EMAIL SEND???
    * EMAIL SEND???
    * EMAIL SEND???
          CALL FUNCTION 'START_FORM'
            EXPORTING
              form        = gc_formname
              language    = sy-langu
            EXCEPTIONS
              form        = 1
              format      = 2
              unended     = 3
              unopened    = 4
              unused      = 5
              spool_error = 6
              codepage    = 7
              OTHERS      = 8.
          IF sy-subrc <> 0.
          ENDIF.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'CLOSE_FORM'
        EXCEPTIONS
          OTHERS = 1.
    Thanx
    Tamá

  • How we call  reports in script

    hi gurus.
    please tell me how we call  reports in script.
    thanks,
    subhasis

    Hi,
    we can call report thro' sapscripts by following way,
    Calling ABAP Subroutines: PERFORM
    for eg.
    Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine
    /: DEFINE &TOT_PRICE&
    /: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name> /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM
    Then write the variable where ever you want it to be printed (mostly it will be in footer window)
    Then create subroutine pool program and you have to write the code.
    FORM F_GET_PRICE tables int_cond structure itcsy
    outt_cond structure itcsy. data : value type kbert.
    statics value1 type kbert.
    Read int_cond table index 1.
    value = int_cond-value.
    value1 = value1 + value.
    Read outt_cond table index 1.
    outt_cond-value = value1.
    Modify outt_cond index 1.
    ENDFORM.
    To know more, have a look at this thread ..
    Re: SAP Script: Display Total calculated  on page 2 in page 1

  • Printing Problem in sap script

    Hi all,
    There is a printing problem in z report of sapscript.
    when I am giving continuous print ...
       1st page is right in print format but in 2nd page the text comes 1 row up...and so on...
    so the starting point for all page are not same...
    Please help me...

    Hello,
    Check SAP note 39259.
    Regards,
    David

  • Is there any module in ABAP which requires almost zero percent of coding?

    Hi all,
    i just wanted to know if there is any module in ABAP which has zero percent of coding apart from functional modules like SD MM etc?
    Regards
    Sanjeev

    ABAP is a programming language.
    If you say reporting, bdc, sapscript, module pool, smartforms and ask if they need coding, the answer is yes. They require ABAP programming language for its coding.
    Everything in SAP done not require coding. For a person working in SAP-BW there is substantially low necessity for ABAP codes. However it requires ABAP knowledge when working with Exits in BW.
    SAP-XI mostly requires creating scenarios creating IDOCs, BDOCs and handling XML. This also has very little ABAP.
    Reward points if helpful.

Maybe you are looking for