Grandtotal and Subtotal on amount field

Hello all,
In the ALV display when I press the total or subtotal button for amount column it gives the total irrespective of the currencies which are different. I need the sum to show for separate currencies. I have even added the Totals field with the following cde
ls_fieldcat-fieldname = 'TOTAL'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = '15'.
ls_fieldcat-cfieldname = 'WAERK'.
ls_fieldcat-do_sum = 'X'.
Still I get the same result with the Totals column showing vaccant and at the end of the totals column it only lists zero
and at the end of currency column it lists the various currencies. However when i run the standard report BALVEX01 it shows the sum in different currencies for both totals and subtotals operation without any extra coding.
FARKANKHUD

try this
DATA :      IT_SORT     TYPE SLIS_T_SORTINFO_ALV,
       WA_SORT     TYPE SLIS_SORTINFO_ALV,
  WA_SORT-TABNAME = 'IT_OUTPUT'. " your internal table name
  WA_SORT-FIELDNAME = 'AMOUNT'. " field name for Amount
  WA_SORT-UP = 'X'.
  WA_SORT-GROUP = 'X'.
  WA_SORT-SUBTOT = 'X'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
  WA_SORT-TABNAME = 'IT_OUTPUT'.
  WA_SORT-FIELDNAME = 'CURRENCY'. " field name for currency
  WA_SORT-UP = 'X'.
  WA_SORT-GROUP = 'X'.
  WA_SORT-SUBTOT = 'X'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
