ALV Grid to Tree Hirarchy
Hi all,
Please guid me how to change the ALV grid output of a report to ALV Tree Hirarchical display.Requirement is to change the output from ALV Grid to Tree Hirarchy.
Thanks in advance.
Pavan
Hi,
Hope this sample code will help:
*& Report Z_50657_ALV_EX4 *
*& Program Name: Test Program for ALV *
Developer Name: ADCDEV (Rahul Kavuri ) *
Description: This program demonstrates Hierarchical List Display
*& using VBAP and VBAK as Item and Header Tables *
*& Date:12th April 2006
REPORT Z_50657_ALV_EX4
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
Type Pools *
TYPE-POOLS: SLIS.
Tables *
TABLES: VBAK, "Sales Document: Header Data
VBAP. "Sales Document: Item Data
Internal Tables *
Internal table to hold data from VBAK
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
AUDAT LIKE VBAK-AUDAT, "Document date
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Value of the Sales Order
EXPAND TYPE C,
END OF IT_VBAK.
Internal table to hold data from VBAP
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
MATNR LIKE VBAP-MATNR, "Material Number
PSTYV LIKE VBAP-PSTYV, "Sales document item category
CHARG LIKE VBAP-CHARG, "Batch Number
END OF IT_VBAP.
Data Declarations and Variables *
work area to retain fieldcatalog values and internal table for catalog
DATA: X_FIELDCAT_VBAK TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBAK TYPE SLIS_T_FIELDCAT_ALV.
DATA: X_FIELDCAT_VBAP TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBAP TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA: IT_HEADER TYPE SLIS_TABNAME,
IT_ITEM TYPE SLIS_TABNAME.
DATA: X_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*Sales Document and Sales Document Type as input fields
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN,
S_AUART FOR VBAK-AUART.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIASATION *
INITIALIZATION.
Assigning Internal Table Names
IT_HEADER = 'IT_VBAK'.
IT_ITEM = 'IT_VBAP'.
CLEAR IT_KEYINFO.
IT_KEYINFO-HEADER01 = 'VBELN'.
comparing the keys and relating the header and item internal tables
IT_KEYINFO-ITEM01 = 'VBELN'.
IT_KEYINFO-HEADER02 = SPACE.
IT_KEYINFO-ITEM02 = 'POSNR'.
At Selection-Screen *
AT SELECTION-SCREEN.
PERFORM VALIDATION.
Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*MERGE FIELDCATALOGUES OF IT_VBAP AND IT_VBAK
PERFORM FIELDCATALOG_MERGE.
*CHANGE LAYOUT ACCORDING TO THE REQUIREMENTS
PERFORM LAYOUT_CHG.
*USE SORT FUNCTION SO AS TO GET SUBTOTALS AND GRAND TOTAL
PERFORM SORT_FUNC.
*FINAL DISPLAY ACCORDING TO THE HIERARCHY
PERFORM FINAL_DISPLAY.
End of Selection *
FORM VALIDATION.
SELECT SINGLE VBELN
FROM VBAK
INTO VBAK-VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'NO SALES DOCUMENT RECORD FOUND'.
STOP.
ENDIF.
SELECT SINGLE AUART
FROM VBAK
INTO VBAK-AUART
WHERE AUART IN S_AUART.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'THE MENTIONED DATE HAS NO RECORDS'.
STOP.
ENDIF.
ENDFORM. "VALIDATION
*& Form GET_DATA
text
FORM GET_DATA.
SELECT VBELN
AUDAT
AUART
NETWR FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND AUART IN S_AUART.
SORT IT_VBAK BY VBELN.
SELECT VBELN
POSNR
MATNR
PSTYV
CHARG FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
ENDFORM. "GET_DATA
*& Form FIELDCATALOG_MERGE
text
FORM FIELDCATALOG_MERGE.
X_FIELDCAT_VBAK-FIELDNAME = 'NETWR'.
X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
X_FIELDCAT_VBAK-DO_SUM = 'X'.
APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
CLEAR X_FIELDCAT_VBAK.
X_FIELDCAT_VBAK-FIELDNAME = 'AUART'.
X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
CLEAR X_FIELDCAT_VBAK.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAK'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBAK.
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_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAP'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBAK.
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. "FIELDCATALOG_MERGE
*& Form LAYOUT_CHG
text
FORM LAYOUT_CHG.
L_LAYOUT-ZEBRA = 'X'.
L_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
L_LAYOUT-TOTALS_TEXT = 'TOTAL'.
L_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
L_LAYOUT-EXPAND_ALL = 'X'.
ENDFORM. "LAYOUT_CHG
*& Form SORT_FUNC
text
FORM SORT_FUNC.
X_SORT-SPOS = 1.
X_SORT-FIELDNAME = 'AUART'.
X_SORT-TABNAME = 'IT_VBAK'.
X_SORT-UP = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
X_SORT-SPOS = 2.
X_SORT-FIELDNAME = 'NETWR'.
X_SORT-TABNAME = 'IT_VBAK'.
X_SORT-UP = 'X'.
X_SORT-SUBTOT = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
ENDFORM. "SORT_FUNC
*& Form FINAL_DISPLAY
text
FORM FINAL_DISPLAY.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBAK
IT_SORT = IT_SORT
I_TABNAME_HEADER = IT_HEADER
I_TABNAME_ITEM = IT_ITEM
IS_KEYINFO = IT_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_VBAK
T_OUTTAB_ITEM = IT_VBAP
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. "FINAL_DISPLAY
Reward points if found helpful
..
Cheers,
Chandra Sekhar.
Similar Messages
-
Hi,
I need to design multiple table controls in a screen and they should be expandable and collapsable .....any inputs ?
Is this can be achieved through multiple grid lists with tree by any chance??
some thing like
me22n screen -
where the table control for items there is expandable and collapsable....I need threesuch table controls on my screen......any inputs are highly appreciatedHi,
Hope this sample code will help:
*& Report Z_50657_ALV_EX4 *
*& Program Name: Test Program for ALV *
Developer Name: ADCDEV (Rahul Kavuri ) *
Description: This program demonstrates Hierarchical List Display
*& using VBAP and VBAK as Item and Header Tables *
*& Date:12th April 2006
REPORT Z_50657_ALV_EX4
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
Type Pools *
TYPE-POOLS: SLIS.
Tables *
TABLES: VBAK, "Sales Document: Header Data
VBAP. "Sales Document: Item Data
Internal Tables *
Internal table to hold data from VBAK
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
AUDAT LIKE VBAK-AUDAT, "Document date
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Value of the Sales Order
EXPAND TYPE C,
END OF IT_VBAK.
Internal table to hold data from VBAP
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
MATNR LIKE VBAP-MATNR, "Material Number
PSTYV LIKE VBAP-PSTYV, "Sales document item category
CHARG LIKE VBAP-CHARG, "Batch Number
END OF IT_VBAP.
Data Declarations and Variables *
work area to retain fieldcatalog values and internal table for catalog
DATA: X_FIELDCAT_VBAK TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBAK TYPE SLIS_T_FIELDCAT_ALV.
DATA: X_FIELDCAT_VBAP TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBAP TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA: IT_HEADER TYPE SLIS_TABNAME,
IT_ITEM TYPE SLIS_TABNAME.
DATA: X_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*Sales Document and Sales Document Type as input fields
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN,
S_AUART FOR VBAK-AUART.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIASATION *
INITIALIZATION.
Assigning Internal Table Names
IT_HEADER = 'IT_VBAK'.
IT_ITEM = 'IT_VBAP'.
CLEAR IT_KEYINFO.
IT_KEYINFO-HEADER01 = 'VBELN'.
comparing the keys and relating the header and item internal tables
IT_KEYINFO-ITEM01 = 'VBELN'.
IT_KEYINFO-HEADER02 = SPACE.
IT_KEYINFO-ITEM02 = 'POSNR'.
At Selection-Screen *
AT SELECTION-SCREEN.
PERFORM VALIDATION.
Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*MERGE FIELDCATALOGUES OF IT_VBAP AND IT_VBAK
PERFORM FIELDCATALOG_MERGE.
*CHANGE LAYOUT ACCORDING TO THE REQUIREMENTS
PERFORM LAYOUT_CHG.
*USE SORT FUNCTION SO AS TO GET SUBTOTALS AND GRAND TOTAL
PERFORM SORT_FUNC.
*FINAL DISPLAY ACCORDING TO THE HIERARCHY
PERFORM FINAL_DISPLAY.
End of Selection *
FORM VALIDATION.
SELECT SINGLE VBELN
FROM VBAK
INTO VBAK-VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC 0.
MESSAGE I000 WITH 'NO SALES DOCUMENT RECORD FOUND'.
STOP.
ENDIF.
SELECT SINGLE AUART
FROM VBAK
INTO VBAK-AUART
WHERE AUART IN S_AUART.
IF SY-SUBRC 0.
MESSAGE I000 WITH 'THE MENTIONED DATE HAS NO RECORDS'.
STOP.
ENDIF.
ENDFORM. "VALIDATION
*& Form GET_DATA
text
FORM GET_DATA.
SELECT VBELN
AUDAT
AUART
NETWR FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND AUART IN S_AUART.
SORT IT_VBAK BY VBELN.
SELECT VBELN
POSNR
MATNR
PSTYV
CHARG FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
ENDFORM. "GET_DATA
*& Form FIELDCATALOG_MERGE
text
FORM FIELDCATALOG_MERGE.
X_FIELDCAT_VBAK-FIELDNAME = 'NETWR'.
X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
X_FIELDCAT_VBAK-DO_SUM = 'X'.
APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
CLEAR X_FIELDCAT_VBAK.
X_FIELDCAT_VBAK-FIELDNAME = 'AUART'.
X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
CLEAR X_FIELDCAT_VBAK.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAK'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBAK.
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_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAP'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBAK.
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. "FIELDCATALOG_MERGE
*& Form LAYOUT_CHG
text
FORM LAYOUT_CHG.
L_LAYOUT-ZEBRA = 'X'.
L_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
L_LAYOUT-TOTALS_TEXT = 'TOTAL'.
L_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
L_LAYOUT-EXPAND_ALL = 'X'.
ENDFORM. "LAYOUT_CHG
*& Form SORT_FUNC
text
FORM SORT_FUNC.
X_SORT-SPOS = 1.
X_SORT-FIELDNAME = 'AUART'.
X_SORT-TABNAME = 'IT_VBAK'.
X_SORT-UP = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
X_SORT-SPOS = 2.
X_SORT-FIELDNAME = 'NETWR'.
X_SORT-TABNAME = 'IT_VBAK'.
X_SORT-UP = 'X'.
X_SORT-SUBTOT = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
ENDFORM. "SORT_FUNC
*& Form FINAL_DISPLAY
text
FORM FINAL_DISPLAY.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBAK
IT_SORT = IT_SORT
I_TABNAME_HEADER = IT_HEADER
I_TABNAME_ITEM = IT_ITEM
IS_KEYINFO = IT_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_VBAK
T_OUTTAB_ITEM = IT_VBAP
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. "FINAL_DISPLAY
Also go thru dis program for heirachical tree
BCALV_TREE_01
Reward Points if found helpfull..
Cheers,
Chandra Sekhar. -
Application events in ALV Grid Control
Hello,
Since SET_REGISTERED_EVENTS cannot be used for ALV Grid Control, how do I register a system event (data_changed) as an application event, so that PAI is processed. I am using ALV grid not tree.
ThanksALV events can be defined as application events while creating Grid object.
In addition to parent, Pass one more parameter:-I_APPL_EVENTS = 'X'.
CREATE OBJECT grid
EXPORTING
i_parent = g_custom_container
I_APPL_EVENTS = 'X'. -
Make ALV GRID screen resizable
Hi All,
I have created an object V_MAPBOX using reference to class CL_GUI_DIALOGBOX_CONTAINER.
CREATE OBJECT v_mapbox
EXPORTING
width = 300
height = 130
style = cl_gui_control=>ws_sysmenu
repid = 'ZMAP'
dynnr = '1000'
top = v_top2
left = v_left2
caption = 'Mapping Information'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
event_already_registered = 6
error_regist_event = 7
OTHERS = 8.
Then created an object V_MAPALV with reference to class CL_GUI_ALV_GRID exporting V_MAPBOX.
Finally I am calling the method SET_TABLE_FOR_FIRST_DISPLAY of CL_GUI_ALV_GRID to display the screen on my custom container of screen 1000.
CALL METHOD v_mapalv->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = wa_layout
CHANGING
it_outtab = i_map
it_fieldcatalog = i_fieldcat_map
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
The screen is getting displayed as expected. But I require to make this ALV screen to be resizable while it is displayed.
Have tried calling CALL METHOD v_mapbox->resize, before calling the V_MAPALV methods but it does not work.
Need to know how can I make this resizable.Hi,
ABAP objects are used to implement the controls in programs.
An SAP Container can contain other controls (for example, SAP ALV Grid Control, Tree Control, SAP Picture Control, SAP Splitter Control, and so on). It administers these controls logically in one collection and provides a physical area for the display.
Every control exists in a container. Since containers are themselves controls, they can be nested within one another. The container becomes the parent of its control. SAP containers are divided into five groups:
SAP custom container: Displays within an area defined in Screen Painter on screens or sub screens.
Class: CL_GUI_CUSTOM_CONTAINER
SAP dialog box container: Displays in a modeless dialog box or as a full screen. Class:
CL_GUI_DIALOGBOX_CONTAINER
SAP docking container: Displays as docked, resizable sub-window with the option of displaying it as a modeless dialog box. Class: CL_GUI_DOCKING_CONTAINER
SAP splitter container: Displays and groups several controls in one area - that is, splits the area into cells Class: CL_GUI_SPLITTER_CONTAINER
SAP easy splitter container: Displays controls in two cells, which the user can resize using a split bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER.
In the control, you can adjust the column width by dragging, or use the 'Optimum width' function to adjust the column width to the data currently displayed. You can also change the column sequence by selecting a column and dragging it to a new position.
Thanks,
Pradeep. -
Problem with same layout (variant) for two ALV Grid and ALV Tree
Hello!
I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
How to avoid this?Hi,
Take Two radio buttons.
First radion button display the two containers in grid format,
second radio button display the two containers in tree format base on user selection.
CREATE OBJECT G_DOCING_CONTAINER
EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
DISPLAY THE DATA IN GRID FORMATA
CREATE OBJECT r_grid
EXPORTING
i_parent = G_DOCING_CONTAINER
CALL METHOD g_docing_container->set_width
EXPORTING
width = 1300.
DISPLAY THE GRID DATA IN SECOND CONTAINER
CREATE OBJECT r_grid1
EXPORTING
i_parent = G_DOCING_CONTAINER
CALL METHOD g_docing_container->set_width
EXPORTING
width = 1300.
OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
CREATE OBJECT g_tree
EXPORTING
parent = g_docing_container"g_custom_container
IF R1 = 'X'. "FOR GRID DISPLAY
CALL METHOD r_grid1->set_table_for_first_display
CALL METHOD r_grid2->set_table_for_first_display
ELSE.
************TREE DISPLAY
ENDIF.
regards,
muralii -
ALV Grid/Tree in Dialog Popup
Hi,
I have requirement whereby I display an partially filled ALV Grid.
To populate a specific field of the ALV I need to pop-up a dialog form on which is displayed either another ALV Grid or preferably an ALV Tree.
The data behind the Dilog ALV/Tree is a table of Parent-Child relationships.
The user will either navigate the ALV Grid by clicking on a 'Parent' and refreshing the ALV with the Children etc or do the same by expanding nodes on the ALV Tree.
When the user has reached the lowest level of the 'hierarchy' this value is returned to the initial ALV Grid.
I have had a look around the ABAP and OO Demo's and in the Weblogs etc on SDN.
However I cannot seem to 'manipulate' these into my specific requirements.
Ideally, I need to create either a FM or Class/Method which takes as input the above table of relationships, displays the dilog and then returns the selected child.
My questions are:
Can this be done?
Which is the best way for me to approach this?
Thanks,
MartinHi,
I have requirement whereby I display an partially filled ALV Grid.
To populate a specific field of the ALV I need to pop-up a dialog form on which is displayed either another ALV Grid or preferably an ALV Tree.
The data behind the Dilog ALV/Tree is a table of Parent-Child relationships.
The user will either navigate the ALV Grid by clicking on a 'Parent' and refreshing the ALV with the Children etc or do the same by expanding nodes on the ALV Tree.
When the user has reached the lowest level of the 'hierarchy' this value is returned to the initial ALV Grid.
I have had a look around the ABAP and OO Demo's and in the Weblogs etc on SDN.
However I cannot seem to 'manipulate' these into my specific requirements.
Ideally, I need to create either a FM or Class/Method which takes as input the above table of relationships, displays the dilog and then returns the selected child.
My questions are:
Can this be done?
Which is the best way for me to approach this?
Thanks,
Martin -
Folder in alv grid display report
Hi Experts,
I have a requirement to generate the folder in alv grid display, to display the multiple line items where ever we have.
Actually I am displaying the material details and production order details.
If the material is having the multiple production order details , in that case we need to place all the production order details in one folder, and if you open that folder arrow, we have to display the production order details.
I am using REUSE_ALV_GRID_DISPLAY function module to develope this application. Here Hierseq list is recommended to use for this application, why because folder option is already available in grid display. that we can observe in CL6AN.
Is it possible to implement it through function modules or through OOABAP.
Actually, I have to generate the report which we can see in CL6AN Transaction code,,
Your valuable suggestions surely will attract the benifits.
Thanks in advance.
Ramesh.Hi ramesh,
Hierseq list is not supported in the grid display. You could do this using an OO tree display but this could be rather complicated. What about displaying one field per material line with the number of production orders. At double-click on that field, open a second grid display (possibly as popup) to show the production order details.
Regards,
Clemens -
hi experts
i have a report which displays out put in alv grid display with 17 fields.
my requirement is i have to change the alvgrid display output into ALV Tree with
9 levels with fields and their descriptions.
i should mantain back option in alv tree output.when i press back button it should come to
selection scree or previous screen.
3).can any one help me in the requirement.
thanks advanance.
sailajaHello Sailaja
You may want to have a look at sample report ZUS_SDN_ALV_TREE_DEMO in thread
alv tree checbox problem when attempt to get the selected checjboxes
Regards
Uwe -
How to read a alv grid row data from standard program
Hi All,
I am working on transaction LBK1. Actually when you will open this transaction in the left hand side it will show you the data in tree. When you click on a notification node it will show the relevant data in right side. In which there is a operation tab . In this tab the data comes in alv grid. If user selects a row then I have to get that selected row value. There is also a toolbar above on the tree side. There are some buttons which execute our implementation class where I can put the code.
Can anyone please help me out? How I can read that selected row in our class/method?
Thanks in advance.
Best Regards
RituSetting and getting selected rows (Columns) and read line contents
You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similiar methods for columns.
Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows fronm the table. In the examples below the grid table is named gi_sflight.
Data declaratrion:
DATA:
Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
Example 1: Reading index of selected row(s) and using it to read the grid table
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Example 2: Set selected row(s).
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
exporting
it_index_rows = gi_index_rows.
ENDIF. -
Need to display two ALV GRIDs in a single screen
Hi,
I have a question, i'm using version 4.6. I want to display 2 ALVs in a single screen or by calling.
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 : Display In a single report
ALV1 report (Editable ,Has to be a GRID)
ALV2 report (Non Editable, Has to be a GRID)
(or)
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 :
ALV1 report (Editable ,Has to be a GRID, with a custom button to call ALV2 hiding the ALV1 ie not visible to user)
ALV2 report (Non Editable ,Has to be a GRID, with a custom button to call ALV1 hiding the ALV2 ie not visible to user)
Please help me <b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada GalindoHi
ABAP List Viewer
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
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
Check the program in the following link:
http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
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
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
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
13. Top-of-page in ALV
selection-screen and top-of-page in ALV
14. ALV Group Heading
http://www.sap-img.com/fu037.htm
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
15. ALV output to PDF conversion
It has an example code for PDF Conversion.
http://www.erpgenie.com/abap/code/abap51.htm
converting the output of alv in pdf
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
Regards
Anji -
Hi guys !!
Do you have any good manual or tutorial on how to create a alv grid, including all the steps for the abap program and the screen painter.
Thanks a lot !Javier,
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
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
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
Don't forget to reward if useful.... -
Hi,
Can any one tell me about the possibility to display sub headings for an ALV grid control i.e to have a group of columns under one column similar to the feature in excel?
Regards,
SujathaHi Sujatha, also check this code.
REPORT ZALV5_OBJECTS.
TABLES : EKKO.
TYPE-POOLS : SLIS.
TYPES : BEGIN OF TY_EKKO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
STATU TYPE EKPO-STATU,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
MENGE TYPE EKPO-MENGE,
MEINS TYPE EKPO-MEINS,
NETPR TYPE EKPO-NETPR,
PEINH TYPE EKPO-PEINH,
END OF TY_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF TY_EKKO INITIAL SIZE 0,
IT_EKPO TYPE STANDARD TABLE OF TY_EKKO INITIAL SIZE 0,
IT_EMPTYTAB TYPE STANDARD TABLE OF TY_EKKO INITIAL SIZE 0,
WA_EKKO TYPE TY_EKKO,
WA_EKPO TYPE TY_EKKO.
DATA: OK_CODE LIKE SY-UCOMM, "OK-Code
SAVE_OK LIKE SY-UCOMM.
*ALV data declarations
DATA: FIELDCATALOG TYPE LVC_T_FCAT WITH HEADER LINE.
DATA: GD_FIELDCAT TYPE LVC_T_FCAT,
GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
*ALVtree data declarations
CLASS CL_GUI_COLUMN_TREE DEFINITION LOAD.
CLASS CL_GUI_CFW DEFINITION LOAD.
DATA: GD_TREE TYPE REF TO CL_GUI_ALV_TREE,
GD_HIERARCHY_HEADER TYPE TREEV_HHDR,
GD_REPORT_TITLE TYPE SLIS_T_LISTHEADER,
GD_LOGO TYPE SDYDO_VALUE,
GD_VARIANT TYPE DISVARIANT.
*Create container for alv-tree
DATA: GD_TREE_CONTAINER_NAME(30) TYPE C,
GD_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*Includes
*INCLUDE ZDEMO_ALVTREEO01. "Screen PBO Modules
*INCLUDE ZDEMO_ALVTREEI01. "Screen PAI Modules
*INCLUDE ZDEMO_ALVTREEF01. "ABAP Subroutines(FORMS)
*Start-of-selection.
START-OF-SELECTION.
ALVtree setup data
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_HIERARCHY_HEADER CHANGING GD_HIERARCHY_HEADER.
PERFORM BUILD_REPORT_TITLE USING GD_REPORT_TITLE GD_LOGO.
PERFORM BUILD_VARIANT.
Display ALVtree report
CALL SCREEN 100.
*& Form data_retrieval
text
--> p1 text
<-- p2 text
FORM DATA_RETRIEVAL .
SELECT EBELN
UP TO 10 ROWS
FROM EKKO
INTO CORRESPONDING FIELDS OF TABLE IT_EKKO.
LOOP AT IT_EKKO INTO WA_EKKO.
SELECT EBELN EBELP STATU AEDAT MATNR MENGE MEINS NETPR PEINH
FROM EKPO
APPENDING TABLE IT_EKPO
WHERE EBELN EQ WA_EKKO-EBELN.
ENDLOOP.
ENDFORM. " data_retrieval
*& Form build_fieldcatalog
text
--> p1 text
<-- p2 text
FORM BUILD_FIELDCATALOG .
Please not there are a number of differences between the structure of
ALVtree fieldcatalogs and ALVgrid fieldcatalogs.
For example the field seltext_m is replace by scrtext_m in ALVtree.
FIELDCATALOG-FIELDNAME = 'EBELN'. "Field name in itab
FIELDCATALOG-SCRTEXT_M = 'Purchase Order'. "Column text
FIELDCATALOG-COL_POS = 0. "Column position
FIELDCATALOG-OUTPUTLEN = 15. "Column width
FIELDCATALOG-EMPHASIZE = 'X'. "Emphasize (X or SPACE)
FIELDCATALOG-KEY = 'X'. "Key Field? (X or SPACE)
fieldcatalog-do_sum = 'X'. "Sum Column?
fieldcatalog-no_zero = 'X'. "Don't display if zero
APPEND FIELDCATALOG TO GD_FIELDCAT.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'EBELP'.
FIELDCATALOG-SCRTEXT_M = 'PO Iten'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 1.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'STATU'.
FIELDCATALOG-SCRTEXT_M = 'Status'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 2.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'AEDAT'.
FIELDCATALOG-SCRTEXT_M = 'Item change date'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 3.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'MATNR'.
FIELDCATALOG-SCRTEXT_M = 'Material Number'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 4.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'MENGE'.
FIELDCATALOG-SCRTEXT_M = 'PO quantity'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 5.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'MEINS'.
FIELDCATALOG-SCRTEXT_M = 'Order Unit'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 6.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'NETPR'.
FIELDCATALOG-SCRTEXT_M = 'Net Price'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 7.
FIELDCATALOG-DATATYPE = 'CURR'.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'PEINH'.
FIELDCATALOG-SCRTEXT_M = 'Price Unit'.
FIELDCATALOG-OUTPUTLEN = 15.
FIELDCATALOG-COL_POS = 8.
APPEND FIELDCATALOG TO GD_FIELDCAT..
CLEAR FIELDCATALOG.
ENDFORM. " build_fieldcatalog
*& Form build_layout
text
--> p1 text
<-- p2 text
FORM BUILD_LAYOUT .
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-TOTALS_TEXT = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'
ENDFORM. " build_layout
*& Form build_hierarchy_header
text
<--P_GD_HIERARCHY_HEADER text
FORM BUILD_HIERARCHY_HEADER CHANGING
P_HIERARCHY_HEADER TYPE TREEV_HHDR.
P_HIERARCHY_HEADER-HEADING = 'Hierarchy Header'(013).
P_HIERARCHY_HEADER-TOOLTIP = 'This is the Hierarchy Header !'(014).
P_HIERARCHY_HEADER-WIDTH = 30.
P_HIERARCHY_HEADER-WIDTH_PIX = ''.
ENDFORM. " build_hierarchy_header
*& Form build_report_title
text
-->P_GD_REPORT_TITLE text
-->P_GD_LOGO text
FORM BUILD_REPORT_TITLE USING PT_REPORT_TITLE TYPE SLIS_T_LISTHEADER
P_GD_LOGO TYPE SDYDO_VALUE.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
LD_DATE(10) TYPE C.
List Heading Line(TYPE H)
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
ls_line-key "Not Used For This Type(H)
LS_LINE-INFO = 'PO ALVTree Display'.
APPEND LS_LINE TO PT_REPORT_TITLE.
Status Line(TYPE S)
LD_DATE(2) = SY-DATUM+6(2).
LD_DATE+2(1) = '/'.
LD_DATE3(2) = SY-DATUM4(2).
LD_DATE+5(1) = '/'.
LD_DATE+6(4) = SY-DATUM(4).
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Date'.
LS_LINE-INFO = LD_DATE.
APPEND LS_LINE TO PT_REPORT_TITLE.
Action Line(TYPE A)
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
CONCATENATE 'Report: ' SY-REPID INTO LS_LINE-INFO SEPARATED BY SPACE.
APPEND LS_LINE TO PT_REPORT_TITLE.
ENDFORM. " build_report_title
*& Form build_variant
text
--> p1 text
<-- p2 text
FORM BUILD_VARIANT .
Set repid for storing variants
GD_VARIANT-REPORT = SY-REPID.
ENDFORM. " build_variant
cheers,
Hema. -
Up and Down Buttons in ALV Grid
Hi,
If you open the Sorting Screen of an ALV Grid, you can select Columns you want to see and you can rearange them by clicking this Up and Down Buttons. Are these up and down buttons Standard or are they only available in this Sorting Screen? Because i also want to allow the user to sort entries in an own ALV Grid by rearranging the entries with Up and Down buttons. Do i have to add them by my own or is there a standard feature. I saw that there is an Move Row Function, but i did not found any documentation on that.
Thanks,Jonhy:
This is a little example with ALV, you can see basically are tree things:
1.- Create fieldcat
2.- Have internal table with informacion
3.- CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
All buttons into ALV Tool Bar are standar, and you can hide/show them, or in some case changed a lot of behavior.
Documentation?
TAW10_3 ALV Grid control Unit, is a excelent chapter to start.
TYPE-POOLS: slis.
TABLES: SPFLI.
data: IT_SPFLI like spfli occurs 0 with header line.
data: t_fieldcat TYPE slis_t_fieldcat_alv,
fs_fieldcat LIKE LINE OF t_fieldcat.
select-options: s_carrid for spfli-carrid,
s_connid for spfli-connid.
SELECT * FROM SPFLI INTO TABLE it_spfli
where CARRID in s_carrid and
CONNID in s_connid .
fs_fieldcat-fieldname = 'CARRID'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 1.
fs_fieldcat-key = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat .
fs_fieldcat-fieldname = 'CONNID'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 2.
fs_fieldcat-key = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat .
fs_fieldcat-fieldname = 'DISTANCE'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 3.
fs_fieldcat-key = ' '.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
fs_fieldcat-fieldname = 'CITYFROM'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 4.
fs_fieldcat-key = ' '.
APPEND fs_fieldcat TO t_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = t_fieldcat
TABLES
t_outtab = it_spfli.
Enjoy the example.
Regards
José Luis -
F.01 Summary Report for ALV grid
Hi all,
We have defined our financial statement version (FSV). We have been running tests in transaction F.01, when we choose ALV Tree output the transaction works perfectly.
However, if we choose ALV grid output and then choose "1" in the Summary Report field (highest summary level, only main points of Balance sheet P&L statement should be displayed) the output is not summarized at all.
In short, no matter what number we put in the Summary Report field we always get the same output.
What needs to be done in order to be able to use this summarization control?
Any help will be appreciated.
Juan
Edited by: Juan Carlos Mier Giraud on Jul 8, 2008 4:50 PMRenata,
Thanks for your help. I am going to need a bit of help to develop the solutions described in the notes you pointed out.
Have you successfully created a summarization for ALV grid output?
I just want to know if it is worthy to devote time to it or just use classic list or ALV tree when appropiate.
Regards -
How to trigger left_click_run event on ALV GRID
Hiiiiiiii........
Can any of u please tell me how to trigger left_click_run event on ALV GRID.
There is an event LEFT_CLICK_RUN and its a public accessed event. But the problem is , the corresponding attribute of this event "EVENT_LEFT_CLICK_RUN" which is needed to registered that event (We need to register our events through a method set_register_events using table of type cntl_simple_events...) is protect accessed. So I am unable to use that attribute...Could u please tell me is there any alternative way to register that event.......ANY POSSIBLE WAY?
Thanks in advance,
RamsI think you should use event selection_changed. Note that you shouldn't allow multiple selection for the tree at the same time, i.e. use: create object g_tree exporting \[...\] node_selection_mode = cl_gui_column_tree=>node_sel_mode_single.
For more information, see this thread: Urgently required : cl_gui_alv_tree single_click event...
Maybe you are looking for
-
[AMD Catalyst] problem with "major" file
Hi, I'm using now the free driver xf86-video-ati for my [Radeon 9200 SE] card, and for several reasons, I want to switch to the proprietary driver, Catalyst. I followed all the steps of the wiki, but when I "startx", it display: ukiDynamicMajor = fai
-
Is it possible to check the log of IP accounts tha...
I would like to check if certain people have been hacking into my skype and reading my conversations, if not the IP address then would it be possible to check the general location of people logging into your skype?
-
Big screen with screen mirroring!
Can I use this app to mirror the screen?
-
Hi, I've set up two stored procedures: 1. One to do a datapump iimport over a network link using the datapump api. 2. Another one to read the resulting log file on the server into a clob fiield in a table. Individually, both of the above work fine. T
-
Why doesn't my Sondy PS located my music files in Itues??
I want to use my Sony PlayStation to play my Itunes music on my home theatre system however, I am unable to locate my music files. Is this due to them being saved as Apple Lossless or is it due to proprieity issues between the two devices??