FCAT for Currency field

Hi Experts,
I have prepared filed catalog for a currency field as given below, Is this correct or anything need i pass it.
Program is going into dump.
Total Actual Costs
  ADD 1 TO WC_COLUMN.
  FS_FIELDCAT-REF_TABNAME   = 'ZCO_VALUES'.
  FS_FIELDCAT-FIELDNAME     = 'TOTACTCSTS'.
  FS_FIELDCAT-CFIELDNAME    = 'TWAER'.
  FS_FIELDCAT-CTABNAME      = 'COSS'.
  FS_FIELDCAT-JUST          = 'R'.
  FS_FIELDCAT-KEY           =  'X'.
  FS_FIELDCAT-DO_SUM        =  'X'.
  FS_FIELDCAT-COL_POS       =  WC_COLUMN.
  FS_FIELDCAT-ROW_POS       = 1.
  FS_FIELDCAT-HOTSPOT       = SPACE.
  FS_FIELDCAT-SELTEXT_L     = 'Tot Act Var'.
  FS_FIELDCAT-TABNAME       = 'INT_REPORT_HEADER'.
  APPEND FS_FIELDCAT   TO   INT_FIELDCAT.
  CLEAR  FS_FIELDCAT.
Thanks,
Sekhar.J

Hi Sekhar,
No need to fill somany fields.
Just fill it like this.
w_fcat-fieldname
w_fcat-tabname
w_fcat-ref_fieldname
w_fcat-ref_tabname
w_fcat-seltext_m
w_fcat-cfieldname--->Field with currency unit
append w_fcat to t_fcat.
clear w_fcat.
Try this and get back to me incase of any queries.
Dont forget to reward points if found useful.
Thanks,
Satyesh

