Sub-routines in scripts

Hi Everybody,
             i have copied the standard script F140_DOCU_EXC_01 into zf140_doc, in that form i need to caluculate Net amount in text element 521 in main window. for that i have written the subroutine.
PERFORM <subroutin_name> IN PROGRAM <prog_name>
USING <parms>
CHANGING <parms>
ENDFORM.
FORM <form_name> TABLES in_var type ITCSY
out_var type ITCSY.
endform.
the above code is not a complete one.i need to caluculate the net amount (&RF140-WRSHB). i am not able to calucualte the net amount, i mean from where should i get the data. and y do u we need the ITCSY stru.. could some one help me with a code.
  Thanks
Srikanth

Looks like there are a hand full which use this structure in the program.
J_1HKORD                         Print Program: Document Extract                           
RFCASH00                         Cash Journal                                              
RFKORB00                         Internal Documents                                        
RFKORD00                         Print Program: Payment Notice                             
RFKORD10                         Print Program: Account Statement                          
RFKORD11                         Print Program: Customer Statement                         
RFKORD20                         Print Program: Charges for a Bill of Exchange             
RFKORD30                         Print Program: Internal Documents                         
RFKORD40                         Print Program: Individual Letters and Standard Letters    
RFKORD50                         Print Program: Document Extract                           
RFKORD60                         Print Program: Failed Payments                            
RFKORD70                         Print Program: Periodic Settlement                        
RFKORD80                         Print Program: Cash Documents                             
RFKORDC1                         Print Program: Cash Receipts for Czech Republic and Slovaki
RFKORDJ1                         Receipt after Payment (Japan)                             
RFKORDJ2                         Receipt Before Payment (Japan)                            
RFKORDJ3                         Receipt - Cleared (Japan)                                 
RFKORDJ4                         Print Program: Statement of Account (Period. Billing)     
RFKORDP1                         Printout of Official Receipts After Payment (Philippines) 
RFKORDP2                         Printout of Official Receipts Before Payment (Philippines)
RFKORDP3                         Printout of Customer Statements (Philippines)             
RFKORDR1                         Print Program: Internal Docs for Confederation of Independe
RFKORDR2                         Print Program: Cash Documents                             
What exactly are you doing.....anything here ring a bell?
Regards,
Rich Heilman

