To get total qty delivered using ALV in a report

Hi All,
I am getting Quantity Delivered iout-lfimg in a ALV Report, in the last line I have to display total qty delivered. Can some one please help me to get this total qty delivered using ALV.
Thanks,
Veni.
FORM get_data.
  SELECT Avbeln Akunag Avsbed Awadat_ist
         Bwerks Bmatnr Blfimg Bvrkme
         C~vbeln
         INTO TABLE IDELI
         FROM LIKP AS A
         INNER JOIN LIPS AS B
                   ON avbeln = bvbeln
         INNER JOIN VBFA AS C
                   ON Bvbeln = Cvbelv
                   AND BPOSNR = CPOSNV
         WHERE A~VBELN IN S_VBELN
               AND A~ERDAT IN S_ERDAT
               AND A~ERNAM IN S_ERNAM
               AND A~VSTEL IN S_VSTEL
               AND A~VKORG IN S_VKORG
               AND A~KUNAG IN S_KUNAG
               AND A~VSBED IN S_VSBED
               AND A~WADAT_IST IN S_WADAT
               AND B~MATNR IN S_MATNR
               AND B~WERKS IN S_WERKS
               AND C~VBTYP_N = 'Q'.
ENDFORM.                    " get_data
FORM process_data.
  loop at ideli.
    if sy-subrc = 0.
concatenate ideli-vbeln ideli-ddeli into lv_wdelno.
      MOVE ideli-vbeln  TO iout-vbeln.
      MOVE lv_wdelno       TO iout-wdelno.
      MOVE ideli-kunag  TO iout-kunag.
      MOVE ideli-vsbed  TO iout-vsbed.
      MOVE ideli-wadat_ist  TO iout-wadat_ist.
      MOVE ideli-werks  TO iout-werks.
      MOVE ideli-matnr  TO iout-matnr.
      MOVE ideli-lfimg  TO iout-lfimg.
      MOVE ideli-vrkme  TO iout-vrkme.
    endif.
    append iout.
    clear iout.
    clear lv_wdelno.
  endloop.
ENDFORM.                    " process_data

Hi,
While building the fieldcatalog, for the total qty column use the below code :
gs_fieldcat-do_sum = 'X'.
Thanks,
Sriram Ponna.

