About ALV as Hierarchy

I want to make my ALV like this [https://weblogs.sdn.sap.com/weblogs/images/1918/wda_alv17.jpg|https://weblogs.sdn.sap.com/weblogs/images/1918/wda_alv17.jpg] by coding. I've found a pdf about how to do it, but it doesn't work.
Here is my code:
  DATA:
        l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
        l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table.
  l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
  IF l_ref_cmp_usage->has_active_component( ) is INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.
  l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
  wd_this->r_table = l_ref_interfacecontroller->get_model( ).
  cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
    r_model = wd_this->r_table ).
  wd_this->r_table->if_salv_wd_table_settings~set_display_type(
  if_salv_wd_c_table_settings=>display_type_hierarchy ).
  DATA: lr_column TYPE REF TO cl_salv_wd_column.
  lr_column = wd_this->r_table->if_salv_wd_column_settings~get_column( 'CNOID' ).
  lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
  lr_column = wd_this->r_table->if_salv_wd_column_settings~get_column( 'STOID' ).
  lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
  wd_this->r_table->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).
how can i make these code work?
thx
by jkchen

hi arjun,
it still doesn't work. when i debug it, the system sets the column hierarchy "false"...
the code is like this now:
  DATA:
        l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
        l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
        l_value TYPE REF TO cl_salv_wd_config_table.
  l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.
  l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
  l_value = l_ref_interfacecontroller->get_model( ).
*  cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
*    r_model = l_value ).
  l_value->if_salv_wd_std_functions~set_hierarchy_allowed( abap_true ).
  l_value->if_salv_wd_table_settings~set_display_type(
  if_salv_wd_c_table_settings=>display_type_hierarchy ).
  DATA: lr_column TYPE REF TO cl_salv_wd_column.
  lr_column = l_value->if_salv_wd_column_settings~get_column( 'CNOID' ).
  lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
  lr_column = l_value->if_salv_wd_column_settings~get_column( 'STOID' ).
  lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
  l_value->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).

