Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Hierarchical ALV

Former Member
0 Kudos
622

hi experts,

can any body solve my programme


TABLES: LFA1,EKKO.

DATA: BEGIN OF ITAB OCCURS 0,
      LIFNR LIKE LFA1-LIFNR,
      NAME1 LIKE LFA1-NAME1,
      ORT01 LIKE LFA1-ORT01,
      LAND1 LIKE LFA1-LAND1,
      REGIO LIKE LFA1-REGIO,
      SORTL LIKE LFA1-SORTL,
      END OF ITAB.

DATA: JTAB LIKE EKKO OCCURS 0 WITH HEADER LINE.

SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 30 ROWS.
SELECT * FROM EKKO INTO TABLE JTAB UP TO 30 ROWS.

TYPE-POOLS: SLIS.

DATA: HEADER TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
      FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
      LAYOUT TYPE SLIS_LAYOUT_ALV,
      KINFO TYPE SLIS_KEYINFO_ALV,
      EVENT TYPE SLIS_T_EVENT WITH HEADER LINE.

LAYOUT-ZEBRA = 'X'.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

KINFO-HEADER01 = 'LIFNR'.
KINFO-ITEM01 = 'LIFNR'.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
 EXPORTING
   I_LIST_TYPE           = 0
 IMPORTING
   ET_EVENTS             = EVENT[]
 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 EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY EVENT TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
 EXPORTING
   I_PROGRAM_NAME               = SY-REPID
   I_INTERNAL_TABNAME           = 'ITAB'
*   I_STRUCTURE_NAME             = 'lfa1'
*   I_CLIENT_NEVER_DISPLAY       = 'X'
*   I_INCLNAME                   = SY-REPID
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
  CHANGING
    CT_FIELDCAT                  = FLDCAT
* 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.

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        = ' '
   IS_LAYOUT                      = LAYOUT
   IT_FIELDCAT                    = FLDCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   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                      = EVENT[]
*   IT_EVENT_EXIT                  =
    I_TABNAME_HEADER               = 'ITAB'
    I_TABNAME_ITEM                 = 'JTAB'
   I_STRUCTURE_NAME_HEADER        = 'LFA1'
   I_STRUCTURE_NAME_ITEM          = 'EKKO'
    IS_KEYINFO                     = KINFO
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                =
*   IR_SALV_HIERSEQ_ADAPTER        =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    T_OUTTAB_HEADER                = ITAB[]
    T_OUTTAB_ITEM                  = JTAB[]
* 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.

FORM TOP_OF_PAGE.
REFRESH HEADER.
HEADER-TYP = 'H'.
HEADER-INFO = 'VENDORS & PURCHASE DOC DETAILS'.
APPEND HEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    IT_LIST_COMMENTARY       = HEADER[]
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
          .
ENDFORM.

16 REPLIES 16
Read only

Former Member
0 Kudos
591

hi chandu,

kindly let me know what is your problem, what i mean is, what expection you are getting when you run the code.

regards,

Pavan

Read only

0 Kudos
591

it is giving runtime errors,while executing the prg.

Read only

Former Member
0 Kudos
591

hi,

Normally in heirarchical report u will get out put as tree manner.

first hedaer details u have to take as key then as per header values u will get item details .......

first that key value u have to append then that key information u have to pass that

HIRSEQ_LIST_DISPLAY function module..

reward me if it is use full answer..

praveen

Read only

Former Member
0 Kudos
591

hi,

here no fieldcat generated so error coming

Read only

Former Member
0 Kudos
591

HI,

it is working fine 4.7 version.

i don't know what is the problem in 5.0 and 6.0.

rgds,

bharat.

Read only

former_member221770
Contributor
0 Kudos
591

Hi Chandu,

I have just tested your program. The issue here is that your fieldcatalog is empty. Try defining ITAB as a data dictionary structure (via SE11) and then passing it to the I_STRUCTURE_NAME parameter in REUSE_ALV_FIELDCATALOG_MERGE.

You should also have some EKKO (JTAB) fields in the fieldcatalog, otherwise there is no need to use the Hierarchy List Display.

Hope this helps.

Pat.

Read only

0 Kudos
591

Hi,

thanks for ur help,but i didn't get u,can u give indetailed explanation or code.

thank you

Read only

0 Kudos
591

HI,

define itab like below.and noe see the code.

TABLES:LFA1,EKKO.

SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.

DATA:ITAB LIKE LFA1 OCCURS 0 WITH HEADER LINE.

DATA:JTAB LIKE EKKO OCCURS 0 WITH HEADER LINE.

SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF

TABLE ITAB WHERE LIFNR IN LIFNR.

SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF

TABLE JTAB WHERE LIFNR IN LIFNR.

TYPE-POOLS:SLIS.

DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA:KINFO TYPE SLIS_KEYINFO_ALV.

DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.

DATA:HEAD TYPE SLIS_T_LISTHEADER WITH HEADER LINE.

LAYOUT-ZEBRA = 'X'.

LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

LAYOUT-WINDOW_TITLEBAR = 'VENDORS AND PURCHASE DOCCUMENTS DETAILS'.

KINFO-HEADER01 = 'LIFNR'.

KINFO-ITEM01 = 'LIFNR'.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = EVE[]

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 EVE WITH KEY NAME = 'TOP_OF_PAGE'.

EVE-FORM = 'TOPOFPAGE'.

MODIFY EVE TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = SY-REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = 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.

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 = ' '

IS_LAYOUT = LAYOUT

IT_FIELDCAT = FCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 5

  • I_SCREEN_START_LINE = 5

  • I_SCREEN_END_COLUMN = 120

  • I_SCREEN_END_LINE = 25

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = EVE[]

  • IT_EVENT_EXIT =

I_TABNAME_HEADER = 'ITAB'

I_TABNAME_ITEM = 'JTAB'

I_STRUCTURE_NAME_HEADER = 'LFA1'

I_STRUCTURE_NAME_ITEM = 'EKKO'

IS_KEYINFO = KINFO

  • 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 = ITAB[]

T_OUTTAB_ITEM = JTAB[]

  • 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.

FORM TOPOFPAGE.

REFRESH HEAD.

HEAD-TYP = 'H'.

HEAD-INFO = 'VENDORS & PURCHASE DOCC. DETAILS'.

APPEND HEAD.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = HEAD[]

  • I_LOGO = ' '

  • I_END_OF_LIST_GRID =

.

ENDFORM.

rgds,

bharat.

Read only

0 Kudos
591

Hi, thank you

i got the ouput.but can u explain wt is hierarchical alv,i heard several definitions but i didn't get the full idea.

Read only

0 Kudos
591

Chandru,

Simply cut and paste either Bharat's or my code into your system and run the report. Hierarchy ALV should be faily self explainatory - in your report you do not have the "header and item" relationship working properly as you are displaying ITAB but not displaying any data from JTAB. This is because your field catalog is only referencing ITAB data. As I said in my earlier post the fieldcatalog controls what data is displayed - see the comments in my program or read the Function Module help under REUSE_ALV_LIST_DISPLAY.

Here's a quick explaination of my program:

Report gets 2 internal tables, TBL_VBAK and TBL_VBAP. TBL_VBAK is the Sales Order Header while TBL_VBAP is the Sales Order Item. This means that for each record in TBL_VBAK there is one or more associated records in TBL_VBAP.

Because of this 1 to many relationship if we were to display this data (both VBAK and VBAP) using REUSE_ALV_LIST_DISPLAY, we would have the VBAK data being repeated multiple times for each VBAP record.

By using REUSE_ALV_HIERSEQ_LIST_DISPLAY it allows us to normalise our table into a header and item table and then display the data in a more logical manner.

Hope this clarifies the situation for you.

Pat.

Read only

former_member221770
Contributor
0 Kudos
591

Chandu,

Go to SE11 and create a new Structure (lets call it ZTEST). Within this structrue define the fields you plan to use in ITAB (lifnr, name1, etc...).

Now save and activste this structure in SE11.

In your FM call to REUSE_ALV_FIELDCATALOG_MERGE, pass "ZTEST" in the I_STRUCTURE_NAME parameter.

What this will do is create a field catalog (FLD_CAT) based on the contents of ZTEST.

Hope this makes sense.

Pat.

Read only

0 Kudos
591

Hi

thank you

i got the output,but i hv one more doubt,is this full code,wt i hv given for hierarchical alv report,just tl me abt "heirarchical alv".wt is it hw is the output it displays etc....

Read only

0 Kudos
591

Chandu,

Hierarchy ALV is used to display "Header and Item" lists. eg. Sales Order Header and Item where VBAK is header and VBAP is item with the relationship being VBELN.

In your example, you have only included LFA1 data in your fieldcatalog. You see the fieldcatalog tells the Fm which fields and more importantly, from which Internal Tables the data is sourced from. Personally I don't use REUSE_ALV_FIELDCATALOG_MERGE but rather build my own fieldcatalog.

Here is a sample ALV Hierarchy Program I have writte:


* This program is an example of how the ALV Hierarchy Display works.
* It will display a sales order and it's associated line items

REPORT  zpat2.
************************************************************************
* Types
************************************************************************
TYPE-POOLS: kkblo.

************************************************************************
* Database Tables
************************************************************************
TABLES: vbak, vbap.

