PROBLEM IN SUBROUTINE IN SAPSCRIPT!

CAUFVD IS A STRUCTURE. WHICH HAS ORDER NO 10000427.
  IAM USING CAUFVD COZ RESB-AUFNR IN PERFORM DOESNOT GIVE A VALUE IN SAP SCRIPT.
  CAUFVD-AUFNR = 10000427
  RESB-AUFNR IN SE11 GIVES THE FOLLOWING.
  RESB-AUFNR = 000010000427
  RESB-RSNUM = 0000005126
  PROBLEM IS THAT IN SELECTION ITS PICKING 10000427 WHEREAS I NEED 000010000427.
  HOW DO I DO THIS?
  PLEASE MENTION COMPLETE STEPS OR MODIFY THE EXISTING.
PERFORM YE_PM_COMMON_RESERV_PR IN PROGRAM ZPMLINCLUDE
USING &CAUFVD-AUFNR&   "RESB-AUFNR WONT WORK. SO IAM USING CAUFVGD-AUFNR.
CHANGING &CONV_RESERV&
CHANGING &CONV_PR&
CHANGING &CONV_PR&
ENDPERFORM.
PERFORM ZPM_COMMON IN PROGRAM ZPMLINCLUDE
USING &CAUVFD-AUFNR& "ORDER NO
CHANGING &CONV_RESERV&
ENDPERFORM.
FORM ZPM_COMMON
   TABLES IN_TAB STRUCTURE ITCSY
          OUT_TAB STRUCTURE ITCSY.
DATA : V_AUFNR TYPE RESB-AUFNR, "ORDER NO 
       V_RSNUM TYPE RESB-RSNUM. "RESERVATION NUMBER
READ TABLE IN_TAB INDEX 1.
MOVE IN_TAB-VALUE TO V_AUFNR.
SELECT SINGLE RSNUM FROM RESB INTO V_RSNUM
WHERE AUFNR = V_AUFNR.
READ TABLE OUT_TAB INDEX 1.
OUT_TAB-VALUE = V_RSNUM.
MODIFY OUT_TAB INDEX 1.
CLEAR OUT_TAB.
ENDFORM.
REGARDS
ESSAM ([email protected])

Hi
Check out the changes in BOLD
FORM ZPM_COMMON
TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA : V_AUFNR TYPE RESB-AUFNR, "ORDER NO
V_RSNUM TYPE RESB-RSNUM. "RESERVATION NUMBER
READ TABLE IN_TAB INDEX 1.
MOVE IN_TAB-VALUE TO V_AUFNR.
**CALL THIS FUNCTION TO CONVERT FOR OUTPUT FORMAT TO
***INTERNAL FORMAT I.E WITH LEADING 0.
<b>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  Exporting
      INPUT = V_AUFNR
  Importing
      OUTPUT = V_AUFNR.</b>
SELECT SINGLE RSNUM FROM RESB INTO V_RSNUM
WHERE AUFNR = V_AUFNR.
READ TABLE OUT_TAB INDEX 1.
<b>**OUT_TAB-VALUE = V_RSNUM.</b><b>write v_rsnum to out_tab-value left-justified.</b>
MODIFY OUT_TAB INDEX 1.
CLEAR OUT_TAB.
ENDFORM.
<b>Reward if Helpful.</b>

