Subtotal in alv report based on the particular field value

Hi,
As per my requirement, i need to do subtotal of quntity field based on the material number field value in alv report.
Ex:  if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
<removed_by_moderator>
Regards
Nagendra

Hi,
Ex: if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
What you can do is in your output table, you will have to create an auxilary field, lets call it as material group (groupid). Now you can do a subtotal on the material group. However the logic to determine what materials belong to which group should be coded. I guess you might be having some logic for that.
So lets say that material 1 to 10 as G1 ( group 1 ) and material 11 to 20 as G2 ( group 2 )
The output of the internal table would be
Groupid  matnr ...
1  1
1  2
1  3.....and so on
2  11
2  12
2  13....upto 20.
Now in the fieldcatalog assign an 'X' to the 'dosum' parameter to the field Groupid
In the sort info do the following :
gs_sort-fieldname = 'GROUPID'.
gs_sort-spos = 1.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'. ***CRUCIAL STATEMENT****
append gs_sort to gt_sort.
Now pass all this data to the alv grid function. And you are done.
regards,
Advait

Similar Messages

  • Authorization of alv report based on plants

    I have created a new alv report for sale order statement.The problem is which can be seen in all plants
    irespective of the user.Suppose our company has 5 palnt
    Plant 1100 to 1500
    The problem is suppose a user he has only rights in a prticular plant but he can see all the palnt sale order details
    How can we authorize this particular alv report based on the plants

    Hello,
    My assumption: You have Company Code(T001-BUKRS) in the selection-screen.
    Plz check the code snippet below:
    DATA:
    IT_PLANT TYPE STANDARD TABLE OF WERKS,
    WA_PLANT LIKE LINE OF IT_PLANT.
    DATA:
    IT_R_WERKS TYPE RANGE_T_WERKS_D,
    R_WERKS TYPE RANGE_S_WERKS_D.
    SELECT BWKEY INTO TABLE IT_PLANT
    FROM T001K
    WHERE BUKRS = '1000'. "--> Here you have to use your sel. scr. parameter
    IF SY-SUBRC = 0.
      SORT IT_PLANT BY WERKS.
    ENDIF.
    LOOP AT IT_PLANT INTO WA_PLANT.
    * Check the authority for the plant
      AUTHORITY-CHECK OBJECT 'M_MSEG_WMB'
               ID 'ACTVT' FIELD '03'
               ID 'WERKS' FIELD WA_PLANT-WERKS.
      IF SY-SUBRC = 0.
        R_WERKS-SIGN = 'I'.
        R_WERKS-OPTION = 'EQ'.
        R_WERKS-LOW = WA_PLANT-WERKS.
        APPEND R_WERKS TO IT_R_WERKS.
        CLEAR R_WERKS.
      ENDIF.
    ENDLOOP.
    IF IT_R_WERKS IS NOT INITIAL.
      "Select data using the Plants for which user is authorised
    ELSE.
      "User has no authority to display any Plant data
    ENDIF.
    Hope this is of some help to you.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 18, 2009 10:18 AM

  • How to assign the Value to the Particular field-Text field

    Hi all,
    My requirement is to call the Web service with input from the ADF page.
    Steps I have done:
    1. I have created a Web service data control based on the WSDL file.
    2. Just drag and drop the Process, It is automatically created the form with the Input fields and then the Process button
    3. When I entered the values and then process button it will pass the values corretly.the web service is invoked correctly with the values entered.
    4. But when I try to assign the value from the some other field that is not working.
    I am assigning the Value to the field by go to the properties of the Particular field value =”CREATE”
    When I do like this that value is showing in the screen. But it will not pass the value to the web service.
    I think the value is only displaying in the screen. Not stored at bindings level. Kindly guide me in this.
    Thanks in Advance
    C.Karukkuvel

    If you want to have the value that is returned displayed in a field that has binding to another item and not the WS result item then the way to do this would be to override the method that is invoked with the button that calls the web service - you then take the result and assign it to the item you want.
    See the way it is done here:
    http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html
    While this sample uses a simple method it would be basically the same for a Web service.

  • How to find out the total, subtotal in alv report

    hi dears,
    how to find out the total, subtotal in alv report?
    pls tell me logic ,
    i will be waiting for eply
    regards
    eswar

    Hi,
    <b>ALV Grid List with sub-totals</b>
    REPORT z_demo_alv_sort.
    * This program lists orders (VBAK) with sort and sub-total for        *
    * 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG)            *
    TABLES : vbak.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    DATA:
      BEGIN OF gt_vbak OCCURS 0,
        vkorg LIKE vbak-vkorg,             " Sales organization
        kunnr LIKE vbak-kunnr,             " Sold-to party
        vbeln LIKE vbak-vbeln,             " Sales document
        netwr LIKE vbak-netwr,             " Net Value of the Sales Order
        waerk LIKE vbak-waerk,             " Document currency
      END OF gt_vbak.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
    *      Form  f_read_data
    FORM f_read_data.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
               FROM vbak
                 UP TO p_max ROWS
              WHERE kunnr IN s_kunnr
                AND vbeln IN s_vbeln
                AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
    *      Form  f_display_data
    FORM f_display_data.
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA
    ***************** END OF PROGRAM Z_DEMO_ALV_SORT **********************
    Regards
    Sudheer

  • How to find total report based on a particular subject area in OBIEE?

    Hi Everyone,
    I am new to OBIEE. I want to find out all the reports based on a particular subject area as there are many subject areas and lot of reports in OBIEE.
    Please help me out in this issue.
    Thanks
    Regards
    Sohail Dayer

    Sohail,
    Check out the catalogue manager reports :
    http://oraclebizint.wordpress.com/2007/11/19/oracle-bi-ee-catalog-reports/
    If you want this kind of thing automated, I personally am very fond of the ODI -> OBIEE Data lineage solution as provided in Oracle By Example tutorials :
    http://www.oracle.com/technology/obe/fusion_middleware/odi/OBI-ODI_Lineage/OBI-ODI_Lineage.htm

  • SUBTOTAL  IN  ALV   REPORT

    hello freinds,
    I am facing problem of subtotal in alv report.
    I am explaining my problem.....................
    In my report there are 8 columns...
    in first colum there is <b>'Acount Number'</b> field. I have to sort out it.and I have done it succesfully. Now in my seventh and eighth column there are fields 'PAYMENT GROSS AMOUNT' and ' IVA AMOUNT' respectively.
    Now I have to do subtotal of these two columns (7th & 8th) according to first column value i.e Acount Number.
    Please send me solution.
    Thanks in Advance........

    Hi,
    try this code ,hope usefull to u, please reward point if usefull to u.
    *& Report  ZALV_SUBTOTAL
    This program lists orders (VBAK) with sort and sub-total for        *
    'sold-to-party' (KUNNR) and 'Sales organization' (VKORG)            *
    REPORT  ZALV_SUBTOTAL.
    TABLES : vbak.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    DATA:
      BEGIN OF gt_vbak OCCURS 0,
        vkorg LIKE vbak-vkorg,             " Sales organization
        kunnr LIKE vbak-kunnr,             " Sold-to party
        vbeln LIKE vbak-vbeln,             " Sales document
        netwr LIKE vbak-netwr,             " Net Value of the Sales Order
        waerk LIKE vbak-waerk,             " Document currency
      END OF gt_vbak.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
         Form  f_read_data
    FORM f_read_data.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
               FROM vbak
                 UP TO p_max ROWS
              WHERE kunnr IN s_kunnr
                AND vbeln IN s_vbeln
                AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
         Form  f_display_data
    FORM f_display_data.
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA
    END OF PROGRAM Z_DEMO_ALV_SORT **********************
    Regards
    fareedas

  • Creating a simple ALV report based on join condition

    Dear All
    SAP Version: ECC6 EHP7
    I wan to create simple ALV report based on join condition. can anyone provide me the complete steps to create this report.
    Regards,

    Hi Syed,
    Please check the link,
    ALV report - Joining 2 tables
    Regards,
    Prakash.

  • Hide grand total field on ALV report, But keep the sub total fields

    Dear Experts,
    1) How to hide grand total field on ALV report, But keep the sub total fields.
    2) How to populate rate per ton & calculate total price according to the qty in delivering document.

    Dear Experts,
    1) How to hide grand total field on ALV report, But keep the sub total fields.
    2) How to populate rate per ton & calculate total price according to the qty in delivering document.

  • How to create a report based on the selection of a node of a tree

    Hello,
    I am new to Oracle Apex and I was trying to build a tree and also an interactive report based on the empno column of the emp table.
    I have created a tree based on emp table. Now I want to display records of the employee selected in the tree.
    Here is the tree query:
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "ENAME" as title,
    null as icon,
    "EMPNO" as value,
    null as tooltip,
    null as link
    from "#OWNER#"."EMP"
    start with "MGR" is null
    connect by prior "EMPNO" = "MGR"
    order siblings by "ENAME"
    Can anyone tell me step by step how to go from here?
    I tried to follow the thread Re: tree question but could not understand much from it.

    The approach for reloading the page and displaying the report is quite simple.
    <li>You start by creating a new page item which would be used to store the selected node ID , eg. P100_SELECTED_NODE (you can make it atext item and change it hidden once everything works as expected)
    <li>Modify the tree query and change the link column in the tree definition SQL query to a link to the same
    for example if your page is 100 , you would make the tree node link to the same page but set the P100SELECTED_NODE with selected node's id_
    This done here
    {message:id=4410987}
    In this case it would be
    'f?p=&APP_ID.:100:'||:APP_SESSION||'::::P100_SELECTED_NODE:'||EMPNO as link Now when you click on a tree node link , it would come back to the same page, but set the P100_SELECTED_NODE with the empno of the clicked node.
    <li> All that is left to do, is changing your Report so that it refers to the new item inorder to filter the records for this employee i.e empno
    SELECT ...
    WHERE empno= :P100_SELECTED_NODE

  • Is there a way to hide some reports based on the selected values in prompt.

    Hi Experts,
    Is there a way to hide some reports based on the selected values in prompt.
    For ex. if a year is selected in the prompt then the report should display year wise report.
    If a year and half year both are selected in the drop down from prompt section then 2 reports should come.. One for year wise and another for half year wise.Kindly look into this.
    Regards
    Ashish

    Hi,
    Use presentation values in prompts for year,half,qtr and month.Example- For year-y is presentation variable in the same way for halfyear-h,qtr-q and month-m.
    create four intermediate reports.Example-Report r1 with only year column,r2 with only halfyear column,r3 with qtr column and r4 with month column.
    Make column in each report(r1,r2,r3,r4) is equal to their presentation variables(y,h,q,m).
    Use four sections.
    Section1-Place report that should come when only year.
    section2-Place report that should come for year and halfyear.
    Section3-Place report that should come for year,halfyear and qtr.
    Section4-Place report that should come for year,halfyear,qtr and month.
    Apply guided navigation for each section selecting guided navigation-
    For section1-
    properties->Guided navigation->check this Reference Source Request(Yes)->select report r1(year)->check this Show Section(if request returns row)
    In the same way do for remaining section2(select r2),section3(select r3) and section4(select r4)
    Thanks,
    Srikanth
    http://bintelligencegroup.wordpress.com/

  • ALV Report to display the status of the requests raised through ESS

    Hi All,
    We have to develop a ALV report to display the status of the requests raised through ESS
    for Leave, Travel & Event Management, Travel and Appraisal workflows.
    ESS Travel, ESS TEM, ESS Apraisal workflows are associted with SAP Business Objects.
    we are using the function module SWI_WORKITEMS_OF_OBJTYPE_GET to get
    the top level work item id's by passing the object type like PDRELA_025, BUS2089.
    By using SWP_WORKFLOW_LOG_READ function we are getting the workflow log
    by passing top level work item id's as imort parameter. 
    The report output should have the following fields
    Initiator, Initiator Personal No, Request Type( Leave, Travel etc.. )
    Date of application of the request, Status ( Approved by RM, Rejected etc )
    Name of the Approver, Approved / Rejected Date.
    The logic should be work for all the above ESS workflows and should be generalized.
    Can any one please let me know the procedure to get the required information from the workflow log.
    It would be great if any one suggest on the same how to proceed further to get the information as mentioned above.
    Thanks & Regards,
    Jagadeeswara Rao Balla.

    Hello,
    You can get most of that information from fm SAP_WAPI_GET_HEADER, input is workitem_id.
    regards
    Rick Bakker
    Hanabi Technology

  • Is it possible to suppress the Page Header of the Main Report based on the Section Name?

    Hi,
    I am fairly new to Crystal Reports XI.  Is it possible to suppress the Page Header of the Main Report based on the Section Name?  Thanks.

    In the section expert you can enter a formula on the suppress function.
    You just need something to check against if it is section name you say
    {section name} ="Suppressme"
    I have used it more in drill level to display headers based on how far you have drilled into a report.
    Hope this helps
    Eric
    Via Christi Health System

  • Need Report based on "CUSTOM DATA field @ Shop Order Maintenance"

    Need the REPORT based on CUSTOM DATA field.
    Requirement - I am having the CUSTOM data at Shop Order Maintenance that is called as XXX, I need some report in SAP ME which can display the SFC related to particular Shop order based on XXX Number.

    Hi!
    As far as I remember there is no such base report. So, you may try to create it using SDK or request it as custom enhancement from SAP.
    If you want to create it using SDK, you can find the required data for report in CUSTOM_FIELDS table.
    Regards,
    Alex.

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • How to separate the Particular field in next line ?

    Hi,
    i have multipule fields in one line but i want to separate the Particular field in next line how to do this ?
    when i am downloading  my output downloaded like this
    but i want to last field should be newline.
    present output:
    901  ab  3455  5667 2123  item1 100
    902  ab  3455  5667 2123  item2 100
    903  ab  3455  5667 2123  item3 100
    in that i am taken item1 100 as string i want to new line from item1
    but i want like this
    experted output:
    901  ab  3455  5667 2123 
    item1 100
    902  ab  3455  5667 2123 
    item2 100
    903  ab  3455  5667 2123 
    item3 100
    plz any code for above example.
    thanks & regards
          sai
    Edited by: k sai ram on Jan 9, 2008 5:26 PM

    Hi Sai,
                make the layout of your root container as matrix layout
    then make item1 as matrix head data.
    inset one transparent ui just after first 100. then make this transparent ui as matrix head data.
    then make 902 as matrix head data
    inset one transparent ui just after second 100. then make this transparent ui as matrix head data.
    repeat the same for next set too.
    You can also do the same with row layout for root element.
    Regards
    Sarath
    Edited by: Sarath Satheesan on Jan 9, 2008 11:17 AM

Maybe you are looking for