Similar Messages

  • Reg: i want to get total qty of partculary month

    Hi All,
    i have developed a report
    the output fields are material,plant and qty.
    my requirment is for that material and plant what is the total qty in that month
    who to sum the qty?
    example is
    material       plant      qty
    10000023    4210       1
    10000023    4210       2
    10000023    4210       3
    But i want get like this
    material       plant      qty
    10000023    4210      6
    please can you help
    thanks
    kavi

    Try this sample code..
          Sort I_ZQMBW_FUJ_VENDQFR by MATNR PLANT
          LOOP AT I_ZQMBW_FUJ_VENDQFR INTO WA_DATA.
            AT END OF MATNR.
              LOOP AT I_ZQMBW_FUJ_VENDQFR INTO WA_DATA WHERE LIFNR = WA_DATA-MATNR.
                V_COUNT = V_COUNT + 1.
                AT END OF PLANT.
                  WA_DATA-TOTAL_QFR = V_COUNT.
                  MODIFY I_ZQMBW_FUJ_VENDQFR FROM WA_DATA  TRANSPORTING TOTAL_QFR   
                                                                    WHERE MATNR = WA_DATA-MATNR
                                                                       AND   MTH = WA_DATA-MTH.
                  CLEAR V_COUNT.
                ENDAT.
              ENDLOOP.
            ENDAT.
          ENDLOOP.
    Hope this helps...

  • How to get two header colums using alv?

    Hi,
    experts,
    I want to display alv output with two header columns like shows below:
    Subjects
    |   English       |         Maths       |     Science     |    Social   |         Politics                   |                
    100
    56
    89
    12
    85
    25
    85
    36
    78
    100
    75
    55
    65
    74
    100
    How to acheive this by using ALV Grid dispaly. please end me any document on this .
    Thanks in advance,
    Shabeer Ahmed.

    Hi,
    Please check the link given below :
    Two column header in ALV Report
    hope it will help you.
    Thanks & Regards,
    Sarita Singh Rathour

  • Getting UNCAUGHT_EXCEPTION CX_WD_CONTEXT at using alv sort function

    Dear colleagues,
    I developed a simple application which displays records in an ALV and at lead-selection shows detailed data in a form. Everthing is working fine except one is clicking on the sort functionality at the top of the ALV short dump is thrown.
    In trx ST22 I find :
    The lead selection has not been set. V_DEFAULT
    "UNCAUGHT_EXCEPTION" "CX_WD_CONTEXT"
    "CL_WDR_CONTEXT_NODE===========CP" or "CL_WDR_CONTEXT_NODE===========CM00R"
    "_RAISE_ELEMENT_NOT_FOUND"
    Lead selection is checked and also debugging the code did not bring me any further.
    Any help is greatly appreciated.
    Thanks in advance
    Michael

    Hi Regina,
    first of all thanks for your quick answer and explanation. I'm not sure what you mean with 'register to the standard functions of the ALV' because this is a functionality which works in other ALVs without register any event method to them or do you mean that in my case I have to react to the sorting in a new method in the view controller? Concerning 'refill the subnode via supply function' I'm doing this already.
    Disabling the sorting is no option anymore because the users already know and love this feature
    Regards
    Michael

  • Cannot get the details in ME2N when using ALV but can when using BEST

    Hi experts,
    Could you let me know why I am not able to get the results when using ALV as Scope of List in ME2N Transaction, but can get data when using BEST?
    Regards,
    Pri

    Hi Priya,
    Check the following :
    IMG-> Materials Management-> Purchasing-> Reporting-> Scope of List->Define Scope of List
    Here select ALV and click details.
    Check the check boxes you need.
    Cheers,
    Satish

  • Get total in ALV report

    Data : Begin of it_data,
    kunnr type kunnr,
    name1 type name1,
    amt1 type btrt01, " CURR 15,2
    end of it_data.
    loop at it_data into wa_data
    endloop.
    Hello friends,
    I am developing one ALV report with 20 rows.
    I have filled one internal table with some fileds like amount.
    I want to get total of all amount1 in AMT1 field.
    So, How to get total of amount in same internal table in ALV report ?
    It is ok if i get duplicate rows in internal table.
    note : i need not data in field catlog
    Points 'll be awarded soon.
    Regards,

    Hai,
    While Defining Field Catalog,Specify do_sum = 'X' for the field which you want the Total.Before that u have to sort that Values.
    JUST CHECK THIS SAMPLE PROG
    TABLES : STKO,STPO,MAKT,MAST.
    TYPE-POOLS : SLIS.
    DATA : BEGIN OF ISTKO OCCURS 0,
    STLNR LIKE STKO-STLNR,
    DATUV LIKE STKO-DATUV,
    MATNR LIKE MAST-MATNR,
    BMENG LIKE STKO-BMENG,
    BMEIN LIKE STKO-BMEIN,
    END OF ISTKO.
    DATA : BEGIN OF ISTPO OCCURS 0,
    STLNR LIKE STPO-STLNR,
    IDNRK LIKE STPO-IDNRK,
    MENGE LIKE STPO-MENGE,
    MEINS LIKE STPO-MEINS,
    MAKTX LIKE MAKT-MAKTX,
    END OF ISTPO.
    DATA : BEGIN OF IMAKT OCCURS 0,
    MATNR LIKE MAKT-MATNR,
    MAKTX LIKE MAKT-MAKTX,
    END OF IMAKT.
    DATA : BEGIN OF IMAST OCCURS 0,
    MATNR LIKE MAST-MATNR,
    STLNR LIKE MAST-STLNR,
    END OF IMAST.
    DATA : IFIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WFIELDCAT TYPE SLIS_FIELDCAT_ALV,
    ILAYOUT TYPE SLIS_LAYOUT_ALV,
    IKEYINFO TYPE SLIS_KEYINFO_ALV,
    IEVENT TYPE SLIS_T_EVENT,
    WEVENT TYPE SLIS_ALV_EVENT,
    ISORT TYPE SLIS_T_SORTINFO_ALV,
    WSORT TYPE SLIS_SORTINFO_ALV.
    PARAMETERS : P_NUM TYPE I DEFAULT 10.
    START-OF-SELECTION.
    PERFORM GETDATA.
    PERFORM GETHEADERMAT.
    PERFORM GET_MAT_DESC.
    PERFORM BUILD_FCAT_HEAD.
    PERFORM BUILD_FCAT_ITEM.
    PERFORM BUILD_KEYINFO.
    PERFORM BUILD_EVENT_TAB.
    PERFORM BUILD_SORT_TAB.
    PERFORM BUILD_LAYOUT.
    PERFORM DISPLAY_DATA.
    *& Form GETDATA
    text
    --> p1 text
    <-- p2 text
    FORM GETDATA .
    SELECT STLNR DATUV BMENG BMEIN INTO CORRESPONDING FIELDS OF TABLE ISTKO
    FROM STKO UP TO P_NUM ROWS.
    IF NOT ISTKO[] IS INITIAL.
    SELECT STLNR IDNRK MENGE MEINS INTO TABLE ISTPO FROM STPO FOR ALL ENTRIES IN ISTKO
    WHERE STLNR = ISTKO-STLNR AND POSTP = 'L'.
    ENDIF.
    ENDFORM. " GETDATA
    *& Form BUILD_FCAT_HEAD
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_FCAT_HEAD .
    WFIELDCAT-TABNAME = 'ISTKO'.
    WFIELDCAT-FIELDNAME = 'STLNR'.
    WFIELDCAT-SELTEXT_L = 'BOM no'.
    WFIELDCAT-OUTPUTLEN = 15.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTKO'.
    WFIELDCAT-FIELDNAME = 'DATUV'.
    WFIELDCAT-SELTEXT_L = 'BOM date'.
    WFIELDCAT-OUTPUTLEN = 15.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTKO'.
    WFIELDCAT-FIELDNAME = 'MATNR'.
    WFIELDCAT-SELTEXT_L = 'Header mat no'.
    WFIELDCAT-OUTPUTLEN = 18.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTKO'.
    WFIELDCAT-FIELDNAME = 'BMENG'.
    WFIELDCAT-SELTEXT_L = 'Base qty'.
    WFIELDCAT-OUTPUTLEN = 15.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTKO'.
    WFIELDCAT-FIELDNAME = 'BMEIN'.
    WFIELDCAT-SELTEXT_L = 'UOM'.
    WFIELDCAT-OUTPUTLEN = 3.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    ENDFORM. " BUILD_FCAT_HEAD
    *& Form BUILD_FCAT_ITEM
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_FCAT_ITEM .
    WFIELDCAT-TABNAME = 'ISTPO'.
    WFIELDCAT-FIELDNAME = 'STLNR'.
    WFIELDCAT-SELTEXT_L = 'BOM no'.
    WFIELDCAT-NO_OUT = 'X'.
    *WFIELDCAT-HOTSPOT = 'X'.
    WFIELDCAT-OUTPUTLEN = 10.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTPO'.
    WFIELDCAT-FIELDNAME = 'IDNRK'.
    WFIELDCAT-SELTEXT_L = 'Material no'.
    *WFIELDCAT-HOTSPOT = 'X'.
    WFIELDCAT-OUTPUTLEN = 18.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTPO'.
    WFIELDCAT-FIELDNAME = 'MAKTX'.
    WFIELDCAT-SELTEXT_L = 'Material desc'.
    WFIELDCAT-JUST = 'C'.
    WFIELDCAT-OUTPUTLEN = 30.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTPO'.
    WFIELDCAT-FIELDNAME = 'MENGE'.
    WFIELDCAT-SELTEXT_L = 'Item qty'.
    WFIELDCAT-OUTPUTLEN = 15.
    WFIELDCAT-DO_SUM = 'X'.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    WFIELDCAT-TABNAME = 'ISTPO'.
    WFIELDCAT-FIELDNAME = 'MEINS'.
    WFIELDCAT-SELTEXT_L = 'UOM'.
    WFIELDCAT-OUTPUTLEN = 3.
    APPEND WFIELDCAT TO IFIELDCAT.
    CLEAR WFIELDCAT.
    ENDFORM. " BUILD_FCAT_ITEM
    *& Form BUILD_KEYINFO
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_KEYINFO .
    IKEYINFO-HEADER01 = 'STLNR'.
    IKEYINFO-ITEM01 = 'STLNR'.
    ENDFORM. " BUILD_KEYINFO
    *& Form DISPLAY_DATA
    text
    --> p1 text
    <-- p2 text
    FORM DISPLAY_DATA .
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COM'
    IS_LAYOUT = ILAYOUT
    IT_FIELDCAT = IFIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT = ISORT
    IT_FILTER =
    IS_SEL_HIDE =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS = IEVENT[]
    IT_EVENT_EXIT =
    I_TABNAME_HEADER = 'ISTKO'
    I_TABNAME_ITEM = 'ISTPO'
    I_STRUCTURE_NAME_HEADER =
    I_STRUCTURE_NAME_ITEM =
    IS_KEYINFO = IKEYINFO
    IS_PRINT =
    IS_REPREP_ID =
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB_HEADER = ISTKO
    T_OUTTAB_ITEM = ISTPO
    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.
    ENDFORM. " DISPLAY_DATA
    *& Form GET_MAT_DESC
    text
    --> p1 text
    <-- p2 text
    FORM GET_MAT_DESC .
    IF NOT ISTPO[] IS INITIAL.
    SELECT MATNR MAKTX INTO TABLE IMAKT FROM MAKT FOR ALL ENTRIES IN ISTPO
    WHERE MATNR = ISTPO-IDNRK.
    ENDIF.
    LOOP AT ISTPO.
    READ TABLE IMAKT WITH KEY MATNR = ISTPO-IDNRK.
    IF SY-SUBRC = 0.
    ISTPO-MAKTX = IMAKT-MAKTX.
    ENDIF.
    MODIFY ISTPO.
    ENDLOOP.
    ENDFORM. " GET_MAT_DESC
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_LAYOUT .
    ILAYOUT-ZEBRA = 'X'.
    ILAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    ENDFORM. " BUILD_LAYOUT
    *FORM USER_COM USING PUCOM LIKE SY-UCOMM PSELFIELD TYPE SLIS_SELFIELD.
    *CASE PUCOM.
    *WHEN '&IC1'.
    SET PARAMETER ID 'MAT' FIELD PSELFIELD-VALUE.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    *ENDCASE.
    *ENDFORM.
    *& Form BUILD_EVENT_TAB
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_EVENT_TAB .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = IEVENT
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    READ TABLE IEVENT INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC = 0.
    WEVENT-FORM = 'TOPOFPAGE'.
    MODIFY IEVENT FROM WEVENT INDEX SY-TABIX.
    ENDIF.
    ENDFORM. " BUILD_EVENT_TAB
    *& Form TOPOFPAGE
    text
    FORM TOPOFPAGE.
    DATA : ILISTHEAD TYPE SLIS_T_LISTHEADER,
    WLISTHEAD TYPE SLIS_LISTHEADER.
    WLISTHEAD-INFO = 'Its a test hierarchical sequential alv dispaly'.
    WLISTHEAD-TYP = 'H'.
    APPEND WLISTHEAD TO ILISTHEAD.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = ILISTHEAD
    I_LOGO = ''
    I_END_OF_LIST_GRID =
    ENDFORM.
    *& Form GETHEADERMAT
    text
    --> p1 text
    <-- p2 text
    FORM GETHEADERMAT .
    IF NOT ISTKO[] IS INITIAL.
    SELECT MATNR STLNR INTO TABLE IMAST FROM MAST FOR ALL ENTRIES IN ISTKO
    WHERE STLNR = ISTKO-STLNR.
    ENDIF.
    LOOP AT ISTKO.
    READ TABLE IMAST WITH KEY STLNR = ISTKO-STLNR.
    IF SY-SUBRC = 0.
    ISTKO-MATNR = IMAST-MATNR.
    ENDIF.
    MODIFY ISTKO.
    ENDLOOP.
    ENDFORM. " GETHEADERMAT
    *& Form BUILD_SORT_TAB
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_SORT_TAB .
    WSORT-FIELDNAME = 'STLNR'.
    WSORT-TABNAME = 'ISTPO'.
    WSORT-UP = 'X'.
    WSORT-SUBTOT = 'X'.
    WSORT-GROUP = 'UL'.
    APPEND WSORT TO ISORT.
    ENDFORM. " BUILD_SORT_TAB

  • Sub Total Text in an ALV using FACTORY Method

    Hi Gurus,
    My requirement is simple, but I couldn't find any answers under SDN or any other forums. Some of you may ask me to check for the SCN posts, but I almost checked everything.
    My requirement is - When I get the Sub-total in my ALV, it should print a text other than the field which has got sub-total value.
    My ALV Schema:
    Field1  |  Field2 |  Field 3 |
    ____   |______ |______ |
               |             |             |
               |             |             |
              Tot. Qty  | 1000.00|
    I have sorted and added the subtotal = 'X' for the field which I need the Subtotal. Added Aggregations to Field3. But where and how to the field 'Tot. Qty', so that it should appear at the Sub-Total Level.
    Please guide me if I've missed any of the forums. Again my requirement is to print the Field Name.
    Regards,
    -Wahid Hussain Syed.

    Hi,
    You can view this thread for example Display constant text in intermediate results column of SALV as it says that this is a limitation in SALV that "The output of totals and subtotals is handled solely by ALV. You can neither pass the results to your application nor manipulate them in any way.". But you can see a work around done for this problem, to be frank that I have not done that and I am only providing this link for your reference.

  • How to get multiple header lines dynamically and also data hierarchically using ALV

    Hi experts,
    My requirement is shown below.. I neet to compare prices of service RFQs. So i design as below..
    I want to get RFQ number ,Vendor code and vendor name in ALV header and also other headings which static. I think dynamic table is the best way to load RFQ numbers to header.. But problem is i'm unable to load two lines dynamically using ALV.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
         EXPORTING
           i_style_table             = 'X'
           it_fieldcatalog           = gt_dyn_fcat
         IMPORTING
           ep_table                  = gt_dyn_table
         EXCEPTIONS
           generate_subpool_dir_full = 1
           OTHERS                    = 2.
    I use this function and pass RFQ no and vendor code in two rows but it output gt_dyn_table in same row.. How to print them as given image???
    Then in data I want to get service items and according to the external service number divide them to groups and get sub totals and also finally total of all sub categories to compare each RFQs price to  compare.. There i think ALV hierarch can use. but not sure I can use with dynamic table(in header use it).
    What is thee best way to get the output in my image..??
    Thanks..
    Pavi

    Hi experts,
    My requirement is shown below.. I neet to compare prices of service RFQs. So i design as below..
    I want to get RFQ number ,Vendor code and vendor name in ALV header and also other headings which static. I think dynamic table is the best way to load RFQ numbers to header.. But problem is i'm unable to load two lines dynamically using ALV.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
         EXPORTING
           i_style_table             = 'X'
           it_fieldcatalog           = gt_dyn_fcat
         IMPORTING
           ep_table                  = gt_dyn_table
         EXCEPTIONS
           generate_subpool_dir_full = 1
           OTHERS                    = 2.
    I use this function and pass RFQ no and vendor code in two rows but it output gt_dyn_table in same row.. How to print them as given image???
    Then in data I want to get service items and according to the external service number divide them to groups and get sub totals and also finally total of all sub categories to compare each RFQs price to  compare.. There i think ALV hierarch can use. but not sure I can use with dynamic table(in header use it).
    What is thee best way to get the output in my image..??
    Thanks..
    Pavi

  • MCBZ report how to get total stock qty calculation?

    Dear Guru,
            if i checking one material in Tcode:MMBE having unrestricted stock is 356 & reserved qty is 56. After this when i am executing report MCBZ-- Current stock reqmt list & get Total stock qty is 120 for same material.
    can any one tell me how it is calculated (i.e. Total Stock).
    My requirement is we want to see a report which shows diffrence bewtwwen satfey stock & total stock. so i am using this report, if any othere suggestion then please reply me.
    Best Regards,
    Dev

    Dear,
           You can see in MD04 t-code here u can find safety stock and inventory stock.
    Regards
    Ravi

  • Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

  • How to get total in ALV report in same Internal table?

    Data : Begin of it_data,
            kunnr type kunnr,
            name1 type name1,
            amt1  type btrt01, " CURR 15,2
           end of it_data.
    loop at it_data into wa_data
    endloop.      
    Hello friends,
    I am developing one ALV report with 20 rows.
    I have filled one internal table with some fileds like amount.
    I want to get total of all amount1 in AMT1 field.
    So, How to get total of amount in same internal table in ALV report ?
    It is ok if i get duplicate rows in internal table.
    Points 'll be awarded soon.
    Regards,
    NVM

    Hi Ronny,
    the alv output will display the sum at the last row.
    for this functionality u have do this logic.
    data: lw_fcat type slis_fieldcat_alv.
    data: lt_fcat type slis_t_fieldcat_alv/
    wa_fcat-fieldname = 'AMT1'.
    wa_fcat-tabname = 'ITAB'.
    wa_fcat-do_sum = 'X'.
    append wa_fcat to lt_fcat.
    and then pass it to reuse_alv_grid_display function,
    regards,
    Santosh Thorat

  • SSRS 2008 have 2 colums with amount needs to add Total cost and than total cost column divide by Total qty get avg

    SSRS 2008,  have this report
     Qty Column --------- Est cost column -----    Mark up Cost Column  -   Did add Total cost column
    4 pcs-                       $ 2000.00  --------------$  50.00 --------------- $ 2050.00
    Avg  Cost                                                                                      
    $2050/4=  512.50
    how to write this exp to get value $ 512.50 
    what I did , its not giving me correct result,
    =Sum(Fields!estCOSTAMOUNT.Value+Fields!COSTMARKUP.Value)/(Fields!QTY.Value)
    can some one please advise what I am doing wrong.
    thanks in advance

    I tried both exp, did not work
    may be I was not  clear in the question
    Qty Column --------- Est cost column -----    Mark up Cost Column  -   Did add Total cost column
    4 pcs-                       $ 2000.00  --------------$  50.00 --------------- $ 2050.00
    2 pcs ------------------$ 1500.00  --------------=$100.00 ----------------$1600.00
    Total   qty  6  pcs-----$ 3500.00------------------$150.00---------------$ 3650.00
    Avg  Cost                                                                                      
    $3650..00/6=  608.33
    my field name
    =Sum(Fields!COSTAMOUNT.Value)  +  want to add cost amount and Mark up and divide with qty total
    =Sum(Fields!COSTMARKUP.Value)
    =Sum(Fields!QTY.Value)
    please help how can I write it to get the result

  • Getting only one coloum in alv grid

    hi ,
         i m facing a very strange problem. in my report i m getting exect data in my final table but when i m going to show it, it is showing only first coloum. well problem is coming in field catalog merge, it is not appending the whole coloum heading except first one. i did right coding but failed to get the result.
    plz if anybody faced the same problem suggest me the solution.
    it's really urgent.
    REPORT zfir_fix_ar NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 72.
          Tables                                                        *
    TABLES : t001,anla,anlb,anlc,bsis,t095t.
    TYPE-POOL                                                           *
    TYPE-POOLS: slis.
    Internal Table Declaratin                                           *
    DATA: BEGIN OF i_anla OCCURS 0,
           bukrs TYPE anla-bukrs,
           anln1 TYPE anla-anln1,
           aktiv TYPE anla-aktiv,
           txt50 TYPE anla-txt50,
           txa50 TYPE anla-txa50,
           zugdt TYPE anla-zugdt,
           abgdt TYPE anla-abgdt,
           ktogr TYPE anla-ktogr,
           sernr TYPE anla-sernr,
           invnr TYPE anla-invnr,
           menge TYPE anla-menge,
           meins TYPE anla-meins,
           lifnr TYPE anla-lifnr,
           liefe TYPE anla-liefe,
           afabg TYPE anlb-afabg,
          END OF i_anla.
    DATA:BEGIN OF i_anlc OCCURS 0,
          bukrs TYPE anlc-bukrs,
          anln1 TYPE anlc-anln1,
          kansw TYPE anlc-kansw,
          knafa TYPE anlc-knafa,
          nafap TYPE anlc-nafap,
          answl TYPE anlc-answl,
         END OF i_anlc.
    DATA:BEGIN OF i_anlz OCCURS 0,
          bukrs TYPE anlz-bukrs,
          anln1 TYPE anlz-anln1,
          raumn TYPE anlz-raumn,
         END OF i_anlz.
    DATA: BEGIN OF i_bsis OCCURS 0.
            INCLUDE STRUCTURE bsis.
    DATA: END OF i_bsis.
    DATA: BEGIN OF i_final OCCURS 0,
            srno TYPE i,                       " Serial no
            anln1 TYPE anla-anln1,             " asset code no
            txt50 TYPE anla-txt50,             " Brief Description of Assets
            txa50 TYPE anla-txa50,             " Further Description
            ktogr TYPE anla-ktogr,             " Asset Class No.
            ktgrtx TYPE t095t-ktgrtx,          " Asset Class Name
            sernr TYPE anla-sernr,             " Serial Number
            invnr TYPE anla-invnr,             " Assets Identification No
            menge TYPE anla-menge,             " Qty
            meins TYPE anla-meins,             " UOM
            raumn TYPE anlz-raumn,             " Location
            lifnr TYPE anla-lifnr,             " Vendor
            liefe TYPE anla-liefe,             " Capitalisation Date
            aktiv TYPE anla-aktiv,             " Date put to use
            g_kansw TYPE anlc-kansw,           " Opening Gross Block
            b_kansw TYPE anlc-kansw,           " Additions during the period
            b_answl TYPE anlc-answl," Deductions/ Adjustmentsduring d period
            g_total TYPE bsis-dmbtr,           " Closing Gross Block
            d_open TYPE anlb-afabg,            " Dep on opening block
            d_sold TYPE anlb-afabg,         " Dep on assets sold/written off
            d_add  TYPE anlb-afabg,     " dep on additions during the period
            afabg TYPE anlb-afabg,             " Total dep for the period
            cd_sold TYPE bsis-dmbtr,              " *** Dep on assets sold
            cd_asst TYPE bsis-dmbtr,       " *** Dep on assets written off
            cd_dep   TYPE bsis-dmbtr,     " Total *** dep on deductions
            ccd_dep  TYPE bsis-dmbtr,             " Closing Acc Dep
            a       TYPE bsis-dmbtr,              " WDV of assets sold
            b       TYPE bsis-dmbtr,              " Selling Price
            c       TYPE bsis-dmbtr,              " Profit / (Loss) on sale
            d       TYPE bsis-dmbtr,              " Loss on write off
            e       TYPE bsis-dmbtr,              " Opening WDV
            f       TYPE bsis-dmbtr,              " Closing WDV
          END OF i_final.
    DATA : text(30).
    DATA : b_date TYPE sy-datum.
    Global variables
    DATA: g_repid LIKE sy-repid,
    g_events TYPE slis_t_event,
    g_list_top_of_page TYPE slis_t_listheader,
    g_exit_caused_by_caller,
    g_exit_caused_by_user TYPE slis_exit_by_user,
    g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
    g_save TYPE c.
    Declaration for Constants
    CONSTANTS : c_x TYPE c VALUE 'X', " Flag
    c_c TYPE c VALUE 'C', " Flag
    c_l TYPE c VALUE 'L', " Flag
    c_a TYPE c VALUE 'A', " Line Type
    c_h TYPE c VALUE 'H', " Dr/Cr
    c_s TYPE c VALUE 'S'. " Line Type
    * Internal table to hold field catgory data
    DATA: i_fldcat TYPE slis_t_fieldcat_alv. " Table - field catgory
    Internal table to hold Sort/Subtotals criteria data
    DATA: i_sort TYPE slis_t_sortinfo_alv. " Table - sort/Subtotals
    Structure
    DATA: x_layout TYPE slis_layout_alv, " Structure-layout
    x_fldcat LIKE LINE OF i_fldcat, " Structure-field catagory
    x_sort LIKE LINE OF i_sort. " Structure-Sort/Subtotals
    s e l e c t i o n    s c r e e n
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
    SELECT-OPTIONS : s_bukrs FOR t001-bukrs  OBLIGATORY NO INTERVALS
    NO-EXTENSION.
    SELECT-OPTIONS : s_anlkl FOR anla-anlkl.
    SELECT-OPTIONS : s_anln FOR anla-anln1.
    SELECT-OPTIONS : s_date FOR sy-datum OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    Initialization
    INITIALIZATION.
      g_repid = sy-repid.
      PERFORM layout_init USING x_layout.
      PERFORM eventtab_build USING g_events[].
      START OF SELECTION                                                 *
    START-OF-SELECTION.
      PERFORM calc_date.
      PERFORM get_data.
      PERFORM move_data.
    *PERFORM display_data.
    End of selection
    END-OF-SELECTION.
    Build layout report layout.
      PERFORM populate_layout_stucture.
    Perform build_field_catalog and Sort Table
      PERFORM build_field_catalog.
    PERFORM BUILD_SORT_TOTALS.
    List Header for Top-Of-Page
      PERFORM comment_build USING g_list_top_of_page[].
    Call list viewer function module
      PERFORM call_list_viewer .
    ****************Form - Routines************************************
    Form : layout_init
    Description : Form to Build layout for list display
    FORM layout_init USING rs_layout TYPE slis_layout_alv.
      rs_layout-detail_popup = c_x.
    ENDFORM.                    "layout_init
    Form : Eventtab_build
    Description : Registration of events to happen during list display
    FORM eventtab_build USING rt_events TYPE slis_t_event.
    Registration of events to happen during list display
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = rt_events.
      READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
      INTO ls_event.
      IF sy-subrc = 0.
        MOVE g_top_of_page TO ls_event-form.
        APPEND ls_event TO rt_events.
      ENDIF.
    ENDFORM. "eventtab_build
    Form : top_of_page
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = g_list_top_of_page.
    ENDFORM.                    "top_of_page
    *&      Form  GET_Data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
    SELECT abukrs aanln1 aaktiv atxt50 atxa50 azugdt aabgdt aktogr
    asernr ainvnr amenge ameins alifnr aliefe b~afabg
    INTO TABLE i_anla
    FROM anla AS a INNER JOIN anlb AS b
    ON aanln1 EQ banln1 AND
        abukrs EQ bbukrs
    WHERE a~anln1 IN s_anln
    AND a~anlkl IN s_anlkl
    AND a~bukrs IN s_bukrs
    AND b~afabe = '01'.
      SELECT bukrs anln1 kansw knafa nafap answl INTO TABLE i_anlc
      FROM anlc
      FOR ALL ENTRIES IN i_anla
      WHERE anln1 = i_anla-anln1
        AND bukrs = i_anla-bukrs.
      SELECT bukrs anln1 raumn FROM anlz INTO TABLE i_anlz
      FOR ALL ENTRIES IN i_anla
      WHERE anln1 = i_anla-anln1
        AND bukrs = i_anla-bukrs.
    ENDFORM.                    " GET_Data
    *&      Form  Move_data
          text
    -->  p1        text
    <--  p2        text
    FORM move_data .
      LOOP AT i_anla.
        MOVE i_anla-anln1 TO i_final-anln1.
        MOVE i_anla-txt50 TO i_final-txt50.
        MOVE i_anla-txa50 TO i_final-txa50.
        MOVE i_anla-ktogr TO i_final-ktogr.
        MOVE i_anla-sernr TO i_final-sernr.
        MOVE i_anla-invnr TO i_final-invnr.
        MOVE i_anla-menge TO i_final-menge.
        MOVE i_anla-meins TO i_final-meins.
        MOVE i_anla-afabg TO i_final-afabg.
        MOVE i_anla-lifnr TO i_final-lifnr.
        MOVE i_anla-liefe TO i_final-liefe.
        MOVE i_anla-aktiv TO i_final-aktiv.
        SELECT SINGLE * FROM t095t WHERE spras = 'E'
                                     AND ktogr = i_anla-ktogr.
        MOVE t095t-ktgrtx TO i_final-ktgrtx.
        READ TABLE i_anlc WITH KEY anln1 = i_anla-anln1
                                   bukrs = i_anla-bukrs.
        IF sy-subrc EQ 0.
          IF i_anla-zugdt LT s_date-low.
            MOVE  i_anlc-kansw TO i_final-g_kansw.
          ELSEIF i_anla-abgdt BETWEEN s_date-low AND s_date-high.
            MOVE  i_anlc-kansw TO i_final-b_answl.
            MOVE i_anlc-nafap TO i_final-d_add.
          ELSEIF i_anla-aktiv BETWEEN s_date-low AND s_date-high.
            MOVE i_anlc-kansw TO i_final-b_kansw.
            MOVE i_anlc-nafap TO i_final-d_sold.
          ELSE.
            MOVE i_anlc-nafap TO i_final-d_open.
          ENDIF.
          i_final-cd_sold = i_final-d_open + i_final-d_sold.
          i_final-cd_asst = i_final-d_open + i_final-d_sold.
          i_final-cd_dep  = i_final-cd_sold + i_final-cd_asst.
          i_final-ccd_dep = i_final-afabg + i_final-d_open - i_final-cd_dep.
          i_final-a = i_final-b_answl - i_final-cd_sold.
          i_final-d = i_final-b_answl - i_final-cd_asst.
          i_final-e = i_final-g_kansw - i_final-d_open.
          i_final-f = i_final-g_kansw - i_final-ccd_dep.
          i_final-afabg   =  i_final-d_sold  + i_final-d_open  +
    i_final-d_add.
          i_final-g_total =  i_final-g_kansw + i_final-b_answl +
    i_final-b_kansw.
        ENDIF.
        READ TABLE i_anlz WITH KEY anln1 = i_anla-anln1
                                   bukrs = i_anla-bukrs.
        IF sy-subrc EQ 0.
          MOVE i_anlz-raumn TO i_final-raumn.
        ENDIF.
        APPEND i_final.
        CLEAR i_final.
      ENDLOOP.
    ENDFORM.                    " Move_data
    Form : populate_layout_stucture
    Description : Populating the layout structure
    FORM populate_layout_stucture.
      CLEAR x_layout .
    Layout properties
      x_layout-zebra = c_x.
      x_layout-detail_popup = c_x.
      x_layout-detail_initial_lines = c_x.
      x_layout-colwidth_optimize = c_x.
    ENDFORM. " populate_layout_stucture
    Form : build_field_catalog
    Description : Building the field catalog data
    FORM build_field_catalog.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
         i_program_name               = g_repid
         i_internal_tabname           = 'I_FINAL'
         i_inclname                   = g_repid
        CHANGING
          ct_fieldcat                  = i_fldcat.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *DATA: SY-
    Getting the Header text for the coloums
      LOOP AT i_fldcat INTO x_fldcat WHERE fieldname = 'SRNO' OR
       fieldname = 'ANLN1' OR
      fieldname = 'TXT50' OR
      fieldname = 'TXA50' OR
      fieldname = 'KTOGR' OR
      fieldname = 'KTGRTX' OR
      fieldname = 'SERNR' OR
      fieldname = 'INVNR' OR
       fieldname = 'MENGE' OR
        fieldname = 'MEINS' OR
         fieldname = 'RAUMN' OR
         fieldname = 'LIFNR' OR
          fieldname = 'LIEFE' OR
           fieldname = 'AKTIV' OR
            fieldname = 'AFABG' OR
             fieldname = 'G_KANSW' OR
              fieldname = 'B_KANSW' OR
               fieldname = 'B_ANSWL' OR
               fieldname = 'G_TOTAL' OR
               fieldname = 'D_OPEN' OR
               fieldname = 'D_SOLD' OR
               fieldname = 'D_ADD' OR
               fieldname = 'AFABG' OR
               fieldname = 'CD_SOLD' OR
               fieldname = 'CD_ASST' OR
               fieldname = 'CD_DEP' OR
               fieldname = 'CCD_DEP' OR
               fieldname = 'A' OR
               fieldname = 'B' OR
               fieldname = 'C' OR
               fieldname = 'D' OR
               fieldname = 'E' OR
               fieldname = 'F'.
        IF x_fldcat-fieldname = 'SRNO'.
          x_fldcat-seltext_l = 'Sr. No'.
          x_fldcat-outputlen = 6.
          x_fldcat-just      = 'C'.
          x_fldcat-key       = 'X'.
          x_fldcat-inttype = c_c.
        ENDIF.
        IF x_fldcat-fieldname = 'ANLN1'.
          x_fldcat-outputlen = 17.
          x_fldcat-seltext_l = 'SAP Asset Code'.
          x_fldcat-just      = 'L'.
          x_fldcat-key       = 'X'.
          x_fldcat-inttype = c_c.
          x_fldcat-seltext_m = 'SAP Asset Code'.
          x_fldcat-seltext_s = 'SAP Asset Code'.
          x_fldcat-reptext_ddic = 'SAP Asset Code'.
        ENDIF.
        IF x_fldcat-fieldname = 'TXT50'.
          x_fldcat-outputlen = 50.
          x_fldcat-seltext_l = 'Brief Description of Assets'.
          x_fldcat-just      = 'L'.
          x_fldcat-key       = 'X'.
        ENDIF.
        IF x_fldcat-fieldname = 'TXA50'.
          x_fldcat-outputlen = 60.
          x_fldcat-seltext_l = 'Further Description'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'KTOGR'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Acct determinat'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'KTGRTX'.
          x_fldcat-outputlen = 30.
          x_fldcat-seltext_l = 'Acct determinat Text'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'SERNR'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Serial number'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'INVNR'.
          x_fldcat-outputlen = 25.
          x_fldcat-seltext_l = 'Assets identification No'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'MENGE'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Qty'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'MEINS'.
          x_fldcat-outputlen = 10.
          x_fldcat-seltext_l = 'UOM'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'RAUMN'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Location'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'LIFNR'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Vendor'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'LIEFE'.
          x_fldcat-outputlen = 30.
          x_fldcat-seltext_l = 'Supplier Name'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'AKTIV'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Capitalisation Date'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'AFABG'.
          x_fldcat-outputlen = 18.
          x_fldcat-seltext_l = 'Date put to use'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'G_KANSW'.
          x_fldcat-outputlen = 18.
          x_fldcat-seltext_l = 'Opening Gross Block'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'B_KANSW'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Addition'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'B_ANSWL'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Deduction / Adj'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'G_TOTAL'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Closing Gross Block'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'D_OPEN'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Dep on opening block'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'D_SOLD'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Dep on assets sold/ written off'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'D_ADD'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Addition During Year'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'AFABG'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Total dep for the period'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'CD_SOLD'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = '*** Dep on assets sold'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'CD_ASST'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = '*** Dep on assets written off'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'CD_DEP'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Total *** dep on deductions'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'CCD_DEP'.
          x_fldcat-outputlen = 20.
          x_fldcat-seltext_l = 'Closing Acc Dep'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'A'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'WDV of assets sold'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'B'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Selling Price'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'C'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Profit / (Loss) on sale'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'D'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Loss on Write off'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'E'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Closing WDV'.
          x_fldcat-just      = 'L'.
        ENDIF.
        IF x_fldcat-fieldname = 'F'.
          x_fldcat-outputlen = 15.
          x_fldcat-seltext_l = 'Opening WDV'.
          x_fldcat-just      = 'L'.
        ENDIF.
        MODIFY i_fldcat FROM x_fldcat INDEX sy-tabix.
      ENDLOOP.
    ENDFORM. " build_field_catalog
    Form : comment_build
    Description : This form is used to display the Report Header(ALV)
    FORM comment_build USING lt_top_of_page TYPE
    slis_t_listheader.
      DATA: l_line TYPE slis_listheader,
      l_heading1 LIKE rs38m-repti.
      CLEAR l_line.
      l_heading1 =
      'Asset Register Report'.
      g_repid = sy-repid.
      l_line-typ = c_h.
      MOVE l_heading1 TO l_line-info.
      APPEND l_line TO lt_top_of_page.
    ENDFORM.                    "comment_build
    *&      Form  calc_date
          text
    -->  p1        text
    <--  p2        text
    FORM calc_date .
      b_date = s_date-low - 1.
    ENDFORM.                    " calc_date
    Form : call_list_viewer
    Description : This form is used to display the grid through ALV
    FORM call_list_viewer.
    *PERFORM header_prn.
      LOOP AT i_final.
        MOVE sy-tabix TO i_final-srno.
        MODIFY i_final TRANSPORTING srno.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = g_repid
          is_layout               = x_layout
          it_fieldcat             = i_fldcat[]
          it_sort                 = i_sort[]
          i_default               = c_x
          i_save                  = g_save
          it_events               = g_events[]
        IMPORTING
          e_exit_caused_by_caller = g_exit_caused_by_caller
          es_exit_caused_by_user  = g_exit_caused_by_user
        TABLES
          t_outtab                = i_final
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      IF sy-subrc <> 0.
        WRITE: / 'Problem in calling the ALV report'(042).
      ENDIF.
    ENDFORM. " call_list_viewer
    thanks in advance,
    marks will b sure*
    regards
    vijay dwivedi

    Change ur table declaration as shown below, replace the word <b>TYPE</b> with <b>LIKE</b>
    DATA: BEGIN OF i_final OCCURS 0,
    srno TYPE i, " Serial no
    anln1 LIKE anla-anln1, " asset code no
    txt50 LIKE anla-txt50, " Brief Description of Assets
    txa50 LIKE anla-txa50, " Further Description
    ktogr LIKE anla-ktogr, " Asset Class No.
    ktgrtx LIKE t095t-ktgrtx, " Asset Class Name
    sernr LIKE anla-sernr, " Serial Number
    invnr LIKE anla-invnr, " Assets Identification No
    menge LIKE anla-menge, " Qty
    meins LIKE anla-meins, " UOM
    raumn LIKE anlz-raumn, " Location
    lifnr LIKE anla-lifnr, " Vendor
    liefe LIKE anla-liefe, " Capitalisation Date
    aktiv LIKE anla-aktiv, " Date put to use
    g_kansw LIKE anlc-kansw, " Opening Gross Block
    b_kansw LIKE anlc-kansw, " Additions during the period
    b_answl LIKE anlc-answl," Deductions/ Adjustmentsduring d period
    g_total LIKE bsis-dmbtr, " Closing Gross Block
    d_open LIKE anlb-afabg, " Dep on opening block
    d_sold LIKE anlb-afabg, " Dep on assets sold/written off
    d_add LIKE anlb-afabg, " dep on additions during the period
    afabg LIKE anlb-afabg, " Total dep for the period
    cd_sold LIKE bsis-dmbtr, " *** Dep on assets sold
    cd_asst LIKE bsis-dmbtr, " *** Dep on assets written off
    cd_dep LIKE bsis-dmbtr, " Total *** dep on deductions
    ccd_dep LIKE bsis-dmbtr, " Closing Acc Dep
    a LIKE bsis-dmbtr, " WDV of assets sold
    b LIKE bsis-dmbtr, " Selling Price
    c LIKE bsis-dmbtr, " Profit / (Loss) on sale
    d LIKE bsis-dmbtr, " Loss on write off
    e LIKE bsis-dmbtr, " Opening WDV
    f LIKE bsis-dmbtr, " Closing WDV
    END OF i_final.

  • Reg: passing totals /subtotals of a ALV to a smartform

    I have a editable ALV report which has a button to call a smartform . Once the user edits some  fields I need to pass the refreshed total to the smartform.  I want to know - in what structure the totals/subtotals  of the ALV report are stored.

    Banu,
    Even if you figure out how to get the subtotals / totals from a ALV, I would still suggest you to use the features of SMART Forms to calculate the same again in the form.
    http://help.sap.com/saphelp_nw04/helpdata/en/55/610e2db57911d4b62c006094192fe3/content.htm
    So, that way if your form is triggered even without doing the subtotalling done by the user you are on the safer side as the form will still display what you have designed it for.
    Regards,
    Ravi
    Note :Please mark all the helpful answers

  • Display two heading in single column using ALV report

    Hi Experts,
    I got a requirement for displaying 2 rows heading in a single column report. Is it possible that I can perform this task using ALV. How to get this 2 rows in ALV.
    This is a criteria that need to be output in ALV REPORT.
    MATERIAL CODE--MATERIAL NUMBERSTORAGE LOC----SLOC1     SLOC2
    --DATE--DATE1      DATE2
    123445--TEST MATERIAL22--
    3
    As mentioned above storage loc and date will be changing with respect to data dynamically and under this double heading qty will be displayed.
    Just want to know how to get double heading. It is clear that how to display dynamically but unaware of double heading using fieldcatalog.
    Regards,
    Yahya

    Hi Yahya,
    Please pass row position in fieldcatalogue for the respective columns.
    E.g  MOVE '2' to w_fieldcat-row_pos.  " This will display the field in 2nd row.
    Thanks,
    Rupali

