Currency in form

Hi Guys,
I have a question that hope you guys can help me with. I have a table in a form, it has a column displaying price and another column contains the currency. I need to display the price column with the currency sign depending on the currency column. It is possible that different row might have different currency. How do i bind dynamically the currency to the price column?
I am using Lifcycle designer version 8.01.

Hi Otto,
Thanks.
Let me just confirm what you suggesting...
1. have both the price column and the currency column.
2. Use javascript to read the currency column and based on that dynamically set the pattern for the price column. And i believe i need to set the locale as well to get the currency symbol displayed correctly?
I am new to scripting, may i know where is the best place to place this script, which object and which event?

Similar Messages

  • Currency in form fields

    I have a report where some of the data contains currency infomation. When the user clicks "Edit", the user is taken to another page where they edit the data.
    Is there a way within the edit mode where I can display data right aligned and with a currency value ie : show the $ symbol and two decimal places in the data, I prefer not to put the $ in the field description if a can.

    In smart forms if we want to display quantity and currency fields. We cannott directly display currency field and quantity fields.
    To display the mdo like this
    Ex: GLOBAL Definitions
    WA_NETPR LIKE EKPO-NETPR
    For that we have to create an extra variable in global definitions
    Ex: netpr FIELD of EKPO
    CREATE program lines and specify WA_NETWR = itab-netpr.
    Close the thread once your question is answered.
    Regards,
    SaiRam

  • Local currency on forms

    Hi,
    My manager has two projects below him (level0 members). Problem is that one is in USD and one is in EUR currency. So in his form he inputs 100 USD to USD project and 100 EUR in EUR project for example. But then the sum is 200 for local which is not correct. Is it somehow possible to solve this? The manager has EUR currency set up.
    thank you very much

    Hi!
    Can you just run a currency conversion script which should translate those local figures to a reporting currency?
    I suppose you have a multicurrency application and a form where you have enabled "allow multiple currencies per entity".
    On the form you can then use the "Calculate currencies"-calculation. Then you can select a reporting currency for example in page (if you have defined form that way)
    kind regards,
    user637777

  • Error while opening form in parent currency

    Hi
    I have created a form where i input the data at entity currency for various entities.
    I need to view data at consolidated level in parent currency.
    But each time after i select the parent entity and then select <Parent currency>, the form does not open and gives an error as follows:
    An unknown error has occurred in the HsvWebFormGeneratorACM object.
    Show Details:
    Error Reference Number: {CDB5B697-1463-42F2-92E3-E63D5884A56F};User Name: admin@Native Directory
    Num: 0x80004005;Type: 0;DTime: 1/29/2010 1:07:59 PM;Svr: STARINDEVHYAP;File: CHsvData.cpp;Line: 7163;Ver: 11.1.1.3.0.2413;
    Num: 0x80004005;Type: 0;DTime: 1/29/2010 1:07:59 PM;Svr: STARINDEVHYAP;File: WDEFGenerator.cpp;Line: 3735;Ver: 11.1.1.3.0.2413;
    Num: 0x80040d40;Type: 0;DTime: 1/29/2010 1:07:59 PM;Svr: STARINDEVHYAP;File: WDEFGenerator.cpp;Line: 3155;Ver: 11.1.1.3.0.2413;
    Num: 0x80040d40;Type: 0;DTime: 1/29/2010 1:07:59 PM;Svr: STARINDEVHYAP;File: CHsvWebFormGeneratorACM.cpp;Line: 2724;Ver: 11.1.1.3.0.2413;
    Num: 0x80040d40;Type: 0;DTime: 1/29/2010 1:07:59 PM;Svr: STARINDEVHYAP;File: CHsvWebFormGeneratorACM.cpp;Line: 2433;Ver: 11.1.1.3.0.2413;
    Num: 0x80040d40;Type: 0;DTime: 1/29/2010 1:08:00 PM;Svr: STARINDEVHYAP;File: CHsvWebFormsACV.cpp;Line: 569;Ver: 11.1.1.3.0.2413;
    The script for the said form is as below :
    ReportType=WebForm
    ReportLabel=Historical Data
    ReportDescription=Historical Data
    BackgroundPOV=S#Actuals.w#YTD.E#100.V#<Entity Currency>.I#[ICP None].C1#No PCC.C2#H_1001.C3#BaseData.C4#NotApplicable
    SelectablePOVList=Y{[Hierarchy]}.P{[Third Generation]}
    C1=C2{Historicals.[Hierarchy]}
    R1=A{Historical Acc.[Hierarchy]}
    ShowLabels=True
    ShowDescriptions=True
    what would be reason for the said error?
    Regards,

    Solved the issue..... since the entity top member and the parent currency members were in the default view, it gave the error message
    rgds

  • S_ALR_87012178 currency

    Hi, i need to display the report s_alr_87012178 with a currency different form the local courrency. I've choose the following values
    OI sorted list sorting (1,2) 2
    Summarization Level (0-6) 6
    OI list summarization (0-2) 1
    but the system changes the OI sorted list sorting (1,2) from 2 to 1
    Thanks
    Cristina

    Refer to OSS 769338
    You select the summarization level '6' for the output control, In this case, the program sets the selection parameters 'OI sorted list sorting (1,2)', 'OI list summarization (0-2)' and 'Company code data'<b> automatically to the values 1, 1 and</b> 2.
    Reason and Prerequisites
    The summarization level 6 causes a single-line issue of the OI list. That is, the program issues the customer number, the sorting field, the country and the list data in one line. However, only 132 characters are available for every issue line. With that an issue of additional fields is not possible anymore. For this reason, the above-mentioned parameters are set automatically in the program.
    <b>
    Solution</b>
    Use the summarization level 1 if you require the information on the document currency, the business area or the company code in addition to the OI list.

  • Currency doubts

    Hi All,
    I am working in Hyperion 9.3.1. I am having some currency issue. I am having 28 currencies in my planning application. While creating the forms, if i select local currency, i can able to enters the value in the form. If i select other than local currency, the form is in green color. I cant able to enter the value.
    1) What is meant by local currency?(i did't create this member in currency dimension, By default is coming)
    2) How to change the reporting currency in planning application, can i have more than reporting currency?
    3) while creating the form, If i select the other than local currency the form in green color, how can i overcome this error?
    Please guide me in this situation.
    Thanks,
    Lakshmi

    Hi,
    This is not an error. If you enabled multi currency in your application, you must assign default currencies to entities. Your users cannot enter data against currencies. However, entering data to local currency effectively means entering data to the default currency of the selected entity. If you want to be able to enter data to multiple currencies to web forms, you must enable this at web forms. After enabling this, you will find a selection of currencies at each cell in the data form.
    You should run or make your users run currency conversion rules to make the translation. These rules does take care about conversions and you use currencies in reporting.
    It is also perfectly possible to have more than 1 reporting currency. It's just a matter of defining and running the currency conversion rule.
    Cheers,
    Alp

  • Currency field in PO item

    Hi,
    in what table is contained the field related to the currency (WAERS) for each item of a PO ?
    I didn't find it in table EKPO.
    Regards

    hi,
    Never forget the currencies flow form master data like vendor master data...if its not defined in it ...it'll not be there in the PO...
    Check TABLE LFM2 - VMR- purchasing data...
    Here it is defined in the field WAERS...check it in SE16 tcode..
    And as suggested below it is placed in the doc item....in the table EKPO...
    Hope its clear..
    Regards
    Priyanka.P

  • Move currency symbol

    Hello,
    Any one knows how to move a currency sign form the right of an amount to the left of it?
    I am working on translation and I need to move the £ sign to the left of the amount ie. £330.00, should be 330.00£ in Spanish, is there anyway I could do that without copying and pasting?
    Many thanks,
    Rosa.

    Hi Rosa,
    You should be able to do this with a custom format. Since I am in the US I went and put the $ on the right.
    Create Custom Format is the last option in the Data Format menu.
    quinn

  • Trouble in currency conversion

    I am having problem in a conversion.
    I have a net value in a foreign currency (GBP) that is the net value of an invoice, I want convert it in local currency (EUR).
    I use CONVERT_TO_LOCAL_CURRENCY with the rate specified in vbrk-kurrf, but it seems it contains not enough decimal positions, so the value that I obtain and the corrispondent value in bseg-dmbtr are not equal, indeed are different after the second decimal position.
    Have you got any idea?
    Thank you

    Hii
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
          EXPORTING
            DATE             = SYST-DATUM
            FOREIGN_AMOUNT   = for_amount
            FOREIGN_CURRENCY = 'USD'
            LOCAL_CURRENCY   = 'GPP'
               TYPE_OF_RATE = 'M' 
          IMPORTING
            LOCAL_AMOUNT     = loc_ammount
          EXCEPTIONS
            NO_RATE_FOUND    = 1
            OVERFLOW         = 2
            NO_FACTORS_FOUND = 3
            NO_SPREAD_FOUND  = 4
            DERIVED_2_TIMES  = 5.
    also chk this link
    <b>CONVERT_TO_LOCAL_CURRENCY
    Look at  this code for converting currency values from one currency to another .this example converts 10 euros into GBP. When you display this value you first need to convert it from its internal SAP value to the proper external display value.
    <b>DATA: gd_fcurr TYPE tcurr-fcurr,
          gd_tcurr TYPE tcurr-tcurr,
          gd_date  TYPE sy-datum,
          gd_value TYPE i.
    gd_fcurr = 'EUR'.
    gd_tcurr = 'GBP'.
    gd_date  = sy-datum.
    gd_value = 10.
    PERFORM currency_conversion USING gd_fcurr
                                      gd_tcurr
                                      gd_date
                             CHANGING gd_value.
    Convert value to Currency value
    *&      Form  currency_conversion
          text
         -->P_GD_FCURR  text
         -->P_GD_TCURR  text
         -->P_GD_DATE   text
         <--P_GD_VALUE  text
    FORM currency_conversion  USING    p_fcurr
                                       p_tcurr
                                       p_date
                              CHANGING p_value.
      DATA: t_er        TYPE tcurr-ukurs,
            t_ff        TYPE tcurr-ffact,
            t_lf        TYPE tcurr-tfact,
            t_vfd       TYPE datum,
            ld_erate(12)   TYPE c.
      CALL FUNCTION 'READ_EXCHANGE_RATE'
        EXPORTING
          CLIENT                  = SY-MANDT
          date                    = p_date
          foreign_currency        = p_fcurr
          local_currency          = p_tcurr
          TYPE_OF_RATE            = 'M'
          EXACT_DATE              = ' '
       IMPORTING
          exchange_rate           = t_er
          foreign_factor          = t_ff
          local_factor            = t_lf
          valid_from_date         = t_vfd
          DERIVED_RATE_TYPE       =
          FIXED_RATE              =
          OLDEST_RATE_FROM        =
       EXCEPTIONS
         no_rate_found           = 1
         no_factors_found        = 2
         no_spread_found         = 3
         derived_2_times         = 4
         overflow                = 5
         zero_rate               = 6
         OTHERS                  = 7
      IF sy-subrc EQ 0.
        ld_erate = t_er / ( t_ff / t_lf ).
        p_value = p_value * ld_erate.
      ENDIF.
    ENDFORM.                    " currency_conversion</b>
    Values stored in fields of type CURR can have different values than those displayed on screen. This can be done using a number of standard ABAP statements like
    WRITE/ *Write TO and also with the FM CURRENCY_AMOUNT_SAP_TO_DISPLAY.
    data:      p_intval like wmto_s-amount.   "Internal Amount
      data:      gd_disval  like wmto_s-amount. "Display Amount
      call function 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'
           exporting
                currency        = po_tab-waers
                amount_internal = p_intval
           importing
                amount_display  = gd_disval
           exceptions
                internal_error  = 1
                others          = 2.
    Regards
    Naresh

  • Calculation of customer payment performance   by profit center

    I want to calculate customer payment performance by profit center  it is a report.
    Caluation clue.
    <b>Performance is a measure of when the payment was made versus the due date calculated by the payment terms</b>.
    i want the logic to be included in the following code.
    REPORT                                               
    TABLE DECLARATIONS
    TABLES: BFOD_A,         "FI subsequent BA/PC adjustment: Customer items
            BSID,           "Open Items
            BSAD,           "Cleared Items
            BKPF,           "Docuemnt Header
            KNA1,           "Customer Master
            CEPCT,          "Texts for Profit Center Master Data
            CEPC,           "Profit center master data table
            SKB1,           "G/L account master
            VBFA,           "Sales Document Flow
            VBAK.           "Sales Document: Header Data
    CONTROLS: TABAGING TYPE TABLEVIEW USING SCREEN 9000.
    FIELD-SYMBOLS: <COLUMN>.
    Internal tables followed by types
    TYPES: BEGIN OF T_TOTAL,
             WAERS  LIKE COEP-TWAER,
             DAYS01 LIKE COEP-WTGBTR,
             DAYS02 LIKE COEP-WTGBTR,
             DAYS03 LIKE COEP-WTGBTR,
             DAYS04 LIKE COEP-WTGBTR,
             DAYS05 LIKE COEP-WTGBTR,
             TOTAL  LIKE COEP-WTGBTR,
           END OF T_TOTAL.
    DATA: V_DISVARIANT       TYPE DISVARIANT,
          REF_CUSTOM         TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          REF_ALV_ZRPT       TYPE REF TO CL_GUI_ALV_GRID.
    DATA: V_SAVE(1)    TYPE C,
          V_DEFAULT(1) TYPE C,
          V_VARIANT    TYPE DISVARIANT,
          V_SORT       TYPE LVC_S_SORT,
          V_LAYOUT     TYPE LVC_S_LAYO,
          V_SAVE_TABIX LIKE SY-TABIX,
          V_SAVE_TIME  LIKE SY-UZEIT,
          V_ALV_FIELDCAT TYPE LVC_S_FCAT,
          V_SAVE_INDEX LIKE SY-TABIX,
          V_ROW        TYPE LVC_S_ROW,
          V_ROWS       TYPE LINE OF LVC_T_ROW.
    DATA: BEGIN OF V_HDR,
            CURKY(9) TYPE C,
            CURR(20) TYPE C,
            COL1(20) TYPE C,
            COL2(20) TYPE C,
            COL3(20) TYPE C,
            COL4(20) TYPE C,
            TOTAL(20) TYPE C,
          END OF V_HDR.
    DATA: BEGIN OF V_FIELD,
            NAME(15) TYPE C,
            VALUE(17) TYPE C,
          END OF V_FIELD.
    DATA: BEGIN OF I_BFOD_A OCCURS 0,
            PRCTR LIKE BFOD_A-PRCTR,
            KUNNR LIKE BFOD_A-KUNNR,
            BUKRS LIKE BFOD_A-BUKRS,
            GJAHR LIKE BFOD_A-GJAHR,
            BELNR LIKE BFOD_A-BELNR,
            BUZEI LIKE BFOD_A-BUZEI,
            AUGDT LIKE BFOD_A-AUGDT,
            HKONT LIKE BFOD_A-HKONT,
            BUDAT LIKE BFOD_A-BUDAT,
            SHKZG LIKE BFOD_A-SHKZG,
            DMBTR LIKE BFOD_A-DMBTR,
            DMBE2 LIKE BFOD_A-DMBE2,
          END OF I_BFOD_A.
    DATA: I_SET_VALUES   LIKE SETVALUES OCCURS 0 WITH HEADER LINE,
          I_SORT         TYPE LVC_T_SORT,
          I_ALV_FIELDCAT TYPE LVC_T_FCAT,
          I_PRCTR_COCD   TYPE FCINPCA001 OCCURS 0 WITH HEADER LINE,
          I_BFODA_KUNNR  LIKE I_BFOD_A OCCURS 0 WITH HEADER LINE,
    Begin of changes for DEVK909110
         I_REPORT       TYPE ZFR0ARPR_S1 OCCURS 0 WITH HEADER LINE,
          I_REPORT       TYPE ZPSS_ARBYPC OCCURS 0 WITH HEADER LINE,
    End of changes for DEVK909110
          I_FAEDE        LIKE FAEDE,
          I_TOTAL        TYPE T_TOTAL OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_BKPF OCCURS 0,
            BUKRS LIKE BKPF-BUKRS,
            BELNR LIKE BKPF-BELNR,
            GJAHR LIKE BKPF-GJAHR,
            BKTXT LIKE BKPF-BKTXT,
            XBLNR LIKE BKPF-XBLNR,
            HWAER LIKE BKPF-HWAER,
            HWAE2 LIKE BKPF-HWAE2,
          END OF I_BKPF.
    *... combine BSAD and BSID
    DATA: BEGIN OF I_BSYD OCCURS 0,
            KUNNR LIKE BSID-KUNNR,
            BUKRS LIKE BSID-BUKRS,
            GJAHR LIKE BSID-GJAHR,
            BELNR LIKE BSID-BELNR,
            BUZEI LIKE BSID-BUZEI,
            AUGDT LIKE BSID-AUGDT,
            BLDAT LIKE BSID-BLDAT,
            BUDAT LIKE BSID-BUDAT,
            HKONT LIKE BSID-HKONT,
            WAERS LIKE BSID-WAERS,
            ZFBDT LIKE BSID-ZFBDT,
            ZBD1T LIKE BSID-ZBD1T,
            ZBD2T LIKE BSID-ZBD2T,
            ZBD3T LIKE BSID-ZBD3T,
            XBLNR LIKE BSID-XBLNR,
            REBZG LIKE BSID-REBZG,
            SHKZG LIKE BSID-SHKZG,
            DMBTR LIKE BSID-DMBTR,
            WRBTR LIKE BSID-WRBTR,
          END OF I_BSYD.
    DATA: BEGIN OF I_CEPC OCCURS 0,
             PRCTR LIKE CEPC-PRCTR,
             KHINR LIKE CEPC-KHINR,
          END OF I_CEPC.
    DATA: BEGIN OF I_CEPCT OCCURS 0,
             PRCTR LIKE CEPCT-PRCTR,
             MCTXT LIKE CEPCT-MCTXT,
          END OF I_CEPCT.
    DATA: BEGIN OF I_PRCTR OCCURS 0,
            PRCTR LIKE BFOD_A-PRCTR,
          END OF I_PRCTR.
    DATA: BEGIN OF I_KNA1 OCCURS 0,
             KUNNR LIKE KNA1-KUNNR,
             NAME1 LIKE KNA1-NAME1,
          END OF I_KNA1.
    Working Variables Declarations
    *... accumulators
    DATA: V_BFOD_TXNAMT LIKE BSID-WRBTR,    "transaction currency amt
          V_FRCURR      LIKE TCURR-FCURR,   "local currency
          V_TOCURR      LIKE TCURR-FCURR,   "local currency
          V_LCURR       LIKE T001-WAERS,    "local currency
          V_CUSTTOTUSD  LIKE BFOD_A-DMBE2,  "customer total grp curr
          V_TOTAL       LIKE BPPE-WTP03,    "days total grp curr
          V_CURRENT     LIKE BPPE-WTP03,    "days current grp curr
          V_TOTAL_USD   LIKE BPPE-WTP03,    "days total grp curr
          V_TOTAL_ROW   LIKE BPPE-WTP03.    "total of local curr/row
    DATA: V_PRCTR          LIKE CEPC-PRCTR,   "profit center
          V_SUBRC          LIKE SY-SUBRC,
          V_FLAG           TYPE I,
          V_DPAST          TYPE I,     "past due days working
          V_GRAND          TYPE C,
          V_DIFF_COLOR     TYPE C,
          V_MSG(50)        TYPE C,
          V_SAVE_PCFN(128) TYPE C,
          V_EXTENSION(4)   TYPE C,
          V_PREV_PRCTR     LIKE CEPC-PRCTR,
          V_POS            LIKE SY-FDPOS,
          V_SAVE_BUKRS     LIKE BFOD_A-BUKRS,
          V_SAVE_KHINR     LIKE CEPC-KHINR,
          V_PERC           TYPE P DECIMALS 10,
          V_ZBD1T          LIKE BSID-ZBD1T,
          V_ZFBDT          LIKE BSID-ZFBDT,
          V_GROUP_CLASS    LIKE RGSBS-CLASS,
          V_GROUP_NAME     LIKE RGSBS-SETNR,
          V_GROUP_TITLE    LIKE RGSBS-TITLE,
          V_SETID          LIKE SETHIER-SETID,
          V_FILETYPE       LIKE RLGRAP-FILETYPE VALUE 'DAT',
          V_CNT            LIKE SY-TABIX,
          V_PREV_BELNR     LIKE BSID-BELNR,
          V_REPORT1        LIKE I_REPORT,
          V_REPORT         LIKE I_REPORT,
          V_TABIX          LIKE SY-TABIX.
    Constants
    CONSTANTS:
          C_0H(2)     TYPE C VALUE '0H',
          C_0106(4)   TYPE C VALUE '0106',
          C_SPACE(11) TYPE C VALUE '          ',
          C_USD(3)    TYPE C VALUE 'USD',
          C_KBRC      LIKE CEPC-KOKRS VALUE 'KBRC',
          C_TXT(4)    TYPE C VALUE '.txt',
          C_XLS(4)    TYPE C VALUE '.xls',
          C_RTF(4)    TYPE C VALUE '.rtf',
          C_PERIOD(1) TYPE C VALUE '.',
          C_TODATE    LIKE CEPC-DATBI VALUE '99991231'.
    RANGES: R_KUNNR FOR KNA1-KUNNR.         "Customer
    Selection Screen Parameters and Select-options
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:     P_KHINR LIKE CEPC-KHINR.
    SELECT-OPTIONS: S_PRCTR FOR CEPC-PRCTR,
                    S_KUNNR FOR KNA1-KUNNR,
                    S_BUKRS FOR BKPF-BUKRS,
                    S_HKONT FOR SKB1-SAKNR.
    PARAMETERS:     P_BUDAT LIKE BFOD_A-BUDAT OBLIGATORY.
    SELECTION-SCREEN ULINE.
    SELECT-OPTIONS: S_BELNR FOR BFOD_A-BELNR,
                    S_AUART FOR VBAK-AUART,
                    S_VTWEG FOR VBAK-VTWEG,
                    S_VBTYP FOR VBFA-VBTYP_V.
    SELECTION-SCREEN ULINE.
    PARAMETERS: P_AGEDY TYPE ZZAGEMULT DEFAULT '30' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
    PARAMETERS: P_DSVAR LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B2.
    class lcl_event_receiver: local class to handle event DOUBLE_CLICK
    Definition:
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
        MTH_PRINT_TOP_OF_PAGE
            FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID.
        METHODS:
        MTH_PRINT_TOP_OF_LIST
            FOR EVENT PRINT_TOP_OF_LIST OF CL_GUI_ALV_GRID.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    class lcl_event_receiver: local class to handle event DOUBLE_CLICK
    Implementation:
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD MTH_PRINT_TOP_OF_PAGE.
        CALL FUNCTION 'Z_CA_STD_HEADER'
          EXPORTING
            HEADING    = SY-TITLE
            P_REPID    = SY-CPROG
            LINE_WIDTH = SY-LINSZ.
      ENDMETHOD.                    "MTH_PRINT_TOP_OF_PAGE
      METHOD MTH_PRINT_TOP_OF_LIST.
        CALL FUNCTION 'Z_CA_STD_HEADER'
          EXPORTING
            HEADING    = SY-TITLE
            P_REPID    = SY-CPROG
            LINE_WIDTH = SY-LINSZ.
        CALL FUNCTION 'Z_CA_PRINT_SELECTION_OPTIONS'
          EXPORTING
            P_PGMN  = SY-CPROG
            P_SKIP  = 'X'
            P_NOTOP = 'X'.
        NEW-PAGE.
      ENDMETHOD.                    "MTH_PRINT_TOP_OF_LIST
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    DATA: REF_EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
    Selection Screen Prompt values
      At Selection Screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_DSVAR.
      DATA: LS_DISPLAY_VARIANT TYPE DISVARIANT.
    Get the display variant
      V_DISVARIANT-REPORT  = SY-CPROG.
      V_DISVARIANT-VARIANT = P_DSVAR.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          IS_VARIANT = V_DISVARIANT
          I_SAVE     = 'A'
        IMPORTING
          ES_VARIANT = LS_DISPLAY_VARIANT
        EXCEPTIONS
          OTHERS     = 3.
    Load results to parameter
      IF SY-SUBRC = 0 AND NOT LS_DISPLAY_VARIANT IS INITIAL.
        P_DSVAR = LS_DISPLAY_VARIANT-VARIANT.
      ENDIF.
    *...performed when looking for values in fields
      performs the drop down selection list
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KHINR.     "Profit center grp
      PERFORM F_GET_S_KHINR.
    Selection Screen validations
    AT SELECTION-SCREEN.
      IF P_KHINR IS INITIAL.
        IF S_PRCTR[] IS INITIAL.
          IF S_BUKRS[] IS INITIAL.
            MESSAGE E000 WITH TEXT-300 TEXT-302.
          ENDIF.
        ENDIF.
      ELSE.
        IF S_PRCTR[] IS INITIAL.
          PERFORM F_VALIDATE_KHINR.
        ELSE.
    *.. Error msg: Please enter either a Profit Center Group or a
                 profit center, but not both
          MESSAGE E000 WITH TEXT-300 TEXT-301.
          EXIT.
        ENDIF.
      ENDIF.
      IF NOT S_AUART[] IS INITIAL.
        MESSAGE E000 WITH TEXT-303.
      ENDIF.
      IF NOT S_VTWEG[] IS INITIAL.
        MESSAGE E000 WITH TEXT-304.
      ENDIF.
       Event AT LINE-SELECTION
    AT LINE-SELECTION.
      CHECK SY-LSIND LE 1.
      CHECK NOT I_REPORT-BELNR IS INITIAL.
      SET PARAMETER ID 'BLN'  FIELD I_REPORT-BELNR.
      SET PARAMETER ID 'BUK'  FIELD I_REPORT-BUKRS.
      SET PARAMETER ID 'GJR'  FIELD I_REPORT-GJAHR.
      CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
      CLEAR: I_REPORT-BELNR, I_REPORT-BUKRS, I_REPORT-GJAHR.
    INITIALIZATION
    INITIALIZATION.
    START OF MAIN PROCESSING
    START-OF-SELECTION.
    Check aging days multiplier
      IF P_AGEDY LE 0.
        MESSAGE S000 WITH 'Aging Days Multiplier must be greater than zero'.
        EXIT.
      ENDIF.
    Populate the s_prctr from a profit center group
      IF NOT I_SET_VALUES[] IS INITIAL.
        PERFORM F_POPULATE_PRCTR_FROM_PRCTRGRP.
      ENDIF.
    Build and validate prctr against cepc table
      IF NOT S_PRCTR[] IS INITIAL.
        PERFORM F_BUILD_I_CEPC_TABLE.      "FILLS THE VALID PROFIT CTR TABLE
      ENDIF.
    Get base selections
      PERFORM F_SELECT_DATA.               "BUILD REF INTERNAL TABLES
    Get additional fields and build reporting structure
      PERFORM F_BUILD_I_REPORT.            "BUILDS INTERNAL REPORTING TABLE
    Generate ALV report
      PERFORM F_WRITE_REPORT.              "WRITES i_report AND RUNS CALCS
    END-OF-SELECTION.
      FREE: I_BFOD_A, I_KNA1, I_CEPC, I_CEPCT, I_REPORT.
          Form  F_DIS_MSG
    FORM F_DIS_MSG USING VALUE(P_PERCENTAGE) VALUE(P_TEXT).
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          PERCENTAGE = P_PERCENTAGE
          TEXT       = P_TEXT
        EXCEPTIONS
          OTHERS     = 1.
    ENDFORM.                               " F_DIS_MSG
          Form  F_GET_S_KHINR
          Get prompt values for Profit Center Group
    FORM F_GET_S_KHINR.
      PERFORM F_DIS_MSG USING 100 'Get prompt values for Profit Ctr Group.'.
      COMMIT WORK.
      CALL FUNCTION 'K_GROUP_SELECT'
        EXPORTING
          BUTTONS            = 'X'
          CLASS              = '0H  '
          CRUSER             = '*'
          FIELD_NAME         = 'RPRCTR'
          SEARCHFLD          = 'KBRC'
          SEARCHFLD_INPUT    = ' '
          SEARCHFLD_REQUIRED = 'X'
          SET                = '*'
          START_COLUMN       = 10
          START_ROW          = 5
          TABLE              = 'GLPCT'
          TYPELIST           = 'BS'
          UPDUSER            = '*'
        IMPORTING
          CLASS_NAME         = V_GROUP_CLASS
          SET_NAME           = V_GROUP_NAME
          SET_TITLE          = V_GROUP_TITLE
        EXCEPTIONS
          NO_SET_PICKED      = 1
          OTHERS             = 2.
      IF SY-SUBRC = 0.
        P_KHINR = V_GROUP_NAME.
      ENDIF.
    ENDFORM.                               " F_GET_S_KHINR
          FORM F_VALIDATE_KHINR                                         *
    FORM F_VALIDATE_KHINR.
      PERFORM F_DIS_MSG USING 100 'Validate Profit Center group.'.
      COMMIT WORK.
      CLEAR I_SET_VALUES.
      REFRESH I_SET_VALUES.
      CONCATENATE C_0106  C_KBRC P_KHINR INTO V_SETID.
      CONDENSE V_SETID.
      CALL FUNCTION 'G_SET_TREE_IMPORT'
        EXPORTING
          CLIENT                    = SY-MANDT
          FIELDNAME                 = 'RPRCTR'
          LANGU                     = SY-LANGU
          SETID                     = V_SETID
          TABNAME                   = 'GLPCT'
          NO_TABLE_BUFFERING        = 'X'
        TABLES
          SET_VALUES                = I_SET_VALUES
        EXCEPTIONS
          SET_NOT_FOUND             = 1
          ILLEGAL_FIELD_REPLACEMENT = 2
          ILLEGAL_TABLE_REPLACEMENT = 3
          OTHERS                    = 4.
      IF SY-SUBRC NE 0.
    E: Unable to find Profit Center Group & - please modify selection
        MESSAGE E000 WITH TEXT-002 P_KHINR.
      ENDIF.
      IF I_SET_VALUES[] IS INITIAL.
        MESSAGE E000 WITH P_KHINR TEXT-039.
      ENDIF.
    ENDFORM.                               " F_VALIDATE_KHINR
          Form  F_SELECT_DATA
    FORM F_SELECT_DATA.
      PERFORM F_DIS_MSG USING 100 'Retrieve info from SAP tables.'.
      COMMIT WORK.
    Build the BFOD_A internal table based on user selections
    f i_cepc table is initial, it means derive all prctr under a co cd
      IF S_PRCTR[] IS INITIAL.
        PERFORM F_RETRIEVE_BFODA_BY_COMPANY.
      ELSE.
        PERFORM F_RETRIEVE_BFODA_BY_PRCTR.
      ENDIF.
      IF I_BFOD_A[] IS INITIAL.
    *... No records fit selection criteria.
        MESSAGE E000 WITH TEXT-H20.
      ENDIF.
    Get the text for profit center
      SELECT SPRAS PRCTR DATBI KOKRS MCTXT FROM CEPCT
                 INTO CORRESPONDING FIELDS OF TABLE I_CEPCT
                  FOR ALL ENTRIES IN I_CEPC
                WHERE SPRAS = SY-LANGU
                  AND PRCTR = I_CEPC-PRCTR.
    Build an internal table of unique bfod keys for bsid and bsad
      I_BFODA_KUNNR[] = I_BFOD_A[].
      SORT I_BFODA_KUNNR BY KUNNR BUKRS GJAHR BELNR BUZEI.
      DELETE ADJACENT DUPLICATES FROM I_BFODA_KUNNR COMPARING
         KUNNR BUKRS GJAHR BELNR BUZEI.
    Build BSID Internal table
      SELECT MANDT BUKRS KUNNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR
             BUZEI BUDAT HKONT BLDAT WAERS REBZG XBLNR SHKZG DMBTR
             WRBTR ZFBDT ZBD1T ZBD2T ZBD3T
                FROM BSID INTO CORRESPONDING FIELDS OF TABLE I_BSYD
                 FOR ALL ENTRIES IN I_BFODA_KUNNR
               WHERE KUNNR EQ I_BFODA_KUNNR-KUNNR
                 AND BUKRS EQ I_BFODA_KUNNR-BUKRS
                 AND GJAHR EQ I_BFODA_KUNNR-GJAHR
                 AND BELNR EQ I_BFODA_KUNNR-BELNR
                 AND BUZEI EQ I_BFODA_KUNNR-BUZEI.
    Build BSAD internal table
      SELECT MANDT BUKRS KUNNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR
          BUZEI HKONT BUDAT BLDAT WAERS REBZG XBLNR SHKZG DMBTR WRBTR ZFBDT
          ZBD1T ZBD2T ZBD3T
             FROM BSAD APPENDING CORRESPONDING FIELDS OF TABLE I_BSYD
              FOR ALL ENTRIES IN I_BFODA_KUNNR
            WHERE KUNNR EQ I_BFODA_KUNNR-KUNNR
              AND BUKRS EQ I_BFODA_KUNNR-BUKRS
              AND AUGDT GT P_BUDAT
              AND GJAHR EQ I_BFODA_KUNNR-GJAHR
              AND BELNR EQ I_BFODA_KUNNR-BELNR
              AND BUZEI EQ I_BFODA_KUNNR-BUZEI.
      IF NOT I_BSYD[] IS INITIAL.
    Remove records based on selection criteria
        DELETE I_BSYD WHERE
           NOT BUDAT LE P_BUDAT OR
           NOT HKONT IN S_HKONT.
      ENDIF.
    Acquire document headers
      SELECT BUKRS BELNR GJAHR BKTXT XBLNR HWAER HWAE2 FROM BKPF
                    INTO TABLE I_BKPF
                    FOR ALL ENTRIES IN I_BSYD
                    WHERE BUKRS EQ I_BSYD-BUKRS
                      AND BELNR EQ I_BSYD-BELNR
                      AND GJAHR EQ I_BSYD-GJAHR.
    Sort document lines
      SORT I_BSYD BY KUNNR BUKRS GJAHR BELNR BUZEI ASCENDING.
      SORT I_BKPF BY  BUKRS BELNR GJAHR ASCENDING.
    Create table of unique customers
      SORT I_BFODA_KUNNR BY KUNNR.
      DELETE ADJACENT DUPLICATES FROM I_BFODA_KUNNR COMPARING KUNNR.
    Build customer table
      SELECT KUNNR NAME1 FROM KNA1
                INTO TABLE I_KNA1
                 FOR ALL ENTRIES IN I_BFODA_KUNNR
               WHERE KUNNR EQ I_BFODA_KUNNR-KUNNR.
    Free memory space
      FREE I_BFODA_KUNNR.
    ENDFORM.                               " F_SELECT_DATA
          Form  F_BUILD_I_CEPC_TABLE
          build the i_cepc internal table that would populate the
          valid profit centers to processed.
    FORM F_BUILD_I_CEPC_TABLE.
      PERFORM F_DIS_MSG USING 100 'Build the Profit Center Ref Table.'.
      COMMIT WORK.
    Acquire CEPC table
      IF I_PRCTR[] IS INITIAL.
        SORT S_PRCTR.
        SELECT PRCTR KHINR
          FROM CEPC
          INTO TABLE I_CEPC
          WHERE PRCTR IN S_PRCTR.
    Sort table
        SORT I_CEPC BY PRCTR KHINR.
    Remove duplicate values
        DELETE ADJACENT DUPLICATES FROM I_CEPC COMPARING PRCTR.
        I_PRCTR[] = I_CEPC[].
    Sort table
        SORT I_PRCTR BY PRCTR.
      ELSE.
    Sort table
        SORT I_PRCTR BY PRCTR.
    Acquire CEPC table
        SELECT PRCTR KHINR
          FROM CEPC
          INTO TABLE I_CEPC
          FOR ALL ENTRIES IN I_PRCTR
          WHERE PRCTR = I_PRCTR-PRCTR.
    SOrt table
        SORT I_CEPC BY PRCTR KHINR.
      ENDIF.
      IF I_CEPC[] IS INITIAL.
        MESSAGE E000 WITH TEXT-006.
      ENDIF.
    ENDFORM.                               " F_BUILD_i_CEPC_TABLE
          Form  F_BUILD_I_REPORT
          Build the A/R report internal table from bfod_a, bsid and bsad
          It is necessary to go to BSAD/BSID to get the document currency
          not present in bfod_a.
    FORM F_BUILD_I_REPORT.
      PERFORM F_DIS_MSG USING 100 'Build the report information.'.
      COMMIT WORK.
    Sort all internal tables, this is essential for later processing
      SORT I_BFOD_A BY KUNNR BUKRS GJAHR BELNR BUZEI .
      SORT I_BSYD BY KUNNR BUKRS GJAHR BELNR BUZEI.
      SORT I_CEPC BY PRCTR KHINR.
      LOOP AT I_BFOD_A.
    New customer
        AT NEW KUNNR.
          READ TABLE I_KNA1 WITH KEY KUNNR = I_BFOD_A-KUNNR BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            MOVE I_KNA1-NAME1 TO I_REPORT-NAME1.
          ENDIF.
        ENDAT.
    Acquire header fields
        READ TABLE I_BKPF WITH KEY BUKRS = I_BFOD_A-BUKRS
                                   BELNR = I_BFOD_A-BELNR
                                   GJAHR = I_BFOD_A-GJAHR BINARY SEARCH.
        IF SY-SUBRC NE 0.
          CLEAR I_BKPF.
        ENDIF.
    Build base record
        PERFORM F_MOVE_BASE_TO_REPORT.
    Load profit center data
        IF P_KHINR IS INITIAL.
          IF V_PREV_PRCTR = I_BFOD_A-PRCTR.
            I_REPORT-KHINR = I_CEPC-KHINR.
          ELSE.
            READ TABLE I_CEPC WITH KEY PRCTR = I_BFOD_A-PRCTR BINARY SEARCH.
            IF SY-SUBRC = 0.
              I_REPORT-KHINR = I_CEPC-KHINR.
            ELSE.
              CLEAR I_REPORT-KHINR.
            ENDIF.
            V_PREV_PRCTR = I_BFOD_A-PRCTR.
          ENDIF.
        ELSE.
          I_REPORT-KHINR = P_KHINR.
        ENDIF.
    Reverse signs
        IF I_REPORT-SHKZG = 'H'.
          I_REPORT-DMBTR = I_REPORT-DMBTR * -1.
          I_REPORT-DMBE2 = I_REPORT-DMBE2 * -1.
        ENDIF.
    Additional details
        READ TABLE I_BSYD WITH KEY KUNNR = I_BFOD_A-KUNNR
                                   BUKRS = I_BFOD_A-BUKRS
                                   GJAHR = I_BFOD_A-GJAHR
                                   BELNR = I_BFOD_A-BELNR
                                   BUZEI = I_BFOD_A-BUZEI BINARY SEARCH.
        IF SY-SUBRC = 0.
          PERFORM F_FORMAT_I_REPORT_FR_BSYD.
          APPEND I_REPORT.
        ENDIF.
      ENDLOOP.
    ENDFORM.                               " F_BUILD_I_REPORT
          Form  F_FORMAT_I_REPORT_FR_BSYD
    Retrieve all the information needed for reporting from BSID.
    If a document has a referencing invoice (REBZG), the payment terms
       and the baseline date to be used will come from the referencing
       invoice.
    FORM F_FORMAT_I_REPORT_FR_BSYD.
    *=> get the document currency amount from bsid
      I_REPORT-BLDAT = I_BSYD-BLDAT.
      I_REPORT-WAERS = I_BSYD-WAERS.
    PERFORM F_CONVERT_CURRENCY_FR_2_AMTS USING I_REPORT-HWAER I_BSYD-WAERS
                                                I_BSYD-DMBTR   I_BSYD-WRBTR
                                                             I_BFOD_A-DMBTR
                                                     CHANGING V_BFOD_TXNAMT.
      I_REPORT-WRBTR = V_BFOD_TXNAMT.
      IF I_BSYD-SHKZG = 'H'.
        I_REPORT-WRBTR = I_REPORT-WRBTR * -1.
      ENDIF.
      V_ZBD1T = I_BSYD-ZBD1T.
      V_ZFBDT = I_BSYD-ZFBDT.
    *=> determine reference document (referencing invoice)
      CLEAR I_REPORT-SORT.
      CASE I_BSYD-REBZG.
        WHEN ' '.
          I_REPORT-SORT = I_BFOD_A-BELNR.
        WHEN 'V'.
          I_REPORT-SORT = I_BSYD-XBLNR.
        WHEN OTHERS.
          I_REPORT-SORT = I_BSYD-REBZG.
          PERFORM F_GET_DATEPAYTERM_FR_ORIGDOC.
      ENDCASE.
      CLEAR I_FAEDE.
      I_FAEDE-SHKZG = I_BSYD-SHKZG.
      I_FAEDE-KOART = 'D'.
      I_FAEDE-ZFBDT = I_BSYD-ZFBDT.
      I_FAEDE-ZBD1T = I_BSYD-ZBD1T.
      I_FAEDE-ZBD2T = I_BSYD-ZBD2T.
      I_FAEDE-ZBD3T = I_BSYD-ZBD3T.
      I_FAEDE-REBZG = I_BSYD-REBZG.
      I_FAEDE-BLDAT = I_BSYD-BLDAT.
      CALL FUNCTION 'DETERMINE_DUE_DATE'
        EXPORTING
          I_FAEDE                    = I_FAEDE
        IMPORTING
          E_FAEDE                    = I_FAEDE
        EXCEPTIONS
          ACCOUNT_TYPE_NOT_SUPPORTED = 1
          OTHERS                     = 2.
      V_DPAST = P_BUDAT - I_FAEDE-NETDT.
      IF V_DPAST < 0.
        I_REPORT-DPAST = 0.
      ELSE.
        MOVE V_DPAST TO I_REPORT-DPAST.
      ENDIF.
      I_REPORT-ZBD1T = V_ZBD1T.
      I_REPORT-NETDT = I_FAEDE-NETDT.
    Update totals
      PERFORM F_BUILD_TOTALS.
    ENDFORM.                               " F_FORMAT_I_REPORT_FR_BSYD
          Form  F_GET_DATEPAYTERM_FR_ORIGDOC
    FORM F_GET_DATEPAYTERM_FR_ORIGDOC.
    In order to go back to the original document's payment terms and
    baseline date, we neeed to resort bsid/bsad to a different sort
    order b-coz only these 3 fields logically matched the orig doc
      SORT I_BSYD BY KUNNR BUKRS BELNR.
      READ TABLE I_BSYD WITH KEY KUNNR = I_BFOD_A-KUNNR
                                 BUKRS = I_BFOD_A-BUKRS
                                 BELNR = I_REPORT-SORT BINARY SEARCH.
      IF SY-SUBRC = 0.
        V_ZBD1T = I_BSYD-ZBD1T.            "payment term
        V_ZFBDT = I_BSYD-ZFBDT.            "baseline due date
      ENDIF.
      SORT I_BSYD BY KUNNR BUKRS GJAHR BELNR BUZEI.
    ENDFORM.                               " F_GET_DATEPAYTERM_FR_ORIGDOC
          Form  F_WRITE_REPORT
          Write A/R report summarized by profit center.
          Report will be build by profit center and sum all customers
             then will sum past do for profit center and catagorized
             will also sum by project / wbs element.
    FORM F_WRITE_REPORT.
      SORT I_REPORT BY PRCTR KUNNR SORT BLDAT BELNR DPAST DESCENDING.
      CALL SCREEN 9000.
    ENDFORM.                               " F_WRITE_REPORT
          Form  F_POPULATE_PRCTR_FROM_PRCTRGRP
    FORM F_POPULATE_PRCTR_FROM_PRCTRGRP.
      LOOP AT I_SET_VALUES.
        IF I_SET_VALUES-TO = I_SET_VALUES-FROM.
          I_PRCTR-PRCTR = I_SET_VALUES-TO.
          COLLECT I_PRCTR.
          S_PRCTR-SIGN   = 'I'.
          S_PRCTR-OPTION = 'EQ'.
          S_PRCTR-LOW    = I_SET_VALUES-TO.
          COLLECT S_PRCTR.
        ELSE.
          MESSAGE E000 WITH 'System Error, contact programmer'
                  I_SET_VALUES-TO I_SET_VALUES-FROM.
        ENDIF.
      ENDLOOP.
    ENDFORM.                               " F_POPULATE_PRCTR_FROM_PRCTRGRP
          Form  F_CONVERT_CURRENCY_FR_2_AMTS
          This function module will ensure proper handling of decimals
          and conversion of currency. This will give you the historical
          exchange rate used.
          BFOD_A does not have the trans curr amt so we will get it
           using:  ( bsid trans curr amt / bsid loc curr amt ) *
                   bfod_a loc currency amt
    FORM F_CONVERT_CURRENCY_FR_2_AMTS USING V_FRCURR V_TOCURR
                                            V_OFRAMT V_OTOAMT V_NFRAMT
                                     CHANGING V_NTOAMT.
      CALL FUNCTION 'Z_CONVERT_CURRENCY_FROM_2_AMTS'
        EXPORTING
          FROM_CURRENCY   = V_FRCURR
          TO_CURRENCY     = V_TOCURR
          OLD_FROM_AMOUNT = V_OFRAMT
          OLD_TO_AMOUNT   = V_OTOAMT
          NEW_FROM_AMOUNT = V_NFRAMT
        IMPORTING
          NEW_TO_AMOUNT   = V_NTOAMT
        EXCEPTIONS
          OTHERS          = 1.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH TEXT-005.
      ENDIF.
    ENDFORM.                               " F_CONVERT_CURRENCY_FR_2_AMTS
          Form  F_RETRIEVE_BFODA_BY_COMPANY
    FORM F_RETRIEVE_BFODA_BY_COMPANY.
    Acquire BFOD_A table
      SELECT PRCTR KUNNR BUKRS GJAHR BELNR BUZEI AUGDT HKONT BUDAT
             SHKZG DMBTR DMBE2 FROM BFOD_A
         INTO TABLE I_BFOD_A
         WHERE BUKRS IN S_BUKRS.
      IF I_BFOD_A[] IS INITIAL.
        EXIT.
      ELSE.
    Remove records based on selection criteria
        DELETE I_BFOD_A WHERE NOT KUNNR IN S_KUNNR OR
                              NOT BUDAT LE P_BUDAT OR
                              NOT HKONT IN S_HKONT OR
                              NOT BELNR IN S_BELNR OR
                            ( NOT AUGDT IS INITIAL AND
                              NOT AUGDT > P_BUDAT ).
      ENDIF.
    Build selection option
      LOOP AT I_BFOD_A.
        I_PRCTR-PRCTR  = I_BFOD_A-PRCTR.
        COLLECT I_PRCTR.
        S_PRCTR-SIGN   = 'I'.
        S_PRCTR-OPTION = 'EQ'.
        S_PRCTR-LOW    = I_BFOD_A-PRCTR.
        COLLECT S_PRCTR.
      ENDLOOP.
      SORT S_PRCTR.
      SORT I_PRCTR BY PRCTR.
      PERFORM F_BUILD_I_CEPC_TABLE.
    ENDFORM.                    " F_RETRIEVE_BFODA_BY_COMPANY
          Form  F_RETRIEVE_BFODA_BY_PRCTR
    FORM F_RETRIEVE_BFODA_BY_PRCTR.
    Acquire BFOD_A table
      SELECT PRCTR KUNNR BUKRS GJAHR BELNR BUZEI AUGDT HKONT BUDAT
             SHKZG DMBTR DMBE2 FROM BFOD_A
         INTO TABLE I_BFOD_A
         FOR ALL ENTRIES IN I_PRCTR
         WHERE PRCTR = I_PRCTR-PRCTR AND
               KUNNR IN S_KUNNR AND
               BUKRS IN S_BUKRS.
      IF I_BFOD_A[] IS INITIAL.
        EXIT.
      ELSE.
    Remove records based on selection criteria
        DELETE I_BFOD_A WHERE NOT KUNNR IN S_KUNNR OR
                              NOT BUKRS IN S_BUKRS OR
                              NOT BUDAT LE P_BUDAT OR
                              NOT HKONT IN S_HKONT OR
                              NOT BELNR IN S_BELNR OR
                            ( NOT AUGDT IS INITIAL AND
                              NOT AUGDT > P_BUDAT ).
      ENDIF.
    ENDFORM.                    " F_RETRIEVE_BFODA_BY_PRCTR
          Form  F_MOVE_BASE_TO_REPORT
    FORM F_MOVE_BASE_TO_REPORT.
      I_REPORT-PRCTR = I_BFOD_A-PRCTR.
      I_REPORT-KUNNR = I_BFOD_A-KUNNR.
      I_REPORT-BELNR = I_BFOD_A-BELNR.
      I_REPORT-BUKRS = I_BFOD_A-BUKRS.
      I_REPORT-HKONT = I_BFOD_A-HKONT.
      I_REPORT-AUGDT = I_BFOD_A-AUGDT.
      I_REPORT-BUDAT = I_BFOD_A-BUDAT.
      I_REPORT-GJAHR = I_BFOD_A-GJAHR.
      I_REPORT-BUZEI = I_BFOD_A-BUZEI.
      I_REPORT-SHKZG = I_BFOD_A-SHKZG.
      I_REPORT-DMBTR = I_BFOD_A-DMBTR.
      I_REPORT-DMBE2 = I_BFOD_A-DMBE2.
      I_REPORT-HWAER = I_BKPF-HWAER.
      I_REPORT-HWAE2 = I_BKPF-HWAE2.
      I_REPORT-BKTXT = I_BKPF-BKTXT.
      I_REPORT-XBLNR = I_BKPF-XBLNR.
    ENDFORM.                    " F_MOVE_BASE_TO_REPORT
         Module  STATUS_9000  OUTPUT
          text
    MODULE STATUS_9000 OUTPUT.
      SET PF-STATUS '9000'.
      SET TITLEBAR '900'.
    Launch standard ALV grid
      PERFORM F_CREATE_ALV_GRID_CONTROL.
      PERFORM F_LOAD_COLUMN_HEADINGS.
    ENDMODULE.                 " STATUS_9000  OUTPUT
          Module  USER_COMMAND_9000  INPUT
          text
    MODULE USER_COMMAND_9000 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT' OR 'CANC' OR 'BACK'.
          CALL METHOD REF_CUSTOM->FREE.
          SET SCREEN 0.
          LEAVE SCREEN.
    Begin of changes for Release 2 by HBE7890 - DEVK909110
        WHEN 'PRIN'.
          PERFORM PRINT_AGING_TOTALS.
    End of changes.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
          Form  F_CREATE_ALV_GRID_CONTROL
          text
    FORM F_CREATE_ALV_GRID_CONTROL.
    Set field catalog for ALV
      PERFORM F_SET_FIELDCAT.
      IF REF_CUSTOM IS INITIAL.
      Create ALV container
        CREATE OBJECT REF_CUSTOM
          EXPORTING
            CONTAINER_NAME = 'ZRPT_CONTAINER'.
      Create ALV grid control
        CREATE OBJECT REF_ALV_ZRPT
          EXPORTING
            I_PARENT          = REF_CUSTOM.
    Adjust look and feel
        PERFORM F_CHANGE_SETTINGS.
    Call the ALV Build
        CALL METHOD REF_ALV_ZRPT->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            IS_LAYOUT       = V_LAYOUT
            IS_VARIANT      = V_VARIANT
            I_SAVE          = V_SAVE
            I_DEFAULT       = V_DEFAULT
          CHANGING
            IT_SORT         = I_SORT
            IT_OUTTAB       = I_REPORT[]
            IT_FIELDCATALOG = I_ALV_FIELDCAT[].
    Create print top of page
        CREATE OBJECT REF_EVENT_RECEIVER.
        SET HANDLER REF_EVENT_RECEIVER->MTH_PRINT_TOP_OF_PAGE
            FOR REF_ALV_ZRPT.
    Create print top of page
        CREATE OBJECT REF_EVENT_RECEIVER.
        SET HANDLER REF_EVENT_RECEIVER->MTH_PRINT_TOP_OF_LIST
            FOR REF_ALV_ZRPT.
      ENDIF.
    ENDFORM.                    " F_CREATE_ALV_GRID_CONTROL
         Form  F_CHANGE_SETTINGS
          text
    FORM F_CHANGE_SETTINGS .
    Set layout parameters
      V_LAYOUT-GRID_TITLE = 'A/R by Profit Center'.
      V_LAYOUT-SEL_MODE   = 'A'.
      V_LAYOUT-INFO_FNAME = 'LINECOLOR'.
      V_LAYOUT-CWIDTH_OPT = 'X'.
      V_LAYOUT-NO_MERGING = 'X'.
      V_LAYOUT-NUMC_TOTAL = 'X'.
      V_DEFAULT           = 'X'.
      V_SAVE              = 'A'.
    Set display variant
      V_VARIANT-REPORT  = SY-REPID.
      IF P_DSVAR NE ''.
        V_VARIANT-VARIANT = P_DSVAR.
      ENDIF.
    ENDFORM.                    " F_CHANGE_SETTINGS
          Form  F_SET_FIELDCAT
          text
    FORM F_SET_FIELDCAT .
    Set field catalog for ALV
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
         I_STRUCTURE_NAME       = 'ZFR0ARPR_S1'  "DEVK909110
          I_STRUCTURE_NAME       = 'ZPSS_ARBYPC'                "DEVK909110
        CHANGING
          CT_FIELDCAT            = I_ALV_FIELDCAT
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
    Override any attributes
      LOOP AT I_ALV_FIELDCAT INTO V_ALV_FIELDCAT.
        IF V_ALV_FIELDCAT-FIELDNAME EQ 'NAME1'.
          MOVE 'Customer Name' TO: V_ALV_FIELDCAT-REPTEXT,
                                   V_ALV_FIELDCAT-SCRTEXT_L,
                                   V_ALV_FIELDCAT-SCRTEXT_M,
                                   V_ALV_FIELDCAT-SCRTEXT_S.
        ENDIF.
        IF V_ALV_FIELDCAT-FIELDNAME EQ 'SORT'.
          MOVE 'Documentation' TO: V_ALV_FIELDCAT-REPTEXT,
                                   V_ALV_FIELDCAT-SCRTEXT_L,
                                   V_ALV_FIELDCAT-SCRTEXT_M.
          MOVE 'DocRef' TO         V_ALV_FIELDCAT-SCRTEXT_S.
        ENDIF.
        MODIFY I_ALV_FIELDCAT FROM V_ALV_FIELDCAT.
      ENDLOOP.
    ENDFORM.                    " F_SET_FIELDCAT
          Form  F_BUILD_TOTALS
          text
    FORM F_BUILD_TOTALS .
      DATA: V_DAYS TYPE I,
            V_INDEX(2) TYPE N.
      CLEAR I_TOTAL.
    Build total line
      MOVE I_REPORT-HWAER TO I_TOTAL-WAERS.
      MOVE I_REPORT-DMBTR TO I_TOTAL-TOTAL.
      DO 5 TIMES.
        V_DAYS = ( SY-INDEX - 1 ) * P_AGEDY.
        V_INDEX = SY-INDEX.
        IF I_REPORT-DPAST LE V_DAYS.
          CONCATENATE 'I_TOTAL-DAYS' V_INDEX INTO V_FIELD-NAME.
          ASSIGN (V_FIELD-NAME) TO <COLUMN>.
          <COLUMN> = I_REPORT-DMBTR.
          EXIT.
        ELSEIF SY-INDEX EQ 5.
          CONCATENATE 'I_TOTAL-DAYS' V_INDEX INTO V_FIELD-NAME.
          ASSIGN (V_FIELD-NAME) TO <COLUMN>.
          <COLUMN> = I_REPORT-DMBTR.
          EXIT.
        ENDIF.
      ENDDO.
      COLLECT I_TOTAL.
    ENDFORM.                    " F_BUILD_TOTALS
        

    CO-PA has all the information you need...
    Profitability Analysis is that part of CO where operations will access its performance factors and profitability statements contain margins, standard cost variance, sales information, allocations and other related profit or loss data. This module helps analyze profitability of customers, markets and products at various levels of contribution margins. Profitability is measured down to the SD billing document line and is adjusted periodically against standard costs and other costs.
    It has 2 methods of approach :
    Costing based Profitability Analysis - This is primarily designed to let you analyze profits quickly for the purpose of sales management.
    Account based Profitabilty Analysis - This type of Profitability Analysis enables you to reconcile cost and financial accounting at any time using accounts.
    Guess, the second approach is what you are looking for...

  • Function module for USD amount to TWD

    Hi,
    Any one send me function module for converting USD currency to TWD.
    Thanks,
    donald

    HI,
    DATA: gd_fcurr TYPE tcurr-fcurr,
          gd_tcurr TYPE tcurr-tcurr,
          gd_date  TYPE sy-datum,
          gd_value TYPE i.
    gd_fcurr = 'USD'.
    gd_tcurr = 'TWD'.
    gd_date  = sy-datum.
    gd_value = 10.
    PERFORM currency_conversion USING gd_fcurr
                                      gd_tcurr
                                      gd_date
                             CHANGING gd_value.
    * Convert value to Currency value
    *&      Form  currency_conversion
    *       text
    *      -->P_GD_FCURR  text
    *      -->P_GD_TCURR  text
    *      -->P_GD_DATE   text
    *      <--P_GD_VALUE  text
    FORM currency_conversion  USING    p_fcurr
                                       p_tcurr
                                       p_date
                              CHANGING p_value.
      DATA: t_er        TYPE tcurr-ukurs,
            t_ff        TYPE tcurr-ffact,
            t_lf        TYPE tcurr-tfact,
            t_vfd       TYPE datum,
            ld_erate(12)   TYPE c.
      CALL FUNCTION 'READ_EXCHANGE_RATE'
        EXPORTING
    *       CLIENT                  = SY-MANDT
          date                    = p_date
          foreign_currency        = p_fcurr
          local_currency          = p_tcurr
          TYPE_OF_RATE            = 'M'
    *       EXACT_DATE              = ' '
       IMPORTING
          exchange_rate           = t_er
          foreign_factor          = t_ff
          local_factor            = t_lf
          valid_from_date         = t_vfd
    *       DERIVED_RATE_TYPE       =
    *       FIXED_RATE              =
    *       OLDEST_RATE_FROM        =
       EXCEPTIONS
         no_rate_found           = 1
         no_factors_found        = 2
         no_spread_found         = 3
         derived_2_times         = 4
         overflow                = 5
         zero_rate               = 6
         OTHERS                  = 7
      IF sy-subrc EQ 0.
        ld_erate = t_er / ( t_ff / t_lf ).
        p_value = p_value * ld_erate.
      ENDIF.
    ENDFORM.                    " currency_conversion
    You can use
    <b>CONVERT_TO_FOREIGN_CURRENCY</b> Convert local currency to foreign
    <b>CONVERT_TO_LOCAL_CURRENCY</b> Convert from foreign currency to local currency currency.

  • Get PO Approval limit for Approver and substitute

    Hello all,
    Description:
    When an approver assigns a substitute for approval, the PO Value Limit (HRP5503-LIMIT) for the position needs to be equal to or greater than that of the approver.  If this is not true, then an error message saying u201CSubstitute has insufficient signing authorityu201D should be returned to the user upon adding the substitute.
    Logic can be found in SAP program LBW02F01 (include)
    under routine FORM / D1328_FIND_DEPUTIES
    Here i need to fetch the PO approver details and substitute detaiils.
    Please let me know about this.
    Thanks in advance

    Substitution is for the total inbox ... 
    I don't think it can be done only for Purchase Order or Shopping Cart or What ever it is...
    You can use the Implicit Enhacement Operation to add code to the standard sap code...
    Try to re-use the following code and get the value limit from the Business Object BUS4101.
    "swc_create_object req_user 'BUS4101' sy-uname.
    swc_get_property req_user 'ApprovalLimit' lv_calimit-approval_limit.
    swc_get_property req_user 'ApprovalCurrency' lv_calimit-currency."
    FORM / D1328_FIND_DEPUTIES -- In this, "gt_deputies" is the standard table used by SAP in the code which stores all the substitute uses..
    You need to delete the user entries who are having value limit less than the approver user in the "gt_deputies".
    I have done the same for one of my requirements.. but it was not specific for only PO.
    Regards,
    PR.

  • Conversion of EUR into USD

    Hi all
    can anybody help me in converting the EUR values to USD
    for example the value is 32.000,00 in EUR and this EUR value i need to convert into USD.
    thanks in advance
    anju

    See this code
    http://www.sapdevelopment.co.uk/country/country_curr.htm
    DATA: gd_fcurr TYPE tcurr-fcurr,
          gd_tcurr TYPE tcurr-tcurr,
          gd_date  TYPE sy-datum,
          gd_value TYPE i.
    gd_fcurr = 'EUR'.
    gd_tcurr = 'GBP'.
    gd_date  = sy-datum.
    gd_value = 10.
    PERFORM currency_conversion USING gd_fcurr
                                      gd_tcurr
                                      gd_date
                             CHANGING gd_value.
    * Convert value to Currency value
    *&      Form  currency_conversion
    *       text
    *      -->P_GD_FCURR  text
    *      -->P_GD_TCURR  text
    *      -->P_GD_DATE   text
    *      <--P_GD_VALUE  text
    FORM currency_conversion  USING    p_fcurr
                                       p_tcurr
                                       p_date
                              CHANGING p_value.
      DATA: t_er        TYPE tcurr-ukurs,
            t_ff        TYPE tcurr-ffact,
            t_lf        TYPE tcurr-tfact,
            t_vfd       TYPE datum,
            ld_erate(12)   TYPE c.
      CALL FUNCTION 'READ_EXCHANGE_RATE'
        EXPORTING
    *       CLIENT                  = SY-MANDT
          date                    = p_date
          foreign_currency        = p_fcurr
          local_currency          = p_tcurr
          TYPE_OF_RATE            = 'M'
    *       EXACT_DATE              = ' '
       IMPORTING
          exchange_rate           = t_er
          foreign_factor          = t_ff
          local_factor            = t_lf
          valid_from_date         = t_vfd
    *       DERIVED_RATE_TYPE       =
    *       FIXED_RATE              =
    *       OLDEST_RATE_FROM        =
       EXCEPTIONS
         no_rate_found           = 1
         no_factors_found        = 2
         no_spread_found         = 3
         derived_2_times         = 4
         overflow                = 5
         zero_rate               = 6
         OTHERS                  = 7
      IF sy-subrc EQ 0.
        ld_erate = t_er / ( t_ff / t_lf ).
        p_value = p_value * ld_erate.
      ENDIF.
    ENDFORM.                    " currency_conversion

  • Hello, I would subscribe to creative cloud for photographer if only I could pay monthly fees in Canadian dollars (not US). How come Canadian dollars is not an option in the pick list???

    Hello, I would subscribe to creative cloud for photographer if only I could pay monthly fees in Canadian dollars (not US). How come Canadian dollars is not an option in the pick list???

    Hello,
    Your reply is not an answer to my question.
    My question or remark is that where I wanted to pay in Canadian dollars (not US) otherwise I will not subscribe to monthly/annual fees that may vary due to currency variation form US to Canadian dollars.
                                                                                    This is the pick list, as you can see there are a bunch of currencies but no Canadian dollars :
    De : John T Smith 
    Envoyé : 27 février 2015 21:45
    À : Norman Simpson
    Objet :  Hello, I would subscribe to creative cloud for photographer if only I could pay monthly fees in Canadian dollars (not US). How come Canadian dollars is not an option in the pick list???
    Hello, I would subscribe to creative cloud for photographer if only I could pay monthly fees in Canadian dollars (not US). How come Canadian dollars is not an option in the pick list???
    created by John T Smith <https://forums.adobe.com/people/JohnTSmith>  in Adobe Creative Cloud - View the full discussion <https://forums.adobe.com/message/7238062#7238062>

  • Button focus

    Hi there. I've got few components in the screen, and I'd like to set focus on one of them after entering the screen. How can I do this? Greetings. P.

    Hai.
    check this.
    1) Call Screen: Calling a single screen can be used for embedding a screen sequence. If you want to prevent the called screen from covering the current screen completely (say u want 2 display both screen) you can use the CALL SCREEN statement with the STARTING AT and ENDING AT
    CALL SCREEN 200
    If we write this statement in screen 100 ,it will goto screen 200 and it will retain screen 100(ie u can come back)
    and moreover u have options using this
    CALL SCREEN 200 STARTING AT x1 y1 ENDING AT x2 y2
    2) If we use set screen first the processing blocks in the present screen will be executed and control goes to the screen which is called.
    in this control remains in that calling screen only, it doesnt come back to our screen.
    3)In screen 100,we call screen 200.The PBO and PAI of screen 200 is processed.Now in screen 200,if we use leave to screen 100,the processing starts from screen 100 after the call screen 200 statement.The PBO and the PAI of screen 100 need not be processed again from the beginning in this case.
    4) That is if we use leave to screen,the control goes back to the screen from which the present screen was called and continues with the processing.
    SET SCREEN 200
    1) With the above statement , it will goto screen 200 and screen 100 no more remains
    2) Screen No 0 : This special screen number causes the screen to jump back to the calling screen.
    set screen 0 used to go back to the previous screen.
    With SET SCREEN the current screen simply specifies the next screen in the chain , control branches to this next screen as sonn as th e current screen has been processed .Return from next screen to current screen is not automatic .It does not interrupt processing of the current screen.If we want to branch to the next screen without finishing the current one ,use LEAVE SCREEN.
    With CALL SCREEN , the current (calling) chain is suspended , and a next screen (screen chain) is called .The called can then return to the suspended chain with the statement LEAVE SCREEN TO SCREEN 0 .Sometime we might want to let an user call a pop up screen from the main application screen to let him enter secondary information.After they have completed their enteries, the users should be able to close the popup and return directly to the place where they left off in the main screen.Here comes CALL SCREEN into picture .This statement lets us insert such a sequence intp the current one
    check the example code.
    DATA: gd_fcurr TYPE tcurr-fcurr,
          gd_tcurr TYPE tcurr-tcurr,
          gd_date  TYPE sy-datum,
          gd_value TYPE i.
    gd_fcurr = 'EUR'.
    gd_tcurr = 'GBP'.
    gd_date  = sy-datum.
    gd_value = 10.
    PERFORM currency_conversion USING gd_fcurr
                                      gd_tcurr
                                      gd_date
                             CHANGING gd_value.
    Convert value to Currency value
    *&      Form  currency_conversion
          text
         -->P_GD_FCURR  text
         -->P_GD_TCURR  text
         -->P_GD_DATE   text
         <--P_GD_VALUE  text
    FORM currency_conversion  USING    p_fcurr
                                       p_tcurr
                                       p_date
                              CHANGING p_value.
      DATA: t_er        TYPE tcurr-ukurs,
            t_ff        TYPE tcurr-ffact,
            t_lf        TYPE tcurr-tfact,
            t_vfd       TYPE datum,
            ld_erate(12)   TYPE c.
      CALL FUNCTION 'READ_EXCHANGE_RATE'
        EXPORTING
          CLIENT                  = SY-MANDT
          date                    = p_date
          foreign_currency        = p_fcurr
          local_currency          = p_tcurr
          TYPE_OF_RATE            = 'M'
          EXACT_DATE              = ' '
       IMPORTING
          exchange_rate           = t_er
          foreign_factor          = t_ff
          local_factor            = t_lf
          valid_from_date         = t_vfd
          DERIVED_RATE_TYPE       =
          FIXED_RATE              =
          OLDEST_RATE_FROM        =
       EXCEPTIONS
         no_rate_found           = 1
         no_factors_found        = 2
         no_spread_found         = 3
         derived_2_times         = 4
         overflow                = 5
         zero_rate               = 6
         OTHERS                  = 7
      IF sy-subrc EQ 0.
        ld_erate = t_er / ( t_ff / t_lf ).
        p_value = p_value * ld_erate.
      ENDIF.
    ENDFORM.                    " currency_conversion
    See the below link for explanation and a Program
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/fmCurrencyConversion&
    regards.
    sowjanya.b

Maybe you are looking for