Similar Messages

  • Negative sign for Currency fields

    Hello experts,
    If a currency field containt -Ve sign (86.47-) then, i have to move it this sign to Left sinde. I have do this as follow by moving the currency field value to Charractor field
    DATA:  w_total1 (18).
                 MOVE w_total To w_total1.
                 IF w_total1 CA '-'.
                   SHIFT w_total1 RIGHT CIRCULAR.
                 ENDIF.
                 CONDENSE w_total1 NO-GAPS.
    But don't want to move this to Chanddacter field for other pupepose. Now how can i **** the -Ve sign to left side for currency field, IF bsid-shkzg EQ 'H'.
    Thanks.

    Hi sandhya ,
    Try this :
    DATA:  w_total type string ,
          w_total1 type string.
    w_total = '1,4567.7-'.
                 MOVE w_total To w_total1.
                 IF w_total1 CA '-'.
                   SHIFT w_total1 RIGHT CIRCULAR.
                 ENDIF.
    *             CONDENSE w_total1 NO-GAPS.
                 write : / w_total1.
    Hope all your issues are fixed now .
    Regards ,
    lokesh
    Edited by: Lokesh Pattnayak on Oct 11, 2010 10:23 AM

  • Search help for currency field

    I am not able any search help for currency field , CUKY of lenght 5
    If anyone knows it please tell

    You can use the data element WAERS / refer to field BKPF-WAERS.  The search help will show up automatically as the field BKPF-WAERS, has check table TCURC.
    Also see the "Origin of Input help" column in "Entry help/ check" tab in SE11 for table BKPF, it says - "Input help implemented with check table".
    For example in tcode FB01, the currency field on the selection screen is BKPF-WAERS. The search help is displayed
    Hope it helps

  • Dynamic displaying of decimal points for currency field in ALV

    Hi,
            In ALV output there is a currency field and displaying data of different countries. It should display decimal point according to the country's currency. But at a time it can display data of different countries.

    Hi Dilip,
    I think your question is about currencies with different number of digits after decimal point. If you have the currency field in the ALV row, you have to give it's name as currency reference for the value field in the field catalog.
    After creating the field catalog, call a form and do something like this (change fielnames accordingly).
    <pre>
    *&      Form  alv_fieldcat_enhance
          Individual Enrichment of field catalog
    FORM alv_fieldcat_enhance
      CHANGING pt_alv_fieldcat TYPE slis_t_fieldcat_alv.
      FIELD-SYMBOLS:
        <alv_fieldcat> TYPE slis_fieldcat_alv.
      LOOP AT pt_alv_fieldcat ASSIGNING <alv_fieldcat>.
        IF <alv_fieldcat>-fieldname(5) = 'KBETR' OR
           <alv_fieldcat>-fieldname(5) = 'SKBTR' OR
           <alv_fieldcat>-fieldname(5) = 'DMBTR'.
    Company code currency
          <alv_fieldcat>-cfieldname = 'BWAER'.
    Document Currency for conditions, net value and taxes
        ELSEIF  <alv_fieldcat>-fieldname(5) = 'KWERT' OR
                <alv_fieldcat>-fieldname    = 'NETWR' OR
                <alv_fieldcat>-fieldname    = 'NPAX_MWST_AMNT'.
    Document Currency
          <alv_fieldcat>-cfieldname = 'WAERK'.
        ENDIF." <alv_fieldcat>-fieldname(5) = 'KBETR' or
      ENDLOOP." at pt_alv_fieldcat assigning <fieldcat_alv>.
    ENDFORM.                    " alv_fieldcat_enhance
    </pre>
    Regards,
    Clemens

  • Remving Default Zeros for Currency Field

    Dear All,
    I have one attaribute in context with type CPET_PRICEQUOT. This is the currency field. When the application is executed in portal it appears as 0.00 . How do I hide this 0.00 . I need this field for further calculation.
    Regards,
    Raghvendra.

    Hi,
    type this code in WDDOINIT
    DATA lo_el_context TYPE REF TO if_wd_context_element.
      DATA ls_context TYPE wd_this->element_context.
    * get element via lead selection
      lo_el_context = wd_context->get_element( ).
    ** get single attribute
      lo_el_context->set_attribute_null(
        EXPORTING
          name =  `NEW` ). " NEW is the name of attribute
    Your problem will be definitely solved
    Regards,
    Rohit

  • GRC PC 10.0 business rule creation: Wildcard for Currency field

    Hi,
    Currently I am designing a business rule that has standard price as a deficiency. I am using a blank check. But the system wants me to choose a specific currency. I want it to retrieve all records with the deficiency, regardless of currency.
    I've tried using "*" in the currency field, but it retrieves nothing. I am only able to retrieve records when I add a specific currency.
    Why is that? And what can I do to fix this problem?
    Thank you.

    Hi Raphael,
    Have you defined the Currency field as a filter criteria? If yes, can you please remove the field from filter selection and try to execute the rule again.
    Just make sure it comes under output format section.
    regards,
    Rajeshwari

  • Report Output for Currency Field--EKBE-WRBTR

    Hello ABAP Experts
    Since the Issue is related with Related Report output. Thought ABAP General Forum would be right place to post.
    If not Suggest an appropriate forum for the same. I shall post them in Correct Forum.
    Currently the report display Currency value From EKBE- WRBTR field
    Actual Record Stored in EKBE is like this
    0,00
    400,00
    1.600,00
    client requirement is
    0, 00
    400,00
    1600, 00
    Option-1
    I have tried option for conversion to CHAR & printing in Output, the issue I face is when I export to Excel I am getting an ABAP Error CONVT_NO_NUMBER(Short Dump)-This dump is due to conversion while exporting to excel.
    Option-2(from SDN)
    Give a logic based on T005 table i.e. this table has the decimal place setting for a each country (this I need to Verify)u2014But the I fear that report output can be confusing.
    Expecting all your expert inputs!!
    BR
    Bharath

    Hi Bharat,
    You can set it using user--profile I guess.
    For own data go to
    system>user profile>own data---> defaults.
    There you can select the currency format.
    Hope this helps you.
    Thanks,
    Arun

  • Initial value in table control is displayed as space for currency field

    Hi Experts,
    I have a problem with table control in module pool. Below is the code for populating the table control:
      loop at   GT_NEW_ABAN
           into GT_NEW_ABAN_WA
           with control TAB_FAC_ABAND
           cursor TAB_FAC_ABAND-current_line.
        module TAB_FAC_ABAND_get_lines.
    *&spwizard:   module TAB_FAC_ABAND_change_field_attr
      endloop.
    The internal table GT_NEW_ABAN and the work area GT_NEW_ABAN_WA are declared as below:
    DATA: GT_NEW_ABAN LIKE ZTABANDON OCCURS 0 WITH HEADER LINE,
       GT_NEW_ABAN_WA LIKE ZTABANDON ,
    while debugging the value of a field in GT_NEW_ABAN_WA is coming as 0.00, but in the screen display it is coming as space.
    In the structure ZTABANDON the data type of the particular field is CURR, and in the layout it is DEC.
    How can I fetch the same value 0.00 as coming in the work area to the screen display? How to change the space to 0.00?
    Regards,
    Soumya.

    Hi,
    In the screen painter double click on the fieldname. It will show the properties. There make the type of the field as Currency(CURR I think).
    Regards,
    Renjith Michael.
    Edited by: Renjith Michael on Jan 12, 2008 4:18 PM

  • Customer exits for currency field in generic extractor

    Hi,
    I had a requirement to create a generic extractor. I've created a generic extractor by name 'ZXXZ_XXX_TAX_ATTR'. This extractor was created based on a table T007V in turn view. It has a currency and a quantity type field. Those two fields were not refering to a table fields but were refering a structure. So as per the note 335342, if we have fields of curr/quan type and are having reference fields as a structure field, we need to populate those fields throught a customer exit.
    As I have read that the same problem has been solved by you with customer exit. So can you mail me the exit code as I am not a good in  ABAP.
    Regards,
    Amol Gaurkar

    Hi Amol,
    Here is the code below,
    TYPES: BEGIN OF TY_T007V,
                     TRKORR TYPE TRKORR,
                     ALAND  TYPE ALAND,
                     MWSKZ TYPE MWSKZ,
                     TXJCD  TYPE TXJCD,
                     DATAM  TYPE DATAM,
                     KSCHL  TYPE KSCHL,
                     KBETR  TYPE KBETR,
                  END OF TY_T007V.
    DATA:  T_T007V TYPE STANDARD TABLE OF TY_T007V,
                T_EXTRSTRU TYPE STANDARD TABLE OF <b><Extract Structure></b>,
    **--    Work Area
               W_T007V TYPE TY_T007V,
               L_TABIX   TYPE SY-TABIX.
    CASE I_DATASOURCE.
       WHEN 'ZXXZ_XXX_TAX_ATTR'.
         REFRESH: T_T007V.
         CLEAR:     W_T007V,
                          L_TABIX.
         T_EXTRSTRU[] = C_T_DATA[].
         IF NOT T_EXTRSTRU IS INITIAL.
    Fetching all the records into internal table T_T007V from the transparent table T007V
           SELECT TRKORR
                         ALAND
                         MWSKZ
                         TXJCD
                         DATAM
                         KSCHL
                         KBETR
               INTO TABLE T_T007V
               FROM T007V
                FOR ALL ENTRIES IN T_EXTRSTRU
              WHERE TRKORR = T_EXTRSTRU-KOKRS
                AND ALAND = T_EXTRSTRU-ALAND
                AND MWSKZ = T_EXTRSTRU-MWSKZ
                AND TXJCD  = T_EXTRSTRU-TXJCD
                AND DATAM = T_EXTRSTRU-DATAM
                AND KSCHL = T_EXTRSTRU-KSCHL.
           IF NOT T_T007V IS INITIAL.
             SORT T_T007V BY TRKORR ALAND MWSKZ TXJCD DATAM KSCHL.
             LOOP AT T_EXTRSTRU INTO W_EXTRSTRU.
               L_TABIX = SY-TABIX.
               READ TABLE T_T007V INTO W_T007V
                                 WITH KEY TRKORR = T_EXTRSTRU-KOKRS
                                                  ALAND   = T_EXTRSTRU-ALAND
                                                  MWSKZ  = T_EXTRSTRU-MWSKZ
                                                  TXJCD    = T_EXTRSTRU-TXJCD
                                                  DATAM   = T_EXTRSTRU-DATAM
                                                  KSCHL   = T_EXTRSTRU-KSCHL
                                 BINARY SEARCH.
               IF SY-SUBRC = 0.
                 W_EXTRSTRU-KBETR = W_T007V-KBETR.
                 MODIFY T_EXTRSTRU FROM W_EXTRSTRU INDEX L_TABIX.
                 CLEAR W_EXTRSTRU.
               ENDIF.
               CLEAR: W_T007V,
                      L_TABIX,
                      W_EXTRSTRU.
             ENDLOOP.
           ENDIF.
           REFRESH C_T_DATA.
           C_T_DATA[] = T_EXTRSTRU[].
           REFRESH: T_T007V,
                    T_EXTRSTRU.
         ENDIF.
    ENDCASE.                           "ENDCASE FOR RETREVING THE EXTRACTOR
    <b>Reward points if this helps,</b>
    Kiran

  • Adobe form output different in QA and PRD for Currency field

    Background:
    I am using adobe form to display purchase order details using a output type.
    I am displaying the field NETWR of the purchase order in the form.
    For return orders this value is negative.
    Problem:
    In production system the value is displayed as 0. where as in QA the negative value gets displayed.
    The version of the form is same in both the system.
    Also I have speficied the Currency/quantity fields in the interface.
    I did a bit of debugging and found that in the generated function module of the form there is a difference.
    QA:
    PERFORM %OUTPUT USING 'NETWR' %WORKAREA4-NETWR 'CURR' 'P' 'HEADER-WAERS' HEADER-WAERS ' '.
    PRD:
    PERFORM %OUTPUT USING 'NETWR' %WORKAREA4-NETWR 'CURR' ' ' 'HEADER-WAERS' HEADER-WAERS ' '.
    You can see that the VALUE P (ABAP type for curr) is passed in QA but not in PRD.
    I am not able to understand what causes this code change.
    Has anybody come across this problem?
    Note: I am using copy of MEDRUCK for the interface.

    Thank you for posting your solution like a good community member! I was having the same problem and your post helped. Many Thanks

  • Problem in using Currency Field in EXTRACTOR

    hello,
            I have a requirement to create Extractor involving some fields from a Ztable.
    While creating extractor (data source) in RSO2 transaction, when i enter the Z table name in "Extraction from DB view - View/Table" and click on SAVE, i get an error msg " Invalid extract structure template ZTABLE of DataSource Zextractor".
    But if i remove the only currency field in the ztable and then try using the ztable for extractor, its working fine. I dunno why? but i need the currency field in the extractor. Kindly let me know how to deal with this issue. Sure points for useful answers.
    thx,
    BaLaJi.......

    hi,
    for currency fields and decimal fields u should provide reference for them. give currency field in fields section -> click on refernce -> give
    currency field name table name refernce key name table name -> save n activate.
    if helpful reward some points.
    with regards,
    Suresh.A

  • Problem in currency field

    Hello All,
      I am moving an amount value to a field that is of currency type using write statment.But i cannot use write statment for currency fields.I tried using currency 'EUR' also but it is giving the same error.
    write : gs_outtab-rmwwr_out to lv_rmwwr_out currency 'EUR',
    Error : LV_RMWWR_OUT must be a character type.
    How to remove this error?
    Thanks,
    Rakesh.

    Hello,
    With WRITE stmt you cannot use CURR type elements. Do an F1.
    You need some workaround.
    BR,
    Suhas

  • Changes in currency field in standard screen

    hi.
    i have to change, number of decimal places for currency field in standard transactions.
    i.e 2 decimals to 4 decimals.
    please! how to do it.
    Regards.
    Sreenu.

    Check the Tcode OY04.
    these values are maintained in TCURX.

  • Setting currency and measurement unit for a field in an ALV report

    Plz give sample code to set currency and measurement unit for a field in an ALV report

    dear friend
    i am seanding you
    the display form
    if you need select form
    and process form also pls keep in touch.
    if help full rewards are expecting.
    yours
    vivek
    FORM build_field_catalog .
      DATA: w_dthigh(10).
      CLEAR fcat.
      fcat-fieldname = 'VBELN'.
      fcat-outputlen = 10.
      fcat-seltext_s = 'COMMERCIAL INVOICE'.
      fcat-seltext_m = 'Commercial Invoice'.
      fcat-seltext_l = 'COMMERCIAL INVOICE'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-key = 'X'.
      fcat-hotspot = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'EXNUM'.
      fcat-outputlen = 10.
      fcat-seltext_s = 'EXCISE INVOICE'.
      fcat-seltext_m = 'Excise Invoice'.
      fcat-seltext_l = 'EXCISE INVOICE'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-hotspot = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'EXDAT'.
      fcat-outputlen = 10.
      fcat-seltext_s = 'EXCISE DATE'.
      fcat-seltext_m = 'Excise Date'.
      fcat-seltext_l = 'EXCISE DATE'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'D'.
      fcat-datatype = 'DATS'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'NAME1'.
      fcat-outputlen = 30.
      fcat-seltext_s = 'CUSTOMER'.
      fcat-seltext_m = 'Customer'.
      fcat-seltext_l = 'CUSTOMER'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-lowercase = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'ZZPD'.
      fcat-outputlen = 15.
      fcat-seltext_s = 'COUNTRY'.
      fcat-seltext_m = 'COUNTRY'.
      fcat-seltext_l = 'COUNTRY'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-lowercase = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'WERKS'.
      fcat-outputlen = 4.
      fcat-seltext_s = 'PLANT'.
      fcat-seltext_m = 'Plant'.
      fcat-seltext_l = 'PLANT'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-key = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'ARKTX'.
      fcat-outputlen = 40.
      fcat-seltext_s = 'MATERIAL DESCRIPTION'.
      fcat-seltext_m = 'Material Description'.
      fcat-seltext_l = 'MATERIAL DESCRIPTION'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-lowercase = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'FKART'.
      fcat-outputlen = 4.
      fcat-seltext_s = 'Billing type'.
      fcat-seltext_m = 'Billing type'.
      fcat-seltext_l = 'Billing type'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      fcat-key = 'X'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'INCO1'.
      fcat-outputlen = 5.
      fcat-seltext_s = 'INCO TERMS'.
      fcat-seltext_m = 'INCO TERMS'.
      fcat-seltext_l = 'INCO TERMS'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'INCO2'.
      fcat-outputlen = 10.
      fcat-seltext_s = 'INCO TERMS DES'.
      fcat-seltext_m = 'INCO TERMS DES'.
      fcat-seltext_l = 'INCO TERMS DES'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      APPEND fcat.
    CLEAR fcat.
    fcat-fieldname = 'FKIMG'.
    fcat-outputlen = 14.
    fcat-seltext_s = 'QUANTITY'.
    fcat-seltext_m = 'Quantity'.
    fcat-seltext_l = 'QUANTITY'.
    fcat-ddictxt = 'M'.
    fcat-inttype = 'P'.
    fcat-datatype = 'QUAN'.
    APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'FKLMG'.
      fcat-outputlen = 10.
      fcat-seltext_s = 'QUANTITY'.
      fcat-seltext_m = 'QUANTITY'.
      fcat-seltext_l = 'QUANTITY'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'P'.
      fcat-datatype = 'QUAN'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'MEINS'.
      fcat-outputlen = 5.
      fcat-seltext_s = 'UNIT'.
      fcat-seltext_m = 'UNIT'.
      fcat-seltext_l = 'UNIT'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CHAR'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'KBETR'.
      fcat-outputlen = 8.
      fcat-seltext_s = 'RATE'.
      fcat-seltext_m = 'Rate'.
      fcat-seltext_l = 'RATE'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'P'.
      fcat-datatype = 'CURR'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'NSR'.
      fcat-outputlen = 8.
      fcat-seltext_s = 'Exmill'.
      fcat-seltext_m = 'Exmill'.
      fcat-seltext_l = 'Exmill'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'P'.
      fcat-datatype = 'CURR'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'KURSK'.
      fcat-outputlen = 8.
      fcat-seltext_s = 'EXCHANGE RATE'.
      fcat-seltext_m = 'Exchange Rate'.
      fcat-seltext_l = 'Exchange Rate'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'P'.
      fcat-datatype = 'CURR'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'WAERK'.
      fcat-outputlen = 5.
      fcat-seltext_s = 'CURRENCY'.
      fcat-seltext_m = 'Currency'.
      fcat-seltext_l = 'CURRENCY'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'C'.
      fcat-datatype = 'CUKY'.
      APPEND fcat.
      CLEAR fcat.
      fcat-fieldname = 'LCURR1'.
      fcat-outputlen = 14.
      fcat-seltext_s = 'GROSS AMT'.
      fcat-seltext_m = 'Gross Amt'.
      fcat-seltext_l = 'GROSS AMT'.
      fcat-ddictxt = 'L'.
      fcat-inttype = 'P'.
      fcat-datatype = 'CURR'.
    fcat-do_sum = 'X'.
      APPEND fcat.
    ================================= *****************
      fheader-typ = 'H'.
      SELECT SINGLE butxt
        FROM t001
        INTO fheader-info
       WHERE bukrs EQ '1000'.
      APPEND fheader.
      CLEAR fheader.
      fheader-typ = 'H'.
      fheader-info = 'Daily Shipments For Exp'.
      APPEND fheader.
      CLEAR fheader.
    Plant
      SORT s_werks BY low.
      READ TABLE s_werks INDEX 1.
      fheader-typ = 'S'.
      WRITE s_werks-low TO fheader-key.
      SORT s_werks BY high DESCENDING.
      READ TABLE s_werks INDEX 1.
      IF s_werks-high NE space.
        CONCATENATE fheader-key 'TO' s_werks-high INTO fheader-info
                                SEPARATED BY space.
      ELSE.
        WRITE fheader-key TO fheader-info.
      ENDIF.
      CLEAR fheader-key.
      fheader-key = 'PLANT : '.
      APPEND fheader.
      CLEAR fheader.
    Billing Typ
    SORT S_FKART BY LOW.
    READ TABLE S_FKART INDEX 1.
    FHEADER-TYP = 'S'.
    WRITE S_FKART-LOW TO FHEADER-KEY.
    SORT S_FKART BY HIGH DESCENDING.
    READ TABLE S_FKART INDEX 1.
    IF S_FKART-HIGH NE SPACE.
    CONCATENATE FHEADER-KEY 'TO' S_FKART-HIGH INTO FHEADER-INFO
                             SEPARATED BY SPACE.
    ELSE.
       WRITE FHEADER-KEY TO FHEADER-INFO.
    ENDIF.
    CLEAR FHEADER-KEY.
    FHEADER-KEY = 'DOCUMENT TYPE : '.
    APPEND FHEADER.
    CLEAR FHEADER.
    Date...
      fheader-typ = 'S'.
    FHEADER-KEY = S_FKDAT-LOW.
      WRITE s_fkdat-low  TO fheader-key.
      WRITE s_fkdat-high TO w_dthigh.
      CONCATENATE fheader-key 'TO' w_dthigh INTO fheader-info
                              SEPARATED BY space.
      CLEAR fheader-key.
      fheader-key = 'PERIOD : '.
      APPEND fheader.
      CLEAR fheader.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = fevents[]
        EXCEPTIONS
          list_type_wrong = 1
          OTHERS          = 2.
      READ TABLE fevents WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        fevents-form = 'TOPOFPAGE'.
        MODIFY fevents INDEX sy-tabix.
        CLEAR fevents.
      ENDIF.
      rptname = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                        EXPORTING
                          i_callback_program                = rptname
                          it_fieldcat                       = fcat[]
                          i_default                         = 'S'
                          it_events                         = fevents[]
                          i_save                            = 'X'
                         TABLES
                           t_outtab                          = it_output[]
                      EXCEPTIONS
                        PROGRAM_ERROR                     = 1
                        OTHERS                            = 2
    ENDFORM.                    " BUILD_FIELD_CATALOG

  • To calculate average for a currency field in alv

    Hi,
    I have a requirement in which i need to find the average of a currency field in alv. For the particular field, i'm passing the value of DO_SUM = 'C' in thr field catalog(as suggested in many threads); but I'm not able to calculate the average. it still shows me summation when i click on summation button.
    What could be the possible error??? Is there any other method we can do the same??
    Thanks in Advance.
    Jaspreet

    Hi
    U can try this way.
    *& Report  Z_DEMO_JG
    *& Display average in ALV report
    REPORT  z_demo_jg LINE-SIZE 80 LINE-COUNT 50
                                         NO STANDARD PAGE HEADING.
    TABLES: sflight.
    TYPE-POOLS: slis.
    * Data declaration
    DATA: i_flight TYPE STANDARD TABLE OF sflight,
          i_catalog TYPE slis_t_fieldcat_alv,
          w_flight TYPE sflight,
          w_catalog TYPE slis_fieldcat_alv.
    DATA: v_repid TYPE syrepid.
    * Selection screen
    SELECT-OPTIONS: s_carrid FOR sflight-carrid.
    START-OF-SELECTION.
    * Fetch data from sflight table
      SELECT *
       FROM sflight
      INTO TABLE i_flight
      WHERE carrid IN s_carrid.
      CHECK sy-subrc = 0.
      v_repid = sy-repid.
    * Build field catalog for ALV report
      PERFORM build_catalog.
    * Display ALV report
      PERFORM display_report.
    *&      Form  build_catalog
    *       Build field catalog for ALV report
    *       None
    FORM build_catalog .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = v_repid
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = i_catalog
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc = 0.
    *   For average populate 'C' as value in
    *   field DO_SUM
        w_catalog-do_sum = 'C'. " C = Average
    *   Modify record with new value
        MODIFY i_catalog FROM w_catalog TRANSPORTING
        do_sum WHERE fieldname = 'PRICE'.
      ENDIF.
    ENDFORM.                    " build_catalog
    *&      Form  display_report
    *       Display ALV report
    *       None
    FORM display_report .
      IF i_catalog[] IS NOT INITIAL.
    *   Call ALV grid
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = v_repid
            it_fieldcat        = i_catalog
          TABLES
            t_outtab           = i_flight
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
    ENDFORM.                    " display_report
    Edited by: meetjoe on Sep 15, 2009 7:17 PM

Maybe you are looking for