Skip to Content
avatar image
Former Member

BRFplus: Sum Amount in Table

Experts,

We are having trouble summing amount columns of tables in BRFplus. We have tried 2 different ideas and each has a different error:

  1. Table Operation - sum the column containing the amount. This returns a currency error. It is not possible to pass a currency at runtime because it does not exist in the table structure.
  2. TABLE_SUM_AMOUNT - create a formula and use this function to calculate the amount. This always returns the error "Column 0050569BA4BE1EE487810606D083E1 does not exist in table Table Type." Regardless of the column or the table type, this same error appears for all TABLE_SUM* functions.

Any ideas? Your help would be greatly appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Sep 17, 2014 at 11:05 AM

    Hi Jon,

    from my point of view the second option is the one that should definitly work, However I tested it on our system and it does not. I get the same error as you.

    When debugging the issue one will see that the problem is located in the class CL_FDT_FORMULA_PARSER method _CHECK_TABLE_FUNCTIONAL. Here the program tries to compare the column name that is entered in the formula expression vs. the available column names determined via the structure of the table:


    IF lv_name EQ lv_colname.

    lv_found = abap_true.

    EXIT. ">>>>>>>>>>

    ENDIF.

    The problem is that the parameter lv_name contains the technical name of the column (e. g. AMOUNT) and the while the parameter lv_colname contains the GUID of the column (that is also the reson for the cryptical error message). As this check is done for all these functions, it is consistent that the error is raised as you describe it.

    I did not find any note that solves that issue, so I would recommend that you open an OSS.

    Best regards

    Christian

    P.S. I am on a NW740 with SP06

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 17, 2014 at 11:18 PM

    Can you elaborate more about 1.

    'Total' Table operation & result filed is amount field.

    Input table:

    1) 10, blank currency

    2) 10, blank currency

    Output element:

    30, blank currency

    on NW731.11

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 29, 2014 at 04:18 PM

    We have opened OSS Note 887267/2014 for this issue. The error in the formula function can be worked around by switching to expert mode and changing the column name to the field in single quotes (although SAP should still fix this issue - workarounds are not acceptable):

    TABLE_SUM_AMOUNT ( 0050569BA4BE1EE486990918279CB05B , 'BETRW' )

    However, once this is fixed, the Formula Function now has the same currency problem as the Table Operation in #1 of my original post. Considering BRFplus is used by a large number of SAP customers, I find it hard to believe that this issue has not been encountered before.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jon,

      Also if you are always or mostly summing to one main currency you might want to put a default currency in your Rules Applications settings.. at least that helps sort out the default treatment of decimal places.


      Also Amounts in BRFplus have both a value and a currency part. You need to move both into and out of your BRFplus amount. If you move your BETRW and WAERS to a value of data type IF_FDT_TYPES=>ELEMENT_AMOUNT then you can easily map it to your BRFplus amount, and pass it to BRFplus as fully formulated amount with currency. Put the BETRW in the NUMBER part, and WAERS in the CURRENCY part.


      I'd also warn you that the standard conversion formula function CONVERT_AMOUNT only converts at the default exchange rate on the current date. However it's really surprisingly easy to create a custom formula function that extends that. (One blog I'm still trying to find time to write). Took me about an hour to create the custom formula function... seriously! The code's more than half written for you already in CL_FDT_FORMULA_FUNCTIONAL->CONVERT_AMOUNT. Let me know if that's critical to what you are doing and I'll try and move up my blogging timeframe.


      Rgds,

      Jocelyn