Similar Messages

  • Calling external sub-routine from script

    asap.

    this simple example can help you out i hope.
    in the script,
    /: PERFORM WAREHOUSE IN PROGRAM ZWAREHOUSE
    /: USING &WERKS&
    /: USING &LGORT&
    /: CHANGING &FLAG&
    /: ENDPERFORM
    /: IF &FLAG& NE 'X'
    <print the data>
    /: ENDIF
    in the program zwarehouse,
    FORM warehouse TABLES fp_in STRUCTURE itcsy
    fp_out STRUCTURE itcsy.
    TABLES t320.
    DATA : l_werks LIKE resbd-werks,
    l_lgort LIKE resbd-lgort,
    l_flag(1) type c.
    clear : l_werks, l_lgort, l_FLAG.
    READ TABLE fp_in INDEX 1.
    l_werks = fp_in-value.
    READ TABLE fp_in INDEX 2.
    l_lgort = fp_in-value.
    SELECT SINGLE *
    FROM t320
    WHERE werks EQ l_werks AND
    lgort EQ l_lgort.
    IF SY-SUBRC EQ 0.
    l_flag = 'X'.
    ENDIF.
    READ TABLE fp_out INDEX 1.
    fp_out-value = l_flag.
    MODIFY fp_out INDEX sy-tabix.
    ENDFORM. "WAREHOUSE

  • How to on Debugging Mode for T-Code F110 from Script in Sub routine Pool Pr

    Hi Every one....
    I have done SAP-Script for Payment Vocher for T-code F110 ..I have a Sub Routine Program where I have few Form statements which is called by SAP - Script using Perform Statements, But my problem is when I set a break point in Sub Routine pool program, the out put is issuing with out Debugger ...
    Could any one plz suggest me wht to do???
    Help ful answers will be rewarded....
    Regards,
    sg

    Hi,
    First see if the 'Perform' statement is getting triggered in Script. To put a breakpoint in any script ( even if you do not know the form name, that is the best part ) is se38---->RSTXDBUG --->F8 & execute your pgm/Transaction. The control will wait in the form-debugger.
    I hope this helps,
    Regards
    Raju Chitale

  • Select statement in a sub routine(For Sapscript)

    Hi,
    M unable to write select statement for my reqirement in Sap-script in Sub routine.
    My requirement is 1)"Your correspondent for quality" in main window of my form.
    For dis rule is as below
    "Get the 'changed by' value resord in table QCPR field AENDERER.For the same value found in tabe USR21 fiels BNAME,pick up the PERSUNUM value.For dis PERSUNUM value, found in ADRP feild NAME_TEXT the value for "Your Correspondent for Quality".
    2) For this PERSUNUM value found in ADCP-TEL_NUMBER the vakue for "Ph".
    3)For this PERSUNUM value found in ADCP-FAX_NUMBER the vakue for "FAX".
    4For this PERSUNUM value found in ADR6-SMTP_ADDR the vakue for "EMAIL".
    Please help me out it's urgent for me.I wil b waiting 4 ur reply.

    READ TABLE in_par WITH KEY 'QCPR-AENDERER'.
      CHECK sy-subrc = 0.
      MOVE in_par-value TO V_aenderer
    .  READ TABLE in_par WITH KEY 'USR21-BNAME.
      CHECK sy-subrc = 0.
      MOVE in_par-value TO V_bname
      SELECT SINGLE persnumber addrnumber
        INTO wa_usr21-persnumber wa_usr21-addrnumber
        FROM usr21
        WHERE bname = V_bname
    and <b>check field for this</b> = V_aenderer.
      CHECK sy-subrc = 0.
      SELECT SINGLE tel_number fax_number
        INTO adcp-tel_number adcp-fax_number
        FROM adcp
        WHERE addrnumber = usr21-addrnumber
          AND persnumber = usr21-persnumber.
      CHECK sy-subrc = 0.
      READ TABLE out_par WITH KEY 'ADCP-TEL_NUMBER'.
      CHECK sy-subrc = 0.
      out_par-value = adcp-tel_number.
      MODIFY out_par INDEX sy-tabix.
      READ TABLE out_par WITH KEY 'ADCP-FAX_NUMBER'.
      CHECK sy-subrc = 0.
      out_par-value = adcp-fax_number.
      MODIFY out_par INDEX sy-tabix.
      SELECT SINGLE smtp_addr
        INTO adr6-smtp_addr
        FROM adr6
        WHERE addrnumber = usr21-addrnumber
          AND persnumber = usr21-persnumber.
      READ TABLE out_par WITH KEY 'ADR6-SMTP_ADDR'.
      CHECK sy-subrc = 0.
      out_par-value = adr6-smtp_addr.
      MODIFY out_par INDEX sy-tabix.
    Regards

  • How do we write the sub routines in smart forms?

    1) How do we write the sub routines in smart forms?
    2) What is the’ form interface’ in smart forms?
    3) Write down the path for writing for select queries in smart forms?
    4) How do we put dynamic page break in smart forms?
    5) in which system field contain the total page number of all forms in the currently processed print request in smart forms?
    6) What is the name of function module used to calling smart forms?
    1)     What is the functionality of function module ‘controal_form’?
    2)     How do we print the system date in this format ’15th Jan 2008’ on scripts?
    3)     What r the various print modes available in scripts?
    4)     What is the tcode for text element?
    5)     How do we draw horizontal line in scripts?
    6)     How can we suppress the leading zeros for a field in scripts?
    7)     In which system field is used to print current no page in scripts?
    Which f.m is used to reads text in sap scripts

    1) How do we write the sub routines in smart forms?
    after opening form see global definitions
    click on that there one tab called form routines inthat you can write subroutines logic.
    You can call in program lines .
    2) What is the’ form interface’ in smart forms?
    It is an interface between program and form .
    like function module we provide import,export,tables,exceptions
    Based on import and export parameters form will display for us.
    3) Write down the path for writing for select queries in smart forms?
    On window give right click in that command->programlines
    you can write all select  statements.
    4) How do we put dynamic page break in smart forms?
    you can define break point using break-point<>. syntax.
    5) in which system field contain the total page number of all forms in the currently processed print request in smart forms?
    SFSY-PAGE
    SFSY-JOBPAGES
    6) What is the name of function module used to calling smart forms?
    SSF_FUNCTION_MODULE_NAME
    =================
    1) What is the functionality of function module ‘control_form’?
    This function module is used to insert SAPScript control commands like NEW-PAGE etc from whithin the ABAP program.
    CALL FUNCTION 'CONTROL_FORM'
    EXPORTING
      COMMAND    =
    EXCEPTIONS
      UNOPENED   = 1
      OTHERS        = 3
    IF SY-SUBRC NE 0.
    MESSAGE ...
    ENDIF.
    2) How do we print the system date in this format ’15th Jan 2008’ on scripts?
    Use SET DATE MASK to change format of date display.
    3) What r the various print modes available in scripts?
    4) What is the tcode for text element?
    se91
    5) How do we draw horizontal line in scripts?
    &ULINE&
    6) How can we suppress the leading zeros for a field in scripts?
    &it_vbak-vbeln(Z)&
    7) In which system field is used to print current no page in scripts?
    &SYST-PAGE& of &SYST-FORMPAGES&
    Which f.m is used to reads text in sap scripts
    READ_TEXT functiomodule.
    Reward points

  • How do i make this a sub routine

    I have a little script to drill down folders and add comments to every folder and ever file inside the parent folder. It works perfectly well when run but itself. This was based heavily on the script found by NovaScotian here http://discussions.apple.com/thread.jspa?messageID=2182916&#2182916
    I basically want to make this script into a sub routine, and i have tried various methods and havent been able to make it work.
    global the_comments
    global each_item
    global pete
    global ddp
    global ddp2
    set ddp to {}
    set ddp2 to {}
    set theLetter to "s"
    set newDroppedFiles to choose folder with multiple selections allowed
    to drilldown(afolder)
    tell application "Finder"
    set file_list to files of a_folder
    set folder_list to folders of a_folder
    end tell
    repeat with i in file_list
    processDrilledDownFile(i)
    tell application "Finder"
    set comment of pete to text of the_comments
    end tell
    end repeat
    repeat with i in folder_list
    copy i to end of ddp2
    drill_down(i)
    end repeat
    end drill_down
    on processDrilledDownFile(a_file)
    copy a_file to end of ddp
    end processDrilledDownFile
    set the_comments to (do shell script "/usr/bin/defaults read com.Rich.move " & theLetter & "Text")
    repeat with each_item in newDroppedFiles
    set pete to each_item
    tell application "Finder"
    set comment of each_item to text of the_comments
    end tell
    drill_down(pete)
    end repeat
    repeat with each_item in ddp
    tell application "Finder"
    set comment of each_item to text of the_comments
    end tell
    end repeat
    repeat with each_item in ddp2
    tell application "Finder"
    set comment of each_item to text of the_comments
    end tell
    end repeat
    regards
    Rich

    Your script already includes several subroutines, so the trick is separating those out first.
    Essentially your script consists of three elements - global declarations, your own subroutines and a run handler. Since there's no explicit 'on run', everything that's not inside a subroutine becomes the run handler.
    Therefore what you should do is strip out all the code that's not a global declaration or an existing handler and just wrap that in a new 'on subroutinename()... end subroutinename' block.
    For sanity's sake I'd also add a specific run handler to bind it all together.
    This means you'll end up with something like:
    <pre class=command>global the_comments
    global each_item
    global pete
    global ddp
    global ddp2
    on run
    my myNiftySubroutine()
    end run
    to drilldown(afolder)
    tell application "Finder"
    set file_list to files of a_folder
    set folder_list to folders of a_folder
    end tell
    repeat with i in file_list
    processDrilledDownFile(i)
    tell application "Finder"
    set comment of pete to text of the_comments
    end tell
    end repeat
    repeat with i in folder_list
    copy i to end of ddp2
    drill_down(i)
    end repeat
    end drill_down
    on processDrilledDownFile(a_file)
    copy a_file to end of ddp
    end processDrilledDownFile
    on myNiftySubroutine()
    set ddp to {}
    set ddp2 to {}
    set theLetter to "s"
    set newDroppedFiles to choose folder with multiple selections allowed
    set the_comments to (do shell script "/usr/bin/defaults read com.Rich.move " & theLetter & "Text")
    repeat with each_item in newDroppedFiles
    set pete to each_item
    tell application "Finder"
    set comment of each_item to text of the_comments
    end tell
    drill_down(pete)
    end repeat
    repeat with each_item in ddp
    tell application "Finder"
    set comment of each_item to text of the_comments
    end tell
    end repeat
    repeat with each_item in ddp2
    tell application "Finder"
    set comment of each_item to text of the_comments
    end tell
    end repeat
    end myNiftySubroutine</pre>
    There's just one other observation - most of the globals are not actually needed since you can just pass them as parameters to the subroutines.
    I'm also not sure what the purpose of the script is - the upshot seems to be that you're setting the comment of items in the Finder, however, since you:
    <pre class=command> set comment of pete to text of the_comments</pre>
    and pete is a global pointing to the folder you're processing, surely this sets the comment of the folder x times, where x is the number of files in the folder - in other words if there are 100 files in the folder, you set the comment of the folder 100 times and don't touch the files themselves. Is that what you intend?

  • How do we define a sub-routine in a subroutine pool

    How do we define a sub-routine in a subroutine pool and how do we call the same in an executable program

    Hi
    Go to SE38.Create a program and in the program type select Subroutine pool.Inside this u can code for teh various subroutines or forms.
    For calling these forms these forms in ur main program refer below link:
    <u>http://help.sap.com/saphelp_nw04/helpdata/en/9f/db999535c111d1829f0000e829fbfe/content.htm</u>
    Sample code:
    Below is the subroutine pool used in the creation of the SAP Script:
    Program Name : Z689_SUBROUTINE
    Date          : 03/28/2007
    Author        : Sayee Manojnah Kasala
    Description  : This is the subroutine used for SAP Script,
                   Z689_SAPSCRIPT.It fetches customer details like
                    customer name & place
    PROGRAM  Z689_SUBROUTINE.
    Form GET_LAND1
    Fetches the country key
    *&      Form  get_land1
          text
         -->INTABLE    text
         -->OUTTABLE   text
    FORM get_land1 TABLES intable STRUCTURE itcsy
                          outtable STRUCTURE itcsy.
      DATA: v_kunnr LIKE kna1-kunnr,
            v_land1 LIKE kna1-land1,
            v_name1 LIKE kna1-name1.
      READ TABLE intable INDEX 1.
      v_kunnr = intable-value.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = v_kunnr
        IMPORTING
          output = v_kunnr.
      IF sy-subrc = 0.
        SELECT SINGLE land1
          FROM kna1
          INTO v_land1
          WHERE kunnr = v_kunnr.
        IF sy-subrc = 0.
          READ TABLE outtable INDEX 1.
          outtable-value = v_land1.
          MODIFY outtable INDEX 1.
        ENDIF.
        SELECT SINGLE name1
          FROM kna1
          INTO v_name1
          WHERE kunnr = v_kunnr.
        IF sy-subrc = 0.
          READ TABLE outtable INDEX 2.
          outtable-value = v_name1.
          MODIFY outtable INDEX 2.
        ENDIF.
      ENDIF.
      CLEAR: intable,outtable.
    ENDFORM.                                                    "get_land1
    Form GET_LANDX
    Fetches the Country Name
    *&      Form  get_landx
          text
         -->INTABLE    text
         -->OUTTABLE   text
    FORM get_landx TABLES intable STRUCTURE itcsy
                          outtable STRUCTURE itcsy.
      DATA: v_land1 LIKE kna1-land1,
            v_landx LIKE t005t-landx.
      READ TABLE intable INDEX 1.
      v_land1 = intable-value.
      IF sy-subrc = 0.
        SELECT SINGLE landx
          FROM t005t
          INTO v_landx
          WHERE land1 = v_land1 AND spras = 'E'.
        IF sy-subrc = 0.
          READ TABLE outtable INDEX 1.
          outtable-value = v_landx.
          MODIFY outtable INDEX 1.
        ENDIF.
      ENDIF.
      CLEAR: intable,outtable.
    ENDFORM.                    "get_landx
    It can be called as follows:
    PERFORM GET_LANDX IN PROGRAM Z689_SUBROUTINE
    USING &V_LAND1&
    CHANGING&V_LANDX&
    ENDPERFORM.
    Reward points if found useful.
    Thanks
    Vasudha
    Message was edited by:
            Vasudha L

  • Dynamic TABLE parameter in Sub routine call

    Hi,
    Is it possible to have a dynamic TABLE parameter in a sub-routine call? The structure of the internal table will be different during different calls to the sub-routine.
    I have a subroutine which has the FM "HR_INFOTYPE_OPERATION" to update the infotype data for an Applicant. Now i want to call this subroutine for every Infotype update. So every time the structure of the internal table to be passed will vary depending on Infotype ( eg P0002 for Infotype 0002, p0006 for infotype 0006).
    Any pointers will be appreciated.
    Thanks in advance.

    Hi Navin,
    yes, why not.
    just use a generic type parameter, i.e.
    FORM process USING IT_00x type table IV_type typc.
    It depend what yout FORM shall do. If you pass the types name, you can dynamically assign to a field-symbol of the respective type.
    Regards,
    Clemens

  • Passing parametrs to Sub routines

    Hi all,
    Please tell me how to pass the Parameters  as message number and message id for an SUB ROUTINE.If possible please give me the sample code.
    Regards
    Ajay

    declare
    data : message_nm type  sy-msgno,
            sys_id type sy-repid.
    simply write rthe oerform AS
    perform sample_form using message_nm
                                            sys_id
    then in the form.
    form sample_form using message_nm type sy-msgno
                                            sys_id type sy-repid .
    endform.
    reward points if useful...
    Edited by: Rudra Prasanna Mohapatra on Jun 25, 2008 1:41 PM

  • Include or sub-routine in user-exit

    Hi all,
    i want to put  a sub-routine in my customer user-exit (CMOD).but i can not put the subroutine.
    can i put a subroutine or include statement in a user exit?
    correct answers will be rewarded.
    Thanks
    pabi

    You can make subroutine calls inside a User exit, only if the exit is part of a function pool. All the subroutines can be placed in an include in the function pool & can be called with a Perform Statement from the User Exit.
    ~Suresh

  • Urgent!!!!Related To SUB-ROUTINES

    Hi All,
    I have 2 subroutines.My problem is that if a particular sub-routine is terminated in middle for any reason my second sub-routine should not get called.How can i know that?Please answer my question as soon as possible.
    Useful answers will be rewarded with points.
    Regards,
    Chaitanya.
    Message was edited by:
            LEELA KRISHNA SAI CHAITANYA

    Hi leela,
    you can use one global variable for this as flag.
    ex:
    data flag type c.
    perform sub1.
    if flag = 'X'.
    perform sub2.
    endif.
    form sub1.
    if (condition yes).
       flag = 'X'.
    endif.
    endform.
    form sub2.
    endform.
    this will work well

  • Smart forms not displaying result from sub routine

    I am working on a smart form and need to display the description of the fabric code. Under Form Routines, I create a sub routine
    FORM fcc_values USING gv_fabrictext.
    which is supposed to store the description in gv_fabrictext. GV_FABRICTEXT has been declared in global data as char64. Then I call prior to displaying my table as
    perform fcc_values using gv_fabrictext.
    And then insert the field &gv_fabrictext& in cell but this does not display any result
    I know for sure that this sub routine works as I have tested it separately as a test program. Any ideas?

    1. put break point at ssf_function madulename and check field value.
    or
    2 fm_name export parameter ur not mentioned
    or
    3 global variable not defined properly
    go through above. still if u didnt get
    need program where the problem to find.
    Message was edited by:
            Deepa KN

  • Reg, sub routine

    how can u call a sub-routine from other programmes?

    Hi,
    Start of Content Area
    Naming Subroutines Locate the document in its SAP Library structure
    With the PERFORM statement, you can call subroutines which are coded in the same ABAP program (internal calls), or subroutines which are coded in other ABAP programs (external calls).
    You can also specify the name of the subroutine dynamically at runtime, and call subroutines from a list.
    Internal Subroutine Calls
    To call a subroutine defined in the same program, you need only specify its name in the PERFORM statement:
    PERFORM subr [USING    p1 p2... ]
                 [CHANGING p1 p2... ].
    The internal subroutine can access all of the global data of the calling program.
    Example
    REPORT demo_mod_tech_perform_int.
    DATA: num1 TYPE i,
          num2 TYPE i,
          sum  TYPE i.
    num1 = 2. num2 = 4.
    PERFORM addit.
    num1 = 7. num2 = 11.
    PERFORM addit.
    FORM addit.
      sum = num1 + num2.
      PERFORM out.
    ENDFORM.
    FORM out.
      WRITE: / 'Sum of', num1, 'and', num2, 'is', sum.
    ENDFORM.
    This produces the following output:
    Sum of          2 and          4 is          6
    Sum of          7 and         11 is         18
    In this example the subroutines addit and out are defined at the end of the program. addit is called by the program and out is called by addit. The subroutines have access to the global fields num1, num2 und sum.
    External Subroutine Calls
    The principal function of subroutines is for modularizing and structuring local programs. However, subroutines can also be called externally from other ABAP programs. In an extreme case, you might have an ABAP program that contained nothing but subroutines. These programs cannot run on their own, but are used by other ABAP programs as pools of external subroutines.
    However, if you want to make a function available throughout the system, you should use function modules instead of external subroutines. You create function modules in the ABAP Workbench using the Function Builder. They are stored in a central library, and have a defined release procedure.
    You can encapsulate functions and data in the attributes and methods of classes in ABAP Objects. For any requirements that exceed pure functions, you can use global classes instead of external subroutines.
    When you call a subroutine externally, you must know the name of the program in which it is defined:
    PERFORM subr(prog) [USING    p1 p2... ]
                       [CHANGING p1 p2... ] [IF FOUND].
    You specify the program name prog statically. You can use the IF FOUND option to prevent a runtime error from occurring if the program progdoes not contain a subroutine subr. In this case, the system simply ignores the PERFORM statement.
    When you call an external subroutine, the system loads the whole of the program containing the subroutine into the internal session of the calling program (if it has not already been loaded). In order to save memory space, you should keep the number of subroutines called in different programs to a minimum.
    Example
    Suppose a program contains the following subroutine:
    REPORT formpool.
    FORM header.
      WRITE: / 'Program started by', sy-uname,
             / 'on host', sy-host,
               'date:', sy-datum, 'time:', sy-uzeit.
      ULINE.
    ENDFORM.
    The subroutine can then be called from another program as follows:
    REPORT demo_mod_tech_perform_ext.
    PERFORM header(demo_mod_tech_formpool_1) IF FOUND.
    In this example, no data is passed between the calling program and the subroutine.
    Specifying Subroutines Dynamically
    You can specify the name of a subroutine and, in the case of external calls, the name of the program in which it occurs, dynamically as follows:
    PERFORM (fsubr)[IN PROGRAM (fprog)][USING    p1 p2... ]
                                       [CHANGING p1 p2... ]
                                       [IF FOUND].
    The names of the subroutine and the external program are the contents of the fields fsubr und fprogrespectively. By using the option IF FOUND, you can prevent a runtime error from being triggered if no subroutine with the name fsubr is found. If you omit the parentheses, this variant of the PERFORMstatement behaves like the static variant.
    Example
    Assume a program contains the following subroutines:
    PROGRAM formpool.
    FORM sub1.
      WRITE: / 'Subroutine 1'.
    ENDFORM.
    FORM sub2.
      WRITE: / 'Subroutine 2'.
    ENDFORM.
    Dynamic Subroutine Specification:
    PROGRAM form_test.
    DATA: progname(8) TYPE c VALUE 'FORMPOOL',
          subrname(8) TYPE c.
    subrname = 'SUB1'.
    PERFORM (subrname) IN PROGRAM (progname) IF FOUND.
    SUBRNAME = 'SUB2'.
    PERFORM (subrname) IN PROGRAM (progname) IF FOUND.
    This produces the following output:
    Subroutine 1
    Subroutine 2
    The character field progname contains the name of the program, in which the subroutines are contained. The names of the subroutines are assigned to the character field subrname.
    Calling Subroutines from a List
    You can call a subroutine from a list as follows:
    PERFORM idx OF subr1 subr2 ... subrn.
    The system calls the subroutine specified in the subroutine list in position idx. You can only use this variant of the PERFORMstatement for internal subroutine calls, and only for subroutines without a parameter interface. The field idx can be a variable or a literal.
    Example
    REPORT demo_mod_tech_perform_list.
    DO 2 TIMES.
      PERFORM sy-index OF sub1 sub2.
    ENDDO.
    FORM sub1.
      WRITE / 'Subroutine 1'.
    ENDFORM.
    FORM sub2.
      WRITE / 'Subroutine 2'.
    ENDFORM.
    This produces the following output:
    Subroutine 1
    Subroutine 2
    Regards,
    Chandru

  • What is sub routine pool in sap script? when it is used?

    hi ,
             i am new to sap-abap can any one clarify my doubt .

    Hi Praveen,
    If you modify the sap standard script according to that you have to modify the print program also....
    But its not advisable to modify the print program directly so, for the changes what ever u have made in the scripts you have to write the logic in a subroutine with in report program and you have to call this subroutine with PERFORM statement in the scripts.....
    Reward points if it is helpful..
    Regards,
    Omkar.

  • Script sub-routine crashes on second loop

    G'day
    I've got a 2000+ line Mail script that worked in Tiger, but seems to be a problem under leopard.
    The first pass getting a Mail message ID works ok, but on the second pass, when getting a new ID, as soon as I try and use the ID variable, the script shows the ID once, then completely stops.
    I've written a short version of the script to demonstrate the dilemma, but its still over 65,000 characters.
    I can send the whole script to anyone kind enough to try it. Mail me at [email protected]
    Anyone kind enough to run it must
    1. first create a mail folder called "* items to shift"
    2. Alter the short piece of script after the 'Set to suit' comment, to set your printer and email address.
    3. Then the script must be saved in the main Library/Scrips/Folder Action Scripts.
    4. Then, the script must be attached as a Folder Action to the 'messages' folder INSIDE the actual "* items to shift.mbox" mail folder which is in.....
    <your home folder>/Library/Mail/Mailboxes.
    5. Enable 'Access for Assistive devices' in the 'Universal Access' control panel.
    Now, drop some mail on the '* items to shift' mail box. The second message should freeze after showing the ID once. The mail won't disappear, but will be shifted to a newly created dated mail folder.
    The piece of offending script is as follows...
    on MainLoopTwo(this_folder)
    tell application "Mail"
    activate
    repeat while (number of messages of mailbox MailBoxName) > 0
    set frontmost of application "Mail" to true
    if RunForOz then say "main loop"
    set EveryMailboxList to mailboxes
    repeat with testBoxName in EveryMailboxList
    set selected mailboxes of message viewers to {mailbox MailBoxName}
    if (name of testBoxName as string) ≠ MailBoxName then
    set selected mailboxes of message viewers to {mailbox (name of testBoxName as string)}
    exit repeat
    end if
    end repeat
    set CycleThroughMessages to last message of mailbox MailBoxName
    tell application "Mail"
    activate
    set TheName to ""
    set TheName to the (id of CycleThroughMessages & ".emlx" as string)
    set frontmost of application "Mail" to true
    try
    if (exists CycleThroughMessages) in mailbox MailBoxName then
    if my CheckThePausedReference(TheName) then
    set byPassPrint to true
    my TransferToITMP(CycleThroughMessages, true)
    end if
    else
    set byPassPrint to true
    end if
    on error TheError number errNum
    say "oooooops, can't set i d"
    set TheName to ""
    set byPassPrint to true
    end try
    set thetempname to TheName as string
    tell application "System Events"
    try
    tell application "Mail" to display dialog thetempname
    -- Next line after second loop fails after previous line.
    -- 'On Error' does not trap error
    -- Script simply stops
    tell application "Mail" to display dialog thetempname
    on error
    say "error"
    end try
    end tell
    if RunForOz then say "main loop continues"
    my MainLoopThree(CycleThroughMessages)
    end tell
    end repeat
    end tell
    set TimeToElapse to my seeiftimehaselapsed("Check if elapsed")
    if TimeToElapse = "" then -- No time stored, so check if to recycle
    say "Checking recycle"
    tell application "Mail"
    set TemporaryMail2 to messages of mailbox MailBoxName
    end tell
    if (count of TemporaryMail2) > 0 then my MainLoopTwo(this_folder)
    end if
    end MainLoopTwo

    G'day
    For your information.
    I've worked out what the problem is.
    After removing a message from a series of messages in a mailbox, using a repeat loop or any other way, after about 5-10 seconds the Mail App seems to send an update signal to itself, or to Applescript, I'm not sure which.
    This update causes any dialog box, or open message, to very briefly 'flicker'. Once that happens, the script can't run anything else.
    The workaround is to run the main script on it's own, and call it from a short folder attached script.
    The problem only arises when the script is directly attached as a folder action, and in Leopard.
    A definite bug I think.
    Regards
    Santa

Maybe you are looking for