How to use perform statements in sap scripts

how to use perform statements in sap scripts . and pls send me one progam for this
thnaks
raja

Hi Raja,
<b>PERFORM</b> key work is used to include subroutine in sapscript form...
But the processing is lttle bit different form the one we use in ABAP.
Here the paramters passed to form is stored in internal table of name-value table. there are two table one for inbound parameter and other for outbound parameters.
Check out the example below to see how this is used..
<b>Definition in the SAPscript form:</b>
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/ &BARCODE&
<b>Coding of the calling ABAP program:</b>
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.
Hope this is clear to understand...
Enjoy SAP.
Pankaj Singh.

Similar Messages

  • How to use IF Conditon in SAP Scripts?

    Hi Guys,
                   I am having adoubt how to use IF conditon with multiple variables in SAp Scripts
    for ex If a>b and a>c and a>d
             Elseif b>a and b>c and b> d.
             Elseif .....
              endif.
              How to use above example in SAP Scripts.
    thanks,
    Gopi.

    hi Gopi,
    it is almost the same as normal ABAP, you only have to use & before and after the variable and the variable has to be in capitals and you have to make the line as command ( /: before the line )
    IF &A& > &B& AND ...
    text to print
    ELSEIF ...
    text to print
    ENDIF.
    hope this helps
    ec

  • How to debugg particular statement in sap script

    hi friends,
    i want to know How to debugg particular statement in sap script.
    plz reply.
    thanks in advance,
    regards
    bhaskar

    hi
      execute rstxdbug to activate script debugger...once the driver program reaches open_form, a popup box will come where u can mention the name of a command, call functinon, text element, etc to place a break point...once it gets into the debugging mode, double click on any line to set a break point, after that pressing f8 will get you to that line
    if helpful, reward
    Sathish. R

  • How to use perform and endperform in scripts

    Can anybody cleaerly explains me how to use perform and endperform in scripts with an example to add something extra dynamically to the standard script (like rvorder01).
    thanks in advance.
    regards
    anil.

    Check this example:
    In form
    PERFORM READ_TEXTS IN PROGRAM 'Z08M1_FORM_EKFORM1'
    USING &EKKO-EKORG&
    USING &EKPO-WERKS&
    USING &EKKO-EKGRP&
    USING &EKKO-BSTYP&
    CHANGING &COMPNAME&
    CHANGING &SENDADR&
    CHANGING &INVCADR&
    CHANGING &COMPADR&
    CHANGING &COVERLTR&
    CHANGING &SHIPADR&
    CHANGING &REMINDER&
    CHANGING &REJECTION&
    CHANGING &POSTADR&
    CHANGING &LOGO&
    ENDPERFORM
    In program
    FORM READ_TEXTS TABLES IN_PAR   STRUCTURE ITCSY
                           OUT_PAR  STRUCTURE ITCSY.
      DATA : L_EKORG TYPE EKORG,
             L_WERKS TYPE WERKS_D,
             L_BSTYP TYPE BSTYP,
             L_EKGRP TYPE BKGRP.
      READ TABLE IN_PAR WITH KEY 'EKKO-EKORG' .
      CHECK SY-SUBRC = 0.
      L_EKORG = IN_PAR-VALUE.
      READ TABLE IN_PAR WITH KEY 'EKPO-WERKS' .
      CHECK SY-SUBRC = 0.
      L_WERKS = IN_PAR-VALUE.
      READ TABLE IN_PAR WITH KEY 'EKKO-EKGRP' .
      CHECK SY-SUBRC = 0.
      L_EKGRP = IN_PAR-VALUE.
      READ TABLE IN_PAR WITH KEY 'EKKO-BSTYP' .
      CHECK SY-SUBRC = 0.
      L_BSTYP = IN_PAR-VALUE.
      CLEAR Z08M1_ORG_TEXTS.
      SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
                                              AND WERKS = L_WERKS
                                              AND EKGRP = L_EKGRP
                                              AND BSTYP = L_BSTYP.
      IF SY-SUBRC NE 0.
        SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
                                               AND WERKS = L_WERKS
                                               AND EKGRP = L_EKGRP
                                               AND BSTYP = SPACE.
      ENDIF.
      READ TABLE OUT_PAR WITH KEY 'COMPNAME'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COMP.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'SENDADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_ADRS.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'INVCADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_INVC.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'COMPADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_CPAD.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'COVERLTR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COVR.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'SHIPADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_SHIP.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'REMINDER'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RMDR.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'REJECTION'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RJCT.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'POSTADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_POST.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'LOGO'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_LOGO.
      MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.
    Check and let me know if u face any problem.
    Regards

  • How to use " PERFORM ", STATEMENT WITH OFFSET

    hI,
    How we use Perform statement with offset, like
      Example:   " PERFORM READ_SEGRELEASE USING INT_EDIDC+11."
    My requirement is to use Perform with Automatic length declaration.
    Automatic length declaration in PERFORM statement
    Kindly Explain and Provide some Example programm written in this situation.
    Thanks,
    P.N.Kumar

    Hiere is an example of what you probably require:
    DATA:
    lv_offset        TYPE syoffi,
    lv_length        TYPE flength,
    lv_field          TYPE string.
    lv_field  = 'This is my value: hello world'.
    lv_length = 5.
    lv_offset = 18.
    PERFORM read_segrelease USING lv_field
                                                            lv_length
                                                            lv_offset.
    *&      Form  READ_SEGRELEASE
    *       text
    *      -->P_LV_FIELD  text
    *      -->P_LV_LENGTH  text
    *      -->P_LV_OFFSET  text
    FORM read_segrelease USING    p_lv_field         TYPE string
                                                         p_lv_length      TYPE flength
                                                         p_lv_offset      TYPE syoffi.
      DATA:
      lv_result    TYPE string.
      lv_result = p_lv_field+p_lv_offset(p_lv_length).
      WRITE: / lv_result.
    ENDFORM.                    " READ_SEGRELEASE

  • How to use print control in Sap script

    I would like to use print control in Sap script.Actualy my problem I have security font Troy ECF. Using this font I would like to print amount field in Check printing.
    we count download this font with sap .we talked to customer care they told we should hard code in sapscript. pls can any1 help on this how to do and how to use print control for this fonts.

    call this funcation. crate_text.
    CALL FUNCTION 'CREATE_TEXT'
             EXPORTING
               FID               =
               FLANGUAGE         =
               FNAME             =
               FOBJECT           =
             SAVE_DIRECT       = 'X'
             FFORMAT           = '*'
             TABLES
               FLINES            =
           EXCEPTIONS
             NO_INIT           = 1
             NO_SAVE           = 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.

  • Perform statement in SAP scripts

    Hi experts,
    My requirement is that I don't want to display line items for particular customer with a particular item category, For this purpose I was asked to create a Z table with fields customer number(KUNNR) and Item category(PSTYV) and I have to make changes only in layout but not in driver program. So how do i do it? How to write preform statement in form layout which satisfies my requirement. And also in this perform statement I have to check if that customer and item category exists in that Z table. If so then I should not display the line item in the output else the line item should be displayed.
    Thanks in Adv.
    Vasu

    Hi,
    write this in script (Ex:Main Window)
    /:           PERFORM GET_COMM_CODE_DESC IN PROGRAM ZVPPACKL
    /:           USING &VBDPL-MATNR&
    /:           USING &VBDPL-WERKS&
    /:           USING &VBDPL-STAWN&
    /:           USING &VBDKL-ALAND&
    /:           CHANGING &STAWN&
    /:           CHANGING &TEXT1&
    /*           Begin of Insert -- PRAVIKAN -- DV2K933249 -- PR091808
    /:           CHANGING &W_COMMODITY_EU&
    /:           CHANGING &W_COMMODITY_DESC_EU&
    /*           End of Insert -- PRAVIKAN -- DV2K933249 -- PR091808
    /:           ENDPERFORM
    Driver program (ZVPPACKL)
    FORM get_comm_code_desc TABLES intab STRUCTURE itcsy
                                   outtab STRUCTURE itcsy.
      DATA: stawn LIKE t604t-stawn,
           matnr LIKE marc-matnr,                               "CL060501
           werks LIKE marc-werks,                               "CL060501
            land1 LIKE t604t-land1,
            text1 LIKE t604t-text1,
            w_commodity_eu       TYPE stawn,                    "PR092908
            w_commodity_desc_eu  TYPE bezei40.                  "PR092908
      READ TABLE intab WITH KEY name = 'VBDPL-MATNR'.           "CL060501
      matnr = intab-value.                                      "CL060501
      READ TABLE intab WITH KEY name = 'VBDPL-WERKS'.           "CL060501
      werks = intab-value.                                      "CL060501
      land1 = intab-value.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = matnr
        IMPORTING
          output = matnr.
      CLEAR: stawn,
             text1.
      SELECT SINGLE stawn
              INTO stawn
              FROM marc
             WHERE matnr = matnr
               AND werks = '3101'.
      IF NOT stawn IS INITIAL.
        SELECT SINGLE text1
                 INTO text1
                 FROM t604t
                WHERE spras = 'EN'
                  AND land1 = 'US'
                  AND stawn = stawn.
      ENDIF.
      CLEAR: w_commodity_eu,
             w_commodity_desc_eu.
      SELECT SINGLE stawn
              INTO w_commodity_eu
              FROM marc
             WHERE matnr = matnr
               AND werks = '0010'.
      IF NOT w_commodity_eu IS INITIAL.
        SELECT SINGLE text1
                 INTO w_commodity_desc_eu
                 FROM t604t
                WHERE spras = 'EN'
                  AND land1 = 'GB'
                  AND stawn = w_commodity_eu.
      ENDIF.
      READ TABLE outtab WITH KEY name = 'STAWN'.                "CL060501
      outtab-value = stawn.                                     "CL060501
      MODIFY outtab INDEX sy-tabix.
      READ TABLE outtab WITH KEY name = 'TEXT1'.
      outtab-value = text1.
      MODIFY outtab INDEX sy-tabix.
      READ TABLE outtab WITH KEY name = 'W_COMMODITY_EU'.
      IF sy-subrc EQ 0.
        outtab-value = w_commodity_eu.
        MODIFY outtab INDEX sy-tabix.
      ENDIF.
      READ TABLE outtab WITH KEY name = 'W_COMMODITY_DESC_EU'.
      IF sy-subrc EQ 0.
        outtab-value = w_commodity_desc_eu.
        MODIFY outtab INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    "GET_COMM_CODE_DESC
    Regards
    Krishna

  • How to use Standard text in SAP SCRIPTS

    Hi all,
    Please tell me how can we use the standard text what we have created in SO10 with sap scripts.

    Hi Gaurav
    You can create standard texts using the transaction SO10. Then to insert these standard texts in the SAPScript choose the menu, Insert->Text->Standard and choose the standard text that you want to choose.
    Alternatively, you can display standard texts in your SAP Scripts using the command:
    INCLUDE ZSTEXT OBJECT TEXT ID ST LANGUAGE EN
    where ZSTEXT refers to the Standard Text name.
    Reward pts if found usefull
    Regards
    Sathish:)

  • HOW TO USE PERFORM STATEMENT IN SMARTFORMS

    Hi,
    Can anyone tell me how to use call subroutine in smartform?
    Thanks & Regards,
    Gauarv.

    Hi,
    Hope this helps you..
    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.

  • How To use barcode in the sap scripts

    I have to put two windows in a form ,both windows should contain BARCODE
    so how i can proceed plz provide me solutions for same and possible few example code which can guide me .

    There is no change required to the print program the bar code conversion is handled by the SAPScript form.  What you do need to do is create a special character string.
    Simply click on the Character Formats button and then in standard attributes, select Bar Code in the appropriate field (it is labled Bar Code)  you probably need to talk to someone regarding which Bar Code format to use, since there is a quite a few  of them.
    Hope this helps.

  • How to use SPLIT statements in SAP

    I have a Variable which stores two field values like Purchase Order No and Date now I want to display this Value correctly from that Variable
    e.g VAR1 = PONO/Date
    How to print PONO on one line and Date on the other line from the VARIABLE VAR1.

    Hi Nandan,
    There are different ways to do this.
    Suppose your variable contains always a fixed length of two other values like PO number an Date.
    DATA: v_pono         TYPE ebeln,
          v_date         TYPE sydatum,
          v_variable(18) TYPE C.
    v_variable = '000001234520050201'.
    You can then read the parts like this:
    v_pono = v_variable+000(010).
    v_date = v_variable+010(008).
    Suppose your variable contains always a variable length of two other values like PO number an Date.
    DATA: v_pono         TYPE ebeln,
          v_date         TYPE sydatum,
          v_variable(20) TYPE C,
          v_table        LIKE v_variable OCCURS 0.
    v_variable = '12345/20050201'.
    You can then read the parts like this:
    SPLIT v_variable AT '/' INTO TABLE v_table.
    READ TABLE v_table INTO v_pono INDEX 1.
    READ TABLE v_table INTO v_date INDEX 2.
    Or you can use it like this:
    SPLIT v_variable AT '/' INTO v_pono v_date.
    Hope this gives you some clues.
    Regards,
    Rob.

  • How to use New page in SAP-Scripts

    Dear All,
    hope all are doing well, how to write a new page at new customer, with out blank page lastly.
    thanks.

    Hi,
    try this
    LOOP AT it_kna1.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element  = 'ELE1'
          function = 'SET'
          type     = 'BODY'
          window   = 'MAIN'.
      DESCRIBE TABLE it_kna1 LINES records.
      IF window LT records.
        window = window + 1.
        CALL FUNCTION 'CONTROL_FORM'
         EXPORTING
              command         = 'NEW-WINDOW'
    EXCEPTIONS
      UNOPENED        = 1
    UNSTARTED       = 2
    OTHERS          = 3
      ENDIF.
    ENDLOOP.
    thankx,
    raji.

  • Use of IF statement in SAP Scripts

    Can u tell me how to use IF statement in SAP Scripts.
    The problem is
    if &sy-tabix& eq '1'
    total
    else
    total1.
    endif.
    this sy-tabix is not working

    i think sy-tabix will not work here....
    do like this..
    data : vtabix type i.
    loop at itab.
    vtabix = sy-tabix.
    write_form...for the text element..
    endloop.
    in form layout
    /: if &vtabix(c)& eq 1
    /:endif
    regards
    shiba dutta

  • How 2 debug a Perform subroutine in sap script

    Hi,
    I have a perform endperform in Script. But tht is not working in some case. i m trying to debug but i m not able to go inside the routine and see wht it is doing? . can any one help me how to debug a subroutine in sap script.

    Hi Panigrahi,
    1) Put a break point in your perform.
    2)  YOu should change the dispatch option in your Output screen of the transaction which triggers your sap script. The dispatch option should be 1 (Send with a periodically scheduled job).
    Then save your transaction.
    3) Go to se38 and run the program RSNAST00.
    Give the Object Key as the Document Number for which you are triggering the script output.
    The control will stop in your perform.
    Regards,
    Ravi

  • Using Function Module in SAP Script

    Dear Friends,
    how can i use function modules in sap scripts?. i want to use call function SPELL_AMOUNT in sap script?
    in text element using perform statement hw can i use?
    Regarding i search related articles but, i am not getting any solution.
    Plz help Me.
    Regards,
    K.S.Kannan

    Dear Kanan,
    You can do it in two ways:
    Way1
    your Amount will be in some variable say VAR_AMT1 and want in words in field say VAR_SPELL.
    In your report program you can use the function module SPELL_AMOUNT and pass the  VAR_AMT1 to it and you will get the words in VAR_SPELL.
    So now in your sap script you can use the variable  VAR_SPELL to print the amount in words.
    we normally use this above method.
    WAY2
    You are inside Sap script and you can write the following code in the sap Script window.
    /: PERFORM AMT_TEXT IN PROGRAM ZF_REPORT USING &VAR_AMT1& CHANGING &VAR_SPELL&
    /: ENDPERFORM
    In the Tag Column when you press F4 you can see various symbols like
    /: =  ( / /= /( /: /* /E
    . Select
    In the program ZF_REPORT (any report) you should have the perform AMT_TEXT  where you should use the function module SPELL_AMOUNT to convert the amount into words.
    Hope its Clear.

Maybe you are looking for

  • Booklet printing to tabloid

    I hope I am posting this correctly. I thought I could get telephone assistance regardless of the cost. My reputation is hanging on this. I would pay any amount at this point. For years I have printed the same tabloid size art catalog from inDesign (C

  • Camera connection kit not working the same on IOS 5 as it did on IOS 4. Bugs or deliberate features?

    Using the Camera connection kit Previously downloaded files were recognised and only new pictures were uploaded. Doesn't seem to work in IOS 5. I was using the Ipad as a photos backup and display device.

  • Yosemite: Western Digital External Drives fully supported?

    I use a Western Digital My Book Studio Edition II 2TB via FireWire as my TimeMachine backup drive. I still run Mavericks on my iMac 27" 2012 model (Core i5, 2.9 Ghz, 8GB Ram, 1TB Fusion drive). It had no problems with Mavericks since I updated to wd

  • Can not publish to MMe-bug or am I missing something?

    I am unable to publish to MMe from whitin Aperture. I have the album icon showing in the library pane, it sinchronizes for some time, but the album doesn't show on Mobile Me. When I go to Preferences, Web, the program freezes and I have to force-quit

  • Sonido de Ventilación - Flex 20

    Buen día. Acabo de adquirir un equipo Flex 20, todo bien, hasta que comence a escuchar un sonido vastante extraño en la parte de la ventilación.  Podrian ayudarme con este problema. Les agrego el sonido que tiene el equipo. sonido ventilacion