Need help in getting subtotal in ALV

Hi Experts
I've done subtotal in ALV. I'm getting below output. But i want net value subtotal should come by adding to its previous subtotal.
Ex :   4969      02.01.1997     CURA         5.500
         4970      03.01.1997     CURA        38.338  (32.838 + 5.500)
My code :
type-pools slis.
data : BEGIN OF ty_vbak OCCURS 0,
          VBELN like vbak-vbeln,
          erdat like vbak-erdat,
          ernam like vbak-ernam,
          netwr like vbak-netwr,
          END OF ty_vbak.
DATA : it_fcat type SLIS_T_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV,
            IT_SORT TYPE SLIS_T_SORTINFO_ALV,
            WA_SORT TYPE SLIS_SORTINFO_ALV,
            G_VBELN TYPE VBAK-VBELN.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
     I_PROGRAM_NAME         = SY-REPID
     I_INTERNAL_TABNAME     = 'TY_VBAK'
*    I_STRUCTURE_NAME       =
*   I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME             = SY-REPID
*   I_BYPASSING_BUFFER     =
*   I_BUFFER_ACTIVE        =
   CHANGING
     CT_FIELDCAT            = it_fcat.
SELECT-OPTIONS S_VBELN FOR G_VBELN.
SELECT VBELN ERDAT ernam NETWR
   FROM VBAK INTO TABLE ty_vbak WHERE VBELN IN S_VBELN.
*  WA_FCAT-FIELDNAME = 'VBELN'.
*  WA_FCAT-SELTEXT_M = 'Sales Document'.
*  WA_FCAT-OUTPUTLEN = 20.
*  APPEND WA_FCAT TO IT_FCAT.
*  WA_FCAT-FIELDNAME = 'ERDAT'.
*  WA_FCAT-SELTEXT_M = 'DATE'.
*  APPEND WA_FCAT TO IT_FCAT.
*  WA_FCAT-FIELDNAME = 'NETWR'.
*  WA_FCAT-SELTEXT_M = 'NET PRICE'.
*  WA_FCAT-DO_SUM = 'X'.
*  WA_FCAT-OUTPUTLEN = 40.
*  APPEND WA_FCAT TO IT_FCAT.
*  CLEAR WA_FCAT.
READ TABLE IT_FCAT INTO WA_FCAT WITH KEY FIELDNAME = 'NETWR'.
WA_SORT-FIELDNAME = 'ERDAT'.
WA_SORT-UP        = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
WA_FCAT-FIELDNAME = ' '.
WA_FCAT-DO_SUM = 'X'.
MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING
       DO_SUM KEY WHERE FIELDNAME = 'NETWR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
     IT_FIELDCAT                       = IT_FCAT
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
      IT_SORT                           = IT_SORT
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
   TABLES
     T_OUTTAB                          = ty_vbak
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

Hi,
Please try the below Sample code once.
TYPE-POOLS : SLIS.
types : begin of ty_final,
         vbeln type vbak-vbeln,
         posnr type vbap-posnr,
         ernam type vbak-ernam,
         erdat type vbak-erdat,
         netwr type vbak-netwr,
         COL(4)      TYPE   C,
        end of ty_final.
data : lt_vbak type table of vbak,
       lt_vbap type table of vbap,
       wa_vbap type vbap,
       wa_vbak type vbak,
       lt_final type table of ty_final,
       wa_final type ty_final,
       LT_FIELDCAT    TYPE            SLIS_T_FIELDCAT_ALV,
       WA_LAYOUT      TYPE            SLIS_LAYOUT_ALV,
       WA_FIELDCAT    TYPE            SLIS_FIELDCAT_ALV,
       L_NETWR TYPE VBAK-NETWR,
       INDEX TYPE SY-INDEX.
   select * from vbak into table lt_vbak up to 100 rows.
if lt_vbap is not initial.
   select * from vbap into table lt_vbap for all entries in lt_vbak where vbeln = lt_vbak-vbeln.
endif.
    LOOP AT LT_VBAP INTO WA_VBAP.
    INDEX = INDEX  + 1.
    READ TABLE LT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.
      WA_FINAL-VBELN = WA_VBAK-VBELN.
      WA_FINAL-POSNR = WA_VBAP-POSNR .
      WA_FINAL-ERNAM = WA_VBAK-ERNAM.
      WA_FINAL-ERDAT = WA_VBAK-ERDAT.
      WA_FINAL-NETWR = WA_VBAP-NETWR.
      APPEND WA_FINAL TO LT_FINAL.
    L_NETWR = L_NETWR + WA_FINAL-NETWR.
    AT END OF VBELN.
      WA_FINAL-VBELN = ' '.
      WA_FINAL-POSNR = ' ' .
      WA_FINAL-ERNAM = 'Sub Total'.
      WA_FINAL-ERDAT = ' '.
      WA_FINAL-NETWR = L_NETWR.
      WA_FINAL-COL   = 'C310'.
      INDEX = INDEX  + 1.
      INSERT WA_FINAL INTO LT_FINAL INDEX INDEX.
      CLEAR : WA_FINAL, WA_VBAK, WA_VBAP.
    ENDAT.
  ENDLOOP.