************************************************************************
* Structures
************************************************************************
DATA: st_fieldcat TYPE slis_fieldcat_alv.
DATA: st_keyinfo TYPE slis_keyinfo_alv.
DATA: st_sort TYPE slis_sortinfo_alv.
DATA: st_layout TYPE slis_layout_alv.
************************************************************************
* Internal tables
************************************************************************
DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.

DATA: tbl_sort TYPE slis_t_sortinfo_alv.

DATA: BEGIN OF tbl_header OCCURS 0.
        INCLUDE STRUCTURE vbak.
DATA: END OF tbl_header.

DATA: BEGIN OF tbl_item OCCURS 0.
        INCLUDE STRUCTURE vbap.
DATA: END OF tbl_item.
************************************************************************
* Constants
************************************************************************
CONSTANTS: c_y VALUE 'X'. "Yes
CONSTANTS: c_n VALUE ' '. "No

************************************************************************
* Simple Variables
************************************************************************
DATA: field_name(30) TYPE c,
      g_repid        like sy-repid.

************************************************************************
* Selection Screen
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK sel_options WITH FRAME TITLE text-tt1.
SELECT-OPTIONS s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN END OF BLOCK sel_options.

************************************************************************
* Start of Selection
************************************************************************
START-OF-SELECTION.

* Get the Report ID
  g_repid = sy-repid.

* Select data from the Sales Document Header Table
  SELECT * FROM vbak INTO TABLE tbl_header
    WHERE vbeln IN s_vbeln.

* Select the relevant Sales Document Item data
  SELECT * FROM vbap INTO TABLE tbl_item
    FOR ALL ENTRIES IN tbl_header
    WHERE vbeln = tbl_header-vbeln.

************************************************************************
* End of Selection
************************************************************************
END-OF-SELECTION.

  PERFORM get_keyinfo.

  PERFORM get_layout.

  PERFORM get_sort.

  PERFORM get_fieldcat.

  PERFORM create_report.

*&---------------------------------------------------------------------*
*&      Form  get_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_fieldcat.
* Here the field catalog is created. To display more fields simply
* 'uncomment' the additional lines and add the field name. Also note
* that the field catalog is much more powerful than this. You can
* intensify fields, change the colour, assign reference fields, etc.
* Look at type slis_fieldcat_alv for more options.

* Header
  PERFORM write_fieldcat USING 'VBELN' 'TBL_HEADER' 'VBAK' c_y 1
                               c_n c_y c_n c_n.
  PERFORM write_fieldcat USING 'ERDAT' 'TBL_HEADER' 'VBAK' c_n 2
                               c_n c_n c_n c_y.
  PERFORM write_fieldcat USING 'AUDAT' 'TBL_HEADER' 'VBAK' c_n 3
                               c_n c_n c_n c_n.
  PERFORM write_fieldcat USING 'VBTYP' 'TBL_HEADER' 'VBAK' c_n 4
                               c_n c_n c_n c_n.
  PERFORM write_fieldcat USING 'WAERK' 'TBL_HEADER' 'VBAK' c_n 5
                                 c_n c_n c_n c_n.
  PERFORM write_fieldcat USING 'VKBUR' 'TBL_HEADER' 'VBAK' c_n 6
                                 c_n c_n c_n c_y.
*  perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 7.
*  perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 8.
*  perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 9.
*  perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 10.

* Item
  PERFORM write_fieldcat USING 'POSNR' 'TBL_ITEM' 'VBAP' c_y 1
                                 c_n c_n c_n c_n.
  PERFORM write_fieldcat USING 'MATNR' 'TBL_ITEM' 'VBAP' c_n 2
                                 'C411' c_n c_n c_n.
  PERFORM write_fieldcat USING 'NETPR' 'TBL_ITEM' 'VBAP' c_n 3
                                 'C300' c_n c_y c_n.
  PERFORM write_fieldcat USING 'PRCTR' 'TBL_ITEM' 'VBAP' c_n 4
                                 c_n c_n c_n 'X'.
  PERFORM write_fieldcat USING 'GSBER' 'TBL_ITEM' 'VBAP' c_n 5
                                 c_n c_n c_n 'X'.
  PERFORM write_fieldcat USING 'WERKS' 'TBL_ITEM' 'VBAP' c_n 6
                                 c_n c_n c_n 'X'.
  PERFORM write_fieldcat USING 'AUFNR' 'TBL_ITEM' 'VBAP' c_n 7
                                 'C611' c_n c_n c_n.
*  perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 8.
*  perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 9.
*  perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 10.
*  perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 11.
*  perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 12.