Maybe you are looking for

  • Error while creating a business partner / sponsor

    Hi experts, I am getting the following error (same as the one posted by one of the other users) when i try to create a business partner in the 'sponsor' role: Sponsor does not have a customer associated with it. Because of this error I AM STUCK!!! an

  • Xorg-1.8, fails to start

    Hi all, after recent upgrade xorg wont start, i dont have xorg.conf, and im really in stuck, here is Xorg.0.log: [ 54385.216] This is a pre-release version of the X server from The X.Org Foundation. It is not supported in any way. Bugs may be filed i

  • Downloading output of  F110 Tcode to XLS sheet

    Hi Guru's, I  want to download  output of tcode F110(Automatic Payment Transaction)  in XLS sheet . How to do this one . Please anybody guid me. Thanks and Regards, Santhosh

  • EDI Seperator Issue for INbound EDI Scenario

    Hi Experts, Am using latest service pack and SP12 and patch 5 it seems. Still am getting same error. Message could not be forwarded to the JCA adapter. Reason: com.sap.aii.adapter.ediseparator.ra.integration.DispatchException: Message cannot be dispa

  • Ccopying the condition records

    Hi friends, I had some 4000 records with combination of sales org 1000 and customer QWER1. Now I want to copy all these records to new combination as sales org 1000 and customer as QWER12. For this I tried with VK11 and F7(Create with reference to) a