*Build fieldcat
    PERFORM BUILDFIELDCAT USING : '1'  'VBELN'   'LT_FINAL' 'VBELN' ,
                                  '2'  'POSNR'   'LT_FINAL' 'POSNR' ,
                                  '3'  'ERNAM'   'LT_FINAL' 'ERNAM' ,
                                  '4'  'ERDAT'   'LT_FINAL' 'ERDAT' ,
                                  '5'  'NETWR'   'LT_FINAL' 'NETWR'.
* Layout Design
  WA_LAYOUT-ZEBRA             = 'X'.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  WA_LAYOUT-INFO_FIELDNAME  =  'COL'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = SY-CPROG
      I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
      I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
      IS_LAYOUT                = WA_LAYOUT
      IT_FIELDCAT              = LT_FIELDCAT
      I_SAVE                   = 'A'
    TABLES
      T_OUTTAB                 = LT_FINAL.
*&      Form  BUILDFIELDCAT
FORM BUILDFIELDCAT  USING    P_COL_POS
                             P_FIELDNAME
                             P_REF_TAB
                             P_SEL_TXT.          "#EC *
  WA_FIELDCAT-COL_POS       = P_COL_POS.
  WA_FIELDCAT-FIELDNAME     = P_FIELDNAME.
  WA_FIELDCAT-SELTEXT_L     = P_SEL_TXT .
  APPEND WA_FIELDCAT TO LT_FIELDCAT.
  CLEAR  WA_FIELDCAT.
ENDFORM.                    " BUILDFIELDCAT
Regards,
Srikanth