ENDFORM.                    " get_fieldcat
*&---------------------------------------------------------------------*
*&      Form  write_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->name   Field name
*      -->tab    Table name
*      -->st     Structure Name
*      -->key    Is this field a Key?
*      -->pos    Position Number
*      -->emp    Emphasize
*      -->hot    Hotspot
*      -->sum    Do_sum
*      -->hide   No_out
*----------------------------------------------------------------------*
FORM write_fieldcat USING    name tab st key pos emp hot sum hide.

  st_fieldcat-fieldname = name.
  st_fieldcat-tabname = tab.
  st_fieldcat-ref_tabname = st.
  st_fieldcat-key = key.
  st_fieldcat-col_pos = pos.
  st_fieldcat-emphasize = emp.
  st_fieldcat-hotspot = hot.
  st_fieldcat-do_sum = sum.
  st_fieldcat-no_out = hide.
  APPEND st_fieldcat TO tbl_fieldcat.
  CLEAR st_fieldcat.

ENDFORM.                    " write_fieldcat
*&---------------------------------------------------------------------*
*&      Form  create_report
*&---------------------------------------------------------------------*
*       Hummmm I wonder what this subroutine does?
*----------------------------------------------------------------------*
FORM create_report.

* Here we call the Function Module to create the Hierarchical
* Sequential List

  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
     i_interface_check              = ' '
     i_callback_program             = g_repid
     i_callback_user_command        = 'PROCESS_USER_COMMANDS'
     is_layout                      = st_layout
     it_fieldcat                    = tbl_fieldcat
     it_sort                        = tbl_sort
     i_default                      = 'X'
     i_save                         = 'A'
     is_variant                     = ' '
      i_tabname_header               = 'TBL_HEADER'
      i_tabname_item                 = 'TBL_ITEM'
      is_keyinfo                     = st_keyinfo
    TABLES
      t_outtab_header                = tbl_header
      t_outtab_item                  = tbl_item
   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.                    " create_report
*&---------------------------------------------------------------------*
*&      Form  get_keyinfo
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_keyinfo.

* This defines the "link" between the "header" and "item" tables

  st_keyinfo-header01 = 'VBELN'.

ENDFORM.                    " get_keyinfo
*&---------------------------------------------------------------------*
*&      Form  get_sort
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_sort.

* Here we sort the report by the Document Number...why not?

  REFRESH tbl_sort.
  CLEAR st_sort.
  st_sort-spos = 1.
  st_sort-fieldname = 'VBELN'.
  st_sort-up = 'X'.
  APPEND st_sort TO tbl_sort.

ENDFORM.                    " get_sort



*---------------------------------------------------------------------*
*       FORM process_user_commands                                    *
*---------------------------------------------------------------------*
*       Interactive Reporting commands
*---------------------------------------------------------------------*
*  -->  SYST-UCOMM                                                    *
*  -->  SELFIELD                                                      *
*---------------------------------------------------------------------*
FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                 selfield TYPE slis_selfield.

* This subroutine is called when there is user interaction in the output
* In this case if the user double clicks the Document Number then the
* program will call transaction VA03 and display the Sales Document

  CASE syst-ucomm.
    WHEN '&IC1'.
      GET CURSOR FIELD field_name.
      IF field_name = 'TBL_HEADER-VBELN'.
        READ TABLE tbl_header INDEX selfield-tabindex.
        CHECK tbl_header-vbeln NE 0.
        SET PARAMETER ID 'AUN' FIELD tbl_header-vbeln.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDIF.
    WHEN OTHERS.
  ENDCASE.

ENDFORM.                  "process_user_commands
*&---------------------------------------------------------------------*
*&      Form  get_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_layout.
* Here we manipulate the layout of the list. In this instance we are
* giving the list a 'zebra' format. Once again like the field catalog
* there are many more options available. Look at type slis_layout_alv
* for more options.

  CLEAR st_layout.
  st_layout-zebra = 'X'.

ENDFORM.                    " get_layout

Read only

0 Kudos
591

HI,

see my code.i have modified it .it is working fine.

hierarchial sequential list display will show all the records from first(header) table,the corresponding item records(based on keyinfo,in this case the lifnr from lfa1 and ekko are equal) will be shown below that particular header record.

eg:

vendor1 details.......

ebeln1

ebeln2

vendor2 details.......

ebeln5

vendor3 details.......

vendor4 details.......

ebeln6

ebeln7

ebeln8

....(like this)

rgds,

bharat.

Read only

Former Member
0 Kudos
591

i think in your reuse_alv_fieldcatalog_merge fm you should uncomment that <b>bold</b> line. It may work.

If it is not working then you can try to build fieldcatalog manually.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME = 'lfa1'

  • I_CLIENT_NEVER_DISPLAY = 'X'

<b> I_INCLNAME = SY-REPID</b>

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = FLDCAT

  • 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.

regards

shiba dutta

Read only

Former Member
0 Kudos
591

hi chandu,

may i know what problem you are facing here exactly?