Subroutine in script. REWARDED

Hi All,
Please give me a sample and easy code
for calling subroutine in script
subroutine defination zprogram which is having a select statement.
every helpful answere is rewarded surely.

hi priyanka,
sample code for routines in script.
  /: PERFORM FORM_TEST IN PROGRAM ZTEST
/: USING &VAR1&
/: USING &VAR2&
/: USING &VAR3&
/: USING &VARN&
/: CHANGING &VAR_OUT1&
/: CHANGING &VAR_OUTN&
in the program ZTEST...
FORM FORM_TEST tables in_tab structure itcsy
out_tab structure itcsy.
Get value of VARN
data: varn like ....
read table in_tab with key name = 'VARN'.
if sy-subrc = 0.
move in_tab-value to varn.
endif.
Update the value of VAR_OUTN
read table out_tab with key name = 'VAR_OUTN'.
if sy-subrc = 0.
move <value> to out_tab-value.
modify out_tab index sy-tabix.
endif.
ENDFORM.
check this link too...
http://help.sap.com/saphelp_erp2005/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm
Regards...
Arun.
Reward points if useful.

Similar Messages

  • Abput subroutines in scripts

    how to call subroutines in scripts

    Hi
    When you don't have option to change the driver program connected to the script, and when you wants to bring some external data from other tables and to do external calculations we use these subroutines in scripts
    See the sample programs for calling subroutines
    How to call a subroutine form SAPscripts
    The Form :
    /:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
    /:USING &EKKO-EBELN&
    /:CHANGING &CDECENT&
    /:ENDPERFORM
    The report :
    REPORT zkrpmm_perform_z1medruck .
    DATA : BEGIN OF it_input_table OCCURS 10.
    INCLUDE STRUCTURE itcsy.
    DATA : END OF it_input_table.
    déclaration de la table output_table contenant les
    variables exportées
    DATA : BEGIN OF it_output_table OCCURS 0.
    INCLUDE STRUCTURE itcsy.
    DATA : END OF it_output_table.
    DATA : w_ebeln LIKE ekko-ebeln,
    w_vbeln LIKE vbak-vbeln,
    w_zcdffa LIKE vbak-zcdffa.
    FORM CDE_CENT
    FORM cde_cent TABLES input output.
    it_input_table[] = input[].
    it_output_table[] = output[].
    READ TABLE it_input_table INDEX 1.
    MOVE it_input_table-value TO w_ebeln.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = w_ebeln
    IMPORTING
    output = w_ebeln.
    SELECT SINGLE zcdffa FROM ekko
    INTO w_zcdffa
    WHERE ebeln = w_ebeln.
    it_output_table-name = 'CDECENT'.
    MOVE w_zcdffa TO it_output_table-value.
    MODIFY it_output_table INDEX 1.
    output[] = it_output_table[].
    ENDFORM.
    REPORT ZMPO1 .
    form get_freight tables in_par structure itcsy out_par structure itcsy.
    tables: ekko,konv,t685t.
    data: begin of itab occurs 0,
             ebeln like ekko-ebeln,
             knumv like ekko-knumv,
           end of itab.
    data: begin of itab1 occurs 0,
             knumv like konv-knumv,
             kposn like konv-kposn,
             kschl like konv-kschl,
             kbetr like konv-kbetr,
             waers like konv-waers,
             kwert like konv-kwert,
           end of itab1.
    data: begin of iout occurs 0,
             kschl like konv-kschl,
             vtext like t685t-vtext,
             kbetr like konv-kbetr,
             kwert like konv-kwert,
           end of iout.
    data v_po like ekko-ebeln.
    read table in_par with key 'EKKO-EBELN'.
    if sy-subrc = 0.
       v_po = in_par-value.
       select
         ebeln
         knumv
      from ekko
      into table itab
      where ebeln = v_po.
      if sy-subrc = 0.
        loop at itab.
          select
            knumv
            kposn
            kschl
            kbetr
            waers
            kwert
          into table itab1
          from konv
          where knumv = itab-knumv and
                kappl = 'M'.
        endloop.
        loop at itab1.
          if itab1-kposn <> 0.
            select single * from t685t
                              where kschl = itab1-kschl
                                and kappl = 'M'
                                and spras = 'EN'.
            iout-vtext = t685t-vtext.
            iout-kschl = itab1-kschl.
            iout-kbetr = itab1-kbetr.
            iout-kwert = itab1-kwert.
            append iout.
            clear iout.
          endif.
        endloop.
        sort itab1 by kposn.
        loop at iout.
          sort iout by kschl.
          if ( iout-kschl eq 'GSDC' OR
               iout-kschl eq 'GSFR' OR
               iout-kschl eq 'GSIR' ).
            at end of kschl.
              read table iout index sy-tabix.
              sum.
             write:/ iout-kschl,iout-vtext,iout-kwert.
          out_par-name = 'A1'.
          out_par-value = iout-vtext.
          append out_par.
          out_par-name = 'A2'.
          out_par-value = iout-kwert.
          append out_par.
              endat.
            endif.
          endloop.
        endif.
      endif.
    endform.
    IN THE FORM I AM WRITING THIS CODE.
    /:DEFINE &A1& = ' '
    /:DEFINE &A2& = ' '
    /:PERFORM GET_FREIGHT IN PROGRAM ZMFORM_PO1
    /:USING &EKKO-EBELN&
    /:CHANGING &A1&
    /:CHANGING &A2&
    /:ENDPERFORM
    &A1&
    &A2&
    This Code is to be written in the PO form under ADDRESS window.
    /:DEFINE &A1& = ' '
    /:DEFINE &A2& = ' '
    /:DEFINE &A3& = ' '
    /:DEFINE &A4& = ' '
    /:DEFINE &A5& = ' '
    /:DEFINE &A6& = ' '
    /:PERFORM GET_VENDOR IN PROGRAM ZMFORM_PO
    /:USING &EKKO-EBELN&
    /:CHANGING &A1&
    /:CHANGING &A2&
    /:CHANGING &A3&
    /:CHANGING &A4&
    /:CHANGING &A5&
    /:CHANGING &A6&
    /:ENDPERFORM
    &A1&
    &A2&
    &A3&
    &A4&
    &A5&
    &A6&
    Reward points for useful Answers
    Regards
    Anji

  • Passing Currency field to external subroutine from script

    Hi,
                I am passing one currency field to external subroutine from script. In subroutine we can get that currency in character format. I want to convert that into currency format. how can i do that?
    thnk u

    easy conversion:
    number = character_parameter

  • Subroutines in script

    hi friends...
    i need to know where we use  subroutines in scripts..... further is it really necessary to use the same ...since using subroutines reduces performance!!!!!

    Hi..,
    <b>
    In some case we need to do some mathematical operations in scripts !! Those things we cant do in Script Editor !! thats y the subroutines are there in scripts !!</b>
    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.
    <b>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.</b>
    regards,
    sai ramesh

  • Error while sending data to a subroutine in script

    Hi,
      While passing a currency field for calculation to a subroutine through perform statement iam getting runtime error saying "unable ti interpret 5000.00 as a number. 5000.00 is nothing but the first currency value which iam sending for calculation.in the code the error is raised on the bold line .
    rf140-wrshb has value 5000.00 .the code which i have written in subroutine is as follows.
    READ TABLE I_IN WITH KEY NAME = 'RF140-WRSHB'.
    MOVE I_IN-VALUE TO LV_SUM1. 
    CLEAR I_IN.
    DATA: SUM_C TYPE N.
      SUM1 = SUM1 + LV_SUM1.
      READ TABLE I_OUT WITH KEY NAME = 'LV_BALANCE'.
    MOVE SUM1 TO I_OUT-VALUE.
      MODIFY I_OUT TRANSPORTING VALUE WHERE NAME = 'LV_BALANCE'.
      CLEAR I_OUT.
    lv_balance is the one which receives the output value.
    can anyone tell me what is the mistake i have done nd how to rectify it.
    Thanks,
    Rose.

    Hi,
    I have done something similar so below is the code while passing currency fields to subroutines:
    Actually I was retrieving 2 fields from scripts and then substract them and then send back the result to the script. Hope it works out for you, try it out and REWARD POINTS IF HELPFUL!! (also for your prev post!!)
    FORM get_pay TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.
      DATA: lv_var(255)  TYPE c, "dmbtr,
            lv_var1(255) TYPE c, "qsshb,
            lv_var2(255) TYPE c, "dmbtr.
            var(20) TYPE c,
            var1(25) TYPE c,
            var2(25) TYPE c,
            var3(25) TYPE c,
            var4(25) TYPE c,
            var5(25) TYPE c,
            var6(25) TYPE c,
            vari TYPE ztemp,
            vari2 TYPE ztemp,
            vari3 TYPE ztemp.
      DATA: lv_var4 TYPE dmbtr,
            lv_var5 TYPE qsshb,
            lv_var6 TYPE dmbtr,
            len TYPE i,
            len1 TYPE i,
            dot TYPE c.
      READ TABLE in_tab WITH KEY 'REGUP-DMBTR'.
      IF sy-subrc EQ 0.
        lv_var = in_tab-value.
        len = STRLEN( lv_var ).
        len1 = len - 3.
        dot = lv_var+len1(1).
        IF dot = ','.
          SPLIT lv_var AT ',' INTO var1 var2.
          REPLACE '.' IN var1 WITH ','.
          CONCATENATE '.' var2 INTO var2.
          CONCATENATE var1 var2 INTO var.
          CONDENSE var.
          vari = var1.
          SHIFT vari LEFT DELETING LEADING '0'.
          CONCATENATE vari var2 INTO vari.
          lv_var4 = vari.
        ELSE.
          SPLIT lv_var AT '.' INTO var1 var2.
          REPLACE '.' IN var1 WITH ','.
          CONCATENATE '.' var2 INTO var2.
          CONCATENATE var1 var2 INTO var.
          CONDENSE var.
          vari = var1.
          SHIFT vari LEFT DELETING LEADING '0'.
          CONCATENATE vari var2 INTO vari.
          lv_var4 = vari.
        ENDIF.
        CLEAR: dot, len, len1.
      ENDIF.
      lv_var = vari.
      CALL FUNCTION 'CHAR_NUMC_CONVERSION'
        EXPORTING
          input   = lv_var
        IMPORTING
          numcstr = lv_var4.
      READ TABLE in_tab WITH KEY 'REGUP-QBSHB'.
      IF sy-subrc EQ 0.
        lv_var1 = in_tab-value.
        len = STRLEN( lv_var1 ).
        len1 = len - 3.
        dot = lv_var1+len1(1).
        IF dot = ','.
          SPLIT lv_var1 AT ',' INTO var3 var4.
          REPLACE '.' IN var3 WITH ','.
          CONCATENATE '.' var4 INTO var4.
          CONDENSE var.
          vari2 = var3.
          SHIFT vari2 LEFT DELETING LEADING '0'.
          CONCATENATE vari2 var4 INTO vari2.
          lv_var6 = vari2.
        ELSE.
          SPLIT lv_var1 AT '.' INTO var3 var4.
          REPLACE '.' IN var3 WITH ','.
          CONCATENATE '.' var4 INTO var4.
          CONDENSE var.
          vari2 = var3.
          SHIFT vari2 LEFT DELETING LEADING '0'.
          CONCATENATE vari2 var4 INTO vari2.
          lv_var6 = vari2.
        ENDIF.
        CLEAR: dot, len, len1.
      ENDIF.
      lv_var1 = vari2.
      CALL FUNCTION 'CHAR_NUMC_CONVERSION'
        EXPORTING
          input   = lv_var1
        IMPORTING
          numcstr = lv_var6.
      lv_var5 = lv_var4 - lv_var6.
      lv_var2 = lv_var5.
      var = lv_var5.
      WRITE lv_var5 TO var CURRENCY 'SG'.
      READ TABLE out_tab WITH KEY 'LV_PAY'.
      IF sy-subrc EQ 0.
        out_tab-value = var.
        MODIFY out_tab INDEX 1.
      ENDIF.
    ENDFORM.                    "get_PAY
    Regards,
    Narendra.

  • Subroutine in scripts

    Hi folks,
      i want to print purchase order number and document date in purchase order form in seprate window.the purchase order number iam giving in selection-screen that number i want to display. for this iam writing code in subroutine.but the data is not fetching.
    can u please provide me sample coding or example for this.
    Thx in advance,
    Neelima.N

    Hi,
        Are you using Standard Script copied or created your own one.
    If standard script copied with standard print program, in your created window, give this values &EKKO-EBELN&&' / 'EKKO-BEDAT&
    If Custom created script, in the Window give the selection field declared for EBELN and for BEDATin driver program.
    &P_EBELN& &P_BEDAT&
    Regards
    Bala Krishna

  • Subroutine in script

    hi!
    We know that subroutines are possible in main window of script.
    Is it possible to write subroutines in constant and variable windows as well?

    Hi,
           subroutines can be called with in all windows
           of sapscript   
         perform add in progarm(ztest) using a b .
    Regards
    amole

  • External subroutine in script

    Hi,
    Could any one tell me is that possible to use external subroutine.  Actually my script is the output of ML83. Driver program which passing the info. to script is Std one.  Is there any filed relavent to this driver program is updating when 'Service entry is revoked'.  Plz help me out... this is very urgent.
    Thanks
    Sai.

    Hi,
    'Service entry is revoked' means blocked or released..
    Sorry..I am not an expert on Service entry..But I am trying to search for the fields which you are looking for..
    Thanks,
    Naren

  • Regarding subroutine in script

    hi friends,
    i am calling suroutine in script i write in main window of script this
    /: PERFORM ZVEND IN PROGRAM ZRFI_CONF_SUB
    /: USING &BSIK-LIFNR&
      /:USING &BSIK-BUDAT&
    /:ENDPERFORM .
    i created subroutine pool ZRFI_CONF_SUB.
    but when i am debugging form it is not going in that subroutine
    where i am wrong plz reply me .
    regards,
    sonu

    hi anji,
    i am pesting my code plz plz help me plz go through the code .
    in script
    PERFORM ZVEND IN PROGRAM ZRFI_CONF_SUB
    USING &BSIK-LIFNR&
    USING &BSIK-BUDAT&
    ENDPERFORM
    *& Subroutine pool   ZRFI_CONF_SUB                                            *
    PROGRAM  ZRFI_CONF_SUB.
    DATA : BEGIN OF I_BSID OCCURS 0,
               KUNNR LIKE BSID-KUNNR,
               WRBTR LIKE BSID-WRBTR,
               BUDAT LIKE BSID-BUDAT,
               SHKZG like BSID-shkzg,
               BSTAT LIKE BSID-BSTAT,
           END OF I_BSID.
    DATA : BEGIN OF I_BSAD OCCURS 0,
               KUNNR LIKE BSAD-KUNNR,
               WRBTR LIKE BSAD-WRBTR,
               BUDAT LIKE BSAD-BUDAT,
               SHKZG like BSAD-SHKZG,
               BSTAT LIKE BSAD-BSTAT,
           END OF I_BSAD.
    DATA : BEGIN OF I_BSIK OCCURS 0,
               LIFNR LIKE BSIK-LIFNR,
               WRBTR LIKE BSIK-WRBTR,
               BUDAT LIKE BSIK-BUDAT,
               shkzg like bsik-shkzg,
               BSTAT LIKE BSIK-BSTAT,
           END OF I_BSIK.
    DATA : BEGIN OF I_BSAK OCCURS 0,
               LIFNR LIKE BSAK-LIFNR,
               WRBTR LIKE BSAK-WRBTR,
               BUDAT LIKE BSAK-BUDAT,
               shkzg like bsak-shkzg,
               BSTAT LIKE BSAK-BSTAT,
           END OF I_BSAK.
    *****This is form to get the total in Vendor Bal.ConformationForm*****
    FORM ZVEND TABLES IN_BSIK STRUCTURE ITCSY
                      OUT_BSIK STRUCTURE ITCSY.
      data : year(4),
             month(2),
             day(2),
             date(8).
      DATA : V_AMNT TYPE P DECIMALS 2,
             V_AMT  TYPE P DECIMALS 2,
             V_TOT  TYPE P DECIMALS 2,
             V_TOTAL(20),
             V_LIFNR(10) TYPE N,
             V_BUDAT(10),
             V_WRBTR LIKE BSID-WRBTR.
      READ TABLE IN_BSIK INDEX 1.
      V_LIFNR = IN_BSIK-VALUE.
      READ TABLE IN_BSIK INDEX 2.
      V_BUDAT = IN_BSIK-VALUE.
      year  = V_BUDAT+6(4).
      month = V_BUDAT+3(2).
      day   = V_BUDAT+0(2).
      CONCATENATE year month day into date.
      SELECT LIFNR WRBTR BUDAT SHKZG BSTAT FROM  BSIK
                                           INTO  table I_BSIK
                                           WHERE LIFNR = V_LIFNR.
      SELECT LIFNR WRBTR BUDAT SHKZG BSTAT FROM  BSAK
                                           INTO  table I_BSAK
                                           WHERE LIFNR = V_LIFNR.
      LOOP AT I_BSIK WHERE LIFNR = V_LIFNR.
        if i_bsik-BUDAT <= date and i_bsik-bstat ne 'S'.
          if i_bsik-shkzg = 'S' .
            V_AMNT = V_AMNT + I_BSIK-WRBTR .
          else.
            V_AMNT = V_AMNT - I_BSIK-WRBTR.
          endif.
        endif.
      ENDLOOP.
      LOOP AT I_BSAK WHERE LIFNR = V_LIFNR.
        if i_bsak-BUDAT <= date and i_bsak-bstat ne 'S'.
          if i_bsak-shkzg = 'S'.
            V_AMT = V_AMT + I_BSAK-WRBTR .
          else.
            V_AMT = V_AMT - I_BSAK-WRBTR.
          endif.
        endif.
      ENDLOOP.
      V_TOT = V_AMNT + V_AMT.
      V_TOTAL = V_TOT.
      READ TABLE OUT_BSIK INDEX 1.
      OUT_BSIK-VALUE = V_TOTAL.
      MODIFY  OUT_BSIK INDEX 1.
    ENDFORM.                    "ZVEND
    **This is form to get the total in Customer Bal.Conformation Form*****
    FORM ZCUST TABLES IN_BSID STRUCTURE ITCSY
                      OUT_BSID STRUCTURE ITCSY.
      data : year(4),
             month(2),
             day(2),
             date(8).
      DATA : V_AMNT TYPE P DECIMALS 2,
             V_AMT  TYPE P DECIMALS 2,
             V_TOT  TYPE P DECIMALS 2,
             V_TOTAL(20),
             V_KUNNR(10) type n,
             V_BUDAT(10),
             V_WRBTR LIKE BSID-WRBTR.
      READ TABLE IN_BSID INDEX 1.
      V_KUNNR = IN_BSID-VALUE.
      READ TABLE IN_BSID INDEX 2.
      V_BUDAT = IN_BSID-VALUE.
      year  = V_BUDAT+6(4).
      month = V_BUDAT+3(2).
      day   = V_BUDAT+0(2).
      CONCATENATE year month day into date.
      SELECT KUNNR WRBTR BUDAT SHKZG BSTAT FROM  BSID
                                     INTO  table I_BSID
                                     WHERE KUNNR =  V_KUNNR.
      SELECT KUNNR WRBTR BUDAT SHKZG BSTAT FROM  BSAD
                                     INTO  table I_BSAD
                                     WHERE KUNNR = V_KUNNR.
      LOOP AT I_BSID WHERE KUNNR = V_KUNNR.
        if i_bsid-BUDAT <= date and i_bsid-bstat ne 'S'.
          if i_bsid-shkzg = 'S' .
            V_AMNT = V_AMNT + I_BSID-WRBTR .
          else.
            V_AMNT = V_AMNT - I_BSID-WRBTR.
          endif.
        endif.
      ENDLOOP.
      LOOP AT I_BSAD WHERE KUNNR = V_KUNNR.
        if i_bsad-BUDAT <= date and i_bsad-bstat ne 'S'.
          if i_bsad-shkzg = 'S'.
            V_AMT = V_AMT + I_BSAD-WRBTR .
          else.
            V_AMT = V_AMT - I_BSAD-WRBTR.
          endif.
        endif.
      ENDLOOP.
      V_TOT   = V_AMNT + V_AMT.
      V_TOTAL = V_TOT.
      READ TABLE OUT_BSID INDEX 1.
      OUT_BSID-VALUE = V_TOTAL.
      MODIFY  OUT_BSID INDEX 1.
    ENDFORM.                    "ZCUST

  • Error while calling Subroutine from Script

    HI Friends,
    I am getting a short dump whilecalling a suboutine from Script.
    Please suggest if am wrong with below code
    /: PERFORM GET_ADDRESS IN PROGRAM ZSUBROUTINES
    /: USING &MHND-KUNNR&
    /: CHANGING &ADRS-LINE0&
    /: CHANGING &ADRS-LINE1&
    /: ENDPERFORM
    All above fields are available in script window
    In the program
    FORM get_address    TABLES in_tab STRUCTURE itcsy
                                       out_tab stucture itcsy.
    ENDFORM.
    Thanks

    HI,
    Your code is correct, in the FORM and ENDFORM in the program, read the INPUT table and get the values and write your logic using these values and send back the values to the SCRIPT using the OUTTABLE. here you need to use the MODIFY statment for the outtable using Sy-TABIX.
    Regards
    Sudheer

  • Calling subroutine from scripts

    I am calling a subroutine form a standard text, the subroutine is getting called but the input table is comming empty.
    can any one please advise me what could be the problem.
    /:PERFORM GET_APP_DATA IN PROGRAM YHR_APP_DATA
    /:USING &P0001-PERNR&
    /:CHANGING &GRADE&
    /:ENDPERFORM

    Check this sample code...may be it will help u to identify the prob...
    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 u2018PAGEu2019.
    CHECK SY-SUBRC = 0.
    PAGNUM = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY u2018NEXTPAGEu2019.
    CHECK SY-SUBRC = 0.
    NEXTPAGE = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY u2018BARCODEu2019.
    CHECK SY-SUBRC = 0.
    IF PAGNUM = 1.
    OUT_PAR-VALUE = u2018|u2019. "First page
    ELSE.
    OUT_PAR-VALUE = u2018||u2019. "Next page
    ENDIF.
    IF NEXTPAGE = 0.
    OUT_PAR-VALUE+2 = u2018Lu2019. "Flag: last page
    ENDIF.
    MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.
    Regards,
    JOy.

  • Passing Internal Table from Subroutine to Script

    Hi,
    Can I know whether this piece of code will work.
    FORM TERMS_OF_PAYMENT TABLES IN_TAB  STRUCTURE ITCSY
                                 OUT_TAB STRUCTURE ITCSY.
      READ TABLE IN_TAB WITH KEY NAME = 'EKKO-ZTERM'.
      IF SY-SUBRC = 0.
        E_ZTERM = IN_TAB-VALUE.
        CALL FUNCTION 'FI_PRINT_ZTERM'
          EXPORTING
            I_ZTERM = E_ZTERM
            I_LANGU = SY-LANGU
          TABLES
            T_ZTEXT = ZTERM.
      ENDIF.
      LOOP AT ZTERM.
        READ TABLE OUT_TAB WITH KEY NAME = 'ZTERM-T_ZTEXT'.
        IF SY-SUBRC = 0.
          OUT_TAB-VALUE = ZTERM-T_ZTEXT.
          MODIFY OUT_TAB INDEX SY-TABIX.
              CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 ELEMENT = 'TERM_OF_PAYMENT'
                 WINDOW  = 'TERM_PAY'.
        ENDIF.
      ENDLOOP.
    Can anyone please help...
    Vijay.

    Modify the code like this - do not use loop and do not use write_form
    READ TABLE OUT_TAB WITH KEY NAME = 'ZTERM-T_ZTEXT'.
    IF SY-SUBRC = 0.
    OUT_TAB-VALUE = ZTERM-T_ZTEXT.
    MODIFY OUT_TAB INDEX SY-TABIX.

  • How to pass a value of 130 odd characters from a subroutine to a script

    Hi Friends,
    I am passing a value of 130 odd characters(say) from subroutine to script through ITCSY structure (VALUE- 255 characters), however, while debugging the script I find that the whole length is not getting passed into the script.
    Is this a limitation, or is there any solution to this?
    Thanks and Regards,
    Birendra Chatterjee

    Hi,
    Check the size of that Window in which you are displaying this Text of 130 characters.
    May be it is less
    in that case split that string into 2 strings and pass the two strings from ITCSY structure to script and use.
    reward if useful
    regards,
    ANJI

  • Call subroutine in sap script

    how can i call subroutine in SAP Script?& where?

    hi,
    refer d links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/calling%2ba%2bsub-routine%2bin%2bsap%2bscripts
    subroutine in script. REWARDED
    abput subroutines in scripts
    How to call a subroutine in a script ?
    How to call subroutine in a sap script

  • Script external subroutine for multiple fileds display

    Hi,
    can anybody tell
    how to write external subroutine in script.
    i want to display multiple fields data in script by using external subroutine.
    Regards,
    Kumar.

    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.
    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.
    Definition in the SAPscript form:
    /: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
    /: USING &PAGE&
    /: USING &NEXTPAGE&
    /: CHANGING &BARCODE&
    /: ENDPERFORM