Similar Messages

  • Hi need help on getting customer open  items

    hi all,
    i need help regarding getting open items for customers in the previous
    ie. if i give current date,
    i want to get the open items for past 30 days from current date
    help me to get this ...
    thanks a lot
    regards,
    selvi

    or else ,
    use table BSID.
    Regards
    Peram

  • I need help in getting my Iphone 3gs unfrozen

    Need help in getting my Iphone 3gs unfrozen. The apple logo is shown yet it will not restart. Suggestions?

    Hi,
    Try here >  iPhone and iPod touch: Frozen and unresponsive

  • I need help in getting my software options in CS5 Photoshop Student version. We have registered the product but don't have print preview or Adjust Auto Levels for example?

    I need help in getting my software options in CS5 Photoshop Student version. We have registered the product but don't have print preview or Adjust Auto Levels for example?

    <moved from Downloading, Installing, Setting Up to Photoshop General Discussion>

  • I need help in getting my reponses

    I need help in getting my responses back, or I am sending out the form wrong and people aren't getting it. Either way I need help, as I am getting very frustrated.  Thanks Dori

    <moved from Downloading, Installing, Setting Up to Photoshop General Discussion>

  • Sign in told my firefox out of date did try to do upgrade but could not need help to get my sign in workin email

    sign in told my firefox is out of date. did try to do the upgrade but could not do
    need help to get my sign in working

    Kathleen Beal/funstarling please respond in https://support.mozilla.org/en-US/questions/982953

  • I changed my password i forgot what it is need help to get back in

    i need help i changed my passwordand i forgot it now i need help to get back in it keeps saying disabled?? help me plz

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                          
    If recovery mode does not work try DFU mode.                         
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings         
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Need help in getting 'RoleApprover' and 'Manager of RoleApprover'

    We are developing a Custom Role Approval Process using SOA composite.
    A manager or a delegated admin will be raising a Role Approval request for a beneficiary. We need to assign the Approval task to beneficiaries' manager or Role Approver.
    If the RoleApprover does not Approve the task in stipulated time, the task needs to get escalated to RoleApprover's manager.
    I'm new to OIM APIs, i was folllowing the tutorial "developing_oim_custom_approval_process_for_role_request.pdf". This needs an user defined field 'RoleApprover' created in the Role request form. We cannot create user defined field in the role request form.
    I need help in getting the 'RoleApprover' and the 'Manager of RoleApprover' programmatically.
    Payload from the OIM Approval request follows:
    <ns2:process>
    <RequestID>176</RequestID>
    <RequestModel>Assign Roles</RequestModel>
    <RequestTarget>Onhand Quantity</RequestTarget>
    <RequesterDetails>
    <FirstName>Steve</FirstName>
    <LastName>Waugh</LastName>
    <Login>STEVEWAUGH</Login>
    <DisplayName>Steve Waugh</DisplayName>
    <ManagerLogin>XELSYSADM</ManagerLogin>
    <OrganizationName>Test</OrganizationName>
    <Email>[email protected]</Email>
    <Status>Active</Status>
    <XellerateType>End-User</XellerateType>
    <UserType>Full-Time</UserType>
    <Role>ALL USERS</Role>
    <Role>Primavera P6 - Global</Role>
    <Role>iProcurement Catalog Administrator</Role>
    <Role>Onhand Quantity</Role>
    <Role>Test Purchasing Super User</Role>
    <Role>Test Delegated Administrator</Role>
    <Role>HELPDESK ADMINISTRATORS</Role>
    <Role>Test e-Commerce Gateway Super User</Role>
    <Role>eBusiness Finance</Role>
    <Role>Test Line Manager</Role>
    <Role>Test_ApplicationApprover</Role>
    </RequesterDetails>
    <BeneficiaryDetails>
    <FirstName>David</FirstName>
    <LastName>Boon</LastName>
    <Login>DAVIDBOON</Login>
    <DisplayName>David Boon</DisplayName>
    <ManagerLogin>STEVEWAUGH</ManagerLogin>
    <OrganizationName>TestCO</OrganizationName>
    <Email>[email protected]</Email>
    <Status>Active</Status>
    <XellerateType>End-User</XellerateType>
    <UserType>Full-Time</UserType>
    <Role>ALL USERS</Role>
    <Role>Hyperion</Role>
    <Role>Test Purchasing Administrator</Role>
    <Role>Test Internet Expenses Audit Manager</Role>
    <Role>Test Internet Expenses Auditor</Role>
    </BeneficiaryDetails>
    <ObjectDetails>
    <name>Test Onhand Quantity</name>
    <attributes/>
    </ObjectDetails>
    <url>
    http://host:port/workflowservice/CallbackService
    </url>
    <OtherDetails/>
    </ns2:process>
    Edited by: rajesh on Feb 13, 2011 9:00 AM

    Choose Xerces2.4 to serialize the DOM object is an option.
    javac XercesTest.java -classpath xmlParserAPIs.jar;xercesImpl.jar;.
    java -classpath xmlParserAPIs.jar;xercesImpl.jar;. XercesTest test.xml
    below is the source file: XercesTest.java
    //JAXP
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    //APACHE SERIALIZE FUNCTION
    import org.apache.xml.serialize.*;
    class XercesTest
    public static void main(String[] args) throws Exception
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse( new File( args[0] ) );
    File f = new File( "copy_of_"+ args[0] );
    OutputFormat format = new OutputFormat("xml","UTF-8",true ) ;
    FileOutputStream fout = new FileOutputStream( f );
    XMLSerializer ser = new XMLSerializer(fout, format );
    ser.serialize( doc );
    maybe it's helpful
    land

  • The basic sliders disappeared. Including the Exposure, Contrast, Highlights, Shadows, Whites, Blacks, Clarity and Vibrance Sliders are no longer available. I need help to get them back

    The basic sliders disappeared. Including the Exposure, Contrast, Highlights, Shadows, Whites, Blacks, Clarity and Vibrance Sliders are no longer available. I need help to get them back on the program. 
    I can't figure out where the sliders went and how to put them back on. Anyone have any suggestions?
    Thanks

    In Lightroom, go to the Window menu, select Panels, select Basic

  • TS1363 i need help to get out of recovery mode

    i need help to get out of recovery mode

    To get the phone out of recovery mode you will need to connect it to a computer with iTunes installed on it and restore it.

  • My mom and I both have iphone5 but when I send her messages they aren't blue but any other iphone I text is blue I need help to get that fixed

    My mom and I both have iphone5 but when I send her messages they aren't blue but any other iphone I text is blue I need help to get that fixed

    Both of you need to have iMessage activated, and both have to have active Internet connection for iMessage. Are you both using the same Apple ID? Are you using the phone number or Apple ID for messages?

  • HT4199 I need help with getting my printer to print, PLEASE.

    I need help with getting my printer to print, Please.

    What have you done so far?
    I suggest you connect it via a usb  cable first.  Once you get the printer working, move to wifi.  You will have to use an existing printer usb cable or purchase a cable.  Be sure to get the correct cable.  Ask for help.
    The warrenty indicates there is phone support.  Give HP a call.
    Warranty
    One-year limited hardware warranty; 24-hour, 7 days a week phone support
    Robert

  • I need help in getting VZ to fix my DSL speed - they refused to fix it two times

    I live in E. Boston and opened a trouble ticket on 8-26-13 for slow internet speed. Ticket number was {edited for privacy}Agreement was made for a tech to arrive on the 28th between 1 and 5 PM. Somebody showed at my door on the 28th at 11:15AM. He immediately said that he had already done some outside checking and there was a problem outside of my home. I showed him my slow connection speed and he left saying he would be back later. I saw him on poles around my home and he called later saying he needed help from his office and would let me know the status by 3PM or so. I never heard from him again. I continued to check the ticket status and it was open.
    On Friday, Aug. 30th, about 9:15AM, I received a call from a VZ telephone tech named Rich. He again did some outside checking and came into my home. I showed him my slow internet speed and he went back outside after telling me that he had no test equipment but he would go back outside to see what he could do and call his manager since he was not a VZ internet tech. He came back a little later and told me that he did all that he could do and asked me to run my tests again. I did so in front of the tech and the speed was at least 30% slower than it is supposed to be. The VZ telephone tech said he would call for help from his office to send a tech with proper test equipment and he left. A number of hours passed and the VZ telephone tech called and told me HIS MANAGER TOLD HIM TO CLOSE THE TICKET AND TO SEND THE MANAGER THE INFORMATION.
    I immediately asked for and got the name and office of the manager that did this and I have it. I will hold off posting it for a couple of days but then I will let everyone know how this Verizon manager performs as well as who he is. I wonder how his superiors will like that?
    Does anyone have any suggestions who in Verizon cares enough to get my problem resolved? I have already filed a complaint with the AGO today. Verizon does this to keep their numbers from being respective of what they really are as well as knowing that customers do not want to again walk through all of the crap in opening a trouble ticket in India. I have been in telecom for 45 years and this is just disgraceful. It is about time VZ developed some integrity.

    Your issue has been escalated to a Verizon agent. Before the agent can begin assisting you, they will need to collect further information from you.Please go to your profile page for the forum, and look in the middle, right at the top where you will find an area titled "My Support Cases". You can reach your profile page by clicking on your name beside your post, or at the top left of this page underneath the title of the board.
    Under “My Support Cases” you will find a link to the private board where you and the agent may exchange information. This should be checked on a frequent basis as the agent may be waiting for information from you before they can proceed with any actions. Please keep all correspondence regarding your issue in the private support portal.

  • Need help in getting UM report

    Hi Champs,
    Can any one help to get the report ?
    how to run a report against Exchange UM in order to display who has recorded a custom greeting versus those that have not done anything? 
    we need to be able to report on which users have recorded their new voicemail greeting versus those who still have the default message.
    Thanks in advance.
    Regards
    Vijendhar

    have you seen this link?
    http://www.onesimplescript.com/2012/02/auditing-exchange-um-mailbox-recordings.html
    regards Holger Technical Specialist UC

  • Need help in getting process form data

    Hi,
    We have one IT resource type definition say SSH. We have number of IT resources-abc,xyz of same type-SSH .
    When user gets provisioned to this resource, then in the resource profile, we can see resource name as SSH. In the process form of SSH we can see the IT resource name -abc,xyz
    Now the requirement is I need this IT resource name from process forom of SSH. I have written one java code which sends out an email to application owner when this SSH resource is revoked. But I need to show the IT resource name-abc,xyz in the email to application owners.
    Can anybody help to get the process form data?
    Thanks,
    Kalpana.

    yes, add new attribute to the process form and populate using adapter find below code
    public long getITResource(String itResource) {
              long returnValue = 0;
              String methodName = "getITResource";
              try {
                   tcITResourceInstanceOperationsIntf tcITResourceIntf = (tcITResourceInstanceOperationsIntf)Platform.getService(tcITResourceInstanceOperationsIntf.class);
                   HashMap<String, String> map = new HashMap<String, String>();
                   map.put("IT Resources.Name", itResource);
                   tcResultSet resultSet = tcITResourceIntf
                             .findITResourceInstances(map);
                   if (resultSet.getRowCount() <= 0) {
                        logger.error(className, methodName,
                                  "Following IT Resource not fetched:" + map);
                        throw new Exception("IT Resource not fetched");
                   resultSet.goToRow(0);
                   logger.info(className, methodName, "ITResource determined.");
                   // Got the result
                   returnValue = resultSet.getLongValue("IT Resources.Key");
                   tcITResourceIntf.close();
                   ops.closeUtilityObject();
                   return returnValue;
              } catch (Exception e) {
                   logger.error(className, methodName, e.getMessage());
                   return returnValue;
    pass itResource name as literal in adapter. If it is 10g use tcUtilityFactory instead of Platforml.getService
    --nayan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for