Similar Messages

  • Problem in calling ABAP Subroutine from SAPSCRIPT

    Hi,
    I need to get the reason for cancellation of a Business Even in Training & Event Management module, so I am passing Emp_id.
    But the reason(CAAATRT) is returned with blank by the code.
    please help.
    /:DEFINE &EMP_ID&= &PPVAR-TOBJD&
    /:PERFORM HR_REASON_PRINT IN PROGRAM ZHR_REASON_PRINT
    /:USING &EMP_ID&
    /:CHANGING &CAATRT&
    REPORT  ZHR_REASON_PRINT.
    DATA : BEGIN OF in_par OCCURS 10.
            INCLUDE STRUCTURE itcsy.
    DATA : END OF in_par.
    DATA : BEGIN OF out_par OCCURS 0.
            INCLUDE STRUCTURE itcsy.
    DATA : END OF out_par.
    DATA:   TOBJD TYPE PPVAR-TOBJD,
            ADATANR TYPE HRP1001-ADATANR,
            CAATR TYPE HRPAD25-CAATR,
            CAATRT TYPE T77CART-CAATRT,
            EMP_ID TYPE C.
    TABLES     : PPVAR,
             HRP1001,
             HRPAD25,
             T77CART.
    FORM HR_REASON_PRINT TABLES input output.
    in_par[] = input[].
    out_par[] = output[].
    READ TABLE in_par INDEX 1.
    CHECK sy-subrc = 0.
    TOBJD = in_par-value.
    MOVE in_par-value TO TOBJD.
    SELECT ADATANR
    into ADATANR
    FROM HRP1001
    WHERE OBJID EQ TOBJD.
    ENDSELECT.
    SELECT CAATR
    into CAATR
    FROM HRPAD25
    WHERE ADATANR EQ ADATANR.
    ENDSELECT.
    SELECT CAATRT
    INTO CAATRT
    FROM T77CART
    WHERE CAATR EQ CAATR.
    ENDSELECT.
    REFRESH out_par.
      out_par-name = 'DREASON'.
      move CAATRT To out_par-value.
      MODIFY out_par INDEX 1.
    APPEND out_par.
      output[] = out_par[].
    Thanks
    Ramakrishna

    Hi ramakrishna,
    1. while calling subroutines from sapscripts,
    there is a special technique,
    which has got its own limitations.
    2.
    FORM abc
    TABLES
    in_tab STRUCTURE itcsy
    out_tab STRUCTURE itcsy.
    ENDFORM.
    3. The perform in se38 program should be of the
    above format only.
    4. We cannot pass internal tables.
    5. Rather we need to pass
    VARIABLE NAME
    VARIABLE VALUE
    (see the structure of itcsy in se11)
    6. In this form, we have to read
    the internal table in_tab
    to capture the variable name and its value.
    7. Similary, to return the values,
    we have to put one record (for each variable)
    in out_tab.
    regards,
    amit m.

  • Subroutine in sapscript for net due date

    Hi,
    This is the first time I am creating a subroutine for sapscript and I could not get it to work. I need to calculate the net due date using the baseline date plus cash discount days. But the form is just printing out 0000000. I am just trying to extract one due date here but I will have to get it for all line items then sort descending to get the latest one. Can anyone help me to see the gap why this is not working?
    In the sapscript I have the following:
    DEFINE &BASEDATE& = &REGUP-ZFBDT&
    DEFINE &PAYTERMS& = &REGUP-ZBD1T&
    PERFORM NET_DUE_DATE IN PROGRAM Z_SAPSCRIPT_FUNCTIONS
    USING &BASEDATE&
    USING &PAYTERMS&
    CHANGING &DUEDATE&
    ENDPERFORM
    In program Z_SAPSCRIPT_FUNCTIONS
    Thanks in advance!
    Cholen

    Hi Raju!
    I am really getting close! I did the conversion for all variables, however for VBLNR, it does not work. It gives leading zeroes but the value starts with a 'P' before the zeroes and the numeric value. I tried to remove that from the where clause and my select finally got something. However the output on the form is in the internal format. I suppose I should use CONVERT_DATE_TO_EXTERNAL which I tried doing after out_tab-value = lv_netduedate which is the variable I am passing to the form. 
    Raju Shrestha wrote:
    Hi Cholen,
    I believe your lv_laufd is a 10 character field in format MM/DD/YYY or DD/MM/YYYY. You should move that data to a 8 character variable (say lv_date) in YYYYDDMM format.
    Please try this conversion
        CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
          EXPORTING
            date_external            = lv_laufd
          IMPORTING
            date_internal            = lv_date
          EXCEPTIONS
            date_external_is_invalid = 1
            OTHERS                   = 2.
    Check in debug, you should get lv_date in YYYYMMDD. Now use lv_date in your WHERE clause.
    If you still do not get data after lv_date eq YYYYMMDD, check your LIFNR and KUNNR. They should be 10 charaters with leading zeroes if not 10 .
    If needed use the conversion for lv_lifnr and lv_kunnr.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            date_external            = lv_lifnr
          IMPORTING
            date_internal            = lv_lifnr.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            date_external            =  lv_kunnr
          IMPORTING
            date_internal            =  lv_kunnr.
    Cheers,
    Raju.

  • Pass subroutine to Sapscript

    sir,
      Like to know How we pass subroutine in sapscript and how standard texts are added and what is its command and transaction.
    Edited by: Alvaro Tejada Galindo on Apr 28, 2008 4:45 PM

    Subroutines in scripts:
    Calling ABAP Subroutines: PERFORM
    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.
    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 ‘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.

  • Build Applicatio​n problem // external subroutine

    Hey,
    i was build an stand alone application (.exe) and i have a problem with external subroutine to subVi.
    I was trying to add the missing .llb as support file in Source Files but still doesnt work.
    It works on my computer, on another computer doesnt work (please look attached file)
    I have LV 7.1.
    I read on forum about this problem and i didnt find any solution for me.
    Thanks for help.
    Attachments:
    missingSubVi.JPG ‏12 KB

    crossrulz wrote:
    Mark, a lot of things changed going to LabVIEW 8.  LabVIEW 7 didn't have projects or the fancy build specs.  I don't have LabVIEW 7 anywhere, so I can't play around in the menus of the very old build dialog.
    I know a lot has changed. I don't recall myself exactly how LV 7 build specs looked. It should have some type of similar option though.
    If it doesn't the OP may need to be very specific with his paths for calling the dynamic VIs and makes sure he distributes them and place them into the correct directory where his application will access them.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Calling subroutine in sapscript

    can anyone guide how 2 call subrouting in sapscript and i need sample code...i need a simple code how 2 call and implement
    so tat it ll be easy 4 me learn..

    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.
    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.
    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 ‘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.
    regards,
    veeresh

  • Calling subroutines from SAPScript

    Hi all,
    I have added a piece of code in my MAIN window which calls a subroutine in another program. This works just fine. However, when I moved the code from one <b>window element</b> of MAIN to another, the code is no longer triggered.
    What causes this to happen? Is it related to the calling of function module WRITE_FORM in the application program? Any ideas?
    All helpful answers will be rewarded!
    Regards,
    M.V.

    Hi,
    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 !!
    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.
    Regards
    Rama.Pammi

  • Debuggin External subroutine in sapscript

    Hi Gurus,
    I need to debug external soubroutine written in sapscript.i am not getting how to proceed for this.please help me.
    Regards
    Sam
    Moderator message: sapscript debugging = FAQ, please search before posting.
    Edited by: Thomas Zloch on Oct 27, 2010 1:25 PM

    Hi,
          I think this may help
    Place a break point in your subroutine, now activate the sap script debugger.
    Press F5 and continue debugging in sap script once it reaches the statement where the routine is called it will take you to the code.
    regards

  • External subroutine in sapscript

    hi all
    can anyone explain me how to handle an external subroutine in a script with a simple example.
    rg
    sandeep

    Hi Sandeep,
    Try this :
    Use PERFORM from SAPSCRIPT
    /: PERFORM BIN_LOCATION IN PROGRAM Z_SAPSCRIPT_PERFORMS
    /: USING &RESBD-MATNR&
    /: USING &CAUFVD-IWERK&
    /: USING &RESBD-LGORT&
    /: CHANGING &MARD-LGPBE&
    /: ENDPERFORM
    REPORT z_sapscript_performs.
    SUBROUTINES FOR CALLING FROM SAPSCRIPTS
    FORM bin_location TABLES in_tab STRUCTURE itcsy
    out_tab STRUCTURE itcsy.
    get default bin location from MARD for this material/plant/storage *
    location
    DATA: l_matnr TYPE matnr, "material
    l_werks TYPE werks, "plant
    l_lgort TYPE lgort, "storage location
    l_lgpbe TYPE lgpbe. "bin location
    Get first parameter in input table.
    READ TABLE in_tab INDEX 1.
    WRITE in_tab-value TO l_matnr .
    Get second parameter in input table
    READ TABLE in_tab INDEX 2.
    MOVE in_tab-value TO l_werks.
    Get third parameter in input table
    READ TABLE in_tab INDEX 3.
    MOVE in_tab-value TO l_lgort.
    read bin location
    SELECT SINGLE lgpbe INTO l_lgpbe FROM mard
    WHERE matnr = l_matnr
    AND werks = l_werks
    AND lgort = l_lgort.
    IF l_LGPBE IS INITIAL.
    l_LGPBE = 'NONE'.
    ENDIF.
    read & update only parameter in output table
    READ TABLE out_tab INDEX 1.
    out_tab-value = l_lgpbe.
    MODIFY out_tab INDEX 1.
    ENDFORM.
    Regards,
    Lanka

  • Problem with subroutine- need urgrnt help

    hai all,
    need help in subroutine.
    in a report program,
    i had calculated to get the total collection amount and need to generate a list for every day.
    on next day that collection amount must come as a poeninig balance at the top of the list.
    this i had done using two subroutines.
    i have to call the subroutine for opening balance for previous day's collection  first.  after that in have to calculate the todays collection.
    how can i have this please give me a suggession.
    thanks in advance.
    this is my report.
    i want the 'Progressive Total C/O ' from subroutine form f002_item_data. of today to be come in
    'Progressive Total B/F -
    ' ,106 w_total_bf.  of  the  subroutine form f001_progressive_total on next day..
    here is the code.....
    *& Report  ZVR023_COLL_STATEMENT                                       *
    report  zvr023_coll_statement           no standard page heading        .
          MODULE. MSD                                              *
          Objective :                                                   *
          Program   : Updates Tables (   )    Downloads data (  )       *
                      Outputs List   ( X  )                             *
          Date Created                                                  *
          Author                                                *
          Location                                                      *
          LDB                .....                                      *
          External Dependencies                                         *
    Amendment History                                                  *
    Who        Change ID    Reason                                      *
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯                                     *
    XXXXXXXXX  AADDMMYYYY Where XXXX = Developers Name................. *
               AA- Developers Initial ................................  *
          Includes                                                      *
    *INCLUDE   :                                                           *
          Tables                                                        *
    tables   : vbak,bsid,kna1,t001,adrc,vbrk,knvv.
          Types                    Begin with TY_                       *
    types : begin of ty_cust,
            belnr type bseg-belnr,
            wrbtr type bseg-wrbtr,
            xref1 type bseg-xref1,
            kunnr type kna1-kunnr, " sarang
            bschl type bseg-bschl,
            hkont type bseg-hkont,
            end of ty_cust.
    types : begin of ty_bp,
            kunnr type vbak-kunnr,
            bukrs type bseg-bukrs,
            budat type bkpf-budat,
            end of ty_bp.
    types : begin of ty_kna1,
            kunnr type kna1-kunnr,
            name1 type kna1-name1,
            ort01 type kna1-ort01,
            end of ty_kna1.
    types   : begin of ty_lst,
              vbeln      type vbrk-vbeln,                          " INVOICE NO
              fkart      type vbrk-fkart,
              posnr      type vbrp-posnr ,
              fkimg      type vbrp-fkimg ,                         " qty
              fkdat      type vbrk-fkdat,                          " date
              vkorg      type vbrk-vkorg,                          " sales org
              vtweg      type vbrk-vtweg,                          " division
              spart      type vbrk-spart,                          " distribution
              knumv      type vbrk-knumv,                          " Number of the document condition
              matnr      type vbrp-matnr ,
              med_prod   type jptmg0-med_prod,
              kunrg      type vbrk-kunrg,
              kwert      type konv-kwert,
              kbetr      type konv-kbetr,
              netwr      type vbrk-netwr,
    Address Details
             KUNRG type vbrk-KUNRG,
              name1      type kna1-name1,
              stras      type kna1-stras,
              pstlz      type kna1-pstlz,
    ***Added For Billing
             bukrs       type vbrk-bukrs,                          " Company code
             xblnr       type vbrk-xblnr,                          " Bill Ref
             ismpublication type mara-ismpublication,
    Condition Type
             kschl_zj01  type konv-kschl,
             kschl_zdis  type konv-kschl,
             kschl_znet  type konv-kschl,
             kwert_zj01  type konv-kawrt,                          " Base Condition
             kwert_zdis  type konv-kawrt,
             kwert_znet  type konv-kawrt,
             adrnr  type kna1-adrnr,
             end of ty_lst.
    types   : begin of ty_lst1,
              vbeln      type vbrk-vbeln,                          " INVOICE NO
              fkart      type vbrk-fkart,
              fkdat      type vbrk-fkdat,                          " date
              fkimg      type vbrp-fkimg,                          " qty
              kunrg      type vbrk-kunrg,                          " Payer
              fkimg_1    type vbrp-fkimg,                          " qty
              fkimg_2    type vbrp-fkimg,                          " qty
              fkimg_3    type vbrp-fkimg,                          " qty
              fkimg_4    type vbrp-fkimg,                          " qty
              fkimg_5    type vbrp-fkimg,                          " qty
              matnr      type vbrp-matnr,
              med_prod   type jptmg0-med_prod,
              kwert      type konv-kwert,
              kbetr      type konv-kbetr,
              netwr      type vbrk-netwr,
    Address Details
            KUNRG      type vbrk-KUNRG,
              name1      type kna1-name1,
              stras      type kna1-stras,
              pstlz      type kna1-pstlz,
    ***Added For Billing
             bukrs type vbrk-bukrs ,
             xblnr type vbrk-xblnr,
             ismpublication type mara-ismpublication,
    ****SPLIT FOR RATE
             kbetr_1   type   konv-kbetr,
             kbetr_2   type   konv-kbetr,
             kbetr_3   type   konv-kbetr,
    Condition Type
             kschl_zj01 type konv-kschl,
             kschl_zdis type konv-kschl,
             kschl_znet type konv-kschl,
             kwert_zj01 type konv-kawrt,                          " Base Condition
             kwert_zdis type konv-kawrt,
             kwert_znet type konv-kawrt,
             end of ty_lst1.
    types   : begin of ty_condition,
              kschl type konv-kschl,                                " Condition Type
              kwert type konv-kwert,                                " Condition Value
              knumv type konv-knumv,                                " Document Condi
              kposn type konv-kposn,
              kbetr type konv-kbetr,                                " Condition Rate
              end of ty_condition.
    types : begin of ty_bkpf ,
    belnr type bkpf-belnr,
    gjahr type bkpf-gjahr,
    bukrs type bkpf-bukrs,
    end of ty_bkpf.
          Constants                Begin with C_                        *
    *CONSTANTS:                                                            *
          Data                     Begin with W_                        *
    data     : w_cnt type i .
    *DATA     : W_DMBTR  TYPE BSID-DMBTR.   " Open Value
    *DATA     : W_KWERT TYPE  VBRP-FKIMG.   " Invoice Value
    *DATA     : W_QTY_CON TYPE  VBRP-FKIMG.   " QTY
    *DATA     : W_TO_QTY_CON TYPE  VBRP-FKIMG.   " QTY
    *DATA     : W_DIFF TYPE  BSID-DMBTR.   " W_DIFF Bt Open & Invoice
    *DATA     : W_DMBTR_CR  TYPE BSID-DMBTR.   " Cr Value
    *DATA     : W_DMBTR_DR  TYPE BSID-DMBTR.   " Dr Value
    *DATA     : W_DMBTR_TO  TYPE BSID-DMBTR.   " Total Value
    *DATA :     W_KDGRP(2) .
    *DATA  :    W_CNT_IS TYPE I.
    *DATA  :    W_CNT_IS1 TYPE I.
    *DATA  :    W_CNT_IS2 TYPE I.
    *DATA  :    W_CNT_FIRST TYPE I.
    *DATA  :    W_CNT_ITAB TYPE I.
    *DATA  :    W_CNT_FIRST1(2).
    *DATA  :    W_CNT_TAB(62),
              W_CNT_TAB_HEA(62),
    *data:           W_CNT_POS TYPE I.
    Variable for balance window
    data : w_open_bal type dmshb_x8,
           w_total_bf type dmshb_x8,
           w_sub_tot  type dmshb_x8,
           w_total_co type dmshb_x8,
           w_bill_bal type dmshb_x8,
           w_drn_bal type dmshb_x8,
           w_othr_chr type dmshb_x8,
           w_total_bal type dmshb_x8,
           w_coll_bal type dmshb_x8,
           w_unsd_cr  type  dmshb_x8, "Unsold Credit
           w_inceve  type  dmshb_x8, "Incentive
           w_cr_nt   type  dmshb_x8. "Cr Note
    data     : w_pos  type bseg-wrbtr.   " Total Value
    data     : w_neg  type bseg-wrbtr.   " Total Value
    data : w_du_start_date like sy-datum,
           w_du_end_date like sy-datum .
    **vARIABLE DEFINED FOR CONSOLIDATED WINDOW
    data    : w_prod_cnt type i .
    data    : w_prod_ch(2)  .
    data    : w_prod_rate type i .
          Infotypes                   ( HR Module Specific)             *
    *INFOTYPES :                                                           *
          Internal tables          Begin with IT_                       *
    data : it_bp type table of ty_bp with header line,
           it_bp1 type table of ty_bp with header line,
           it_bp2 type table of ty_bp with header line,
           it_bp3 type table of ty_bp with header line,
           it_kna1 type table of ty_kna1 with header line,
           it_cust type table of ty_cust with header line,
           it_cust1 type table of ty_cust with header line,
           it_bkpf type table of ty_bkpf with header line,
           it_cust2 type table of ty_cust with header line,
           it_cust3 type table of ty_cust with header line.
    data : it_pos like rfposxext occurs 1 with header line,
    it_check like rfposxext occurs 1 with header line,
    it_pos_bc1 like rfposxext occurs 1 with header line,
    it_pos_bc like rfposxext occurs 1 with header line,
    it_pos_nc like rfposxext occurs 1 with header line,
           it_pos1 like rfposxext occurs 1 with header line,
           it_sec like rfposxext occurs 1 with header line.
    data : it_bal like rfposxext occurs 1 with header line.
    data : w_text(100) type c.
    data : w_cnt1(3).
    data : l_date like mara-ismpublperiod .
    data : p_date1 like  jkpaz-jkpavon.
    data : l_day_c(2).
    data : l_month_c(2).
    data : l_base_yr_c(4).
    data : w_text1(100) type c.
    data : w_text2(100) type c.
          Field Symbols            Begin with FS_                       *
    *FIELD-SYMBOLS:                                                        *
    field-symbols:  type ty_condition.
          Insert                                                        *
    *INSERT   :                                                            *
          Select Options          Begin with SO_                        *
    selection-screen skip 1.
    selection-screen:  begin of block b1 with frame title text-001.
    select-options  :  so_bukrs for vbrk-bukrs no intervals no-extension obligatory  .
    select-options  :  so_kunrg for vbrk-vkorg no intervals no-extension obligatory,
                       so_vkbur for knvv-vkbur no intervals no-extension ,
                       so_fkdat for bsid-budat  no-extension obligatory ,
                       so_bdat1 for bsid-budat  no-display ,
                       so_bdat3 for bsid-budat  no-display ,
                       so_kunnr for kna1-kunnr no-display.
    selection-screen:  end of block b1.
          Parameters              Begin with PR_                        *
    *PARAMETERS     :                                                      *
    selection-screen begin of block b3 with frame title text-003.
    parameters pr_3 radiobutton group rad1.
    parameters pr_4 radiobutton group rad1.
    selection-screen end of block b3.
    selection-screen begin of block b2 with frame title text-002.
    parameters pr_1 radiobutton group rad.
    parameters pr_2 radiobutton group rad.
    selection-screen end of block b2.
    *INITIALISATION   :
          At selection-screen                                           *
    *AT SELECTION-SCREEN.
          S T A R T   O F   S E L E C T I O N                           *
    start-of-selection.
      if pr_3 is not initial.
    Code commented/added by Praveen on 20.07.2006
       SELECT kunnr INTO CORRESPONDING FIELDS OF TABLE it_bp1 FROM knvv
                                       WHERE vkorg IN so_kunrg
                                         AND kunnr GE '0004000000'
                                         AND kunnr LE '0004999999'.
        select kunnr into corresponding fields of table it_bp1 from knvv
                                        where vkorg in so_kunrg
                                          and aufsd <> '01'
                                          and kunnr ge '0004000000'
                                          and kunnr le '0004999999' .
                                         and
                                         PLTYP ne 'HB'.
    *ends here
      endif.
      if pr_4 is not initial.
        clear so_kunnr[].
        clear so_kunnr.
        so_kunnr-sign = 'I'.
        so_kunnr-option = 'BT'.
        so_kunnr-low =  '0001000000'.
        so_kunnr-high = '0001999999'.
        append so_kunnr.
        so_kunnr-sign = 'I'.
        so_kunnr-option = 'BT'.
        so_kunnr-low =  '0002000000'.
        so_kunnr-high = '0002999999'.
        append so_kunnr.
        so_kunnr-sign = 'I'.
        so_kunnr-option = 'BT'.
        so_kunnr-low =  '0007000000'.
        so_kunnr-high = '0007999999'.
        append so_kunnr.
    Code commented/added by Praveen on 20.07.2006
        select kunnr into corresponding fields of table it_bp1 from knvv
                                        where vkorg in so_kunrg and
                                            kunnr in so_kunnr and
                                            vkbur in so_vkbur.
                                       AND kunnr GE '0001000000'
                                       AND kunnr LE '0001999999'   .
        select kunnr into corresponding fields of table it_bp1 from knvv
                                           where vkorg in so_kunrg and
                                               aufsd <> '01' and
                                               kunnr in so_kunnr and
                                               vkbur in so_vkbur.
                                       AND kunnr GE '0001000000'
                                       AND kunnr LE '0001999999'   .
    ends here
      endif.
      if pr_1 = 'X'.
        perform cust_prog.
        perform cust_line.
        perform f001_progressive_total.
        perform f002_item_data.
      elseif pr_2 = 'X'.
        perform cust_line.
        perform f002_item_data.
      endif.
    *&      Form  cust_prog
          text
    form cust_prog.
      clear it_bp3[].
      p_date1 = so_fkdat-low.
      call function 'Z_VF053_DATE_GET_YEAR_MONTH'
        exporting
          i_date  = p_date1
        importing
          e_dd    = l_day_c
          e_month = l_month_c
          e_year  = l_base_yr_c.
      ranges so_bdat2 for bsid-budat.
      clear : so_bdat3[].
      if l_day_c > 01.
        l_day_c = '01'.
        concatenate   l_base_yr_c l_month_c l_day_c     into l_date.
        so_bdat2-low = l_date.
        so_bdat2-high = so_fkdat-low - 1.
      else.
        so_bdat2-low = '00000000'.
        so_bdat2-high = '00000000'.
      endif.
      so_bdat2-sign = 'I'.
      so_bdat2-option = 'BT'.
      append so_bdat2 to so_bdat3.
      select kunnr bukrs budat into corresponding fields of table it_bp3 from bsid
                                         for all entries in it_bp1
                                         where bukrs in so_bukrs
                                           and kunnr = it_bp1-kunnr
                                           and budat in so_bdat3.
    select kunnr bukrs budat
    appending corresponding fields of table it_bp3
    from bsad
    for all entries in it_bp1
    where bukrs in so_bukrs
    and kunnr = it_bp1-kunnr
    and budat in so_bdat3.
      sort it_bp3 by kunnr .
      delete adjacent duplicates from it_bp3 comparing kunnr.
      sort it_bp3 by kunnr .
      clear w_total_bf.
    endform.                    "cust_prog
    *&      Form  cust_line
          text
    form cust_line.
      clear it_bp[].
      select kunnr bukrs budat
      into corresponding fields of table it_bp
      from bsid
      for all entries in it_bp1
      where bukrs in so_bukrs
      and kunnr = it_bp1-kunnr
      and budat in so_fkdat.
      select kunnr bukrs budat
      appending corresponding fields of table it_bp
      from bsad
      for all entries in it_bp1
      where bukrs in so_bukrs
      and kunnr = it_bp1-kunnr
      And budat in so_fkdat.
      sort it_bp by kunnr .
      delete adjacent duplicates from it_bp comparing kunnr.
      sort it_bp by kunnr .
    endform.                    "cust_line
    *&      Form  f001_progressive_total
          text
    form f001_progressive_total.
      if not it_bp3[] is initial.
        clear : w_text ,w_cnt,p_date1,l_base_yr_c, l_month_c,l_day_c,l_date.
       w_cnt1 = sy-tabix .
       CONCATENATE w_cnt1 '  Feaching Data  '  INTO w_text.
       CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
           text = w_text.
        ranges so_bdat2 for bsid-bldat.
        clear : so_bdat1[].
        p_date1 = so_fkdat-low.
        call function 'Z_VF053_DATE_GET_YEAR_MONTH'
          exporting
            i_date  = p_date1
          importing
            e_dd    = l_day_c
            e_month = l_month_c
            e_year  = l_base_yr_c.
        if l_day_c > 01.
          l_day_c = '01'.
          concatenate   l_base_yr_c l_month_c l_day_c     into l_date.
          so_bdat2-low = l_date.
          so_bdat2-high = so_fkdat-low - 1.
        else.
          l_day_c = so_fkdat-low.
          so_bdat2-low = l_date.
          so_bdat2-high = '00000000'.
        endif.
        so_bdat2-sign = 'I'.
        so_bdat2-option = 'BT'.
        append so_bdat2 to so_bdat1.
        export so_bdat1 to memory id 'DATE1'.
        export it_bp3 to memory id 'IT_BP3'.
        clear : so_bdat1, it_bp3.
        submit  z_rfitemar1
                with x_aisel = 'X'
                with x_norm = 'X'
                with dd_bukrs-low = so_bukrs-low                "#EC *
                and return.
        clear : it_pos[], it_pos .
        import it_pos from memory id 'zit_pos'.
        free memory id 'zit_pos'.
        delete it_pos where blart <> 'DZ'.
    Here Plz Clear all the varible to avoid overlap
        clear : w_open_bal,w_du_start_date,w_du_end_date.
        select belnr bukrs gjahr into corresponding fields of table it_bkpf
        from bkpf  for all entries in it_pos where belnr = it_pos-belnr and gjahr = it_pos-gjahr
    and bukrs = it_pos-bukrs and xreversal = ' '.
    endif.
        loop at it_pos.
          clear it_bkpf.
          read table it_bkpf with key bukrs = it_pos-bukrs belnr = it_pos-belnr gjahr = it_pos-gjahr.
          if sy-subrc eq 0.
            append it_pos to it_check.
          endif.
        endloop.
        it_pos[] = it_check[].
    ***opening bal
    since runtime error is coming while summing the alternate way is being used ... done by jayakumar on 11 10 06
       LOOP AT it_pos .
         SUM .
         w_open_bal = it_pos-dmshb .
         EXIT .
       ENDLOOP .
        loop at it_pos .
       read table it_cust3 with key belnr = it_pos-belnr.
       it_pos-dmshb = it_cust3-wrbtr.
          w_open_bal = w_open_bal + it_pos-dmshb .
        endloop .
        if w_open_bal < 0 .
          w_open_bal = w_open_bal * -1.
        endif.
        w_total_bf = w_total_bf + w_open_bal.
    endif.
      write :20 'Progressive Total B/F -
    ' ,106 w_total_bf.
      skip 1 .
    endform.                    "f001_progressive_total
    *&      Form  f002_item_data
          text
    form f002_item_data.
      if not it_bp[] is initial.
        select * into corresponding fields of table it_kna1 from kna1
                              for all entries in it_bp
                              where kunnr = it_bp-kunnr .
        export so_fkdat to memory id 'DATE'.
        export it_bp to memory id 'IT_BP'.
        clear : so_fkdat, it_bp.
        submit  z_rfitemar1
                with x_aisel = 'X'
                with x_norm = 'X'
                with dd_bukrs-low = so_bukrs-low                "#EC *
                and return.
       DELETE it_pos WHERE u_xreversal <> ' '.
        clear : it_pos[], it_pos .
        import it_pos from memory id 'zit_pos'.
        free memory id 'zit_pos'.
        delete it_pos where blart <> 'DZ'.
        sort it_pos by belnr.
       APPEND LINES OF it_pos TO it_pos1.
       DELETE ADJACENT DUPLICATES FROM it_pos COMPARING belnr." commented by sarang
        clear : it_cust[], it_cust.
        if not it_pos[] is initial.
          select belnr wrbtr xref1 kunnr bschl 
          into corresponding fields of table it_cust
          from bseg
          for all entries in it_pos
          where belnr = it_pos-belnr
          and bukrs = it_pos-bukrs
          and gjahr = it_pos-gjahr
          and bschl in ('15','40') . 
         it_cust2[] = it_cust[].
          delete it_cust where bschl ne 15.
          delete it_cust2 where bschl ne 40.
          sort it_pos by konto.
        else.
          write : 20 '**No Transaction to Display**'.
        endif.
       DELETE it_pos WHERE u_xreversal = 'X'.
        tables bkpf.
        loop at it_pos.
          select single  * from bkpf where belnr = it_pos-belnr and bukrs = it_pos-bukrs and gjahr = it_pos-gjahr and xreversal = ' '.
          if sy-subrc = 0.
            append it_pos to it_pos_bc1.
          endif.
        endloop.
        clear it_pos.
        it_pos[] = it_pos_bc1[].
        sort it_pos by konto belnr xref3.
        loop at it_pos.
          read table it_cust2 with key belnr = it_pos-belnr.
          on change of it_pos-konto or "IT_CUST2-xref1 or
          it_pos-belnr.
            it_pos_bc[] = it_pos[].
            delete it_pos_bc[] where konto ne it_pos-konto.
            delete it_pos_bc[] where belnr ne it_pos-belnr.
            loop at it_pos_bc.
              sum.
              exit.
            endloop.
            append it_pos_bc to it_pos_nc.
          endon.
        endloop.
        free it_pos.
        it_pos[] = it_pos_nc[].
        data : w_amt1 type bseg-dmbtr,
              w_amt2 type bseg-dmbtr.
        clear : w_amt1 , w_amt2.
        sort it_pos by budat belnr konto.
        data : w_ch(5) type c,
               w_i type i.
        w_i = 0.
        loop at it_pos where shkzg = 'H' .
          clear w_text.
          w_i = w_i + 1 .
          w_ch = w_i.
          read table it_cust with key belnr = it_pos-belnr  kunnr = it_pos-konto.
          read table it_kna1 with key kunnr = it_pos-konto .
         CONCATENATE it_kna1-name1 INTO w_text.
          w_text = it_kna1-name1.
         CONDENSE w_text NO-GAPS.
          write : / w_ch left-justified  , 07 it_pos-budat ,20 it_pos-belnr(10) ,31 it_pos-konto(10),42 w_text(60).
          read table it_cust2 with key belnr = it_pos-belnr.
          if it_cust2-xref1 = 'Cash Payment' or it_cust2-xref1 = 'Cash'.
            if it_pos-dmshb < 0 .
             it_pos-dmshb = it_pos-dmshb * -1 .
              it_pos-dmshb = it_cust2-wrbtr.
            else.                              "+PM28072006
             it_pos-dmshb = it_pos-dmshb * -1 . "+PM28072006
              it_pos-dmshb = it_cust2-wrbtr.
            endif.
            write : 72 it_pos-dmshb.
            w_amt1 = w_amt1 + it_pos-dmshb.
          else.
            if it_pos-dmshb < 0 .
             it_pos-dmshb = it_pos-dmshb * -1 .
               it_pos-dmshb = it_cust2-wrbtr.
            else.                            "+PM28072006
             it_pos-dmshb = it_pos-dmshb * -1."+PM28072006
              it_pos-dmshb = it_cust2-wrbtr.
            endif.
            write : 87  it_pos-dmshb.
            w_amt2 = w_amt2 + it_pos-dmshb.
          endif .
        endloop .
      else.
        write : 20 '**No Transaction to Display**'.
      endif.
      clear : it_cust1[] ,w_pos .
      it_cust1[] = it_cust[] .
      sort it_cust1 by wrbtr.
      delete it_cust1 where xref1 <> 'Cash Payment' .
      delete it_cust1 where xref1 <> 'Cash' .
      loop at it_cust1.
        sum .
        w_pos = it_cust1-wrbtr .
        exit .
      endloop .
      clear :it_cust1[],w_neg .
      it_cust1[] = it_cust[] .
      sort it_cust1 by wrbtr.
      delete it_cust1 where xref1 = 'Cash Payment' .
      delete it_cust1 where xref1 = 'Cash' .
      loop at it_cust1.
        sum .
        w_neg = it_cust1-wrbtr .
        exit .
      endloop .
      if w_pos < 0.
        w_pos = w_pos * -1 .
      else.                 "+PM28072006
        w_pos = w_pos * -1. "+PM28072006
      endif.
      if w_neg < 0.
        w_neg = w_neg * -1 .
      else.                 "+PM28072006
        w_neg = w_neg * -1. "+PM28072006
      endif.
      write sy-uline(125) .
      write : /20 'Total Collection Amount -
    >'.
      write : 76 w_amt1 ,91 w_amt2.
      w_sub_tot = w_amt1 + w_amt2.
      if w_sub_tot < 0.
        w_sub_tot = w_sub_tot * -1.
      endif.
      write : 106 w_sub_tot.
      if pr_1 = 'X'.
        w_total_co = w_total_bf + w_sub_tot.
        if w_total_co < 0.
          w_total_co = w_total_co * -1.
        endif.
        write : /20 'Progressive Total C/O -
    >'.
        write : 106 w_total_co.
      endif.
      write sy-uline(125) .
    endform.                    "f002_item_data
         ENDIF .
    *END-OF-SELECTION.
          E N D       O F   S E L E C T I O N                           *
          At line selection                                             *
    *AT LINE-SELECTION.
          User Command Processing                                       *
    *AT USER-COMMAND.
          Top Of Page                                                   *
    top-of-page.
      select single * from t001 where bukrs = so_bukrs-low .
      select single * from adrc where addrnumber = t001-adrnr . "EC *
      write : /05  t001-butxt.
    CONCATENATE adrc-house_num1 '-' adrc-street INTO w_text1.
    CONCATENATE adrc-city1 '-' adrc-post_code1 INTO w_text2.
    WRITE : /05  w_text1 .
    WRITE : /05  w_text2 .
      write : /05  'Sales Organisation:', so_kunrg-low.
      write : /05  'Sales Office:', so_vkbur-low.
      skip 1.
      if pr_3 = 'X'.
        write : /05 'Agent Circulation Collection Statement From ' , so_fkdat-low , ' to ' ,so_fkdat-high .
      else.
        write : /05 'Advertisement  Collection Statement From ' , so_fkdat-low , ' to ' ,so_fkdat-high .
      endif.
      if pr_3 = 'X'.
        write  :/ sy-uline(125) .
        write :/07 'Date' ,20 'Doc No',31 'Code' ,42 'Agent Name & Place',84 'BY CASH' ,97 'BY CHQ/DD' ,115 'Prog. Total'.
        write  :/ sy-uline(125) .
      else.
       write  :/ sy-uline(125) .
       write :/07 'Date' ,20 'Doc No',31 'Code' ,42 'Advertisers Name' ,  84 'BY CASH' ,97 'BY CHQ/DD' ,115 'Prog. Total'.
       write  :/ sy-uline(125) .
      endif .
          End Of Page                                                   *
    END-OF-PAGE.END-OF-PAGE.

    Hello Selvi
    There is no need to use two subroutine. Actually, this would be bad programming. Instead use a switch for your subroutine which determines whether the calculation should be done for the actual and the previous day, e.g.:
    PERFORM do_calculation
                                     USING 'X'          " 'X' = calculate for previous day as well
                                     USING p_date   " current date
                              CHANGING gt_list.   " itab with list data
    And that's how the subroutine could look like:
    FORM do_calculation
                             USING VALUE(ud_calculate_previous_day)  TYPE c
                                        VALUE(ud_date)                             TYPE d
                      CHANGING ct_list    TYPE <table type>.
    * define local data
      DATA:
         ld_date_prev  TYPE d,
         lt_list_prev     TYPE <table type>.  " list for previous day
    * Do the calculations for the current day
      IF ( ud_calculate_previous_day = 'X' ).
        ld_date_prev = ud_date - 1.
        PERFORM do_calculation
                                         USING ' '  " ' ' = no calculation for previous day
                                                    ld_date_prev
                                  CHANGING lt_list_prev.   " itab with list data
      ENDIF.
    * Post-processing after calculation for both days
    ENDFORM.
    Regards
      Uwe

  • Use of subroutine in SapScript

    Hi Friends,
                  I am passing two parameters as input from sapscript perform statement and i want one field from database table as output.
                  In abap editor i have created two internal tables of the type ITCSY for input and output parameters. <b>The name field of the internal table i have created is getting populated but the corresponding value field is not getting populated,</b> so my further logic is not processed and i am not gettin the desired result i.e. it it displaying nothing.
                 Can you guide me on the same?
    Regards,
    Nikhil

    Hi,
    My code is as follows in which i have ynbemployeetable in database from which i am taking empname and empgender as input and i want  empid as output.
    I have written following perform statement in se71.
    PERFORM GET_DETAILS IN PROGRAM ZNIK_SSCRIPT_NEW_AS5
    USING &YNBEMPLOYEETABLE-EMPNAME&
    USING &YNBEMPLOYEETABLE-EMPGENDER&
    CHANGING &EMPID&
    ENDPERFORM
    I have written following form in se38 abap editor. in this the input-value field is not getting populated.
    FORM get_details TABLES input STRUCTURE  ITCSY
                            output STRUCTURE ITCSY.
    DATA : z_empname LIKE ynbemployeetable-empname,
                z_empgender LIKE ynbemployeetable-empgender,
                z_empid type i.
    READ TABLE input with key 'YNBEMPLOYEETABLE-EMPNAME'.
    CHECK sy-subrc = 0.
    z_empname = <b>input-value</b>. "Not getting populated
    READ TABLE input with key 'YNBEMPLOYEETABLE-EMPGENDER'.
    CHECK sy-subrc = 0.
    z_empgender = <b>input-value.</b>  "Not getting populated
    SELECT SINGLE empid FROM ynbemployeetable
    INTO z_empid
    WHERE empname = z_empname and empgender = z_empgender.
    output-name = 'EMPID'.
    MOVE z_empid TO output-value.
    MODIFY output INDEX 1.
    ENDFORM.
    Can you help me know why it is not getting populated and what is the mistake?

  • Use of subroutines in SAPScripts

    When we are calling a subroutine from Script is it possible to retrieve an internal table from the program and use it in the script for printing data?
    for eg:PERFORM <subroutine name> IN PROGRAM <program name> using<var1>
    chnging<var2>.Can Var1 or var 2 be an internal table?

    hi Savitha,
    Var1 and Var2 are defintely tables, but does not serve the purpose of passing internal table values from print program. They are tables of structure ITCSY which has only two fields, NAME (field name) and VALUE (field value). Meaning for one field, there can be only one entry.
    Please see the code attached below:
    PERFORM get_attn IN PROGRAM zprogname USING var1 CHANGING var2.
    FORM get_attn TABLES in_tab STRUCTURE itcsy
                         out_tab STRUCTURE itcsy.
      DATA: v_name2 TYPE kna1-name2,
            v_attn TYPE string,
            v_kunnr TYPE knvk-kunnr,
            v_offset TYPE i,
            err_str TYPE string,
            w_tab   TYPE itcsy.
    * Get Customer Number
      READ TABLE in_tab INTO w_tab WITH KEY name = 'DKADR-KONTO'.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno
                    INTO err_str .
      ENDIF.
    * Get Assistant name
      MOVE w_tab-value TO v_kunnr.
      v_offset = 10 - STRLEN( v_kunnr ).
      SHIFT v_kunnr RIGHT BY v_offset PLACES.
      OVERLAY v_kunnr WITH '0000000000'.
      SELECT SINGLE name2 FROM kna1 INTO v_name2
                          WHERE kunnr = v_kunnr.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno
                    INTO err_str .
      ENDIF.
      CLEAR w_tab.
      READ TABLE out_tab WITH KEY name = 'ATT_NAME' INTO w_tab.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno
                    INTO err_str .
      ENDIF.
      MOVE v_name2 TO w_tab-value.
      MODIFY out_tab INDEX sy-tabix FROM w_tab.
    ENDFORM.                    "get_attn
    Hope this helps,
    Sajan Joseph.

  • Problem with barcode in SAPSCRIPT

    How to add Bar code <b>YBC_EANH</b> to table <b>ITCDS-TDBARCODE</b>, with the following attributes:
    Barcode: YBC_EANH
    Meaning: EAN 128, n.txt,h=32mm

    Hello Ragu,
    Thanks for your reply. I am working on a migration object, therefore the barcode type I want to declare does not exist in the db of the new box in working with. Is there any way I can include a new barcode? For example, to create a new page format, I just have to create it in transaction SPAD. Is there any transaction that I can use that does the same for bar codes? Thank you very much.

  • Problem when creating spool [SAPSCRIPT]

    hi all,
    everytime i ran by transaction, it always creates 2 forms, which should not be the case,
    i checked TDNEWID field in ITCPO, but its blank.
    do you have any idea?

    Hi,
    check this wiki...
    http://wiki.sdn.sap.com/wiki/display/Snippets/DownloadSAPScriptoutputtoPDF+file.
    Prabhudas

  • Subroutine pool of sapscript

    Hi All
    can anybody plz tell me waht is subroutine pool of sapscript??
    waiting for replies
    THanks

    Hi,
       If you want to do calculations on some of the fields in a script one way is to change the print program. And other way is to call a routine in the windw which is in another program.
    For eg: if you have a subroutine named ADD_INCOME in a program ZSHAIL_BASIC, you can call the subroutine in SAPScript as follows:
    /: PERFORM ADD_INCOME IN PROGRAM ZSHAIL_BASIC
    /: USING &var1&
    /: CHANGING &var2&
    /: ENDPERFORM.
    Here the input parameter to the subroutine is var1 and the value returned by the subroutine is var2.
    In the program ZSHAIL_BASIC, you have to call the subroutine as
    FORM ADD_INCOME TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY.
    ENDFORM.
    IN_TAB is a structure of type ITCSY,which has 2 components, NAME and value.
    So in the program, var1(which is sent from SAPScript) , will be stored as IN_TAB-NAME and its value will be in IN_TAB-VALUE. You can utilise the IN_TAB-VALUE and after performing the required operations, the return value should be assigned to table OUT_TAB.
    This value can thus be obtained in var2 specified in SAPScript.
    Thanks and Regards,
    Bharat Kumar Reddy.V

Maybe you are looking for

  • Can i use forms 9i or 10g for client/server applications

    Right now, we are using oracle 9i DB and developer suite 10g. I have to build a client/server application. In one of the OTN articles, it says that from forms 9i onwards, it's not supporting client/server applications. Do i have to use 6i for this. T

  • Matrix Reports in R12

    Hi All, I'm using oracle 11g and EBZ 12.1.3. i want to deploy report in matrix format in R12. i create report in report builder but i dont knw how to deploy in r12 please help Thanks & regards, Macks

  • Help - After 4 months I still can't activate my ac...

    Hi, Been having a huge nightmare with BT customer support. Moved house in April and signed up for BT phone/broadband package and pre-paid the first year. Was a month after move in before we finally had broadband but all good eventually. Then get emai

  • Usupported graphics software photoshop cs6 extended

    i hae windows 7 home premium and when i open photoshop cs6 extended it said "photoshop has detected graphics software that is not supported" and when i use the text tool the text is very small and i have done all the fixes for the small text problem

  • Need to know Failed DFT name

    Hi All, I am having a SSIS Package with 10 DFT. I am looking to store the logs which will show me name of DFT and status of the DFT whether it gets failed or success at the end of ETL. so that I can only go and check the failed DFT . please suggest m