Maybe you are looking for

  • What are the basic .jar files to be set in web dynpro project classpath

    Hi, I am having a problem while customizing the ESS. I used DTR, DC and imported configuration. After that, I created project from one of the DC(say ess/jp/addr). Later when I open an iView from any Web Dynpro component, I am getting lot of errors wi

  • Need help on Adhoc Request  functionality in PI

    Hi Experts , Need help  on the design approach . How can PI handles  if Sender System prefers to send an  Adhoc Request(Outbound)  to PI  . Here is the complete requirement . " An Adhoc Request is send to PI from the Legacy Sender System (Whenever Le

  • No signal in my Samsung tv when I use HDMI connector?

    Hi. I have a problem with the Hdmi connection to my iPad 3. It doesn't work in my Samsung tv, it says " there is not signal". I have tried it  in another one, same brand and it works. Does anyone know what the problem could be? Thanks Ladysnow

  • Publication Businness Objects XI3 (WebI reports)

    Hi experts, I am currently creating PDF publication based on WebI reports. My client refuse to use the standard access to publication files (right click on publication -> History -> left click on the instance -> access to the PDF) because he thinks t

  • Why can't I render or smoothly play 1080p30 .mts file (Canon XA10 camera) on premiere

    Using both a quadcore pc and a brand new quad core macbook pro both take my 1080p .mts file and bring in with yellow line....can't render workspace and won't playback smooth....occassionally a red screen appears as well. I dragged file into new item