Skip to Content
avatar image
Former Member

perform statement in sapscript

Hi Friends,

can any body send me the sample code for calling a perform statement in sapscript. ie..perform <form name> in program <pgname> using....changing...

i want sample code for pgname..

thanks in Advance..

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    May 24, 2006 at 02:42 PM

    Hi,

    A sample perform in script :

    /:PERFORM GET_DATA IN PROGRAM ZPGM1

    /:USING &V_EBELN&

    /:CHANGING &V_NAME1&

    /:ENDPERFORM

    this is a sample form program,

    FORM GET_DATA TABLES ITAB STRUCTURE ITCSY

    OTAB STRUCTURE ITCSY.

    DATA : V_EBELN LIKE EKKO-EBELN,

    V_NAME1 LIKE EKKO-ERNAM,

    P_NAME1 LIKE EKKO-ERNAM.

    READ TABLE ITAB WITH KEY NAME = 'V_EBELN'.

    IF SY-SUBRC = 0.

    V_EBELN = ITAB-VALUE.

    SELECT SINGLE ERNAM FROM EKKO INTO V_NAME1

    WHERE EBELN = V_EBELN.

    IF SY-SUBRC = 0.

    READ TABLE OTAB WITH KEY NAME = 'V_NAME1'.

    IF SY-SUBRC = 0.

    OTAB-VALUE = V_NAME1.

    MODIFY OTAB INDEX SY-TABIX.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDFORM. "GET_DATA

    Regards,

    Aswin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 24, 2006 at 02:43 PM

    hii

    PERFORM 1000_GET_VAT_RATE IN PROGRAM ZPROGRAM

    USING &KNUMV&

    .....

    ENDPERFORM

    check this link

    http://www.sapdevelopment.co.uk/sapscript/sapscript_executeabap.htm

    DATA : c1 TYPE i, c2 TYPE i, res TYPE i.

    c1 = 1.

    c2 = 2.

    data: subroutinename(3) VALUE 'SUM'.

    PERFORM (subroutinename) IN PROGRAM Y_JJTEST1USING c1 c2 CHANGING res.

    *WRITE:/ res.

    *&----


    *

    *& Form sum

    *&----


    *

    • text

    *----


    *

    form sum using p_c1 p_c2 changing value(p_res).

    p_res = p_c1 + p_c2.

    endform. " sum

    plzz reward points for the helpful

    Regards

    Naresh

    Add comment
    10|10000 characters needed characters exceeded

  • May 24, 2006 at 02:43 PM

    IN SCRIPT:

    /: PERFORM GET_BARCODE6 IN PROGRAM ZVXR0076

    /* USING &BARCV&

    /: USING &BARC6&

    /: CHANGING &BARCODE&

    /: ENDPERFORM

    IN PROGRAM ZVXR0076

    FORM get_barcode TABLES sap_data STRUCTURE itcsy

    abap_data STRUCTURE itcsy.

    DATA : barcv LIKE karte-barcv,

    barcode(11).

    READ TABLE sap_data WITH KEY name = 'BARCV'.

    IF sy-subrc EQ 0.

    MOVE sap_data-value TO barcv.

    ENDIF.

    WRITE barcv TO barcode NO-ZERO.

    CONDENSE barcode NO-GAPS.

    READ TABLE abap_data WITH KEY name = 'BARCODE'.

    IF sy-subrc EQ 0.

    abap_data-value = barcode.

    MODIFY abap_data INDEX sy-tabix.

    ENDIF.

    ENDFORM. "GET_BARCODE

    REgards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • May 24, 2006 at 02:47 PM

    Hi Jak,

    check this sample..

    /:   PERFORM GET_UNITS IN PROGRAM ZGET_MASTER
    /:   USING &EKPO-MATNR&
    /:   CHANGING &V_UMREZ&
    /:   CHANGING &V_LAENG&
    /:   CHANGING &V_BREIT&
    /:   CHANGING &V_HOEHE&
    /:   CHANGING &V_MEABM&
    /:   CHANGING &V_BRGEW&
    /:   CHANGING &V_GEWEI&
    /:   CHANGING &V_EAN11&
    /:   CHANGING &V_MATNR&
    /:   ENDPERFORM
    
    Logic to be written in Z Program
    
    REPORT  zget_master         .        
                .
    FORM get_units TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.
      CLEAR v_matnr.
      READ TABLE in_tab INDEX 1.
      CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
        EXPORTING
          input  = in_tab-value
        IMPORTING
          output = v_matnr.
      SELECT SINGLE matnr                 "Material number
                    umrez                 "Numerator for conversion
                    ean11                 "International article number
                    laeng                 "Length
                    breit                 "Width
                    hoehe                 "Height
                    meabm                 "Unit dimension for (L,W,H)
                    brgew                 "Gross weight
                    gewei                 "Weight unit
                    FROM marm
                    INTO
      (v_matnr,v_umrez,v_ean11,v_laeng,v_breit,v_hoehe,v_meabm,v_brgew,
       v_gewei)
                    WHERE matnr = v_matnr
                    AND  meinh  = c_meinh2.
      IF sy-subrc = 0.
        READ TABLE out_tab INDEX 1.
        MOVE v_umrez TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 2.
        MOVE v_laeng TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 3.
        MOVE v_breit TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 4.
        MOVE v_hoehe TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 5.
        MOVE v_meabm TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 6.
        MOVE v_brgew TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 7.
        MOVE v_gewei TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
        READ TABLE out_tab INDEX 8.
        MOVE v_ean11 TO out_tab-value.
        CONDENSE out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
    
    *    READ TABLE out_tab INDEX 9.
    *    MOVE v_matnr TO out_tab-value.
    *    CONDENSE out_tab-value.
    *    MODIFY out_tab INDEX sy-tabix.
      ENDIF.
      READ TABLE out_tab INDEX 9.
      MOVE v_matnr TO out_tab-value.
      CONDENSE out_tab-value.
      MODIFY out_tab INDEX sy-tabix.
    
    ENDFORM.                    "get_units

    regards

    vijay

    Regards

    vijay

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      because the date is represented in external format, first use function CONVERT_DATE_TO_INTERNAL, then add numer of days, then write result to parameter field.

      Hope you know the sapscript perform paramter stuff.

      Regards,

      Clemens

  • avatar image
    Former Member
    May 24, 2006 at 02:48 PM

    PERFORM : It is used to call an ABAP/4

    subroutine from any SE38 program.

    /: 
    PERFORM <form_name> IN PROGRAM <prog>
    /: USING &INVAR1&…..
    /: CHANGING &OUTVAR1&…..
    /: ENDPERFORM

    SE38 program for Perform stmt

    Form <form_name> 
    	Tables itab like itcsy,
    			otab like itcsy.
    - - - - - - - - - -  Coding
     Endform

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 24, 2006 at 02:59 PM

    Hi kumar,

    check the sample code

    this is a program where the subroutine is handled:

    REPORT ZVKKSCRIPTS1 .

    data: v_mat like mara-matnr,

    var1 like makt-maktx.

    form subroutine tables itab structure itcsy

    otab structure itcsy.

    read table itab with key name = 'IT_VBAP-MATNR'.

    if sy-subrc = 0.

    v_mat = itab-value.

    select single maktx from makt into var1

    where matnr = v_mat and

    spras = sy-langu.

    if sy-subrc = 0.

    read table otab with key name = 'VAR1'.

    if sy-subrc = 0.

    otab-value = var1.

    modify otab index sy-tabix.

    endif.

    endif.

    endif.

    endform.

    this is the driver program

    REPORT ZVKKDRIVE .

    tables: mara.

    data: it_vbap like mara occurs 0 with header line.

    select-options: s_matnr for mara-matnr.

    start-of-selection.

    select * from mara into table it_vbap where matnr in s_matnr.

    CALL FUNCTION 'OPEN_FORM'

    EXPORTING

    • APPLICATION = 'TX'

    • ARCHIVE_INDEX =

    • ARCHIVE_PARAMS =

    • DEVICE = 'PRINTER'

    • DIALOG = 'X'

    FORM = 'ZVKK1'

    • 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.

    loop at it_vbap.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    • ELEMENT = ' '

    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.

    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.

    award if it helps.

    regards,

    keerthi.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 24, 2006 at 03:13 PM

    Hii

    check this fm

    WDKAL_DATE_ADD_FKDAYS

    Add comment
    10|10000 characters needed characters exceeded