and
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM     = SY-REPID
      I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
      I_GRID_TITLE           = ''
      IS_LAYOUT              = GS_LAYOUT
      IT_FIELDCAT            = IT_FIELDCAT
      IT_SORT                = IT_SORT
     IT_FILTER              = IT_FILTER
      I_DEFAULT              = 'X'
      I_SAVE                 = 'A'
    TABLES
      T_OUTTAB               = IT_OUTPUT
    EXCEPTIONS
      PROGRAM_ERROR          = 1
      OTHERS                 = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Similar Messages

  • Difference between BSEG amount field and FAGLFLEXA/FAGLFLEXT Amount fields.

    Hi experts,
       We have a newly SAP instance with the New GL activated. However, when i compared between BSEG and the FAGLFLEXA/FAGLFLEXT tables, I found a difference in the length of the transaction amounts.
    BSEG
    DMBTR     DMBTR     CURR     13     2     Amount in Local Currency
    WRBTR     WRBTR     CURR     13     2     Amount in Document Currency
    FAGLFLEXA/FAGLFLEXT
    TSL     VTCUR12     CURR     23     2     Value in Transaction Currency
    HSL     VLCUR12     CURR     23     2     Value in Local Currency
    KSL     VGCUR12     CURR     23     2     Value in Group Currency
    OSL     VOCUR12     CURR     23     2     Value in Another Currency
    Is there a reason for this difference? and any config that needs to be perform to synchronise the difference?
    Thank you in advance.

    Hi Jason,
    Please run report TFC_COMPARE_VZ in SE38/SA38 and compare the difference.  If there is any difference ONLY SAP can correct this.  Should you notice any difference, please raise an OSS.
    Hope this helps.
    Vikas.

  • SubTotal based on field

    Hi,
    I have requirment to do subtotal of amount field for each G/L Account in Adobe Print form.
    Your Input & sugesstion are helpful.
    Thanks in advacne...!!

    Assuming I have 3 Numeric field say NumericField1, NumericField2, NumericField3 where NumericField3 is supposed to show sum of two values i.e. NumericField1 & NumericField2 then make use of the calculate event of NumericField3 and write the following code in it.
    form1.#subform[0].NumericField3::calculate - (FormCalc, client)
    NumericField1 + NumericField2
    Have a look at this [tutorial|http://saptechnicaldotcom/Tutorials/AdobeForms/Totals/page1.htm] as well.
    Chintan

  • Generic UDF to handle empty contexts and contexts with missing fields

    Hi,
    I have been trying to get my head around a UDF for this for a while, but cannot find the solution. I''l start by showing input structure, and expected target structure (subset of an invoice IDoc with 4 line items):
    SOURCE:
    E1EDK01 (0..1)
    E1EDP01
    ---POSEX = 1
    ---E1EDP05
    KOTXT (qualifier) = Z1
    BETRG (amount) = 200,00
    ---E1EDP05
    KOTXT = Z2
    BETRG = 300,00
    ---E1EDP19...
    E1EDP01
    ---POSEX = 2
    ---E1EDP05
    KOTXT = Z1
    ---E1EDP05
    KOTXT = Z2
    BETRG = 400,00
    ---E1EDP19...
    E1EDP01
    ---POSEX = 3
    ---E1EDP05
    KOTXT = Z2
    BETRG = 500,00
    ---E1EDP19...
    E1EDP01
    ---POSEX = 4
    ---E1EDP19...
    TARGET:
    Line
    ---PosId = 1
    ---Price = 200.00
    Line
    ---PosId = 2
    ---Price = N/A
    Line
    ---PosId = 3
    ---Price = N/A
    Line
    ---PosId = 4
    ---Price = N/A
    I want the price from E1EDP05/BETRG where KOTXT = Z1to be set for each line. As you can see the source structure can be split in 4 cases:
    1. for some line items there exist multiple E1EDP05-segments with one of them qualifier Z1 and one corresponding amount field. This is the "perfect" structure and easy to handle.
    2. some line items contains E1EDP05 with qualifier Z1 with no BETRG. Problem-case
    3. some line items contains no E1EDP05-segments with qualifier Z1, but contains other E1EDP05-segments. Can be solved.
    4. some line items contains no E1EDP05-segments at all. Can be solved.
    I need to (I believe) set the context of the KOTXT and BETRG to E1EDP01 since I want one value per line item, irrespective of how many E1EDP05-segments exist per line item. In cases where no value can be found for relevant qualifier (Z1) or no E1EDP05-segments exist for a line item I want a default value to be set (N/A).
    My problem is that all these different cases might occur in the same file, and they mess up the values in each context, leading to wrong BETRG to be picked in some cases (where case 2 exist) since mapWithDefault cannot be used (context contains value for other qualifier).
    Do you know how to handle all these cases?
    Any pseudo-code for an UDF?
    Many thanks for your help!
    Br,
    Kenneth

    Hi Shweta!
    Thanks a lot, your idea didn't completely solve my problem, but pointed me in the right direction and gave me some valuable ideas:)
    For anyone wondering how it is done, I solved it by using your suggested two inputs, along with a third input (constant) which functions as default value for contexts where value-field is missing for a specific qualifier, or in case no segments with desired qualifier exists for a context.
    My mapping now looks like the following (where KOTXT is qualifier and KRATE is value field) for the 3 inputs:
    KOTXT(Context = E1EDP01) \
                                equalsS -->
    Constant(qualifier value) /
    KOTXT(Context = E1EDP05) \
                                equalsS  \
    Constant(qualifier value) /            ifWithoutElse --> removeContexts -->
               KRATE (Context = E1EDP05) /
    Constant(default value) -->
    Then these 3 inputs goes into the following UDF (queue function):
    int j=0;
    boolean contextDone = false;
    for(int i=0;i<a.length;i++)
         if(a<i>.equals("true"))
              if(b[j].equals(ResultList.SUPPRESS))
                   result.addValue(c[0]);
              else
                   result.addValue(b[j]);
              contextDone = true;
              j=j+1;
         if(a<i>.equals(ResultList.CC))
              if (contextDone)
                   contextDone = false;
                   result.addValue(ResultList.CC);
              else
                   result.addValue(c[0]);
                   result.addValue(ResultList.CC);
    This results in a target node created for each context, where context relates to each line item in this case, where each value is either a default value or the value corresponding to the qualifier. This works in all cases where:
    1. there are no segments containing relevant qualifier
    2. there are segments with relevant qualifier, but missing value field
    3. there are segments with relevant qualifier and value field
    Thanks a lot again, Shweta, for guiding me!
    Br,
    Kenneth

  • Gross invoice amount and net invoice amount

    Hi Experts,
    Can anybody tell me which is the gross invoice amount and net invoice amount field.
    From which table can I get them?
    I need to fetch Gross invoice amount and net invoice amount for both PObased invoice and non-PO based invoice against a check.
    Which tables to hit for fetching them?
    Regards,
    Sangeeta.

    Hi Sangeetha,
    I hope table BSIP of field WRBTR can help you in getting the amount.
    check it once.
    Cheers!!
    VEnk@
    Edited by: Venkat Reddy on Nov 5, 2008 6:47 PM

  • How to avoid printing zero in amount field in adobe forms

    Hi All,
    If the amount is empty in the amount field then it is printing 0,00. I have written some peice of code to avoid printing that value. I wanted to print space.
    Below is the  logic which  i have tried in  javascript.
    if  ( this.WRSHB.rawValue == null )
    this.presence == "hidden";
    if  ( this.WRSHB.rawValue == '0,00' )
    this.presence == "hidden";
    I am still able to print 0,00 in the form output.
    Can anyone please help me out in achieveing the same ? Am I missing anything in the javascript coding?
    Thanks and Regards,
    Karthik Ganti.

    Hi,
    Issue is fixed. I have written the above code in Form ready event and changed the amount field type to text field. It worked. Thanks.
    Thanks and Regards,
    Karthik Ganti.

  • User defined function to check the NULL and 0.00 value in a Amount field

    Hi Experts,
    I have one scenario in which i have amount field in Data type.
    I have to create one UDF which will do the following thing.
    1. If the amount field is Null it should throw an exception in mapping.
    2.If the amount field is 0.00 it should throw an exception in mapping.
    3. For all other cases it should pass the amount value to the target.
    Can anyone provide me the code For this UDF.
    Thanks in advance.

    Hi,
      You can add this logic to the UDF. Here var1 is the input string.
    java.math.BigDecimal b=new java.math.BigDecimal(var1);
              if(b.compareTo(new java.math.BigDecimal("0.00"))<=0)
                   //write your logic for values less equal to zero
    One small request, if you think your question has been answered, properly and correctly, could you please kindly if possible close down this thread. It helps people who look for solutions to similar problem.
    regards
    Anupam

  • Field over flow can not display the total and subtotal in ALV

    hi
    i am running a z report with huge data in quality system.
    in 2 columns and not able to show the total and subtotal in 2 columns
    it says field overflow and cannot be dispayed.
    value is around 20character integer.

    You can create a domains with 20 positions and 2 decimal, for example.
    Than, associate this domain a data element.
    To finish assign that data element to the column you wanna sum.
    I hope help.

  • Adding Amount field in BSEG table and display it single line item?

    hi experts,
           I am doing credit / debit form now my requirement is
                                               According to BELNR , GJAHR,BUKRS i want to find credit amount for this selection cretiria.
                         so i want to add all the lines of amount filed for a particular BELNR and display it as single line.
    so i am getting data from print program like this
    SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 2.
    PARAMETERS: p_belnr LIKE bkpf-belnr OBLIGATORY,
                p_bukrs LIKE bkpf-bukrs OBLIGATORY,
                p_gjahr LIKE bkpf-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b0.
    SELECT SINGLE *
                   FROM bkpf
                   INTO  i_bkpf
                   WHERE belnr = p_belnr
                         AND ( blart = 'DG' OR blart = 'ZG' )
                         AND bukrs = p_bukrs
                         AND gjahr = p_gjahr.
    IF sy-subrc = 0.
        SELECT  *
              FROM bseg
              INTO  table it_bseg
              WHERE belnr = i_bkpf-belnr .
      ENDIF.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = 'Z_CREDIT_DEBIT'    " p_name
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
        IMPORTING
          fm_name                  = v_form_name
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    CALL FUNCTION v_form_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        i_bkpf                     = i_bkpf
        i_bseg                     = i_bseg
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    so my I_BSEG containing all line items of particular BELNR . with the field SHKZG  iam  getting only credit line items .
      now i want to do is add all credited amount and display like this in a table.
    against ref#  (BSEG-REBZG) ! details (BSEG-SGTXT)!  amount
    124569                                   10%discount                950.00(total amount ie sum of all lines amount for a BELNR)
                                                                                    10.00(total tax amt ie sum of   all lines of tax amount for a BELNR)                                                                               
                                                                                    960.00

    hi arun,
             i used collect in smartform my procedure is like this .
                   i am getting data into i_BSEG because i declared like this in TABLES parameter
                      i created a loop .
                             in that i mentioned like I_BSEG into WA_BSEG.
                                   then i created a program lines here i mentioned like this.
                                                  COLLECT WA_BSEG INTO IT_BSEG.
               but because of BUZEI "Number of Line Item Within Accounting Document .it is not same it is varying for every credited time that means for every line of BELNR. thats why it is not adding it is just appending .
    so pls tell me any other chance to find sum .
    because i want to sum up all credted amount and display it in single line
    ie first column REBZG "Number of the Invoice the Transaction Belongs to(against ref) i want to display once .
    And Second column  SGTXT "item text(details) for amount once and for tax amount once
    And Third column Amount first line consists total amount & second line consists total for tax amount
    regards,
    satheesh.
    [email protected]
    any doubts chat me regarding this post.

  • Tax Code and Tax Amount Fields are not appearing

    Hi to all,
    While making Downpayment Request (F-47) Tax Code and Tax Amount Fields are not appearing in the screen.
    for more clarity...
    suppose PO is 1150 include all taxes ( Amount 1000+ Tax Amount 150)
    as per agreement with vendor we need to raise DR for 1150 and based on DR we will make downpayment to vendor (F-48)
    But in F-47 screen Tax Code and Tax Amount fields are not appearing.
    Could any body help me on this??
    Thanks in Advance
    Regards,
    Schilukuri

    why you are looking for tax code field, pay gross amount as per PO, same amount will update in PO history as well as Vendor account.
    Even if you find the tax code field and check the tax code check box, system will not calculate tax  at the time of down payment or down payment request.
    Please remember that by default standard SAP provides the tax code field in f-47 or F-48.

  • ALV print problems for reports with two sort fields and subtotal at each

    When a report has two sort fields and subtotal at each of them, the print function is not working correctly. Please see the report below.
    The second "" (single star) record (the 10 RL record) and the '*' (double star) record (the 12 RL record)  are not printing.
    This is happening for any standard SAP reports. Any resolution? Any OSS Notes?
         Material/Stock Code          Grade       Units Count     Unit Type     Set Position     LFT
         520085V000          7818     1     RL     A     19,682 LF
         520085V000          7818     1     RL     A     19,682 LF
    *     520085V000               2     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000               1     RL          
         599098V000          7717     1     RL     A     36,167 LF
    *     599098V000               10     RL          
    **                    12     RL          
    ***                    12               
    Thanks
    Anand
    Edited by: Anand Velayudhan on Feb 9, 2009 11:50 PM

    Hi,
    Check these OSS Notes..
    Note 975777 - ALV total: Subtotals disappear from printout
    Note 1039655 - ALV total: Subtotals disappear from printout II
    Thanks
    Naren

  • How to block amount field and layout field  in transaction MIR7

    Hi Expert,
    Please tell me how to block amount field and layout field  in transaction MIR7 for a particular user .
    i am trying to block through SHD0 tcode but it is not blocked.please give me the right ans
    Thanks In Advance

    Hi Rajuka,
    I wasn't refering to SHD0 transaction variants. User exists and Customer exists are a very interesting enhancements in ABAP which helps to add custom logic to SAP delievered programs/function modules without actually modifying the original program.
    Just to add a little more details to the concept of Custom Exits (Customized user exits), please refer the links below:
    [http://wiki.sdn.sap.com/wiki/display/ABAP/CustomerExits(CMOD)]
    [http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=189893877]
    [http://wiki.sdn.sap.com/wiki/display/ERPFI/Creatinguserexitsforsubstitutions]
    You will find a lot of information about custom exists and its types over the web. Also, your developer might provide you a better insight into this concept and its relevancy to your requirement.
    Cheers!
    Sandipan
    Edited by: Sandipan Choudhury on Dec 10, 2010 8:02 AM

  • Tax amount and sales tax code fields not visible in tcode MIR4

    Hi,
    A workflow has been cretaed for cretaing the invoices. Here in SRM invoice, the tax code and Sales tax code fields are not visible in tcode MIR4 though data has been passed while creating it.
    When i am checking the "calculate tax" check box, am able to see these two fields on the MIR4 page.
    Am not able to find the reason for this behaviour. As its working fine for other invoices. This is the case with only SRM invoice.
    Kindly provide your inputs.
    Thanks!
    Regards,
    Razia Shaheen.

    Hello,
    What you are saying is that the Invoice coming from SRM (Via Idoc i supose) is not bringing the tax code? is that it?
    Cheers !

  • Change the total and subtotal dynamically in ALV GRID

    Hi guys,
               I need to change the total and subtotal of field "AMOUNT" dynamically.I am using ALV GRID CONTROL(oops concept).I need to override the standard functionality.I need to show my own subtotal and total line instead of standard one .

    Hi
    I've understood it, I wanted to use OO Grid too, but I had to use the ALV list in order to write my total.
    If you need to use OO grid u can try to exclude all funcitonalities for the total, subtotal and sorting and insert in the output table the lines with your totals.
    Max

  • DIsplaying WRBTR (AMOUNT FIELD)WITHOUT  DECIMAL PLACES

    Dear all,
    I am facing a problem in displaying amount field  in alv report. I have two currency keys (US dollar and Japan yen). if it is japan yen I should not have to show decimal places and if it is US dollar I should show decimal places.
    How can I do it in a alv report if I have only one output amount field?
    thanks
    Ranjan.

    Hi chittaramjan,
    1. use this kind of funda (just copy paste in new program)
    Important things
    a) one extra field in internal table
      declared in the same exact fashion
    waers LIKE tcurc-waers,
    b) Populate this field
    c) REST THE System will take care
       (based upon country settings)
    2.
    REPORT abc.
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA  : BEGIN OF itab OCCURS 0,
            f1  LIKE P0008-BET01,
            waers LIKE tcurc-waers,
            END OF itab.
    START-OF-SELECTION.
      itab-f1 = '-4.15'.
      itab-waers = 'KRW'.
      APPEND itab.
      itab-f1 = '4.68'.
      itab-waers = 'GBP'.
      APPEND itab.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = sy-repid
          i_internal_tabname = 'ITAB'
          i_inclname         = sy-repid
        CHANGING
          ct_fieldcat        = alvfc.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
          it_fieldcat             = alvfc
        TABLES
          t_outtab                = itab
        EXCEPTIONS
          OTHERS                  = 2.
    regards,
    amit m

Maybe you are looking for

  • Header data not getting updated in line item level

    Hi, We are trying to update Pricing date at header level but it is not gettting copied to item level. getting an message "The header business data does not apply to item xxxx" i have checked the item category and "business item" field is checked. and

  • How to specify a date in a method signature

    How do I specify a date as a method parameter of a bean that will be used to generate a SOAP service? If I specify java.util.Date, I get NullPointerExceptions, perhaps because the internal structure of Date is not compatible with SOAP supported types

  • IWeb pages not listed on .Mac homepage

    After republishing my iWeb site to .Mac the pages are no longer showing up under My Pages in .Mac. Anyone know how to fix that? It's handy to look there and see the counter totals. Thanks!

  • Audio on the internet

    My speakers are working, when I have tested them they seem to be working fine. When I go to watch a video or clip on the internet, there is no sound. As my speakers are working and the volumes are all turned up to max, I am not sure why the sound is

  • Pipe Line Steps not executing

    Hello Experts, I am facing stage issue with PI Server,when i am executing scenario it showing black/white flag in MONI,my mapping part/development perfect. but its not giving target pay load.Pipeline steps also not executing. its new PI 7.1 server,do