Similar Messages

  • WD Abap Alv With hierarchy

    hi folks,
    i use an wd abap alv with hierarchy, on EVENT CLICKED on a CELL never gives me the correct R_PARAM->INDEX back as it does without hierarchy.
    how can i find out the exactly row which is behind the clicked cell?????
    kind regards,
    oliver

    Hi Oliver,
      Hierarchy is one type of setting in WD ABAP not like in normal ALV. I think there is no way to set the lead selection index in the case of Hiearchy, why becuase you can able to select only the leaf nodes only not all the nodes in the hiearachy. For the leaf nodes you can make the lead selected node. Just try to access the leaf node and find out that how you are accesing depending on that you can set the leaf node as selected.
    1. This is link to ALV tutorial, ALV Demo
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9
    There are some standard examples also,
    2.Please refer to Package called as SALV_WD_DEMO .In this you will get ample of sample examples about ALV .
    3. Please search in SDN library you will ALV in WD ABAP you will get many pdfs avilable that will guide you to develope ALV application in WD ABAP.
    Hope this will help you.
    Cheers,
    Darshna.

  • Where can I find a tutorial about Show Folders Hierarchy?

    I have Permiere Elements 11 which also has the Elements Organizer as part of the program. And I have Photoshop Elements 10 also. The Elements Organizer with the video editing program is what I'm interested in though. I think my folder hierarchy is not right. I'd like to straighten it out but I don't know how. Can someone direct me to a tutorial on how to work with the Folders Hierarchy.
    This might be a different question, but it might be related to my confusion about the Folder Hierarchy in the Organizer. On June 10 I was copying some photos from my hard drive to the Organizer - probably a dumb thing to do. While I was doing this, the Pictures folder (View and organizes digital pictures) no longer took me to all my photos on the hard drive. The Pictures folder is under Personal Folder, Documents, Music, Control Panel on the Windows 7 desktop to the right of the Start Menus stuff.
    When I click on Pictures now I get two folders: Adobe and Pictures. The Adobe folder has these values - Size: 0 bytes; Contains: 0 Files, 1 Folder; Created: Monday, June 10, 2013; Attributes: Read-only (only applies to files in the folder. I deleted the Abobe folder several times but it keeps coming back.
    What I would really like to do is to restore my Pictures folder to its original state so that I will have access to all my hard drive photos immediately instead of clicking around in those folders. I vaguely think that something I did to the folder hierarchy in the Optimizer has messed up other things on my computer.

    You wrote, "So if you moved the files, what you need to do is move them back..."
    I don't know how to do this. Could you tell  me how. I moved about 50 photos into the Organizer. Now I know I should not have done this. I'd like to correct the mistake.
    When I click on the Show Folder List icon this is what I see:
    My Pictures
         Pictures
              Faces
                   Clowns
         My Videos
         Computer
                   C:
                   Program Data
                   Users
                        Tommy
                              Faces
                                   Dancing
                                   Faces
                                   Lovers
                                   Racing
                                   Tommy
                         Pictures
                  D
                  E
                  F
                  G
    This makes no sense to me. But I could live with it - except perhaps something I did has made my PrE11 impossible to work with. When I put new clips via the memory card into the program, they do not go into the Timeline. All I get is an error message.
    I like the Adobe programs and don't want to give up on them, especially since my problems probably have been self-imposed.

  • Can somebody give me a sample about alv oo?

    hi experts ,can you give me a sample about alv using oo method,
    i have tried
    data GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
    data lt_fieldcat TYPE slis_t_fieldcat_alv.
        call method alv_grid->set_table_for_first_display
            exporting is_layout = gs_layout
            changing it_outtab = itab_data
                     it_fieldcatalog = lt_fieldcat.
    but the code cann't be compiled, and says "lt_fieldcat is not type-compatible with formal parameter it_fieldcatalog.",and so is the gs_layout.
    can you give me a sample for using alv oo ,and use the fieldcat to set table for first display, not to use i_structure_name.
    Message was edited by:
            liu shaochang

    Hi,
    Please take a look at my code below. Just create a custom control in screen painter and PF-status and title as well. Hope it helps...
    P.S. Please award points if it helps...
    [code]
    *& Report ZFI_CASH_PROOF_SHEET
    *& PROGRAM TYPE  : Report
    *& RICEF ID      : R-149
    *& TITLE         : ZFI_CASH_PROOF_SHEET
    *& SAP Module    : FI
    *& CREATION DATE : 11/06/2007
    *& AUTHOR        : Aris Hidalgo
    *& DESIGNER      : Aris Hidalgo
    *& DESCRIPTION   :
    $*********************************************************************
    *$     CHANGE HISTORY
    *$----
    *$   DATE        | T-Num      | Description                  | Reference
                  |            |                              |
    $*********************************************************************
    REPORT  zfi_cash_proof_sheet
            NO STANDARD PAGE HEADING
            MESSAGE-ID zfi.
    Data Dictionary Table/s                      *
    TABLES: t012k.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    Global Data/s                                *
    DATA: gt_fieldcat          TYPE lvc_t_fcat,
          wa_fieldcat          LIKE LINE OF gt_fieldcat,
          ok_code              TYPE syst-ucomm,
          save_ok              TYPE syst-ucomm,
          g_repid              TYPE syst-repid,
          gs_layout            TYPE lvc_s_layo,
          gv_container         TYPE scrfname VALUE 'CUSTOM_CONTROL',
          lcl_grid1            TYPE REF TO cl_gui_alv_grid,
          lcl_custom_container TYPE REF TO cl_gui_custom_container,
          gs_disvariant        TYPE disvariant,
          lcl_event_receiver   TYPE REF TO lcl_event_receiver,
          gt_sort              TYPE lvc_t_sort,
          gs_sort              TYPE lvc_s_sort.
    Global Structure/s                           *
    TYPES: BEGIN OF t_output,
                bukrs              TYPE bsis-bukrs,
                hbkid              TYPE t012k-hbkid,
                hktid              TYPE t012k-hktid,
                cash_in_bank       TYPE bsis-dmbtr,
                one_day            TYPE bsis-dmbtr,
                two_days           TYPE bsis-dmbtr,
                more_than_two_days TYPE bsis-dmbtr,
                misc_collection    TYPE bsis-dmbtr,
                outs_rel_checks    TYPE bsis-dmbtr,
                treas_transactions TYPE bsis-dmbtr,
                tot_cash_bal       TYPE bsis-dmbtr,
                outs_unrel_checks  TYPE bsis-dmbtr,
                imp_docs_due       TYPE bsis-dmbtr,
                est_cash_balance   TYPE bsis-dmbtr,
               END OF t_output.
    DATA: gt_output TYPE STANDARD TABLE OF t_output,
          wa_output LIKE LINE OF gt_output.
    SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_bukrs FOR t012k-bukrs OBLIGATORY,
                    s_hbkid FOR t012k-hbkid,
                    s_hktid FOR t012k-hktid.
    PARAMETERS:     p_budat TYPE bsak-budat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    */ CLASS DEFINITION/S */
          CLASS lcl_data_def DEFINITION
    CLASS lcl_data_def DEFINITION ABSTRACT.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_t012k,
                bukrs TYPE t012k-bukrs,
                hbkid TYPE t012k-hbkid,
                hktid TYPE t012k-hktid,
                hkont TYPE t012k-hkont,
               END OF t_t012k.
        TYPES: BEGIN OF t_bsis_bsas,
                bukrs TYPE bsis-bukrs,
                hkont TYPE bsis-hkont,
                belnr TYPE bsis-belnr,
                buzei TYPE bsis-buzei,
                gjahr TYPE bsis-gjahr,
                budat TYPE bsis-budat,
                blart TYPE bsis-blart,
                dmbtr TYPE bsis-dmbtr,
                shkzg TYPE bsis-shkzg,
               END OF t_bsis_bsas.
        TYPES: BEGIN OF t_bsid_bsad,
                bukrs TYPE bsid-bukrs,
                belnr TYPE bsid-belnr,
                gjahr TYPE bsid-gjahr,
                blart TYPE bsid-blart,
                buzei TYPE bsid-buzei,
                budat TYPE bsid-budat,
                dmbtr TYPE bsid-dmbtr,
                shkzg TYPE bsid-shkzg,
                bschl TYPE bsid-bschl,
               END OF t_bsid_bsad.
        TYPES: BEGIN OF t_cash_in_bank,
                bukrs TYPE bsis-bukrs,
                hkont TYPE bsis-hkont,
                dmbtr TYPE bsis-dmbtr,
               END OF t_cash_in_bank.
        TYPES: BEGIN OF t_outs_trade_coll,
                bukrs              TYPE bsis-bukrs,
                hkont              TYPE bsis-hkont,
                one_day            TYPE bsis-dmbtr,
                two_days           TYPE bsis-dmbtr,
                more_than_two_days TYPE bsis-dmbtr,
               END OF t_outs_trade_coll.
        TYPES: BEGIN OF t_zcheck_monitor,
                zzbukr TYPE zcheck_monitor-zzbukr,
                zhbkid TYPE zcheck_monitor-zhbkid,
                zhktid TYPE zcheck_monitor-zhktid,
                zubhkt TYPE zcheck_monitor-zubhkt,
                zrwbtr TYPE zcheck_monitor-zrwbtr,
                zrlsvd TYPE zcheck_monitor-zrlsvd,
                zrlsdt TYPE zcheck_monitor-zrlsdt,
               END OF t_zcheck_monitor.
        TYPES: BEGIN OF t_zcheck_monitor_collect,
                zzbukr TYPE zcheck_monitor-zzbukr,
                zubhkt TYPE zcheck_monitor-zubhkt,
                zrwbtr TYPE zcheck_monitor-zrwbtr,
               END OF t_zcheck_monitor_collect.
        TYPES: BEGIN OF t_company,
                bukrs TYPE t001-bukrs,
                butxt TYPE t001-butxt,
               END OF t_company.
        TYPES: BEGIN OF t_header,
                bukrs     TYPE t001-bukrs,
                butxt     TYPE t001-butxt,
                hbkid     TYPE t012k-hbkid,
                hktid     TYPE t012k-hktid,
                expand(1) TYPE c,
               END OF t_header.
        DATA: gt_t012k                  TYPE HASHED TABLE OF t_t012k
                                        WITH UNIQUE KEY bukrs hbkid hktid,
              gt_bsis                   TYPE STANDARD TABLE OF t_bsis_bsas,
              wa_bsis                   LIKE LINE OF gt_bsis,
              gt_bsas                   LIKE gt_bsis,
              gt_bsis_bsas              LIKE gt_bsas,
              gt_bsid_bsad              TYPE STANDARD TABLE OF t_bsid_bsad
                                        WITH NON-UNIQUE KEY bukrs belnr gjahr blart,
              gt_bsid                   LIKE gt_bsid_bsad,
              gt_bsad                   LIKE gt_bsid_bsad,
              gt_bsik                   LIKE gt_bsid_bsad,
              gt_bsak                   LIKE gt_bsid_bsad,
              gt_cash_in_bank           TYPE HASHED TABLE OF t_cash_in_bank
                                        WITH UNIQUE KEY bukrs hkont,
              gt_misc_collection        LIKE gt_cash_in_bank,
              wa_misc_collection        LIKE LINE OF gt_misc_collection,
              gt_importation_docs_due   LIKE gt_cash_in_bank,
              wa_importation_docs_due   LIKE LINE OF gt_importation_docs_due,
              wa_cash_in_bank           LIKE LINE OF gt_cash_in_bank,
              gt_outs_trade_coll        TYPE HASHED TABLE OF t_outs_trade_coll
                                        WITH UNIQUE KEY bukrs hkont,
              wa_outs_trade_coll        LIKE LINE OF gt_outs_trade_coll,
              gt_zcheck_monitor         TYPE STANDARD TABLE OF t_zcheck_monitor,
              gt_zcheck_monitor_collect TYPE HASHED TABLE OF t_zcheck_monitor_collect
                                        WITH UNIQUE KEY zzbukr zubhkt,
              wa_zcheck_monitor_collect LIKE LINE OF gt_zcheck_monitor_collect,
              gt_outs_rel_checks        LIKE gt_cash_in_bank,
              wa_outs_rel_checks        LIKE LINE OF gt_outs_rel_checks,
              gt_outs_unrel_checks      LIKE gt_cash_in_bank,
              wa_outs_unrel_checks      LIKE LINE OF gt_outs_unrel_checks,
              gt_company                TYPE HASHED TABLE OF t_company
                                        WITH UNIQUE KEY bukrs,
              wa_company                LIKE LINE OF gt_company,
              gt_header                 TYPE STANDARD TABLE OF t_header,
              wa_header                 LIKE LINE OF gt_header.
    ENDCLASS.                    "lcl_data_def DEFINITION
          CLASS lcl_get_data DEFINITION
    CLASS lcl_get_data DEFINITION INHERITING FROM lcl_data_def.
      PUBLIC SECTION.
        METHODS: get_bank_details,
                 get_gl_balances,
                 get_cust_items,
                 get_vend_items,
                 sum_gl_accounts,
                 monday_routines
                   IMPORTING
                     im_date  TYPE bsis-budat
                     im_bukrs TYPE bsis-bukrs
                     im_hkont TYPE bsis-hkont
                     im_budat TYPE bsis-budat
                     im_dmbtr TYPE bsis-dmbtr,
                 sunday_routines
                   IMPORTING
                     im_date  TYPE bsis-budat
                     im_bukrs TYPE bsis-bukrs
                     im_hkont TYPE bsis-hkont
                     im_budat TYPE bsis-budat
                     im_dmbtr TYPE bsis-dmbtr,
                 tuesday_routines
                   IMPORTING
                     im_date  TYPE bsis-budat
                     im_bukrs TYPE bsis-bukrs
                     im_hkont TYPE bsis-hkont
                     im_budat TYPE bsis-budat
                     im_dmbtr TYPE bsis-dmbtr,
                 other_days_routines
                   IMPORTING
                     im_date  TYPE bsis-budat
                     im_bukrs TYPE bsis-bukrs
                     im_hkont TYPE bsis-hkont
                     im_budat TYPE bsis-budat
                     im_dmbtr TYPE bsis-dmbtr,
                 difference_in_days
                   IMPORTING
                     im_date  TYPE bsis-budat
                     im_budat TYPE bsis-budat
                   EXPORTING
                     ex_diff  TYPE vtbbewe-atage,
                 outs_check_released,
                 process_data.
      PRIVATE SECTION.
        CONSTANTS: lc_credit   TYPE bsis-shkzg VALUE 'H',
                   lc_debit    TYPE bsis-shkzg VALUE 'S',
                   lc_nt       TYPE bsis-blart VALUE 'NT',
                   lc_nc       TYPE bsis-blart VALUE 'NC',
                   lc_gl_zero  TYPE bsis-hkont VALUE '+++++++++0',
                   lc_gl_one   TYPE bsis-hkont VALUE '+++++++++1',
                   lc_gl_three TYPE bsis-hkont VALUE '+++++++++3',
                   lc_monday   TYPE dtresr-weekday VALUE 'Monday',"#EC NOTEXT
                   lc_tuesday  TYPE dtresr-weekday VALUE 'Tuesday',"#EC NOTEXT
                   lc_sunday   TYPE dtresr-weekday VALUE 'Sunday'."#EC NOTEXT
        CONSTANTS: lc_k3  TYPE bsik-blart VALUE 'K3',
                   lc_k4  TYPE bsik-blart VALUE 'K4',
                   lc_k5  TYPE bsik-blart VALUE 'K5',
                   lc_k6  TYPE bsik-blart VALUE 'K6',
                   lc_k7  TYPE bsik-blart VALUE 'K7',
                   lc_kb  TYPE bsik-blart VALUE 'KB',
                   lc_kd  TYPE bsik-blart VALUE 'KD',
                   lc_31  TYPE bsid-blart VALUE '31',
                   lc_001 TYPE bsid-buzei VALUE '001'.
        DATA: lv_hkont           TYPE bsis-hkont,
              lr_hkont           TYPE RANGE OF bsis-hkont,
              wa_hkont           LIKE LINE OF lr_hkont,
              lr_blart           TYPE RANGE OF bsik-blart,
              wa_blart           LIKE LINE OF lr_blart,
              lv_hkont_new       TYPE bsis-hkont,
              lv_hkont_old       TYPE bsis-hkont,
              lv_date            TYPE vtbbewe-atage,
              lv_budat           TYPE bsis-budat,
              lv_day             TYPE dtresr-weekday.
    ENDCLASS.                    "lcl_get_data DEFINITION
          CLASS lcl_alv_routines DEFINITION
    CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_data_def.
      PUBLIC SECTION.
        METHODS: build_fieldcat   FINAL,
                 sort_alv_display FINAL.
    ENDCLASS.                    "lcl_alv_routines DEFINITION
          CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
            IMPORTING
              er_data_changed,
          handle_top_of_page FOR EVENT print_top_of_page OF cl_gui_alv_grid,
          handle_top_of_list FOR EVENT print_top_of_list OF cl_gui_alv_grid.
      PRIVATE SECTION.
        DATA: ls_good               TYPE lvc_s_modi,
              lv_treas_transactions TYPE t_output-tot_cash_bal,
              lv_tot_cash_bal       TYPE t_output-tot_cash_bal,
              lv_outs_unrel_checks  TYPE t_output-outs_unrel_checks,
              lv_imp_docs_due       TYPE t_output-imp_docs_due,
              lv_est_cash_balance   TYPE t_output-est_cash_balance.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    */ CLASS IMPLEMENTATION/S */
          CLASS lcl_get_data IMPLEMENTATION
    CLASS lcl_get_data IMPLEMENTATION.
    METHOD get_bank_details
      METHOD get_bank_details.
        FIELD-SYMBOLS: <fs_t012k> LIKE LINE OF gt_t012k.
      Get bank account/s and their corresponding G/L account/s
        SELECT bukrs hbkid
               hktid hkont
          FROM t012k
          INTO TABLE gt_t012k
         WHERE bukrs IN s_bukrs
           AND hbkid IN s_hbkid
           AND hktid IN s_hktid.
        IF NOT gt_t012k[] IS INITIAL.
          SORT gt_t012k BY bukrs hbkid hktid hkont.
        Get company name
          SELECT bukrs butxt
            FROM t001
            INTO TABLE gt_company
             FOR ALL ENTRIES IN gt_t012k
           WHERE bukrs = gt_t012k-bukrs.
          LOOP AT gt_t012k ASSIGNING <fs_t012k>.
            wa_hkont-sign   = 'I'.
            wa_hkont-option = 'EQ'.
            wa_hkont-low    = <fs_t012k>-hkont.
            SHIFT wa_hkont-low LEFT DELETING LEADING space.
            APPEND wa_hkont TO lr_hkont.
            CLEAR wa_hkont.
            lv_hkont_new = <fs_t012k>-hkont.
            IF lv_hkont_new <> lv_hkont_old.
              CLEAR lv_hkont.
              lv_hkont = <fs_t012k>-hkont.
              DO 4 TIMES.
                ADD 1 TO lv_hkont.
                CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                  EXPORTING
                    input  = lv_hkont
                  IMPORTING
                    output = lv_hkont.
                wa_hkont-sign   = 'I'.
                wa_hkont-option = 'EQ'.
                wa_hkont-low    = lv_hkont.
                SHIFT wa_hkont-low LEFT DELETING LEADING space.
                APPEND wa_hkont TO lr_hkont.
                CLEAR wa_hkont.
              ENDDO.
            ENDIF.
            lv_hkont_old = lv_hkont_new.
          ENDLOOP.
          CALL METHOD me->get_gl_balances.
        ENDIF.
      ENDMETHOD.                    "get_bank_details
    METHOD get_gl_balances
      METHOD get_gl_balances.
      Get G/L line items(Open items)
        SELECT bukrs hkont belnr
               buzei gjahr budat
               blart dmbtr shkzg
          FROM bsis
          INTO TABLE gt_bsis
           FOR ALL ENTRIES IN gt_t012k
         WHERE bukrs = gt_t012k-bukrs
           AND hkont IN lr_hkont
           AND budat <= p_budat.
      Get G/L line items(Cleared items)
        SELECT bukrs hkont belnr
               buzei gjahr budat
               blart dmbtr shkzg
          FROM bsas
          INTO TABLE gt_bsas
           FOR ALL ENTRIES IN gt_t012k
         WHERE bukrs = gt_t012k-bukrs
           AND hkont IN lr_hkont
           AND budat <= p_budat.
        APPEND LINES OF gt_bsis TO gt_bsis_bsas.
        APPEND LINES OF gt_bsas TO gt_bsis_bsas.
        IF NOT gt_bsis_bsas[] IS INITIAL.
          CALL METHOD me->get_cust_items.
          CALL METHOD me->get_vend_items.
          CALL METHOD me->sum_gl_accounts.
        ENDIF.
      ENDMETHOD.                    "get_gl_balances
    METHOD get_cust_items
      METHOD get_cust_items.
      Get customer line items(Open items)
        SELECT bukrs belnr gjahr blart
               buzei budat dmbtr shkzg
               bschl
          FROM bsid
          INTO TABLE gt_bsid
           FOR ALL ENTRIES IN gt_bsis_bsas
         WHERE bukrs = gt_bsis_bsas-bukrs
           AND gjahr = gt_bsis_bsas-gjahr
           AND belnr = gt_bsis_bsas-belnr.
      Get customer line items(Cleared items)
        SELECT bukrs belnr gjahr blart
               buzei budat dmbtr shkzg
               bschl
          FROM bsad
          INTO TABLE gt_bsad
           FOR ALL ENTRIES IN gt_bsis_bsas
         WHERE bukrs = gt_bsis_bsas-bukrs
           AND gjahr = gt_bsis_bsas-gjahr
           AND belnr = gt_bsis_bsas-belnr.
        APPEND LINES OF gt_bsid TO gt_bsid_bsad.
        APPEND LINES OF gt_bsad TO gt_bsid_bsad.
      ENDMETHOD.                    "get_cust_items
    METHOD get_vend_items
      METHOD get_vend_items.
      Get vendor line items(Open items)
        SELECT bukrs belnr gjahr blart
               buzei budat dmbtr shkzg
               bschl
          FROM bsik
          INTO TABLE gt_bsik
           FOR ALL ENTRIES IN gt_bsis_bsas
         WHERE bukrs = gt_bsis_bsas-bukrs
           AND gjahr = gt_bsis_bsas-gjahr
           AND belnr = gt_bsis_bsas-belnr.
        DEFINE m_blart.
          wa_blart-sign   = 'I'.
          wa_blart-option = 'EQ'.
          wa_blart-low    = &1.
          append wa_blart to lr_blart.
          clear wa_blart.
        END-OF-DEFINITION.
        m_blart lc_k3.
        m_blart lc_k4.
        m_blart lc_k5.
        m_blart lc_k6.
        m_blart lc_k7.
        m_blart lc_kb.
        m_blart lc_kd.
        IF NOT gt_bsik[] IS INITIAL AND NOT lr_blart[] IS INITIAL.
          DELETE gt_bsik WHERE blart NOT IN lr_blart[].
          DELETE gt_bsik WHERE bschl <> lc_31.
        ENDIF.
      ENDMETHOD.                    "get_vend_items
    METHOD sum_gl_accounts
      METHOD sum_gl_accounts.
        FIELD-SYMBOLS: <fs_bsis_bsas>         LIKE LINE OF gt_bsis_bsas,
                       <fs_bsis>              LIKE LINE OF gt_bsis,
                       <fs_bsid_bsad>         LIKE LINE OF gt_bsid_bsad,
                       <fs_bsik>              LIKE LINE OF gt_bsik,
                       <fs_outs_rel_checks>   LIKE LINE OF gt_outs_rel_checks,
                       <fs_outs_unrel_checks> LIKE LINE OF gt_outs_unrel_checks.
        SORT gt_bsis_bsas BY bukrs hkont belnr.
        LOOP AT gt_bsis_bsas ASSIGNING <fs_bsis_bsas>.
          IF <fs_bsis_bsas>-shkzg = lc_credit.   "H
            MULTIPLY <fs_bsis_bsas>-dmbtr BY -1.
          ENDIF.
    */Routine for cash in bank
          IF <fs_bsis_bsas>-hkont CP lc_gl_zero.
            MOVE-CORRESPONDING <fs_bsis_bsas> TO wa_cash_in_bank.
            COLLECT wa_cash_in_bank INTO gt_cash_in_bank.
            CLEAR wa_cash_in_bank.
          ENDIF.
    */Routine for miscellaneous collection
          IF <fs_bsis_bsas>-blart = lc_nt OR
             <fs_bsis_bsas>-blart = lc_nc AND
             <fs_bsis_bsas>-shkzg = lc_debit AND
             <fs_bsis_bsas>-hkont CP lc_gl_one.
            READ TABLE gt_bsid_bsad ASSIGNING <fs_bsid_bsad> WITH TABLE KEY bukrs = <fs_bsis_bsas>-bukrs
                                                                            belnr = <fs_bsis_bsas>-belnr
                                                                            gjahr = <fs_bsis_bsas>-gjahr
                                                                            blart = <fs_bsis_bsas>-blart.
            IF sy-subrc = 0.
              MOVE-CORRESPONDING <fs_bsis_bsas> TO wa_misc_collection.
              COLLECT wa_misc_collection INTO gt_misc_collection.
              CLEAR wa_misc_collection.
            ENDIF.
          ENDIF.
    */Routine for importation docs.due
          IF <fs_bsis_bsas>-shkzg = lc_credit.
            READ TABLE gt_bsik ASSIGNING <fs_bsik> WITH TABLE KEY bukrs = <fs_bsis_bsas>-bukrs
                                                                  belnr = <fs_bsis_bsas>-belnr
                                                                  gjahr = <fs_bsis_bsas>-gjahr
                                                                  blart = <fs_bsis_bsas>-blart.
            IF sy-subrc = 0.
              MOVE-CORRESPONDING <fs_bsis_bsas> TO wa_importation_docs_due.
              COLLECT wa_importation_docs_due INTO gt_importation_docs_due.
              CLEAR gt_importation_docs_due.
            ENDIF.
          ENDIF.
        ENDLOOP.
        IF NOT gt_bsis[] IS INITIAL.
          IF NOT gt_bsis[] IS INITIAL.
            lv_budat = p_budat.
            CALL FUNCTION 'DATE_TO_DAY'
              EXPORTING
                date    = lv_budat
              IMPORTING
                weekday = lv_day.
            LOOP AT gt_bsis ASSIGNING <fs_bsis>.
    */Routine for outstanding trade collection
              IF <fs_bsis>-shkzg = lc_debit AND <fs_bsis>-blart <> lc_nt.
                IF lv_day = lc_monday.
                  CALL METHOD me->monday_routines
                    EXPORTING
                      im_date  = p_budat
                      im_bukrs = <fs_bsis>-bukrs
                      im_hkont = <fs_bsis>-hkont
                      im_budat = <fs_bsis>-budat
                      im_dmbtr = <fs_bsis>-dmbtr.
                ELSEIF lv_day = lc_sunday.
                  CALL METHOD me->sunday_routines
                    EXPORTING
                      im_date  = p_budat
                      im_bukrs = <fs_bsis>-bukrs
                      im_hkont = <fs_bsis>-hkont
                      im_budat = <fs_bsis>-budat
                      im_dmbtr = <fs_bsis>-dmbtr.
                ELSEIF lv_day = lc_tuesday.
                  CALL METHOD me->tuesday_routines
                    EXPORTING
                      im_date  = p_budat
                      im_bukrs = <fs_bsis>-bukrs
                      im_hkont = <fs_bsis>-hkont
                      im_budat = <fs_bsis>-budat
                      im_dmbtr = <fs_bsis>-dmbtr.
                ELSE.
                  CALL METHOD me->other_days_routines
                    EXPORTING
                      im_date  = p_budat
                      im_bukrs = <fs_bsis>-bukrs
                      im_hkont = <fs_bsis>-hkont
                      im_budat = <fs_bsis>-budat
                      im_dmbtr = <fs_bsis>-dmbtr.
                ENDIF.
              ENDIF.
    */Routine for outstanding released checks
              IF <fs_bsis>-hkont CP lc_gl_three AND <fs_bsis>-shkzg = lc_debit.
                MOVE-CORRESPONDING <fs_bsis> TO wa_outs_rel_checks.
                COLLECT wa_outs_rel_checks INTO gt_outs_rel_checks.
                CLEAR wa_outs_rel_checks.
    */Routine for outstanding unreleased checks
              ELSEIF <fs_bsis>-hkont CP lc_gl_three AND <fs_bsis>-shkzg = lc_credit.
                MOVE-CORRESPONDING <fs_bsis> TO wa_outs_unrel_checks.
                COLLECT wa_outs_unrel_checks INTO gt_outs_unrel_checks.
                CLEAR wa_outs_unrel_checks.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
    */Routine for outstanding released check/s
    */this routine will get all records from custom table zcheck_monitor
    */where status is released to vendor
        CALL METHOD me->outs_check_released.
        IF NOT gt_outs_rel_checks[] IS INITIAL.
        Subtract debit line items from ZFE002
          LOOP AT gt_outs_rel_checks ASSIGNING <fs_outs_rel_checks>.
            CLEAR wa_zcheck_monitor_collect.
            READ TABLE gt_zcheck_monitor_collect INTO wa_zcheck_monitor_collect
                                                 WITH TABLE KEY zzbukr = <fs_outs_rel_checks>-bukrs
                                                                zubhkt = <fs_outs_rel_checks>-hkont.
            IF sy-subrc = 0.
              <fs_outs_rel_checks>-dmbtr = wa_zcheck_monitor_collect-zrwbtr -
                                           <fs_outs_rel_checks>-dmbtr.
            ELSE.
              <fs_outs_rel_checks>-dmbtr = 0 - <fs_outs_rel_checks>-dmbtr.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF NOT gt_outs_unrel_checks[] IS INITIAL.
        Subtract ZFE002 records from credit line items
          LOOP AT gt_outs_unrel_checks ASSIGNING <fs_outs_unrel_checks>.
            CLEAR wa_zcheck_monitor_collect.
            READ TABLE gt_zcheck_monitor_collect INTO wa_zcheck_monitor_collect
                                                 WITH TABLE KEY zzbukr = <fs_outs_unrel_checks>-bukrs
                                                                zubhkt = <fs_outs_unrel_checks>-hkont.
            IF sy-subrc = 0.
              <fs_outs_unrel_checks>-dmbtr =  ABS( <fs_outs_unrel_checks>-dmbtr ) -
                                              ABS( wa_zcheck_monitor_collect-zrwbtr ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      Move records to output table
        CALL METHOD me->process_data.
      ENDMETHOD.                    "sum_gl_accounts
    METHOD monday_routines
      METHOD monday_routines.
        wa_outs_trade_coll-bukrs   = im_bukrs.
        wa_outs_trade_coll-hkont   = im_hkont.
        CLEAR lv_date.
        CALL METHOD me->difference_in_days
          EXPORTING
            im_date  = im_date
            im_budat = im_budat
          IMPORTING
            ex_diff  = lv_date.
      One day
        IF lv_date = 3.
          wa_outs_trade_coll-one_day = im_dmbtr.
      Two days
        ELSEIF lv_date = 4.
          wa_outs_trade_coll-two_days = im_dmbtr.
      More than two days
        ELSEIF lv_date > 4.
          wa_outs_trade_coll-more_than_two_days = im_dmbtr.
        ENDIF.
        COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
        CLEAR wa_outs_trade_coll.
      ENDMETHOD.                    "monday_routines
    METHOD sunday_routines
      METHOD sunday_routines.
        wa_outs_trade_coll-bukrs   = im_bukrs.
        wa_outs_trade_coll-hkont   = im_hkont.
        CLEAR lv_date.
        CALL METHOD me->difference_in_days
          EXPORTING
            im_date  = im_date
            im_budat = im_budat
          IMPORTING
            ex_diff  = lv_date.
      One day
        IF lv_date = 2.
          wa_outs_trade_coll-one_day = im_dmbtr.
      Two days
        ELSEIF lv_date = 3.
          wa_outs_trade_coll-two_days = im_dmbtr.
      More than two days
        ELSEIF lv_date > 3.
          wa_outs_trade_coll-more_than_two_days = im_dmbtr.
        ENDIF.
        COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
        CLEAR wa_outs_trade_coll.
      ENDMETHOD.                    "sunday_routines
    METHOD tuesday_routines
      METHOD tuesday_routines.
        wa_outs_trade_coll-bukrs   = im_bukrs.
        wa_outs_trade_coll-hkont   = im_hkont.
        CLEAR lv_date.
        CALL METHOD me->difference_in_days
          EXPORTING
            im_date  = im_date
            im_budat = im_budat
          IMPORTING
            ex_diff  = lv_date.
      One day
        IF lv_date = 1.
          wa_outs_trade_coll-one_day = im_dmbtr.
      Two days
        ELSEIF lv_date = 4.
          wa_outs_trade_coll-two_days = im_dmbtr.
      More than two days
        ELSEIF lv_date > 4.
          wa_outs_trade_coll-more_than_two_days = im_dmbtr.
        ENDIF.
        COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
        CLEAR wa_outs_trade_coll.
      ENDMETHOD.                    "tuesday_routines
    METHOD other_days_routines
      METHOD other_days_routines.
        wa_outs_trade_coll-bukrs   = im_bukrs.
        wa_outs_trade_coll-hkont   = im_hkont.
        CLEAR lv_date.
        CALL METHOD me->difference_in_days
          EXPORTING
            im_date  = im_date
            im_budat = im_budat
          IMPORTING
            ex_diff  = lv_date.
      One day
        IF lv_date = 1.
          wa_outs_trade_coll-one_day = im_dmbtr.
      Two days
        ELSEIF lv_date = 2.
          wa_outs_trade_coll-two_days = im_dmbtr.
      More than two days
        ELSEIF lv_date > 3.
          wa_outs_trade_coll-more_than_two_days = im_dmbtr.
        ENDIF.
        COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
        CLEAR wa_outs_trade_coll.
      ENDMETHOD.                    "other_days_routines
    METHOD difference_in_days
      METHOD difference_in_days.
        CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
          EXPORTING
            i_date_from          = im_budat
          I_KEY_DAY_FROM       =
            i_date_to            = im_date
          I_KEY_DAY_TO         =
          I_FLG_SEPARATE       = ' '
          IMPORTING
            e_days               = ex_diff.
          E_MONTHS             =
          E_YEARS              =
      ENDMETHOD.                    "difference_in_days
    METHOD outs_check_released
      METHOD outs_check_released.
        FIELD-SYMBOLS: <fs_zcheck_monitor> LIKE LINE OF gt_zcheck_monitor.
        SELECT zzbukr zhbkid zhktid
               zubhkt zrwbtr zrlsvd
               zrlsdt
          FROM zcheck_monitor
          INTO TABLE gt_zcheck_monitor
         WHERE zrlsvd <> space.
        IF NOT gt_zcheck_monitor[] IS INITIAL.
          LOOP AT gt_zcheck_monitor ASSIGNING <fs_zcheck_monitor>.
            MOVE-CORRESPONDING <fs_zcheck_monitor> TO wa_zcheck_monitor_collect.
            COLLECT wa_zcheck_monitor_collect INTO gt_zcheck_monitor_collect.
            CLEAR wa_zcheck_monitor_collect.
          ENDLOOP.
        ENDIF.
      ENDMETHOD.                    "outs_check_released
    METHOD process_data
      METHOD process_data.
        FIELD-SYMBOLS: <fs_t012k>             LIKE LINE OF gt_t012k,
                       <fs_company>           LIKE LINE OF gt_company,
                       <fs_cash_in_bank>      LIKE LINE OF gt_cash_in_bank,
                       <fs_outs_trade_coll>   LIKE LINE OF gt_outs_trade_coll,
                       <fs_misc_collection>   LIKE LINE OF gt_misc_collection,
                       <fs_outs_rel_checks>   LIKE LINE OF gt_outs_rel_checks,
                       <fs_outs_unrel_checks> LIKE LINE OF gt_outs_unrel_checks.
        SORT gt_t012k BY bukrs hbkid.
        LOOP AT gt_t012k ASSIGNING <fs_t012k>.
          AT NEW hbkid.
            READ TABLE gt_company ASSIGNING <fs_company>
                                  WITH TABLE KEY bukrs = <fs_t012k>-bukrs.
            IF sy-subrc = 0.
              wa_header-bukrs = <fs_company>-bukrs.
              wa_header-butxt = <fs_company>-butxt.
              wa_header-hbkid = <fs_t012k>-hbkid.
             wa_header-hktid = <fs_t012k>-hktid.
              APPEND wa_header TO gt_header.
              CLEAR wa_header.
            ENDIF.
          ENDAT.
          wa_output-bukrs = <fs_t012k>-bukrs.
          wa_output-hbkid = <fs_t012k>-hbkid.
          wa_output-hktid = <fs_t012k>-hktid.
        Move cash in bank
          READ TABLE gt_cash_in_bank ASSIGNING <fs_cash_in_bank>
                                     WITH TABLE KEY bukrs = <fs_t012k>-bukrs
                                                    hkont = <fs_t012k>-hkont.
          IF sy-subrc = 0.
            wa_output-cash_in_bank = <fs_cash_in_bank>-dmbtr.
            ADD wa_output-cash_in_bank TO wa_output-tot_cash_bal.
          ENDIF.
          CLEAR lv_hkont.
          lv_hkont = <fs_t012k>-hkont.
          ADD 1 TO lv_hkont.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = lv_hkont
            IMPORTING
              output = lv_hkont.
        Move outstanding trade collection(Deposit in transit)
          READ TABLE gt_outs_trade_coll ASSIGNING <fs_outs_trade_coll>
                                        WITH TABLE KEY bukrs = <fs_t012k>-bukrs
                                                       hkont = lv_hkont.
          IF sy-subrc = 0.
            wa_output-one_day            = <fs_outs_trade_coll>-one_day.
            ADD wa_output-one_day TO wa_output-tot_cash_bal.
            wa_output-two_days           = <fs_outs_trade_coll>-two_days.
            ADD wa_output-two_days TO wa_output-tot_cash_bal.
            wa_output-more_than_two_days = <fs_outs_trade_coll>-more_than_two_days.
            ADD wa_output-more_than_two_days TO wa_output-tot_cash_bal.
          ENDIF.
        Move miscellaneous collection
          READ TABLE gt_misc_collection ASSIGNING <fs_misc_collection>
                                        WITH TABLE KEY bukrs = <fs_t012k>-bukrs
                                                       hkont = lv_hkont.
          IF sy-subrc = 0.
            wa_output-misc_collection = <fs_misc_collection>-dmbtr.
            ADD wa_output-misc_collection TO wa_output-tot_cash_bal.
          ENDIF.
        Move outstanding released checks
          CLEAR lv_hkont.
          lv_hkont = <fs_t012k>-hkont.
          ADD 3 TO lv_hkont.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = lv_hkont
            IMPORTING
              output = lv_hkont.
          READ TABLE gt_outs_rel_checks ASSIGNING <fs_outs_rel_checks>
                                        WITH TABLE KEY bukrs = <fs_t012k>-bukrs
                                                       hkont = lv_hkont.
          IF sy-subrc = 0.
            wa_output-outs_rel_checks = <fs_outs_rel_checks>-dmbtr.
            IF wa_output-outs_rel_checks < 0.
              ADD wa_output-outs_rel_checks TO wa_output-tot_cash_bal.
            ELSE.
              SUBTRACT wa_output-outs_rel_checks FROM wa_output-tot_cash_bal.
            ENDIF.
          ELSE.
            CLEAR wa_zcheck_monitor_collect.
            READ TABLE gt_zcheck_monitor_collect INTO wa_zcheck_monitor_collect
                                                 WITH TABLE KEY zzbukr = <fs_t012k>-bukrs
                                                                zubhkt = lv_hkont.
            IF sy-subrc = 0.
              wa_output-outs_rel_checks = wa_zcheck_monitor_collect-zrwbtr.
              IF wa_output-outs_rel_checks < 0.
                ADD wa_output-outs_rel_checks TO wa_output-tot_cash_bal.
              ELSE.
                SUBTRACT wa_output-outs_rel_checks FROM wa_output-tot_cash_bal.
              ENDIF.
            ENDIF.
          ENDIF.
        Move outstanding unreleased checks
          CLEAR lv_hkont.
          lv_hkont = <fs_t012k>-hkont.
          ADD 3 TO lv_hkont.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = lv_hkont
            IMPORTING
              output = lv_hkont.
          READ TABLE gt_outs_unrel_checks ASSIGNING <fs_outs_unrel_checks>
                                          WITH TABLE KEY bukrs = <fs_t012k>-bukrs
                                                         hkont = lv_hkont.
          IF sy-subrc = 0.
            wa_output-outs_unrel_checks = <fs_outs_unrel_checks>-dmbtr.
          ENDIF.
        Move importation docs. due
          CLEAR wa_importation_docs_due.
          READ TABLE gt_importation_docs_due INTO wa_importation_docs_due
                                             WITH TABLE KEY bukrs = <fs_t012k>-bukrs
                                                            hkont = lv_hkont
                                                                    TRANSPORTING dmbtr.
          IF sy-subrc = 0.
            wa_output-imp_docs_due = wa_importation_docs_due-dmbtr.
          ENDIF.
          wa_output-est_cash_balance = wa_output-tot_cash_bal - ( wa_output-outs_unrel_checks +
                                                                  wa_output-imp_docs_due ).
          APPEND wa_output TO gt_output.
          CLEAR wa_output.
        ENDLOOP.
      ENDMETHOD.                    "process_data
    ENDCLASS.                    "lcl_get_data IMPLEMENTATION
          CLASS lcl_alv_routines IMPLEMENTATION
    CLASS lcl_alv_routines IMPLEMENTATION.
      METHOD build_fieldcat.
        DEFINE m_fieldcat.
          add 1 to wa_fieldcat-col_pos.
          wa_fieldcat-fieldname   = &1.
          wa_fieldcat-tabname     = &2.
          wa_fieldcat-coltext     = &3.
          wa_fieldcat-outputlen   = &4.
          wa_fieldcat-key         = &5.
          wa_fieldcat-just        = &6.
          wa_fieldcat-do_sum      = &7.
          wa_fieldcat-emphasize   = &8.
          wa_fieldcat-edit        = &9.
          append wa_fieldcat to gt_fieldcat.
          clear wa_fieldcat.
        END-OF-DEFINITION.
        m_fieldcat 'BUKRS'              'GT_OUTPUT' text-a01  '12' 'X' '' '' '' ''.
        m_fieldcat 'HBKID'              'GT_OUTPUT' text-a14  '10' 'X' '' '' '' ''.
        m_fieldcat 'HKTID'              'GT_OUTPUT' text-a02  '10' 'X' '' '' '' ''.
        m_fieldcat 'CASH_IN_BANK'       'GT_OUTPUT' text-a03  '12' '' 'R' 'X' '' ''.
        m_fieldcat 'ONE_DAY'            'GT_OUTPUT' text-a04  '05' '' 'R' 'X' '' ''.
        m_fieldcat 'TWO_DAYS'           'GT_OUTPUT' text-a05  '06' '' 'R' 'X' '' ''.
        m_fieldcat 'MORE_THAN_TWO_DAYS' 'GT_OUTPUT' text-a06  '08' '' 'R' 'X' '' ''.
        m_fieldcat 'MISC_COLLECTION'    'GT_OUTPUT' text-a07  '16' '' 'R' 'X' '' ''.
        m_fieldcat 'OUTS_REL_CHECKS'    'GT_OUTPUT' text-a08  '21' '' 'R' 'X' '' ''.
        m_fieldcat 'TREAS_TRANSACTIONS' 'GT_OUTPUT' text-a09  '19' '' 'R' 'X' '' 'X'.
        m_fieldcat 'TOT_CASH_BAL'       'GT_OUTPUT' text-a10  '15' '' 'R' 'X' 'C300' ''.
        m_fieldcat 'OUTS_UNREL_CHECKS'  'GT_OUTPUT' text-a11  '19' '' 'R' 'X' '' ''.
        m_fieldcat 'IMP_DOCS_DUE'       'GT_OUTPUT' text-a12  '14' '' 'R' 'X' '' ''.
        m_fieldcat 'EST_CASH_BALANCE'   'GT_OUTPUT' text-a13  '17' '' 'R' 'X' 'C300' ''.
      ENDMETHOD.                    "build_fieldcat
      METHOD sort_alv_display.
        DEFINE m_sort.
          clear gs_sort.
          gs_sort-fieldname = &1.
          gs_sort-spos      = &2.
          gs_sort-up        = &3.
          gs_sort-down      = &4.
          gs_sort-subtot    = &5.
          append gs_sort to gt_sort.
        END-OF-DEFINITION.
        m_sort 'BUKRS' '1' 'X' '' ''.
        m_sort 'HBKID' '2' 'X' '' 'X'.
      ENDMETHOD.                    "sort_alv_display
    ENDCLASS.                    "lcl_alv_routines IMPLEMENTATION
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        LOOP AT er_data_changed->mt_mod_cells INTO ls_good.
          CASE ls_good-fieldname.
            WHEN 'TREAS_TRANSACTIONS'.
              CLEAR lv_tot_cash_bal.
              CALL METHOD er_data_changed->get_cell_value
                EXPORTING
                  i_row_id    = ls_good-row_id
                  i_fieldname = 'TOT_CASH_BAL'
                IMPORTING
                  e_value     = lv_tot_cash_bal.
              IF ls_good-value CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ/'.
                CALL METHOD er_data_changed->add_protocol_entry
                  EXPORTING
                    i_msgid     = '0K'
                    i_msgno     = '000'
                    i_msgty     = 'E'
                    i_msgv1     = text-e01
                    i_msgv2     = ls_good-value
                    i_msgv3     = text-e02
                    i_fieldname = ls_good-fieldname
                    i_row_id    = ls_good-row_id.
                EXIT.
              ELSE.
                CLEAR lv_treas_transactions.
                lv_treas_transactions = ls_good-value.
                ADD lv_tot_cash_bal TO lv_treas_transactions.
                CALL METHOD er_data_changed->modify_cell
                  EXPORTING
                    i_row_id    = ls_good-row_id
                    i_fieldname = 'TOT_CASH_BAL'
                    i_value     = lv_treas_transactions.
                CLEAR lv_outs_unrel_checks.
                CALL METHOD er_data_changed->get_cell_value
                  EXPORTING
                    i_row_id    = ls_good-row_id
                    i_fieldname = 'OUTS_UNREL_CHECKS'
                  IMPORTING
                    e_value     = lv_outs_unrel_checks.
                CLEAR lv_imp_docs_due.
                CALL METHOD er_data_changed->get_cell_value
                  EXPORTING
                    i_row_id    = ls_good-row_id
                    i_fieldname = 'IMP_DOCS_DUE'
                  IMPORTING
                    e_value     = lv_imp_docs_due.
                lv_est_cash_balance = ls_good-value - ( lv_outs_unrel_checks +
                                                        lv_imp_docs_due ).
                CALL METHOD er_data_changed->modify_cell
                  EXPORTING
                    i_row_id    = ls_good-row_id
                    i_fieldname = 'EST_CASH_BALANCE'
                    i_value     = lv_est_cash_balance.
                CLEAR lv_est_cash_balance.
              ENDIF.
          ENDCASE.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
      METHOD handle_top_of_page.
        WRITE: sy-repid.
      ENDMETHOD.                    "handle_top_of_page
      METHOD handle_top_of_list.
        WRITE: sy-repid.
      ENDMETHOD.                    "handle_top_of_list
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    START-OF-

  • Some problems about ALV

    hi everyone:
      I have a problem about ALV. The question is I want to show two headers in the gt_item .(Hierachy)
    I want to use these  in the event "change_fieldcatlog"
    LOOP AT I_FIELDCAT.
    CASE I_FIELDCAT-FIELDNAME
        WHEN 'MESSWERT'.
         I_FIELDCAT-ROW_POS = 1.
         I_FIELDCAT-SEL_L = '1111'.
         I_FIELDCAT-SEL_M = '1111'.
         I_FIELDCAT-SEL_S = '1111'.
        APPEND I_FIELDCAT.
    so I want to add another label in the next row. but I write like this below , it doesn't work .
         I_FIELDCAT-ROW_POS = 2
         I_FIELDCAT-SEL_L = text-004.
         I_FIELDCAT-SEL_M = text-004.
         I_FIELDCAT-SEL_S = text-004.
        APPEND I_FIELDCAT
    ENDCASE.
    ENDLOOP.
    So who can help me ?
    thank you in advacne .
    Regards
    Nick

    Hii Nick, in your program I found that you have created only one fieldcat structure, actually we need 2 structures one is for workarea and one for body.
    like this
    It_Fieldcat type SLIS_T_FIELDCAT_ALV
    Is_Fieldcat type SLIS_FIELDCAT_ALV
    now you can write the code
    LOOP AT It_FIELDCAT into Is_Fieldcat.
    CASE Is_FIELDCAT-FIELDNAME
    WHEN 'MESSWERT'.
    Is_FIELDCAT-ROW_POS = 1.
    Is_FIELDCAT-SEL_L = '1111'.
    Is_FIELDCAT-SEL_M = '1111'.
    Is_FIELDCAT-SEL_S = '1111'.
    APPEND Is_FIELDCAT to It_Fieldcat.
    clear Is_Fieldcat.
    Is_FIELDCAT-ROW_POS = 2
    Is_FIELDCAT-SEL_L = text-004.
    Is_FIELDCAT-SEL_M = text-004.
    Is_FIELDCAT-SEL_S = text-004.
    APPEND Is_FIELDCAT to It_Fieldcat.
    Clear Is_Fieldcat.
    Hope it will works.
    Reward points if helpful.

  • ALV Tree Hierarchy using OOPS

    Hi all,
    I have developed a program for ALV Tree Hierarchy using OOPs.I followed the SAP demo program.I am not able to get the values in the output.Please can anyone guide me where to correct my program. I am placing the entire code so that you all can also debug and see what is wrong.
    *& Report  ZZHIERARCHY_TEST1
    REPORT  zzhierarchy_test1.
    DATA : alv_container TYPE REF TO cl_gui_custom_container,
           alv_tree      TYPE REF TO cl_gui_alv_tree,
           gt_fcat          TYPE lvc_t_fcat,
           gt_vbrk TYPE vbrk OCCURS 0.                             "Output Table
    DATA : gs_hirarchy_header TYPE treev_hhdr.
    START-OF-SELECTION.
    END-OF-SELECTION.
      CALL SCREEN 9100.
    *&      Module  STATUS_9100  OUTPUT
    MODULE status_9100 OUTPUT.
      SET PF-STATUS 'ALV_TREE'.
      IF alv_container IS INITIAL.
        PERFORM tree_dev.
      ENDIF.
    ENDMODULE.                 " STATUS_9100  OUTPUT
    *&      Form  tree_dev
          text
    FORM tree_dev .
      DATA lv_container_name(20) TYPE c.
      lv_container_name = 'ALV_TREE'.
      CREATE OBJECT alv_container
        EXPORTING
          container_name              = lv_container_name
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CREATE OBJECT alv_tree
        EXPORTING
          parent                      = alv_container
          node_selection_mode         = cl_gui_column_tree=>node_sel_mode_single
          item_selection              = 'X'
          no_toolbar                  = ''
          no_html_header              = 'X'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7
          OTHERS                      = 8.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      PERFORM build_hirarchy_header CHANGING gs_hirarchy_header.
      PERFORM buid_fieldcatalog.
      CALL METHOD alv_tree->set_table_for_first_display
        EXPORTING
          is_hierarchy_header = gs_hirarchy_header
        CHANGING
          it_outtab           = gt_vbrk               "Table Must be Empty
          it_fieldcatalog     = gt_fcat.
      PERFORM create_hierarchy.
      CALL METHOD alv_tree->frontend_update.
    ENDFORM.                    " tree_dev
    *&      Form  build_hirarchy_header
         <--P_GS_HIRARCHY_HEADER  text
    FORM build_hirarchy_header  CHANGING p_gs_hirarchy_header TYPE treev_hhdr.
      p_gs_hirarchy_header-heading   =  'Company Code'(001).
      p_gs_hirarchy_header-tooltip   =  'Comapny Code'(002).
      p_gs_hirarchy_header-width     =   35.
      p_gs_hirarchy_header-width_pix =   ''.
    ENDFORM.                    " build_hirarchy_header
    *&      Form  buid_fieldcatalog
    FORM buid_fieldcatalog .
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
         i_structure_name             = 'VBRK'
        CHANGING
          ct_fieldcat                  = gt_fcat
       EXCEPTIONS
         inconsistent_interface       = 1
         program_error                = 2
         OTHERS                       = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT gt_fcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'NETWR'.
            ls_fcat-do_sum = 'X'.
            ls_fcat-h_ftype = 'MAX'.
        ENDCASE.
        MODIFY gt_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                    " buid_fieldcatalog
    *&      Form  create_hierarchy
    FORM create_hierarchy .
      DATA : lt_vbrk TYPE TABLE OF vbrk,
             ls_vbrk TYPE vbrk.
      DATA : top_key     TYPE lvc_nkey,
             company_key TYPE lvc_nkey,
             bzirk_key   TYPE lvc_nkey.
      DATA : lv_bukrs     TYPE bukrs,
             lv_bukrs_prv TYPE bukrs,
             lv_bzirk     TYPE bzirk,
             lv_bzirk_prv TYPE bzirk.
      SELECT * FROM vbrk INTO TABLE lt_vbrk UP TO 500 ROWS.
      SORT lt_vbrk BY bukrs .
      CALL METHOD alv_tree->add_node
        EXPORTING
          i_relat_node_key     = ''
          i_relationship       = cl_gui_column_tree=>relat_last_child
          i_node_text          = 'Company Code'
        IMPORTING
          e_new_node_key       = top_key
        EXCEPTIONS
          relat_node_not_found = 1
          node_not_found       = 2
          OTHERS               = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT lt_vbrk INTO ls_vbrk.
        lv_bukrs = ls_vbrk-bukrs .
        lv_bzirk = ls_vbrk-bzirk .
        IF lv_bukrs <> lv_bukrs_prv.
          lv_bukrs_prv =  lv_bukrs.
          PERFORM add_node USING lv_bukrs
                                 top_key
                        CHANGING company_key.
        ENDIF.
        IF lv_bzirk <> lv_bzirk_prv.
          lv_bzirk_prv = lv_bzirk.
          PERFORM add_posnr USING lv_bzirk
                                  company_key
                         CHANGING bzirk_key.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " create_hierarchy
    *&      Form  add_node
         -->P_LV_BUKRS  text
         -->P_TOP_KEY  text
         <--P_COMPANY_KEY  text
    FORM add_node  USING    p_lv_bukrs    TYPE bukrs
                            p_top_key     TYPE lvc_nkey
                   CHANGING p_company_key TYPE lvc_nkey .
      DATA: l_node_text TYPE lvc_value,
            ls_vbrk TYPE vbrk.
      l_node_text = 'Company' .
      CALL METHOD alv_tree->add_node
        EXPORTING
          i_relat_node_key     = p_top_key
          i_relationship       = cl_gui_column_tree=>relat_last_child
          is_outtab_line       = ls_vbrk
          i_node_text          = l_node_text
        IMPORTING
          e_new_node_key       = p_company_key
        EXCEPTIONS
          relat_node_not_found = 1
          node_not_found       = 2
          OTHERS               = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " add_node
    *&      Form  add_posnr
          text
         -->P_LV_POSNR  text
         -->P_COMPANY_KEY  text
         <--P_POSNR_KEY  text
    FORM add_posnr  USING    p_lv_bzirk    TYPE bzirk
                             p_company_key TYPE lvc_nkey
                    CHANGING p_bzirk_key   TYPE lvc_nkey.
      DATA ls_vbrk TYPE vbrk.
      CALL METHOD alv_tree->add_node
        EXPORTING
          i_relat_node_key     = p_company_key
          i_relationship       = cl_gui_column_tree=>relat_last_child
          is_outtab_line       = ls_vbrk
          i_node_text          = 'Sales District'
        IMPORTING
          e_new_node_key       = p_bzirk_key
        EXCEPTIONS
          relat_node_not_found = 1
          node_not_found       = 2
          OTHERS               = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " add_posnr
    *&      Module  USER_COMMAND_9100  INPUT
    MODULE user_command_9100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
      CALL METHOD alv_container->free.
      LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9100  INPUT

    Check this forum there are many threads on this.

  • A question about ALV subtotal

    Hello Expert,
    I have a question about ALV subtotal
    In my ALV output, there are three columns: SalesOrder, Item, Sales Volumn. Suppose there are following data in the ALV output
    SalesOrder   Item   Volumn
    123              10      100.00
    123              20      300.00
    456              10      200.00
    456              20      500.00
    What I want in the ALV outpu is as below:
    SalesOrder   Item   Volumn
    123              10      100.00
    123              20      300.00
                     subtotal  400.00
    456              10      200.00
    456              20      500.00
                     Subtotal 700.00
    Total                       1100.00
    Is this possible, and how can I achieve that result?
    Thanks & Regards, Johnny

    You can use sortinfo structure of ALV.
      Data:GT_SORT TYPE slis_t_sortinfo_alv.
      GTT_SORT-FIELDNAME = 'VBELN'.
      GTT_SORT-UP = 'X'.
      GTT_SORT-SUBTOT = 'X'.
      APPEND GTT_SORT TO GT_SORT.

  • How to  learn about ALV Grid?

    Hi Experts,
    I dont about ALV grid and how to implement it.So can anyone let me know how to implement the simple basic ALV grid with example?
    Please explain me with set by step procedure.
    Thanks a lot in Advance,
    Regards,
    Raghu

    hi,
    Process to create ALV with OOPs:
    Step 1:
    Create a container. There are 2 type of containers: docking and custom.
    Go to SE38.Create a program. Use Pattern button to create object for docking container. Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_docking and class as cl_gui_docking_contianer.
    Step 2:
    Create a grid inside the container.
    Use Pattern button to create the same. Make the parent of grid as container.
    Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_grid and class as cl_gui_alv_grid. Create object o_grid.
    Step 3:
    Call the function lvc_fieldcatalog_merge to get the field catalog.
    Pass the structure name.
    Step 4:
    Call the method of grid set_table_for_first_display to display the output.
    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as set_table_for_first_display.
    w_variant-report = sy-repid.
    Call method o_grid->set_table_for_first_display
    Step 5:
    Fill the internal table itab with values by using logic.
    select * from mara into table itab up to 100 rows.
    call screen 9000.
    Create a screen by double clicking 9000 in the above line. Fill the description for the screen. In the flow logic, uncomment the PBO and PAI module and create those in main program (for simplicity).
    Step 6:
    Create GUI status. Create GUI Title if required. That can be done by using display object List (CtrlShiftF5).Then in left side, right click the program and create GUI Status and Title.
    Step 7:
    Free the memory occupied once the BACK, EXIT or CANCEL button is clicked. Use Pattern button to call the method FREE of cl_gui_alv_grid and cl_gui_docking_container.
    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as Free.
    Similarly Click Call Method radio button. Give Instance as o_docking and Class/Interface as cl_gui_docking_container and Method as Free.
    Also follow these links.
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Hope this helps, Do reward.

  • What's it all about ALV?

    Dear All
    This fine day I have had a fair few questions about the ALV land on my
    doorstep, asking what articles were around. I have never found any good
    ones. The online help ranges from patchy and confusing to non-existant, and
    keeps bursting into German. I started off with the example in the "reporting
    made easy" book which scratches the surface, and then have progressed by
    trial and error.
    The chances of there being any meaningful documentation for an SAP function
    module tend to be inversely proportional to how useful it is. One trick I
    have found is that when it tells you "Documentation not available in
    language EN", log off and log back on in German. Go back to the function
    module and look again. Sometimes the documentation appears - in English. But
    more often than not it's not there at all.
    Anyway, back to the ALV:-
    The things I have discovered were how to
    change the name of fields
    add extra buttons to the toolbar at the top
    get a box with the users selections to appear when the report is
    printed
    have traffic lights say if a record is OK or not
    allow the user to enter the initial display variant on the front
    screen
    have the user name and date appear at the top of the report
    Here is a "Frankenstien's Monster" containing extracts of code from several
    reports, and re-arranged into a logical order. this doesn't do anything, but
    contains examples of how to do all sorts.
    report z-alv_a_sixpence.
    include z_alv_include.
    Internal Tables
    Selection Screen
    Parameter for the user to choose how the initial screen will be (vital
    for running big reports in background)
    SELECTION-SCREEN BEGIN OF BLOCK blk3 WITH FRAME TITLE text-003.
    PARAMETERS: p_vari LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK blk3.
    At Selection-Screen have a word with the display variant
    AT SELECTION-SCREEN.
    PERFORM check_variant.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    START-OF-SELECTION.
    END-OF-SELECTION.
    Build Field Catalogs (Begin)**************************
    PERFORM resetvalues.
    fieldcat_ln-key = 'X'.
    fieldcat_ln-hotspot = 'X'.
    PERFORM addfield USING '2' 'LIKP' 'WERKS'. "Plant
    PERFORM build_sortcat.
    ******Build Field Catalogs (End)*****************************
    ******Build Event Catalog (Begin)****************************
    PERFORM build_eventcat.
    PERFORM build_layout.
    ********Add a header at the top of the report *******
    PERFORM set_report_header USING w_list_top_of_page[].
    ********Start List Viewer
    PERFORM start_list_viewer.
    ******Start List Viewer (End)********************************
    *******Process Call Back Events (Begin)**************************
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
    CASE ucomm.
    WHEN '&IC1'.
    READ TABLE irepo INDEX selfield-tabindex.
    CHECK sy-subrc = 0.

    1. your listed programm below has an include (z_alv_include) which you
    didn't supply.
    2. have a look at the developement class 'SLIS' which contains manyexamples
    for ALV-programs.
    3. In BC405 one chapter is about reports with ALV.

  • Re : about ALV Reporting

    hi all,
       what are the events in alv reporting?
    Thanks in advance.

    Hi there
    If you read my post in the OO ABAP thread you should find an EASY way of generating your reports with all the functionality you need  EDIT, Data entry, double click,  create EXCEL spread sheet etc etc.
    I can't seem to get the thread ID  for a LINK but look for post entitled
    <b>For all users having probs with OO ALV Grid</b>  it's in the ABAP OBJECTS forum.
    If you follow the steps outlined there you'll be able to generate complex reports very quickly with minimal code and you won't have to do all the tedious FCAT building etc etc.
    The example there uses dynamic tables, and FCATS and the new RTTI (RunTime Information) functionality so your structure can be built FROM ANY ITAB --DDIC or not at run time.
    Your application program will then only need to be about 1 or 2 pages long.
    Copy the CLASS from that post and save it as an INCLUDE.
    Here's just a taster to show you how easy it is.
    This program reads 200 sales orders from VAPMA and displays it in a GRID
    If you double click on a cell transaction VA02 is called. After you leav VA02 the GRID table is updated with a 'C' in the sales order line where you doyble clicked.
    The Toolbar EXCEL will create an EXCEL spreadsheet directly with column headings etc where you can save the data as a file.
    Do these 2 things first
    Create a Blank Screen with a custom container on it called CCONTAINER 1. (SE51)
    (optional) create a STATUS (SE41) so you can have the standard SAP toolbar at the top of the SAP screen .
    Copy this program and the CLASS referred to in my post in the ABAP OBJECTS FORUM.
    Program  ZZORDERDISP.
    DEFINE col_name.
    read  table it_fldcat into  wa_it_fldcat index &1.
          wa_it_fldcat-coltext = &2.
          modify it_fldcat from wa_it_fldcat index &1.
    END-OF-DEFINITION.
    Jimbo 2007.
    FIELD-SYMBOLS :
      <fs1>           TYPE  ANY,
      <fs2>           TYPE  STANDARD TABLE,
      <fs3>           TYPE ANY,
      <field_catalog> TYPE STANDARD TABLE,
      <dyn_table>    TYPE  STANDARD TABLE,
      <orig_table>   TYPE  STANDARD TABLE,
      <dyn_field>,
      <dyn_wa>.
    <b>INCLUDE ZZJIMBOXX_INCL.  ===> copy the CLASS definition
    From my post in ABAP OBJECTS FORUM.</b>
    INCLUDE  <icon>.
    TABLES : VAPMA.
    TYPES:  BEGIN OF s_elements,
      vbeln   TYPE vapma-vbeln,
      posnr   TYPE vapma-posnr,
      matnr   TYPE vapma-matnr,
      kunnr   TYPE vapma-kunnr,
      werks   TYPE vapma-werks,
      vkorg   TYPE vapma-vkorg,
      vkbur   TYPE vapma-vkbur,
      status  TYPE c,
    END OF  s_elements.
    DATA:  z_object           TYPE REF TO zcl_dog,  "Instantiate our class
           grid_container1    TYPE REF TO cl_gui_custom_container,
           t_elements         TYPE TABLE OF s_elements, "refers to our ITAB
           wa_elements        TYPE s_elements,
           wa_dyn_table_line  TYPE REF TO DATA,
           it_fldcat          TYPE lvc_t_fcat,
           i_gridtitle        TYPE lvc_title,
           wa_it_fldcat       TYPE lvc_s_fcat,
           new_table          TYPE REF TO DATA,
           dy_table           TYPE REF TO data,
           dy_line            TYPE REF TO data,
           row_id             TYPE sy-index.
    START-OF-SELECTION.
    CALL SCREEN 100.
    END-OF-SELECTION.
    MODULE status_0100 OUTPUT.
    break-point 2.
    ASSIGN  wa_elements TO <fs1>.
    CREATE OBJECT z_object EXPORTING z_object = z_object.
    CALL METHOD z_object->build_dynamic_structures
            CHANGING it_fldcat = it_fldcat.
    Here before displaying you can change the field catalog to
    adjust your own names
    Method call just uses the names in the table structure.
       col_name 1 'Order Nr'.
       col_name 2 'Item'.
       col_name 3 'Material'.
       col_name 4 'Customer'.
       col_name 5 'Plant'.
       col_name 6 'Sales Org'.
       col_name 7 'Sales Office'.
       col_name 8 'Status'.
    PERFORM populate_dynamic_itab.
    CALL METHOD z_object->display_grid
           CHANGING it_fldcat = it_fldcat.
    SET PF-STATUS '0001'.
      SET TITLEBAR '000'.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'RETURN'.
          LEAVE PROGRAM.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.
    FORM populate_dynamic_itab.
    SELECT vbeln posnr matnr kunnr werks vkorg vkbur
           UP TO 200 rows
           FROM vapma
           INTO  CORRESPONDING FIELDS OF TABLE <dyn_table>.
    Populate Dynamic table  and save a copy
    create 2nd Dyn table to hold original data
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
             it_fieldcatalog = it_fldcat
          IMPORTING
             ep_table = dy_table.
       ASSIGN dy_table->* TO <orig_table>.
    CREATE DATA dy_line LIKE LINE OF <orig_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    <orig_table> = <dyn_table>.
    ENDFORM.
    FORM VERWERK.
    break-point 1.
    Orig table is in dynamic table <orig_table>
    ALV GRID changed table is in <dyn_table>.
    Loop at <orig_table>  into <dyn_wa>.
      Do what you want
    end
    endloop.
    ENDFORM.
    FORM refresh.
    data: ord_nr  TYPE vapma-vbeln.
    READ TABLE  <dyn_table> index row_id into wa_elements.
        ord_nr = wa_elements-vbeln.
    set parameter id 'AUN'  field ord_nr.
    CALL TRANSACTION  'VA02' AND SKIP FIRST SCREEN.
    wa_elements-status = 'C'.
    modify <dyn_table> from wa_elements index row_id.
    break-point 1.
    CALL METHOD z_object->refresh_grid.
    ENDFORM.
    form dubbleklik using
            e_row   type LVC_S_ROW
            e_column type LVC_S_col
            es_row_no type lvc_s_roid.
            break-point 1.
    Get Row id into a variable for this program.
             row_id =  e_row.
             SET TITLEBAR '001'.
            i_gridtitle = 'Grid Title Changed'.
            CALL METHOD  z_object->change_title
              EXPORTING i_gridtitle = i_gridtitle.
            PERFORM refresh.
    endform.
    That's it --code exactly as shown and it will work --you can have a lot of fun with the toolbar options including the excel spread sheet creation without usiing GUI download or whatever.
    Have fun -- and if you ever need to take more than about 5 mins to generate an ALV report in the future your Boss will be upset.
    Cheers
    Jimbo

  • ALV WebDynpro Hierarchy -Setting non-numeric values in the header level row

    Hi Experts,
    When setting up an ALV table as a table hierarchy the standard ALV settings only seem to allow for numeric values to be displayed in the higher hierarchy levels. Is there a way to also set the values for some non-numeric columns into these higher-level rows - programmatically or through the ALV Settings?
    Example: I have delivery item level data in my context and the delivery number as a hierarchy column. Some columns in my context however actually come from the delivery header e.g. delivery block, delivery priority, ship-to etc and I would like to display these in the collapsed header rows of the delivery number.
    It seems obvious to me that this should be doable otherwise if you are looking at at a list of hundreds of deliveries and all you see besides the delivery number is numeric data such as sums & totals, it's kind of hard to know which delivery you might want to expand the sub-level for.
    Please help,
    Peter

    Hi,
    Even we have faced the same issue.
    In ALV hierarchy, we cannot display data at header items/levels. this is a constraint in ALV. You can achieve the same usign TABLE UI element.

  • Mobile sales 5.0 documentation about BP group hierarchy

    Hi,
    I´m searching detailed documentation about mobile sale 5.0. I have already seen the help on line, but it is not containing any details on configurations steps neither on how some functionality is working.
    In particular I´d need to understand how the BP hierarchies are working in msa and if it is possible to distribute the nodes of the hierarchy depending on the BP on the laptop and not bulk. I´ve found tree replication obj: CAPGROUP_WRITE, GRPHIER_WRITE, GRPTREE_WRITE. In CRM 4.0, if I remember well, there were only the CAPGROUP_WRITE; so I cannot understand what are the differences between all of them and when they should be used.
    Does anybody have any documentation? Or know how they are working?
    Any input will be really appreciated.
    BR
    Camilla

    Hi,
    This link might contain the info. you are looking for:
    http://help.sap.com/SCENARIOS_BUS2005/helpdata/EN/BD/F7A942AD920C31E10000000A1550B0/content.htm
    Note: After you get to the page, click on the little 'synchronization' link (red right/left arrow). The overall help structure that contains this topic as well as other related configuration information appears.
    Thanks,
    - Kumar

  • ALV as Hierarchy with aggregation

    Hi
    I have 5 columns: H1, H2, H3, SUM1, SUM2
    For columns SUM1, SUM2:
    lo_field = lo_value->if_salv_wd_field_settings~get_field( <fs_col>-id ).
    lo_field->if_salv_wd_aggr~create_aggr_rule( ).
    lo_aggr_rule = lo_field->if_salv_wd_aggr~get_aggr_rule(  ).
    lo_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
    For columns H1, H2, H3:
    <fs_col>-r_column->if_salv_wd_column_hierarchy~set_hierarchy_column( value = abap_true ).
    If i create sort rule for H1,H2,H3 hierarchy automatic sort is broken.
    How i can create aggregation on Hierarchy ALV?

    hi arjun,
    it still doesn't work. when i debug it, the system sets the column hierarchy "false"...
    the code is like this now:
      DATA:
            l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
            l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
            l_value TYPE REF TO cl_salv_wd_config_table.
      l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
      l_value = l_ref_interfacecontroller->get_model( ).
    *  cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
    *    r_model = l_value ).
      l_value->if_salv_wd_std_functions~set_hierarchy_allowed( abap_true ).
      l_value->if_salv_wd_table_settings~set_display_type(
      if_salv_wd_c_table_settings=>display_type_hierarchy ).
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'CNOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'STOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      l_value->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).

  • Alv three hierarchy

    hello everyone,
    I want to out put to alv list with three hierarchy,is there any way to solve this problem?
    for example:
    1.CAUFV-AUFNR                                     CAUFV-PLNBEZ
    2.AFVC-VORNR       CRHD-ARBPL          AFVC-LTXA1
    3.RESB-MATNR      RESB-BDMNG         RESB-MEINS
    AND AT NEW AUFNR SUM.
    thanks a million1
    regards
    davidzhang.

    Hi,
    for this requirement, best you should go to Tree alv.
    Check the below links for alv Tree.
    [http://www.****************/Tutorials/ALV/ALVTreeDemo/demo.htm|http://www.****************/Tutorials/ALV/ALVTreeDemo/demo.htm]
    DWDM -  transaction for sample/demo programs for controls
    check the below example program are in se38
    BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
    BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
    BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
    BCALV_TEST_SIMPLE_TREE         Program BCALV_TEST_SIMPLE_TREE
    BCALV_TREE_01                  ALV Tree Control: Build Up the Hierarchy Tree
    BCALV_TREE_02                  ALV Tree Control: Event Handling
    BCALV_TREE_03                  ALV Tree Control: Use an Own Context Menu
    BCALV_TREE_04                  ALV Tree Control: Add a Button to the Toolbar
    BCALV_TREE_05                  ALV Tree Control: Add a Menu to the Toolbar
    BCALV_TREE_06                  ALV tree control: Icon column and icon for nodes/items
    BCALV_TREE_DEMO                Demo for ALV tree control
    BCALV_TREE_DND                 ALV tree control: Drag & Drop within a hierarchy tree
    BCALV_TREE_DND_MULTIPLE        ALV tree control: Drag & Drop within a hierarchy tree
    BCALV_TREE_EVENT_RECEIVER      Include BCALV_TREE_EVENT_RECEIVER
    BCALV_TREE_EVENT_RECEIVER01
    BCALV_TREE_ITEMLAYOUT          ALV Tree: Change Item Layouts at Runtime
    BCALV_TREE_MOVE_NODE_TEST      Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO         Program BCALV_TREE_SIMPLE_DEMO
    BCALV_TREE_VERIFY              Verifier for ALV Tree and Simple ALV Tree
    Regards,
    SB

  • Webdynpro ALV Tree hierarchy N

    Hi Experts ,
    Can you tell me how to use ALV tree to list the NOT flat data?
    1
    ***1-1
    ******1-1-1
    ******1-1-2
    ***1-2
    ******1-2-1
    ******1-2-2
    ***1-3
    2
    3
    I will very appreciate if you can give me an example!
    Karl.
    Edited by: Karl Li on Jun 13, 2010 11:43 AM

    Hello,
    thranks for your information.
    I have a column in my table with the name 'Level', which has values as following:
    1.1; 1.1.0; 1.1.1 .... 2.1; 2.2; 2.2.1  etc.
    This means that I want to specify one column as hierarchy column depending on the value. If I just follow the steps of the tutorial above. There is only one hiearchy in the ALV table.
    Do you have any idea, how to implement it? Many thanks!
    Regards
    meer

Maybe you are looking for

  • Global exception handling (Web Applications)

    Hi, I want to capture all run time exceptions and store them into a log file. I have used uncaught error event handler for catching all such run time exceptions. Application has various components and I have manualy introduced few run time exceptions

  • Allocated Heap v.s. Max Heap and OutOfMemoryError

    In my application, I specify heap size like following: -Xms384m -Xmx384m I got few OOME error recently. From our monitoring tool, I can see the 'allocated heap' was only about 280 - 340MB range when OOME happened. That means that the used heap size w

  • Strange problem with SQL-Statement

    Hi guys, i encountered a strange problem trying to execute a statement like this: Insert Into Data Set Text = 'Exception-Type: {0} Message: {1}'; I'm using createStatement and executeUpdate. But the message stored looks like: Exception-Type: 0{} Mess

  • QM Tables

    Hi, In QM i want to check the material whether its a quantitative or Qualitative. I used qpmk table i passed mat insp characteriastic(MKMNR) = 'CHL01', How i can get wether its a QA or QL? And one more issue is in QA32 after click on isp result TAB,

  • One View Cart Button for Header

    Hello,I created a view cart button and copied the text link. However, it an additional item to the cart everytime the view cart button is clicked. I need one generic view cart button for my header that will only open the shopping cart page, without h