Skip to Content
author's profile photo Former Member
Former Member

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Oct 14, 2006 at 06:35 AM

    hi,

    chk this link

    http://www.sap-basis-abap.com//abap/how-to-call-a-subroutine-form-sapscripts.htm

    more help on this.

    here is the total logic for your requirement.

    in the script layout,

    /: PERFORM Get_Pack IN PROGRAM ZTEST

    /: USING &V_FIELD1&

    /: USING &V_FIELD2&

    /: CHANGING &RESULT&

    *----and so onn

    /: ENDPERFORM

    /* HERE WE are printing the result

    • result : &RESULT&

    Then in the program,

    all the paramters you pass from SCRIPT with USING command will come into ITAB.

    all parameters with CHANGING command will comes into OTAB

    FORM Get_Pack TABLES ITAB STRUCTURE ITCSY

    OTAB STRUCTURE ITCSY.

    data: v_field1 type i,

    v_field2 type i,

    v_result type i.

    *--TO read the values from the ITAB you have to use this logic.

    READ TABLE ITAB WITH KEY NAME = 'V_FIELD1'

    TRANSPORTING VALUE.

    IF SY-SUBRC = 0.

    CONDENSE ITAB-VALUE.

    V_FIELD1 = ITAB-VALUE.

    ENDIF.

    READ TABLE ITAB WITH KEY NAME = 'V_FIELD2'

    TRANSPORTING VALUE.

    IF SY-SUBRC = 0.

    CONDENSE ITAB-VALUE.

    V_FIELD2 = ITAB-VALUE.

    ENDIF.

    *--to modify PACK value

    *--write your logic to get the value inTO RESULT.

    V_RESULT = V_FIELD1 + V_FIELD2.

    OTAB-VALUE = V_RESULT.

    condense OTAB-VALUE.

    MODIFY OTAB TRANSPORTING VALUE

    WHERE NAME = 'RESULT'.

    ENDFORM.

    You can create the program either as Executable or subroutine pool in SE38. there will not be any difference,i guess.

    Regards,

    anver

    hi anil kindly close the othere thread regrding ALV row color, if ur issue solved

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2006 at 06:40 AM

    Hi anil,

    This link gives you a simple example.

    http://help.sap.com/saphelp_47x200/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm

    Reward with points if it is helpful

    Regards

    Alfred

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2006 at 04:22 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.