Total Before Discount field.

Hi, evrybody!
Can you show me about what table store Total Before Discount field..in SQL tables
Can you help me! Thank you.

Hi,
The total before discount is the sum of the line total which are stored in the lines table.
For an example ,
Sales Order,
SELECT SUM(PriceBefDi),docentry FROM RDR1 WHERE DOCENTRY = "docentry value" group by docentry.
Regards,
Tom.

Similar Messages

  • Invoice field "Total Before Discount"

    I am importing data via DTW to an invoice. I am then trying to apply a 10% discount. However, the 10% doesn't apply because the field "total before discount" is empty.
    I have tried to look at importing in to this field but can't find which field to update and I also thought that it would update automatically from the line items?
    Although perhaps it's not updating because by adding the items codes and qty during the import it doesn't then set the Total (LC) field. Do I have to set this?
    Edited by: Ricky Thomas on Apr 1, 2011 12:52 PM

    HI,
    Ya,you just add the discount in its respective field along with the previous details(like neceesary standard information for that invoice) and update it through DTW....
    Edited by: kambadasan on Apr 1, 2011 1:29 PM
    Edited by: kambadasan on Apr 1, 2011 1:31 PM

  • Total Before Discount

    Hi,
    Is there a property in the Sales Order Document to get the Total Before Discount ?

    Hi Binita, Hi Marc,
    Effectivly your formula is correct.
    In my application i don't activate Rounding. So the value is only 0.
    To calculate the total before discount :
    Total document - rounding - Tax + discount.
    (DocTotal - TotalExpns - VatSum + DiscSum --> SQL fields)
    (DocTotal - Rounding - VatSum + TotalDiscount --> Properties DIAPI)
    Regards
    Michael
    Edited by: Michael LECLERCQ on Jul 4, 2008 8:49 AM

  • HOW TO GET TOTAL BEFORE DISCOUNT AMOUNT IN MARKETING DOCUMNET

    HI.
    I need one requirement in this,
    i need to capture the Total before discount amount at A/R invoice.
    i checked in tables Discount and Discount amount will be come below Total before Discount amount
    but Total Before Discount Amount i am not able to get it from the Database.
    Any information plz Update me.

    Hi Srinivas,
    As already answered by Seniors that you have to apply Formula to get Total before Discount. Please check below
    Total Before Discount =  ( DocTotal + DiscSum - VatSum )
    If you want to put FMS then please try below FMS for Header Level
    SELECT ( $[OINV.DocTotal] + $[OINV.DiscSum] - $[OINV.VatSum] )
    Hope this helps
    Regards::::
    Atul Chakraborty

  • Other Charges on total before discount value

    Hi Experts,
    I faced an issue while generating sales quotation, apart from tax code we need to put other charges on the total before discount value of the documents like UT charges,P&F charges, Tarnsit Insurance and TPI Charges.
    However these other charges percentage are variable in nature it depend upon the customer to customer(C2C).
    Please put some light on this major issue of sales process.
    Thanks in Advance
    Regards
    Amit Tyagi

    Hi Amit,
    In the lines of the quotation there is only place for 3 sorts of freight charges, but I think this will be the most easy to use for you.
    At first you have to setup your freight charges: Administration > General Settings > General > Freight
    Define your different charges there, so you can use them in the sales quotation.
    After you have done that, you can open the sales quotation and take a look at the freight charges that is displayed under the document discount. If you click on the golden arrow, you can see the defined freight costs and give in the ammounts.
    You can also do this in the lines, open the form settings for the sales quotation and make the freight costs visible in table format. It is possible to make formatted searches on these colums.
    I have one question remaining at this moment: Do you want to see the extra costs on the lay-out?
    Kind regards,
    Hendri Wessels

  • Total Amount before Discount do not match Row total

    Hi,
    I have this scenario for my A/R invoice. The amount in the the total (lc) column do not match with the total before discount field.
    So, when I tried to create Cm for this invoice I encountered an error: There is a difference between total and it's contents.
    What is the possible cause for this and how will I resolve this?
    Thanks!

    Hi Nelle,
    If you are create any UDF related to this calculation at row level then first remove it then check it.
    There are no any UDF created then upgrade your PL..
    Thanks,
    Srujal Patel

  • How can we setup "price before discount" in foreign currency?

    Hi all,
    Hopefully someone can help.How can we setup "price before discount" in foreign currency?   Can someone also please tell me the proper Variable Number (No.) for that?
    Look forward to your reply,

    IHi,
    Thanks for your help..i will give good feedback to you all.
    Just to let you know in pro forma invoices we have got Unit Price in GBP (example: 7.4000 GBP )  but Total line, Total Before Discount, Total (document) are in Euro.We have already changed that to 88->87 and 91->93 so those fields are correct apart Unit Price?
    Any advice please ?

  • Synchronisation of price before discount

    At the time the synchronisation of special prices and discounts was realised last year, there hasn't been a change of the way the prices are synching to Business One.
    Webtools only synches the price after discount to SBO to the field RDR1.Price (which is the field price before discount). On the invoice only the price after discount is shown.
    u221A     OrderDetail.PurchasePrice     NPOrderDetail.PurchasePrice     SAPbobsCOM.Documents.Lines.Price     RDR1.Price
    My customers like to see the price before discount, the discount (in %) and the price after discount on the invoice.
    Any suggestions to solve this. So has someone already build a way around to achieve this.
    When I look at the OrderDetail table I can see the PurchasePrice (Price before discount) and DiscountPer (discount amount per article). When I'm correct these amounts are deducted during the synch and the price after discount is shown in the field RDR1.Price in SBO.
    To achieve it the way we like we have to duplicate the OrderDetail table, rename it, build a plugin so that the PurchasePrice is synched to the field RDR1.Price and that we create a calculation field (PurchasePrice - DiscountPer) and that this field is synching with the field RDR1.Price after discount. SBO will calculate the discount % itself. For the synch we have to use our own OrderDetail table.
    I'm I correct are do we miss something.
    Best regards,
    Tim
    Edited by: T. Verholt on Oct 8, 2009 12:46 PM

    IHi,
    Thanks for your help..i will give good feedback to you all.
    Just to let you know in pro forma invoices we have got Unit Price in GBP (example: 7.4000 GBP )  but Total line, Total Before Discount, Total (document) are in Euro.We have already changed that to 88->87 and 91->93 so those fields are correct apart Unit Price?
    Any advice please ?

  • Problem with the discount field in PO form.

    Hi All
    I have a major problem in the PO form when ever I capture an invoice and then i insert the amount like R 100 000 then I try and add it with out maybe be a date in , the system will give me an error about date which is fine then I put in my date , then before i add the doc i change the total amount in one of the lines then the system inserts discount in the discount field automatically.
    If i first entered R 100 000 then changed the amount to R 15 000 the system enters a discount of 85%.
    Can anyone please explain this to me.
    Thanks
    Bongani

    Hi Gordon
    Issue solved the user was entering the amount in the total column not in the unit price column.
    Thanks
    Bongani

  • Purpose of Cash Discount field in Material Master

    what is the purpose of Cash Discount field in Material Master. what does it control. do it link to SKTO anywhere?
    please explain

    Hi,
    Cash discount is applicable for this material or not..
    This is for Sales only..
    Pricing Procedure (RVAA01) and if you activate SKTV and SKTO Condition types
    Cash Discount can calculate before tax or after tax
    Condition Type- SKTV(Statistical Condition Type)---If you check requirement is "14" which says Discount before Tax( This will calculate from the Filed Material master "Cash Discount Indicator" ie "SKTOF"
    Condition Type-SKTO-(Statistical Condition Type)--
    >Requirement "9" Discount After tax - here also it will consider filed "SKTOF" ie "Cash discount indicator in material master.
    SAM

  • Discount Field on PO

    Hi all,
    We would like to use the discount field on the PO screen (at the bottom) and have that amount reflected in the Discounts Earned account per the GL account determination that we setup under PO-> General-> cash Discounts.  I entered in a PO with a discount and copied through to the invoice and made a payment, however, the discounted amount did not get debited from the Discounts earned account.
    Can anyone help please? Did I set something up incorrectly?
    thanks,
    jane

    Hi Jane,
    Only a cash discount given at the payment stage will be reflected in the accounting.
    Any discount given before that will not be reflected in teh accounting.
    Hope it helps,
    Jesper

  • Discount field not permitted

    Hi Experts,
          A message "Value in "Discount %" field is greater than permitted" will appear when adding an A/P Invoice transaction. How do I permit the user so he can proceed with his transaction?

    Hi,
    Go to Administration> System Initialization> Authorization--> Select user (On left Hand side)
    Check if max discount has some value entered. If yes, update it to 100% (if required), update and then check.
    Also, check in Business partner> Payment term tab> Total Discount to see if any discount % is entered. If yes, update the same and check.
    Thnks,
    Joseph

  • Customer wants to see Discount Field and Quantity field in Sales order Form

    Hi Gurus,
    Highly appreciate if you provide the solution for below issue:
    My customer requirement is to see Discount field in sales order lines screen...They want to know how much percentage of discount they are giving to customer, if they want to modify for respective line they modify in that field.
    Standard functionality discount field is NOT there in SO lines for because they manual enter discount in SO form, system should calculate Discounted price.
    One more required if they enter Item code, able to see available quantity bottom of the form Sub inventory wise, Availability, resealable.
    Current standard functionality supports - Click Availability button to check the availability..Its very difficult for them to check for each and every line item, is there any functionality to support this issue.
    Thanks
    Satti

    Hi,
    Both of your requirements should be customised.
    There is no standard functionality which attains your requirements.
    For my present project, we have customised 2 seperate reports, one which shows the availability of the items in subinventory and locator.
    Also a report which shows discount for all the lines and for the entire order.
    Thanks
    -Arif.

  • Not allowing totaling of a field in alv output

    hi,
    I had made a ALV in which i have to hide 1 field for getting it totaling.
    i.e. if somebody try to make total of it ,it should not be allowed on dat field . is dere any solution for this problem?
    plzz provide me guidelines for it.

    Please please it this. I made the total for every field other than RACCT and SUM_COMM.
    *&      Form  sub_prepare_display_output
          Display output
    -->  No Parameter
    FORM sub_prepare_display_output .
    Local variables
      DATA: l_lead_col   TYPE char25,       " Lead column
            l_progname   TYPE sy-repid,     " Program name
    Local internal tables
            l_oref_layout TYPE REF TO cl_salv_layout, "Layout
    Local work area
            l_wa_key      TYPE salv_s_layout_key,     "Work area for key
            l_except1   TYPE REF TO cx_salv_msg,"Exception
            l_text1     TYPE string.            "Exception msg
    If profit center is checked
      IF p_prfctr = c_check.
        l_lead_col = 'Profit Center'(041).
    If product catagory is checked
      ELSEIF p_prodc = c_check.
        l_lead_col = 'Product Category'(042).
    If material is checked
      ELSEIF p_smatnr = c_check.
        l_lead_col = 'Material No.'(043).
      ENDIF.
    Create ALV instance with class-method cl_salv_table=>factory
      TRY.
          CALL METHOD cl_salv_table=>factory
            EXPORTING
              list_display = if_salv_c_bool_sap=>false
            IMPORTING
              r_salv_table = v_oref_table
            CHANGING
              t_table      = i_final.
        CATCH cx_salv_msg INTO l_except1.
          l_text1 = l_except1->get_text( ).
          MESSAGE i000 WITH l_text1.
          LEAVE LIST-PROCESSING.
      ENDTRY.
    Make header of the report
      PERFORM sub_header_report USING v_oref_table.
    Get the toolbar
      v_oref_functions = v_oref_table->get_functions( ).
    For activating application toolbar
      v_oref_functions->set_all( abap_true ).
      v_oref_columns = v_oref_table->get_columns( ).
    It populate the key fields which are always displayed
      PERFORM sub_fill_fields_of_fcatalog USING:
    'SUM_COMM'        l_lead_col                ' ',
    'RACCT'          'Account Number'(035)      ' ',
    'FOBAC'          'FOB Acrual'(023)          'X',
    'EXCESS'         'Excess'(024)              'X',
    'OBSOLE'         'Obsolescence'(025)        'X',
    'PPV'            'Puchachse Price Var'(026) 'X',
    'FR_VAR'         'Freight Variance'(027)    'X',
    'PROD_OR_VAR'    'Produc Ord Var'(028)      'X',
    'DEP_VAR'        'Dept. Variance'(029)      'X',
    'OTH_PROD_VAR'   'Other Prod Var'(030)      'X',
    'PR_OR_SCRP_VAR' 'Scrap Variance'(031)      'X',
    'COST_OF_ACC'    'Cost of Sales Accnt'(032) 'X',
    'INV_ACC'        'Inventory Account'(033)   'X'.
    Optimize the columns
      v_oref_columns->set_optimize( value = 'X' ).
    Setting the layout
    get the LAYOUT object
      l_oref_layout = v_oref_table->get_layout( ).
    set the layout key
      l_progname = sy-repid.
      l_wa_key-report = l_progname.
      l_oref_layout->set_key( value = l_wa_key ).
    set save restriction:
    none / only user-dependent / only user-independent
      l_oref_layout->set_save_restriction(
      value = if_salv_c_layout=>restrict_none  ).
    set: setting of default layout is allowed / isnu2019t allowed
      l_oref_layout->set_default( value = 'X' ).
    Dispaly the output
      v_oref_table->display( ).
    ENDFORM.                    " sub_prepare_display_output
    *&      Form  sub_header_report
        Create the header of the report
         -->P_v_oref_TABLE  table name
    FORM sub_header_report  USING    p_v_oref_table TYPE REF TO
                                               cl_salv_table .
      DATA : l_oref_grid TYPE REF TO cl_salv_form_layout_grid.
      CREATE OBJECT l_oref_grid.
    Add  text items for top of page
      l_oref_grid->create_text( row = 1  column = 1  text = 'Program'(022)
      l_oref_grid->create_text( row = 1  column = 2  text = sy-repid  ).
      l_oref_grid->create_text( row = 2  column = 1
      text = 'User Name'(021) ).
      l_oref_grid->create_text( row = 2  column = 2  text = sy-uname  ).
      l_oref_grid->create_text( row = 3  column = 1  text = 'Date'(020) ).
      l_oref_grid->create_text( row = 3  column = 2  text = sy-datum ).
      l_oref_grid->create_text( row = 3  column = 3  text = 'Time'(019)  ).
      l_oref_grid->create_text( row = 3  column = 4  text = sy-uzeit  ).
      l_oref_grid->create_text( row = 4  column = 1  text = 'System'(018) ).
      l_oref_grid->create_text( row = 4  column = 2  text = sy-sysid ).
      l_oref_grid->create_text( row = 4  column = 3  text = 'Client'(017) ).
      l_oref_grid->create_text( row = 4  column = 4  text = sy-mandt ).
    Declare grid as header of list
      p_v_oref_table->set_top_of_list( value = l_oref_grid ).
    ENDFORM.                    " sub_header_report
    *&      Form  sub_fill_fields_of_fcatalog
          This subroutine populates the field catalog excluding
          period fields
         -->P_FIELDNAME Table field name
         -->P_NAME      Field description
         -->P_DEC       Decimal value flag
    FORM sub_fill_fields_of_fcatalog  USING p_fieldname TYPE lvc_fname
                                            p_name      TYPE c
                                            p_dec       TYPE c.
      DATA: l_char_l TYPE scrtext_l,  "For short text
            l_char_m TYPE scrtext_m,  "For medium text
            l_char_s TYPE scrtext_s,  "For long text
            l_except1   TYPE REF TO cx_salv_not_found,"Exception
            l_text1     TYPE string,            "Exception msg
            l_orf_aggregs TYPE REF TO cl_salv_aggregations.
    Getting the text long/short/medium into variables
      l_char_l = p_name.
      l_char_m = p_name.
      l_char_s = p_name.
    Setting the long/short/medium text and fix the key fileds
      TRY.
          CALL METHOD v_oref_columns->get_column
            EXPORTING
              columnname = p_fieldname
            RECEIVING
              value      = v_oref_column1.
        CATCH cx_salv_not_found INTO l_except1.
          l_text1 = l_except1->get_text( ).
          MESSAGE i000 WITH l_text1.
          LEAVE LIST-PROCESSING.
      ENDTRY.
      v_oref_column ?= v_oref_column1.
      v_oref_column->set_long_text( l_char_l ).
      v_oref_column->set_medium_text( l_char_m ).
      v_oref_column->set_short_text( l_char_s ).
      v_oref_column->set_key( value = 'X' ).
      v_oref_columns->set_key_fixation( value = 'X' ).
    Set the decimal length
      IF p_dec = 'X'.
        v_oref_column->set_decimals( value = '2' ).
      ENDIF.
      IF p_fieldname = 'RACCT' AND p_gl <> c_check.
        v_oref_column->set_visible( value = space ).
      ENDIF.
      IF p_gl = c_check.
        v_oref_columns->set_column_position( columnname = 'RACCT'
                                               position = 2 ).
      ENDIF.
      IF p_fieldname NE 'RACCT' AND p_fieldname NE 'SUM_COMM'.
        l_orf_aggregs = v_oref_table->get_aggregations( ).
        l_orf_aggregs->add_aggregation( columnname = p_fieldname
                       aggregation = if_salv_c_aggregation=>total ).
      ENDIF.
    ENDFORM.                    " sub_fill_fields_of_fcatalog

  • Alv subtotals  and grand total for a field

    Hi friends,
    I Have an internal table ITAB1
    in that i have a senario as below.
    In my GRID display iam getting values in the layou as follows
    BUKRS =  1000
    LIFNR      MATNR     STCST
    100          abc            500,00
    100          pqr             400,00
    100          xyz            200,00
                        sub total
    200         pto              700,00
    200         vbr              900,00
                        sub total
    BUKRS =  2000
    LIFNR      MATNR     STCST
    150          abc            500,00
    150          pqr             400,00
    150          xyz            200,00
                        sub total
    260         pto              700,00
    260         vbr              900,00
                        sub total
              GRAND TOTAL = 
    Now my requirement is at the end of every vendor  i need sub total for STCST field.
    and at the end of every company code i need GRAND TOTAL for STCST field.
    Its alv grid display.
    how can i do that.
    Regards,
    Priyanka.

    Check this sample code may it will help u:
    *& Report  Z_ALV_SUBTOTAL
    REPORT z_alv_subtotal.
    *& Table declaration
    TABLES: ekko.
    *& Type pool declaration
    TYPE-POOLS: slis. " Type pool for ALV
    *& Selection screen
    SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
    *& Type declaration
    * Type declaration for internal table to store EKPO data
    TYPES: BEGIN OF x_data,
           ebeln  TYPE char30,  " Document no.
           ebelp  TYPE ebelp,   " Item no
           matnr  TYPE matnr,   " Material no
           matnr1 TYPE matnr,   " Material no
           werks  TYPE werks_d, " Plant
           werks1 TYPE werks_d, " Plant
           ntgew  TYPE entge,   " Net weight
           gewe   TYPE egewe,   " Unit of weight                          
           END OF x_data.
    *& Internal table declaration
    DATA:
    * Internal table to store EKPO data
      i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
    * Internal table for storing field catalog information
      i_fieldcat TYPE slis_t_fieldcat_alv,
    * Internal table for Top of Page info. in ALV Display
      i_alv_top_of_page TYPE slis_t_listheader,
    * Internal table for ALV Display events
      i_events TYPE slis_t_event,
    * Internal table for storing ALV sort information
      i_sort TYPE  slis_t_sortinfo_alv,
      i_event TYPE slis_t_event.
    *& Work area declaration
    DATA:
      wa_ekko TYPE x_data,
      wa_layout     TYPE slis_layout_alv,
      wa_events         TYPE slis_alv_event,
      wa_sort TYPE slis_sortinfo_alv.
    *& Constant declaration
    CONSTANTS:
       c_header   TYPE char1
                  VALUE 'H',                    "Header in ALV
       c_item     TYPE char1
                  VALUE 'S'.
    *& Start-of-selection event
    START-OF-SELECTION.
    * Select data from ekpo
      SELECT ebeln " Doc no
             ebelp " Item
             matnr " Material*
             matnr " Material*
             werks " Plant*
             werks " Plant*
             ntgew " Quantity
             gewei " Unit
             FROM ekpo
             INTO TABLE i_ekpo
             WHERE ebeln IN s_ebeln
             AND ntgew NE '0.00'.
      IF sy-subrc = 0.
        SORT i_ekpo BY ebeln ebelp matnr .
      ENDIF.
    * To build the Page header
      PERFORM sub_build_header.
    * To prepare field catalog
      PERFORM sub_field_catalog.
    * Perform to populate the layout structure
      PERFORM sub_populate_layout.
    * Perform to populate the sort table.
      PERFORM sub_populate_sort.
    * Perform to populate ALV event
      PERFORM sub_get_event.
    END-OF-SELECTION.
    * Perform to display ALV report
      PERFORM sub_alv_report_display.
    *&      Form  sub_build_header
    *       To build the header
    *       No Parameter
    FORM sub_build_header .
    * Local data declaration
      DATA: l_system     TYPE char10 ,          "System id
            l_r_line     TYPE slis_listheader,  "Hold list header
            l_date       TYPE char10,           "Date
            l_time       TYPE char10,           "Time
            l_success_records TYPE i,           "No of success records
            l_title(300) TYPE c.                " Title
    * Title  Display
      l_r_line-typ = c_header.               " header
      l_title = 'Test report'(001).
      l_r_line-info = l_title.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR l_r_line.
    * Run date Display
      CLEAR l_date.
      l_r_line-typ  = c_item.                " Item
      WRITE: sy-datum  TO l_date MM/DD/YYYY.
      l_r_line-key = 'Run Date :'(002).
      l_r_line-info = l_date.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR: l_r_line,
             l_date.
    ENDFORM.                    " sub_build_header
    *&      Form  sub_field_catalog
    *       Build Field Catalog
    *       No Parameter
    FORM sub_field_catalog .
    *  Build Field Catalog
      PERFORM sub_fill_alv_field_catalog USING:
         '01' '01' 'EBELN' 'I_EKPO' 'L'
         'Doc No'(003) ' ' ' ' ' ' ' ',
         '01' '02' 'EBELP' 'I_EKPO' 'L'
         'Item No'(004) 'X' 'X' ' ' ' ',
         '01' '03' 'MATNR' 'I_EKPO' 'L'
         'Material No'(005) 'X' 'X' ' ' ' ',
         '01' '03' 'MATNR1' 'I_EKPO' 'L'
         'Material No'(005) ' ' ' ' ' ' ' ',
         '01' '04' 'WERKS' 'I_EKPO' 'L'
         'Plant'(006) 'X' 'X' ' ' ' ',
         '01' '04' 'WERKS1' 'I_EKPO' 'L'
         'Plant'(006) ' ' ' ' ' ' ' ',
         '01' '05' 'NTGEW' 'I_EKPO' 'R'
         'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.
    ENDFORM.                    " sub_field_catalog
    *&     Form  sub_fill_alv_field_catalog
    *&     For building Field Catalog
    *&     p_rowpos   Row position
    *&     p_colpos   Col position
    *&     p_fldnam   Fldname
    *&     p_tabnam   Tabname
    *&     p_justif   Justification
    *&     p_seltext  Seltext
    *&     p_out      no out
    *&     p_tech     Technical field
    *&     p_qfield   Quantity field
    *&     p_qtab     Quantity table
    FORM sub_fill_alv_field_catalog  USING  p_rowpos    TYPE sycurow
                                            p_colpos    TYPE sycucol
                                            p_fldnam    TYPE fieldname
                                            p_tabnam    TYPE tabname
                                            p_justif    TYPE char1
                                            p_seltext   TYPE dd03p-scrtext_l
                                            p_out       TYPE char1
                                            p_tech      TYPE char1
                                            p_qfield    TYPE slis_fieldname
                                            p_qtab      TYPE slis_tabname.
    * Local declaration for field catalog
      DATA: wa_lfl_fcat    TYPE  slis_fieldcat_alv.
      wa_lfl_fcat-row_pos        =  p_rowpos.     "Row
      wa_lfl_fcat-col_pos        =  p_colpos.     "Column
      wa_lfl_fcat-fieldname      =  p_fldnam.     "Field Name
      wa_lfl_fcat-tabname        =  p_tabnam.     "Internal Table Name
      wa_lfl_fcat-just           =  p_justif.     "Screen Justified
      wa_lfl_fcat-seltext_l      =  p_seltext.    "Field Text
      wa_lfl_fcat-no_out         =  p_out.        "No output
      wa_lfl_fcat-tech           =  p_tech.       "Technical field
      wa_lfl_fcat-qfieldname     =  p_qfield.     "Quantity unit
      wa_lfl_fcat-qtabname       =  p_qtab .      "Quantity table
      IF p_fldnam = 'NTGEW'.
        wa_lfl_fcat-do_sum  = 'X'.
      ENDIF.
      APPEND wa_lfl_fcat TO i_fieldcat.
      CLEAR wa_lfl_fcat.
    ENDFORM.                    " sub_fill_alv_field_catalog
    *&      Form  sub_populate_layout
    *       Populate ALV layout
    *       No Parameter
    FORM sub_populate_layout .
      CLEAR wa_layout.
      wa_layout-colwidth_optimize = 'X'." Optimization of Col width
    ENDFORM.                    " sub_populate_layout
    *&      Form  sub_populate_sort
    *       Populate ALV sort table
    *       No Parameter
    FORM sub_populate_sort .
    * Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    * Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort
    *&      Form  sub_get_event
    *       Get ALV grid event and pass the form name to subtotal_text
    *       event
    *       No Parameter
    FORM sub_get_event .
      CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
    'SUBTOTAL_TEXT'.
      DATA: l_s_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 4
        IMPORTING
          et_events       = i_event
        EXCEPTIONS
          list_type_wrong = 0
          OTHERS          = 0.
    * Subtotal
      READ TABLE i_event  INTO l_s_event
                        WITH KEY name = slis_ev_subtotal_text.
      IF sy-subrc = 0.
        MOVE c_formname_subtotal_text TO l_s_event-form.
        MODIFY i_event FROM l_s_event INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " sub_get_event
    *&      Form  sub_alv_report_display
    *       For ALV Report Display
    *       No Parameter
    FORM sub_alv_report_display .
      DATA: l_repid TYPE syrepid .
      l_repid = sy-repid .
    * This function module for displaying the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    *    MESSAGE i000 WITH 'Error in ALV report display'(055).
      ENDIF.
    ENDFORM.                    " sub_alv_report_display
    *       FORM sub_alv_top_of_page
    *       Call ALV top of page
    *       No parameter
    FORM sub_alv_top_of_page.                                   "#EC CALLED
    * To write header for the ALV
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_alv_top_of_page.
    ENDFORM.                    "alv_top_of_page
    *&      Form  subtotal_text
    *       Build subtotal text
    *       P_total  Total
    *       p_subtot_text Subtotal text info
    FORM subtotal_text CHANGING
                   p_total TYPE any
                   p_subtot_text TYPE slis_subtot_text.
    * Material level sub total
      IF p_subtot_text-criteria = 'MATNR'.
        p_subtot_text-display_text_for_subtotal
        = 'Material level total'(009).
      ENDIF.
    * Plant level sub total
      IF p_subtot_text-criteria = 'WERKS'.
        p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
      ENDIF.
    ENDFORM.                    "subtotal_text
    Edited by: Joyjit Ghosh on Aug 21, 2008 5:25 PM

Maybe you are looking for