Hierarchial ALV
Hi Friends,
I have created a Hierarchial ALV report using OOP concept (Class Builder). The output is OK but it is displaying the unwanted columns in the header part.
The code written is as follows.
=====================================================
data: gt_zsd_abcd type zsd_abcd occurs 0, "Output-Table
data l_hierarchy_header type treev_hhdr.
perform build_hierarchy_header changing l_hierarchy_header.
call method g_alv_tree->set_table_for_first_display
exporting
i_structure_name = 'zsd_abcd'
is_hierarchy_header = l_hierarchy_header
changing
it_outtab = gt_zsd_abcd. "table must be empty !
perform create_hierarchy.
call method g_alv_tree->frontend_update.
=====================================================
I would like know as to how to display only the required columns in the header part.
Pls guide me.
TIA.
Regards,
Mark K
in the changing parameter you have to pass a fieldcatalog conaining only those columns you want to display .
call method g_alv_tree->set_table_for_first_display
exporting
i_structure_name = 'zsd_abcd'
is_hierarchy_header = l_hierarchy_header
changing
it_outtab = gt_zsd_abcd. "table must be empty !
it_fieldcatalog = gt_fieldcat_lvc[].
you can fill the catalog like this :
FORM zf_create_fieldcat.
DATA ls_fieldcat TYPE lvc_s_fcat.
Main Asset Number
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ANLN1'.
ls_fieldcat-ref_table = 'ANLA'.
ls_fieldcat-no_out = 'X'.
ls_fieldcat-key = ''.
APPEND ls_fieldcat TO gt_fieldcat_lvc.
Asset Subnumber
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ANLN2'.
ls_fieldcat-ref_table = 'ANLA'.
ls_fieldcat-no_out = 'X'.
ls_fieldcat-key = ''.
APPEND ls_fieldcat TO gt_fieldcat_lvc.
Assigned to WBS
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'XLOEV'.
ls_fieldcat-ref_table = 'ANLA'.
ls_fieldcat-coltext = 'Assigned to WBS'(003).
ls_fieldcat-tooltip = ls_fieldcat-coltext.
ls_fieldcat-seltext = ls_fieldcat-coltext.
ls_fieldcat-outputlen = '3'.
APPEND ls_fieldcat TO gt_fieldcat_lvc.
Value
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'URWRT'.
ls_fieldcat-ref_table = 'ANLA'.
ls_fieldcat-coltext = 'Value'(004).
ls_fieldcat-tooltip = ls_fieldcat-coltext.
ls_fieldcat-seltext = ls_fieldcat-coltext.
APPEND ls_fieldcat TO gt_fieldcat_lvc.
Asset description
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'TXT50'.
ls_fieldcat-ref_table = 'ANLA'.
APPEND ls_fieldcat TO gt_fieldcat_lvc.
ENDFORM. " ZF_CREATE_FIELDCAT
Similar Messages
-
How to display 3 level hierarchy alv report using SALV
Hi ,
I need to display a Hierarchy ALV report with 3 level.I thought of trying CL_SALV_HIERSEQ_TABLE but i am able to display only two level report.
How can i display the 3 - level heirarchy report using SALV. I don't want to use SALV_TREE.
Regards,
Aditya Tanguturi.Hi Aditya,
Please check this thread
Is it possible to display more than 2 levels us... | SCN
Thanks !
Amit -
Hi Friends,
I have created a Hierarchial ALV report using OOP concept (Class Builder). The output is OK but it is displaying the unwanted columns in the header part.
The code written is as follows.
=====================================================
REPORT ZMMSTKH.
DATA: G_ALV_TREE TYPE REF TO CL_GUI_ALV_TREE,
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: GT_ZSD_BILLINFO TYPE ZSD_BILLINFO OCCURS 0, "Output-Table
OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM, "OK-Code
G_MAX TYPE I VALUE 255.
DATA CCONTAINER1.
DATA LS_FIELDCAT TYPE LVC_S_FCAT.
DATA GT_FIELDCAT_LVC TYPE LVC_S_FCAT OCCURS 0.
DATA IT_FIELDCATALOG TYPE LVC_S_FCAT OCCURS 0.
END-OF-SELECTION.
CALL SCREEN 100.
*& Module PBO OUTPUT
process before output
MODULE PBO OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAINTITLE'.
IF G_ALV_TREE IS INITIAL.
PERFORM INIT_TREE.
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
IF SY-SUBRC NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'Automation Queue failure'(801)
TXT1 = 'Internal error:'(802)
TXT2 = 'A method in the automation queue'(803)
TXT3 = 'caused a failure.'(804).
ENDIF.
ENDIF.
ENDMODULE. " PBO OUTPUT
*& Module PAI INPUT
process after input
MODULE PAI INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
PERFORM EXIT_PROGRAM.
WHEN OTHERS.
CALL METHOD CL_GUI_CFW=>DISPATCH.
ENDCASE.
CALL METHOD CL_GUI_CFW=>FLUSH.
ENDMODULE. " PAI INPUT
*& Form init_tree
text
--> p1 text
<-- p2 text
FORM INIT_TREE.
DATA: L_TREE_CONTAINER_NAME(30) TYPE C.
L_TREE_CONTAINER_NAME = 'CCONTAINER1'(001).
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = L_TREE_CONTAINER_NAME
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
IF SY-SUBRC <> 0.
MESSAGE X208(00) WITH 'ERROR'(100).
ENDIF.
CREATE OBJECT G_ALV_TREE
EXPORTING
PARENT = G_CUSTOM_CONTAINER
NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_SINGLE
ITEM_SELECTION = 'X'
NO_HTML_HEADER = 'X'
NO_TOOLBAR = ''
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.
IF SY-SUBRC <> 0.
MESSAGE X208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
DATA L_HIERARCHY_HEADER TYPE TREEV_HHDR.
PERFORM BUILD_HIERARCHY_HEADER CHANGING L_HIERARCHY_HEADER.
PERFORM ZF_CREATE_FIELDCAT.
CALL METHOD G_ALV_TREE->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'zsd_billinfo'
IS_HIERARCHY_HEADER = L_HIERARCHY_HEADER
CHANGING
IT_OUTTAB = GT_ZSD_BILLINFO. "table must be empty !
IT_FIELDCATALOG = GT_FIELDCAT_LVC[].
PERFORM CREATE_HIERARCHY.
CALL METHOD G_ALV_TREE->FRONTEND_UPDATE.
ENDFORM. " init_tree
*& Form build_hierarchy_header
FORM BUILD_HIERARCHY_HEADER CHANGING
P_HIERARCHY_HEADER TYPE TREEV_HHDR.
P_HIERARCHY_HEADER-HEADING = 'Region / Material'(300).
p_hierarchy_header-tooltip = 'PO No'(400).
P_HIERARCHY_HEADER-WIDTH = 30.
P_HIERARCHY_HEADER-WIDTH_PIX = ' '.
ENDFORM. " build_hierarchy_header
*& Form exit_program
free object and leave program
FORM EXIT_PROGRAM.
CALL METHOD G_CUSTOM_CONTAINER->FREE.
LEAVE PROGRAM.
ENDFORM. " exit_program
*& Form create_hierarchy
text
--> p1 text
<-- p2 text
FORM CREATE_HIERARCHY.
DATA: LS_ZSD_BILLINFO TYPE ZSD_BILLINFO,
LT_ZSD_BILLINFO TYPE ZSD_BILLINFO OCCURS 0,
l_bukrs like zsd_billinfo-bukrs,
l_vbeln like zsd_billinfo-vbeln,
l_fkdat like zsd_billinfo-fkdat,
l_fkart like zsd_billinfo-fkart,
l_vkorg like zsd_billinfo-vkorg,
l_spart like zsd_billinfo-spart,
L_BZIRK LIKE ZSD_BILLINFO-BZIRK,
L_BZIRK_LAST LIKE ZSD_BILLINFO-BZIRK,
l_vkbur like zsd_billinfo-vkbur,
L_WERKS LIKE ZSD_BILLINFO-WERKS,
L_WERKS_LAST LIKE ZSD_BILLINFO-WERKS,
L_MATNR LIKE ZSD_BILLINFO-MATNR,
L_MATNR_LAST LIKE ZSD_BILLINFO-MATNR,
L_FKIMG LIKE ZSD_BILLINFO-FKIMG,
L_NETWR LIKE ZSD_BILLINFO-NETWR.
DATA: L_BUKRS_KEY TYPE LVC_NKEY,
L_BZIRK_KEY TYPE LVC_NKEY,
L_WERKS_KEY TYPE LVC_NKEY,
L_MATNR_KEY TYPE LVC_NKEY,
l_vbeln_key type lvc_nkey,
L_LAST_KEY TYPE LVC_NKEY.
SELECT BUKRS BZIRK WERKS MATNR FKIMG FROM ZSD_BILLINFO
INTO CORRESPONDING FIELDS OF
TABLE LT_ZSD_BILLINFO
WHERE SPART = 'CT' AND
FKART = 'ZVAT'.
select * from zsd_billinfo into table lt_zsd_billinfo
where spart = 'CT' and
fkart = 'ZVAT'.
SORT LT_ZSD_BILLINFO BY BZIRK WERKS MATNR.
LOOP AT LT_ZSD_BILLINFO INTO LS_ZSD_BILLINFO.
L_BZIRK = LS_ZSD_BILLINFO-BZIRK.
L_WERKS = LS_ZSD_BILLINFO-WERKS.
L_MATNR = LS_ZSD_BILLINFO-MATNR.
IF L_BZIRK <> L_BZIRK_LAST.
L_BZIRK_LAST = L_BZIRK.
PERFORM ADD_BZIRK USING L_BZIRK
CHANGING L_BZIRK_KEY.
CLEAR L_WERKS_LAST.
ENDIF.
IF L_WERKS <> L_WERKS_LAST.
L_WERKS_LAST = L_WERKS.
PERFORM ADD_WERKS_LINE USING LS_ZSD_BILLINFO
L_WERKS_KEY
CHANGING L_WERKS_KEY.
IF L_MATNR <> L_MATNR_LAST.
L_MATNR_LAST = L_MATNR.
PERFORM ADD_MATNR_LINE USING LS_ZSD_BILLINFO
L_MATNR_KEY
CHANGING L_MATNR_KEY.
ENDIF.
PERFORM ADD_COMPLETE_LINE USING LS_ZSD_BILLINFO
L_MATNR_KEY
CHANGING L_LAST_KEY.
ENDIF.
*if l_matnr <> l_matnr_last.
l_matnr_last = l_matnr.
perform add_matnr_line using ls_zsd_billinfo
l_matnr_key
changing l_matnr_key.
endif.
perform add_complete_line using ls_zsd_billinfo
l_matnr_key
changing l_last_key.
ENDLOOP.
ENDFORM. " create_hierarchy
*& Form add_month
*& Form add_ebeln
FORM ADD_BZIRK USING P_BZIRK TYPE C
P_RELAT_KEY TYPE LVC_NKEY
CHANGING P_NODE_KEY TYPE LVC_NKEY.
DATA: L_NODE_TEXT TYPE LVC_VALUE,
LS_ZSD_BILLINFO TYPE ZSD_BILLINFO,
L_BZIRK(12) TYPE C. "output string for month
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = P_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
I_NODE_TEXT = L_NODE_TEXT
IS_OUTTAB_LINE = LS_ZSD_BILLINFO
IMPORTING
E_NEW_NODE_KEY = P_NODE_KEY.
ENDFORM. " add_month
FORM ADD_WERKS_LINE USING PS_ZSD_BILLINFO TYPE ZSD_BILLINFO
P_RELAT_KEY TYPE LVC_NKEY
CHANGING P_NODE_KEY TYPE LVC_NKEY.
DATA: L_NODE_TEXT TYPE LVC_VALUE,
LS_ZSD_BILLINFO TYPE ZSD_BILLINFO.
L_NODE_TEXT = PS_ZSD_BILLINFO-WERKS.
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = P_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
I_NODE_TEXT = L_NODE_TEXT
IS_OUTTAB_LINE = LS_ZSD_BILLINFO
IMPORTING
E_NEW_NODE_KEY = P_NODE_KEY.
ENDFORM. " add_carrid_line
FORM ADD_MATNR_LINE USING PS_ZSD_BILLINFO TYPE ZSD_BILLINFO
P_RELAT_KEY TYPE LVC_NKEY
CHANGING P_NODE_KEY TYPE LVC_NKEY.
DATA: L_NODE_TEXT TYPE LVC_VALUE,
LS_ZSD_BILLINFO TYPE ZSD_BILLINFO.
L_NODE_TEXT = PS_ZSD_BILLINFO-MATNR.
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = P_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
I_NODE_TEXT = L_NODE_TEXT
IS_OUTTAB_LINE = LS_ZSD_BILLINFO
IMPORTING
E_NEW_NODE_KEY = P_NODE_KEY.
ENDFORM. " add_carrid_line
**& Form add_complete_line
FORM ADD_COMPLETE_LINE USING PS_ZSD_BILLINFO TYPE ZSD_BILLINFO
P_RELAT_KEY TYPE LVC_NKEY
CHANGING P_NODE_KEY TYPE LVC_NKEY.
DATA: L_NODE_TEXT TYPE LVC_VALUE.
WRITE PS_ZSD_BILLINFO-BZIRK TO L_NODE_TEXT.
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = P_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
IS_OUTTAB_LINE = PS_ZSD_BILLINFO
I_NODE_TEXT = L_NODE_TEXT
IMPORTING
E_NEW_NODE_KEY = P_NODE_KEY.
ENDFORM. " add_complete_line
*& Form zf_create_fieldcat
text
FORM ZF_CREATE_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'FKIMG'.
LS_FIELDCAT-REF_TABLE = 'zsd_billinfo'.
LS_FIELDCAT-NO_OUT = 'X'.
LS_FIELDCAT-KEY = ''.
APPEND LS_FIELDCAT TO GT_FIELDCAT_LVC.
ENDFORM. " ZF_CREATE_FIELDCAT
=================================================
Kindly look into the code and guide me the solution.
TIA.
Regards,
Mark Khi
good
i tried your ALV report but it is giving some error due to some ztable you have used in your progam,
you can go to se38 and give there BCALV* and press f4, you ll find lots of ALV example related to OOP concept, you can test them and use them as per your requirement.
thnaks
mrutyun^ -
Hierarchy ALV and LinkToURL and row colors
Hi!
I've to implement a hierarchy ALV with two hierarchy columns, which should appear as LinktoURL (different URLs).
The Hierarchy-header-line should be displayed in an other color then the other rows.
Popins are not supported by ALV? This could help, but the displayed table must be printable (PDF), that's why I'm focused to ALV!
Is this possible? If yes, please give me hints you to implement these functionality!
Kind regards and thanks in advance!
PeterHi,
to use Cancel button in dialog based on class cl_salv_table, define your own gui-status or use an existing from standard program, for example gui-status ST850 from program SAPLKKB.
Look here for the complete example:
[http://www.kerum.pl/infodepot/00003]
regards,
Kris -
Hi Friends,
I have created a Hierarchial ALV report using OOP concept (Class Builder). The output is OK but it is displaying the unwanted columns in the header part.
The code written is as follows.
=====================================================
data: gt_zsd_abcd type zsd_abcd occurs 0, "Output-Table
data l_hierarchy_header type treev_hhdr.
perform build_hierarchy_header changing l_hierarchy_header.
call method g_alv_tree->set_table_for_first_display
exporting
i_structure_name = 'zsd_abcd'
is_hierarchy_header = l_hierarchy_header
changing
it_outtab = gt_zsd_abcd. "table must be empty !
perform create_hierarchy.
call method g_alv_tree->frontend_update.
=====================================================
I would like know as to how to display only the required columns in the header part.
Pls guide me.
TIA.
Regards,
Mark KHi Mark,
i got it, in your case you will get all the fields present in the structure you mentioned in the method.
so if you want only Purchase Order then you need to Build the fieldcat only for that field and then pass that fieldcat to the method. and don't pass the structure in this case.
call method alv_tree_control->set_table_for_first_display
exporting
is_variant = l_variant
i_save = 'A'
i_default = 'X'
is_hierarchy_header = l_hierarchy_header
it_special_groups = l_special_groups
it_toolbar_excluding = l_toolbar_excluding
changing
<b>it_fieldcatalog = l_field_catalog</b>
it_outtab = l_output_tbl.
Regards
vijay -
what do u mean by Hierarchial alv's and what is the exact purpose of them according to ooabap functionality and can anybody explain various issues regarding it,If possible with an example.
FOLLOW THE LINKS
alv with oops
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
www.saptechies.com/alv-faq--general-information/
The specified item was not found.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
http://www.geocities.com/mpioud/Abap_programs.html
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIDOCK/BCCIDOCK.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIGOF/BCCIGOF.pdf
http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm
http://esnips.com/doc/b708766f-a934-42a1-8064-c4de75b48fc4/Sample-Program-of-alv-using-oops.ppt
http://esnips.com/doc/a2e42503-cf0f-4418-94ee-580f5900a81f/alv-with-oop.doc
http://esnips.com/doc/2d953590-e8c5-490c-a607-d1ab7cf517d7/ALV.pdf
codes for alv with oops
codeBCALV_EDIT_01.
BCALV_EDIT_02.
BCALV_EDIT_03.
BCALV_EDIT_04.
BCALV_EDIT_05.
BCALV_EDIT_06.
BCALV_EDIT_07.
BCALV_EDIT_08.[/code]
HIERARCHIAL ALV
REUSE_ALV_HIERSEQ_LIST_DISPLAY
Text
Hierarchical sequential list output
Functionality
This module outputs two internal tables as a formated hierarchical-sequential list.
Principle:
Pass an internal table containing the set of header information to be output.
Pass an internal table containing the set of item information to be output.
Pass a structure containing the general list layout details
Pass a field catalog in the form of an internal table. The field catalog describes the fields to be output in the list.
Notes
All interactions which are performed on the list refer directly to the internal output tables, e.g. sorting the list also sorts the passed internal output tables (passed by reference).
The expected output data quantity is an important consideration for the use of the tool or various generic functions (totals, subtotals).
The application must take account of this.
Further Information
Parameters
ES_EXIT_CAUSED_BY_USER
Meaning
See the documentation of parameter .
REUSE_ALV_LIST_DISPLAY ES_EXIT_CAUSED_BY_USER> ES_EXIT_CAUSED_BY_USER .
Range
Default
E_EXIT_CAUSED_BY_CALLER
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY E_EXIT_CAUSED_BY_CALLER> link to REUSE_ALV_LIST_DISPLAY E_EXIT_CAUSED_BY_CALLER
Range
Default
IS_KEYINFO
Meaning
This structure contains the header and item table field names which link the two tables (shared key).
Enter the foreign key field names in the fields KEYINFO-HEADERxx and KEYINFO-ITEMxx. The foreign key field names of the header and item tables are usually identical.
The item table has other key fields as well as the header table foreign key. These other key fields should also be named in this structure. The corresponding header table field (HEADERxx) must be SPACE.
Naming the other key fields guarantees a stable item table sort sequence.
Range
Default
IS_LAYOUT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IS_LAYOUT> link to REUSE_ALV_LIST_DISPLAY IS_LAYOUT
IS_PRINT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IS_PRINT> link to REUSE_ALV_LIST_DISPLAY IS_PRINT
Range
Default
IS_REPREP_ID
IS_SEL_HIDE
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IS_SEL_HIDE> link to REUSE_ALV_LIST_DISPLAY IS_SEL_HIDE
Range
Default
IS_VARIANT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IS_VARIANT> link to REUSE_ALV_LIST_DISPLAY IS_VARIANT
Range
Default
IT_EVENTS
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_EVENTS> link to REUSE_ALV_LIST_DISPLAY IT_EVENTS
Range
Default
IT_EVENT_EXIT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_EVENT_EXIT> link to REUSE_ALV_LIST_DISPLAY IT_EVENT_EXIT
Range
Default
IT_EXCLUDING
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_EXCLUDING> link to REUSE_ALV_LIST_DISPLAY IT_EXCLUDING
Range
Default
IT_FIELDCAT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_FIELDCAT> link to REUSE_ALV_LIST_DISPLAY IT_FIELDCAT
Range
Default
IT_FILTER
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_FILTER> link to REUSE_ALV_LIST_DISPLAY IT_FILTER
Range
Default
IT_SORT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_SORT> link to REUSE_ALV_LIST_DISPLAY IT_SORT
Range
Default
IT_SPECIAL_GROUPS
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY IT_SPECIAL_GROUPS> link to REUSE_ALV_LIST_DISPLAY IT_SPECIAL_GROUPS
Range
Default
I_BUFFER_ACTIVE
I_BYPASSING_BUFFER
I_CALLBACK_PF_STATUS_SET
<DS:FU.REUSE_ALV_LIST_DISPLAY I_CALLBACK_PF_STATUS_SET> link to REUSE_ALV_LIST_DISPLAY I_CALLBACK_PF_STATUS_SET
I_CALLBACK_PROGRAM
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_CALLBACK_PROGRAM> link to REUSE_ALV_LIST_DISPLAY I_CALLBACK_PROGRAM
Range
Default
I_CALLBACK_USER_COMMAND
<DS:FU.REUSE_ALV_LIST_DISPLAY I_CALLBACK_USER_COMMAND> link to REUSE_ALV_LIST_DISPLAY I_CALLBACK_USER_COMMAND
I_DEFAULT
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_DEFAULT> link to REUSE_ALV_LIST_DISPLAY I_DEFAULT
Range
Default
I_INTERFACE_CHECK
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_INTERFACE_CHECK> link to REUSE_ALV_LIST_DISPLAY I_INTERFACE_CHECK
Range
Default
I_SAVE
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_SAVE> link to REUSE_ALV_LIST_DISPLAY I_SAVE
Range
Default
I_SCREEN_END_COLUMN
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_END_COLUMN> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_END_COLUMN
Range
Default
I_SCREEN_END_LINE
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_END_LINE> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_END_LINE
Range
Default
I_SCREEN_START_COLUMN
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_START_COLUMN> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_START_COLUMN
Range
Default
I_SCREEN_START_LINE
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_START_LINE> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_START_LINE
Range
Default
I_STRUCTURE_NAME_HEADER
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME> link to REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME
Range
Default
I_STRUCTURE_NAME_ITEM
Meaning
<DS:FU.REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME> link to REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME
Range
Default
I_TABNAME_HEADER
Meaning
Name of the internal table in the program containing the output data of the highest hierarchy level.
Range
Default
I_TABNAME_ITEM
Meaning
Name of the internal table in the program containing the output data of the lowest hierarchy level.
Range
Default
T_OUTTAB_HEADER
Meaning
Header table with data to be output
<DS:FU.REUSE_ALV_LIST_DISPLAY T_OUTTAB> link to REUSE_ALV_LIST_DISPLAY T_OUTTAB
Range
Default
T_OUTTAB_ITEM
Meaning
Item table with data to be output
<DS:FU.REUSE_ALV_LIST_DISPLAY T_OUTTAB> link to REUSE_ALV_LIST_DISPLAY T_OUTTAB
Default
Exceptions
PROGRAM_ERROR
Meaning
<DS:FX.REUSE_ALV_LIST_DISPLAY PROGRAM_ERROR> link to REUSE_ALV_LIST_DISPLAY PROGRAM_ERROR
EXAMPLE
go through this alv grid display example
wa_listheader-key = ''.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Date'.
append wa_listheader to it_end_listheader.
clear: wa_listheader.
concatenate 'Time' sy-uzeit into w_date separated by space.
wa_listheader-key = ''.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Time'.
append wa_listheader to it_end_listheader.
clear: wa_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_end_listheader[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. " f100-end_of_page
In grid display there will be no end_of_page and no end_of_list.
You have show in top_of_page itself.
Otherwise use list display instead of grid.
Suresh Avutu
These steps have to be carried out...
DATA: gc_formname_top_of_page TYPE slis_formname
VALUE 'TOP_OF_PAGE'.
DATA: gc_formname_end_of_page TYPE slis_formname
VALUE 'END_OF_PAGE'.
DATA: gt_list_top_of_page TYPE slis_t_listheader.
DATA: gt_list_end_of_page TYPE slis_t_listheader.
PERFORM e03_eventtab_build USING gt_event[].
PERFORM e04_comment_build USING
gt_list_top_of_page[].
PERFORM e06_comment_build USING
gt_list_end_of_page[].
PERFORM list_alv_display.
FORM list_alv_display .
gt_event-name = slis_ev_top_of_list.
gt_event-form = 'TOP_OF_PAGE'.
APPEND gt_event.
gt_event-name = slis_ev_end_of_list.
gt_event-form = 'END_OF_PAGE'.
APPEND gt_event.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = ....
FORM end_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = ''
it_list_commentary = gt_list_end_of_page
I_END_OF_LIST_GRID = 1.
ENDFORM. "END_OF_PAGE
FORM e06_comment_build
USING e06_lt_end_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
DATA: yl_uname(60).
< here u can concatenate system date and time to
yl_uname>
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-info = yl_uname.
APPEND ls_line TO e06_lt_end_of_page.
endform. "e06_comment_build
Suman Tyagi
An Example:
REPORT ZALV_GRID.
TABLES :vbap.
type-pools : slis.
data i_events TYPE slis_t_event.
DATA : my_alv TYPE REF TO cl_gui_alv_grid.
TYPES : BEGIN OF itab,
vbeln LIKE vbap-vbeln,
arktx LIKE vbap-arktx,
END OF itab.
TYPES : itab1 TYPE TABLE OF itab.
DATA : display TYPE itab1.
DATA : fcat TYPE SLIS_T_FIELDCAT_ALV.
DATA : wa LIKE LINE OF FCAT.
DATA WA1 LIKE VBAP.
DATA: container TYPE REF TO cl_gui_custom_container.
data report_id like sy-repid.
SELECT-OPTIONS s_vbeln FOR vbap-vbeln.
report_id = sy-repid.
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE display WHERE
vbeln IN s_vbeln.
wa-fieldname = 'VBELN'.
wa-tabname = 'VBAP'.
wa-key = 'X'.
WA-HOTSPOT = 'X'.
wa-text_fieldname = 'Doc no.'.
APPEND wa TO fcat.
CLEAR wa.
wa-fieldname = 'ARKTX'.
wa-tabname = 'VBAP'.
wa-text_fieldname = 'Item Text'.
APPEND wa TO fcat.
PERFORM f0650_build_event USING 'USER_COMMAND'
'F0750_USER_COMMAND'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY '
EXPORTING
I_CALLBACK_PROGRAM = report_id
IT_FIELDCAT = FCAT
IT_EVENTS = i_events
TABLES
t_outtab = DISPLAY
FORM f0650_build_event USING value(w_c_event_name)
value(w_c_event_form).
DATA: f0650_wa_event TYPE slis_alv_event.
CLEAR f0650_wa_event.
f0650_wa_event-name = w_c_event_name.
f0650_wa_event-form = w_c_event_form.
APPEND f0650_wa_event TO i_events.
ENDFORM.
FORM f0750_user_command USING w_ucomm TYPE sy-ucomm
w_selfield TYPE slis_selfield.
CASE w_ucomm.
WHEN '&IC1'.
READ TABLE DISPLAY INTO WA1 INDEX w_selfield-tabindex.
MESSAGE E000 WITH
' You have no authorization to view the report'.
call transaction 'SE11'.
ENDCASE.
ENDFORM.
cheers,
sharad
Edited by: sharad narayan on Apr 18, 2008 9:26 AM
Edited by: sharad narayan on Apr 18, 2008 9:32 AM -
Average Calculation in Hierarchial ALV
Hi,
I need to calculate average mean in hierarchial alv. the standard menu for calculate totals is disabled in both in function module REUSE_ALV_HIERSEQ_LIST_DISPLAY and
in the class cl_salv_hierseq_table. Please help with this
Regards,
Mathivanan.GHi,
Check this post, may help you
https://forums.sdn.sap.com/click.jspa?searchID=7088080&messageID=2847524
Regards,
Satish -
Hi FOlks,
Have a requirement to develop Hierarchy ALV with two levels. As we need to make the columns as editable we are going for ALV OOPS. Is there any way of doing Hierarchy ALV in OOPS...if so, could you please suggest me which Class and method to be used.....
Thanks in advance,
Shyam.Look at sample programs in R3
SALV_DEMO_TREE_DATA_UPDATE Demonstration Program for ALV OM Tree: Changed Data
SALV_DEMO_TREE_EVENTS Demonstration Program for ALV OM Tree: Events
SALV_DEMO_TREE_FUNCTIONS Demonstration Program for ALV OM Tree: Functions
SALV_DEMO_TREE_METADATA Demonstration Program for ALV OM Tree: Metadata
SALV_DEMO_TREE_SELECTIONS Demonstration Program for ALV OM Tree: Selections
SALV_DEMO_TREE_SETTINGS Demonstration Program for ALV OM Tree: Settings
SALV_DEMO_TREE_SIMPLE Demonstration Program for ALV OM Tree
Regards, -
Can we get subtotal and grand total by own calculation in a hierarchy ALV?
Can we get subtotal and grand total by own calculation in a hierarchy ALV? I can get them by setting DO_SUM = 'X' by standard summation, but now I need to do my own summation on subtotal and total, can I?
Can we get subtotal and grand total by own calculation in a hierarchy ALV? I can get them by setting DO_SUM = 'X' by standard summation, but now I need to do my own summation on subtotal and total, can I?
-
Hi Experts,
wht is the use of blocked and hierarchial ALV's.
In which situations are they used? Can u provide any material
Thank Youhi,
<b>Block ALV</b> means more than one list in one screen.
Means u can have many list in one screen at a time.
Like this,
TYPE-POOLS : slis.
TABLES : mara,
makt.
SELECT-OPTIONS : mat FOR mara-matnr.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
matkl LIKE mara-matkl,
mtart LIKE mara-mtart,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mtart LIKE mara-mtart,
count TYPE i,
END OF itab1.
DATA : BEGIN OF itab1_col OCCURS 0,
mtart LIKE mara-mtart,
count TYPE i,
END OF itab1_col.
DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
t_fcat2 TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
t_eve TYPE slis_t_event,
wa_eve TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
DATA : v_repid LIKE sy-repid,
t_mat LIKE mara-matnr.
DEFINE create_fcat.
clear wa_fcat.
wa_fcat-fieldname = &1.
wa_fcat-seltext_l = &2.
wa_fcat-outputlen = &3.
append wa_fcat to t_fcat1.
END-OF-DEFINITION.
START-OF-SELECTION.
PERFORM get_data.
PERFORM dis_data.
*& Form get_data
text
FORM get_data.
SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara AS a INNER JOIN makt AS b ON
amatnr = bmatnr
WHERE a~matnr IN mat.
LOOP AT itab.
itab1-mtart = itab-mtart.
itab1-count = 1.
APPEND itab1.
ENDLOOP.
SORT itab1 BY mtart.
LOOP AT itab1.
MOVE-CORRESPONDING itab1 TO itab1_col.
COLLECT itab1_col.
ENDLOOP.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid.
REFRESH t_fcat1.
CLEAR t_fcat1.
REFRESH t_eve.
wa_eve-name = 'TOP_OF_PAGE'.
wa_eve-form = 'TOP_OF_PAGE1'.
APPEND wa_eve TO t_eve.
create_fcat:
'MATNR' 'Material' '10',
'MAKTX' 'Material Description' '40',
'MTART' 'Type' '10',
'MATKL' 'Group' '10'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = t_layout
it_fieldcat = t_fcat1
i_tabname = 'ITAB'
it_events = t_eve
TABLES
t_outtab = itab.
REFRESH t_fcat1.
CLEAR t_fcat1.
REFRESH t_eve.
wa_eve-name = 'TOP_OF_PAGE'.
wa_eve-form = 'TOP_OF_PAGE2'.
APPEND wa_eve TO t_eve.
create_fcat:
'MTART' 'Type' '10',
'COUNT' 'Total' '5'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = t_layout
it_fieldcat = t_fcat1
i_tabname = 'ITAB1_COL'
it_events = t_eve
TABLES
t_outtab = itab1_col.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
ENDFORM. "dis_data
*& Form top_of_page1
text
FORM top_of_page1.
FORMAT COLOR COL_POSITIVE.
WRITE:/ 'First Block'.
FORMAT COLOR OFF.
ENDFORM. "top_of_page
*& Form top_of_page2
text
FORM top_of_page2.
FORMAT COLOR COL_NEGATIVE.
WRITE /5 'Second Block'.
FORMAT COLOR OFF.
ENDFORM. "top_of_page
In <b>hierarchical ALV</b> hierarchy will create,
Like This,
TYPE-POOLS : slis.
TABLES : mseg.
DATA : BEGIN OF itab_head OCCURS 0,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
END OF itab_head.
DATA : BEGIN OF itab_item OCCURS 0,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
mblnr LIKE mseg-mblnr,
menge LIKE mseg-menge,
END OF itab_item.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
key_info TYPE slis_keyinfo_alv,
t_eve TYPE slis_t_event,
gt_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF gt_subtot,
t_listhead TYPE slis_t_listheader,
st_line TYPE slis_listheader.
DATA : t_mtdoc LIKE mseg-mblnr.
SELECT-OPTIONS : mat FOR mseg-matnr.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
START-OF-SELECTION.
PERFORM get_data.
PERFORM dis_data.
*& Form build_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA : wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB_HEAD'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB_HEAD'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB_ITEM'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB_ITEM'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MATNR'.
subtot-tabname = 'ITAB_HEAD'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO gt_subtot.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_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 t_eve INTO wa_eve WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc = 0.
wa_eve-form = 'TOP_OF_PAGE'.
MODIFY t_eve FROM wa_eve INDEX sy-tabix.
ENDIF.
ENDFORM. "build_eve
*& Form get_data
text
FORM get_data.
SELECT matnr werks mblnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab_item
WHERE matnr IN mat.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
key_info-header01 = 'MATNR'.
key_info-item01 = 'MATNR'.
key_info-header02 = 'WERKS'.
key_info-item02 = 'WERKS'.
REFRESH itab_head.
LOOP AT itab_item.
ON CHANGE OF itab_item-matnr OR itab_item-werks.
MOVE-CORRESPONDING itab_item TO itab_head.
APPEND itab_head.
ENDON.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZHEIRALV_PRDS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = t_fcat
it_sort = gt_subtot
it_events = t_eve[]
i_tabname_header = 'ITAB_HEAD'
i_tabname_item = 'ITAB_ITEM'
is_keyinfo = key_info
TABLES
t_outtab_header = itab_head
t_outtab_item = itab_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. "dis_data
*& Form top_of_page
text
FORM top_of_page.
CLEAR st_line.
st_line-typ = 'H'.
st_line-info = 'Dhwani Shah'.
APPEND st_line TO t_listhead.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_listhead
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "top_of_page
reward if useful. -
Multilevel hierarchy ALV report of Mother WBS
Hi ABAP Guru,
I have created a Mother WBS sturcture which has been created in CJ91 tcode. I need a same hierarchy alv report same structure as shown in cj91 t code. Please help me out.
I have created a alv reort on that but when I make change in mother WBS, the new added wbs is comming in my report at last. PLease help me out.Hi Manish,
I am able to see WBS Elements in MB51 Report after going to detailed list from the initial output page. In this detailed output the sender and receiver WBS Elements are getting displayed incorrectly.From that screen only,if I go to Material document list,sender and receiver WBS Elements are getting displayed correctly.
Regards,
B P Singh -
Need hierarchy alv report base on salv_demo_hierseq_simple
Hi friends,
i need to do a hierarchy alv report,
i copied example code from program salv_demo_hierseq_simple and changes the selection screen +changed the select from tables.
my problem is that the results is one big list of data,
i dont have to open and close lines.
is anyone can help me with what could the problem be?
thanks,
dana.Guys,
Any Idea on this. -
Hi al!!
Does anybody know if in a Hierarchy ALV it is possible to have columns separated by lines?
Thanks in advance & kind regards,
Marce.CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = 'X' *
I_CALLBACK_PROGRAM = 'ZPRCREPTZ1'
I_CALLBACK_USER_COMMAND = 'CALLBACK_USER_COMMAND'
I_CALLBACK_PF_STATUS_SET = 'CALLBACK_STATUS'
IT_FIELDCAT = FIELDCAT_AXXX
IT_EXCLUDING = EX_FCODE
IS_LAYOUT = LAYOUT_AXXX
IT_SORT = IT_SORT_AXXX
IT_EVENTS = ET_EVENTS_AXXX
IT_EVENT_EXIT = ET_EVENT_EXIT
I_TABNAME_HEADER = TABNAME_HEADER_AXXX
I_TABNAME_ITEM = TABNAME_ITEM_AXXX
IS_KEYINFO = KEYINFO
IS_PRINT = IS_PRINT_AXXX
* IMPORTING *
* E_EXIT_CAUSED_BY_CALLER = *
* ES_EXIT_CAUSED_BY_USER = *
TABLES
T_OUTTAB_HEADER = SORTTAB_AXXX
T_OUTTAB_ITEM = T_POS_AXXX
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
[Click Here for more explanation|http://www.saptechies.com/how-to-use-alv-for-hierarchical-lists/] -
Hierarchial alv in a sequential manner for 6 levels
Can we have hierarchial ALV with multiple levels.
I.e Header will have Item details -Item_01, on further clicking the item; it should further show item details , i.e Item_02.
It is something like folder inside a folder till 6 levels.
is it possible, if yes? then please suggest.
Thanks.Hi Mansi,
Thanks for the code.
I have tried this.This works fine for parent child relation.
My requirement is further drill down..for which I have tried to add one more bidning relation, but it didn't work.
Have you tried? -
Regarding Hierarchial ALV Display
Can any one please tell me the 'keyinfo' parameter in the ALV function REUSE_ALV_HIERSEQ_LIST_DISPLAY.
I want all the details regarding the parameter keyinfo.
Thanks in advance.this is used to specify that according to which field u want hierarchy....
means i want that according to material number i want hierarchical display than i have to pass matnr in this
and
key_info-header01 = 'MAT'.
key_info-item01 = 'MAT'.
In this we passing field name of header table and item table....
Now see this example..
In this i want hierarchy depend on Material and palnt both..
so my code will be
TYPE-POOLS : slis.
TABLES : mseg.
DATA : BEGIN OF itab_head OCCURS 0,
mat LIKE mseg-matnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
END OF itab_head.
DATA : BEGIN OF itab_item OCCURS 0,
mat LIKE mseg-matnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
mblnr LIKE mseg-mblnr,
menge LIKE mseg-menge,
END OF itab_item.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
key_info TYPE slis_keyinfo_alv,
t_eve TYPE slis_t_event,
gt_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF gt_subtot,
t_listhead TYPE slis_t_listheader,
st_line TYPE slis_listheader.
DATA : t_mtdoc LIKE mseg-mblnr.
SELECT-OPTIONS : mat FOR mseg-matnr.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
START-OF-SELECTION.
PERFORM get_data.
PERFORM dis_data.
*& Form build_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA : wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB_HEAD'.
wa_fcat-fieldname = 'MAT'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB_HEAD'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB_ITEM'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB_ITEM'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MAT'.
subtot-tabname = 'ITAB_HEAD'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO gt_subtot.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_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.
ENDFORM. "build_eve
*& Form get_data
text
FORM get_data.
SELECT matnr AS mat werks mblnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab_item
WHERE matnr IN mat.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
key_info-header01 = 'MAT'.
key_info-item01 = 'MAT'.
key_info-header02 = 'WERKS'.
key_info-item02 = 'WERKS'.
REFRESH itab_head.
LOOP AT itab_item.
ON CHANGE OF itab_item-mat OR itab_item-werks.
MOVE-CORRESPONDING itab_item TO itab_head.
APPEND itab_head.
ENDON.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_PRDS'
it_fieldcat = t_fcat
it_sort = gt_subtot
it_events = t_eve[]
i_tabname_header = 'ITAB_HEAD'
i_tabname_item = 'ITAB_ITEM'
is_keyinfo = key_info
TABLES
t_outtab_header = itab_head
t_outtab_item = itab_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. "dis_data
reward if usefull.....
Maybe you are looking for
-
Hi, I done File->RFC scenario. It was showing WAITING in Message Monitoring. But in CC Monitoring showing error like <b>No suitable sender agrement found</b>. Y it is showing like this? even I done Sender Agrement? thx and regards, Ansar.
-
Adapter MetaData problem (PI installation).
Hi All, I had installed 'PI' and as part of post installation, i imported the CR_Content.zip into the SLD. After doing that when i import the SAP BASIS 7.00 Software component into the repository, to my surprise it is imported but doesn't contain any
-
Mavericks will not download from Appstore
My MacBook Pro 15" early 2011 model running Lion 10.7.5, wont download Mavericks. Using wi-fi internet connection, any ideas why or possible solutions, would be appreciated.
-
OPatch failed with error code 74 when applying patch PSE 13723798
Hello all, tried to apply patch (PSE 13723798) to fix the no-scrollbar bug in Webcenter Portal Admin Console. But found this error during the patching process, as described below. Any solution for this? Running prerequisite checks. . . Patch 13723798
-
I created a panoramic view of a bridge, but the merging of the five photos produced a blank section of sky. Did the same at the bottom of the picture too, but I just cropped that out. Is there good way to fill such a large area and produce a result