Normal ALVs vrs ALV OOPs
I am using ALV OOPs. In ALV OOPs Appl tool bar is working by default when we create PF-STATUS. But in case of normal ALVs we need to write code for SY-UCOMM in PAI. why this happens, can anybody give tips.
Regards,
Naseer.
Hi Naseer,
In Normal ALV we use Function mnodule and in OOPs we use classes and methods.
In Normal ALV we cannot place grids on screens but in OOALV we can place grids on screens.
we can insert logos in OOPS ALV.
see the code below
for displaying LOGO in ALV GRID CONTROL, we work with
Predefined global class. CL_GUI_ALV_TREE_SIMPLE. FOR
displaying LOGO. AND we use CL_GUI_CUSTOM_CONTAINTER for
identifies the location where we r goinh to display.
DECLARATIONS;
TYPE-POOLS: SDYDO, SLIS.
DATA: L_LOGO TYPE SDYDO_VALUE, FOR DISPLAYING LOGO
L_LIST TYPE SLIS_T_LISTHEADER. FOR LIST HEADING
DATA: LOGO TYPE SCRFNAME VALUE SLOGO,
CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
LOGO1 TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
CREATE INSTANCE FOR ABOVE DEFINED CLASSES IN PBO EVENT
OF SCREEN FLOW LOGIC.
IF CONTAINER IS INITIAL.
CREATE OBJECT CONTAINER EXPORTING CONTAINER_NAME =
LOGO.
CREATE OBJECT LOGO1 EXPORTING I_PARENT = CONTAINER.
NOW CALL THE METHOD FOR DISPLAYING LOGO IN GRID CONTROL
CALL METHOD LOGO->CREATE_REPORT_HEADER
EXPORTING
I_LIST_COMMENTARY = L_LIST
I_LOGO = HERE PASS WHERE LOGO EXISTING.
THE ABOVE METHOD EXISTING
Please reward points if helpful..
Cheers,
Chaitanya.
Similar Messages
-
Maximum Number of Columns in OOPs ALV / Normal ALV Grid
Hi Experts ,
We got Stuck in Displaying the 150 Columns in the ALV Display .
Need to Confirm how many Columns can be displayed in ALV - 60/90/99/1023 Or 1023 characters in ALv Display
1. How It can be achieved to display 150 Columns in ALV .
2. By Which way it should be More Efficient Using OOPs ALV or Normal ALV Grid.
We had check almost all the forums Post but didnt get any satisfactory answer for the same .
Thanks in advance
Regards,
Saurabh GoelHello,
If you are preparing your field catalog by using the function module REUSE_ALV_FIELDCAT_MERGE, then you can display a
maximum of something around 70 to 82 fields.
But if you are creating your field catalog manually, then you can display N number of columns in ALV grid.
Check the point of fieldcat preparation.
Hope this helps
Cheers!
Mishra -
Hi Friends,
I just want to convert a normal alv grid report to ALV OOPS report using classes,methods and objects, can you please help me on it.
*I have sent a sample ALV grid report program.
REPORT YSDB_ALV_ECC NO STANDARD PAGE HEADING LINE-SIZE 260 LINE-COUNT 58.
TABLES:
VBRK,
VBRP.
TYPE-POOLS: SLIS.
TYPES:
BEGIN OF Y_VBRK_STRUCT ,
VBELN TYPE VBRK-VBELN,
FKART TYPE VBRK-FKART,
FKDAT TYPE VBRK-FKDAT,
BUKRS TYPE VBRK-BUKRS,
NETWR TYPE VBRK-NETWR,
END OF Y_VBRK_STRUCT.
TYPES:
BEGIN OF Y_VBRP_STRUCT,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
FKIMG TYPE VBRP-FKIMG,
AUBEL TYPE VBRP-AUBEL,
KOSTL TYPE VBRP-KOSTL,
PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
ARKTX TYPE VBRP-ARKTX,
END OF Y_VBRP_STRUCT.
TYPES:
BEGIN OF Y_DISPLAY_STRUCT,
VBELN TYPE VBRK-VBELN,
FKART TYPE VBRK-FKART,
FKDAT TYPE VBRK-FKDAT,
BUKRS TYPE VBRK-BUKRS,
NETWR TYPE VBRK-NETWR,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
FKIMG TYPE VBRP-FKIMG,
AUBEL TYPE VBRP-AUBEL,
KOSTL TYPE VBRP-KOSTL,
PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
ARKTX TYPE VBRP-ARKTX,
END OF Y_DISPLAY_STRUCT .
DATA: W_INDEX LIKE SY-TABIX.
DATA: W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV.
DATA: T_FIELDCATALOG1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_REPID TYPE SY-REPID.
DATA: T_VBRK_ITAB TYPE STANDARD TABLE OF Y_VBRK_STRUCT .
DATA: T_VBRP_ITAB TYPE STANDARD TABLE OF Y_VBRP_STRUCT .
DATA: T_DISPLAY_ITAB TYPE STANDARD TABLE OF Y_DISPLAY_STRUCT.
DATA: E_DISPLAY TYPE Y_DISPLAY_STRUCT.
SELECT-OPTIONS S_VBELN FOR VBRK-VBELN.
SELECT-OPTIONS S_BUKRS FOR VBRK-BUKRS.
SELECT-OPTIONS S_FKDAT FOR VBRK-FKDAT.
START-OF-SELECTION.
PERFORM F_GET_DATA1.
PERFORM F_PROCESS_DATA.
PERFORM F_FIELDCATLOG.
PERFORM F_DISPLAY_DATA.
PERFORM F_CLEAR_FIELDS.
*& Form get_data1
text
FORM F_GET_DATA1 .
SELECT VBELN FKART FKDAT BUKRS NETWR
FROM VBRK
INTO TABLE T_VBRK_ITAB
WHERE BUKRS IN S_BUKRS
AND FKDAT IN S_FKDAT
AND VBELN IN S_VBELN.
IF SY-SUBRC NE 0.
FREE: T_VBRK_ITAB.
ENDIF.
IF NOT T_VBRK_ITAB IS INITIAL.
SELECT VBELN POSNR MATNR FKIMG AUBEL
KOSTL PS_PSP_PNR ARKTX
FROM VBRP
INTO TABLE T_VBRP_ITAB
FOR ALL ENTRIES IN T_VBRK_ITAB
WHERE VBELN EQ T_VBRK_ITAB-VBELN.
IF SY-SUBRC NE 0.
FREE: T_VBRK_ITAB.
ENDIF.
ENDIF.
ENDFORM. " GET_DATA1
text
--> p1 text
<-- p2 text
FORM F_PROCESS_DATA .
SORT T_VBRK_ITAB BY VBELN.
SORT T_VBRP_ITAB BY VBELN.
CLEAR: W_INDEX.
UNASSIGN <FS_STRUCT1>.
UNASSIGN <FS_STRUCT2>.
LOOP AT T_VBRK_ITAB ASSIGNING <FS_STRUCT1>.
READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> WITH KEY VBELN = <FS_STRUCT1>-VBELN BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE SY-TABIX TO W_INDEX.
WHILE SY-SUBRC IS INITIAL AND <FS_STRUCT1>-VBELN = <FS_STRUCT2>-VBELN.
*Header Items Moving
MOVE:
<FS_STRUCT1>-FKART TO E_DISPLAY-FKART,
<FS_STRUCT1>-FKDAT TO E_DISPLAY-FKDAT,
<FS_STRUCT1>-BUKRS TO E_DISPLAY-BUKRS,
<FS_STRUCT1>-NETWR TO E_DISPLAY-NETWR.
*Line items Moving
MOVE: <FS_STRUCT2>-VBELN TO E_DISPLAY-VBELN,
<FS_STRUCT2>-POSNR TO E_DISPLAY-POSNR,
<FS_STRUCT2>-MATNR TO E_DISPLAY-MATNR,
<FS_STRUCT2>-FKIMG TO E_DISPLAY-FKIMG,
<FS_STRUCT2>-AUBEL TO E_DISPLAY-AUBEL,
<FS_STRUCT2>-KOSTL TO E_DISPLAY-KOSTL,
<FS_STRUCT2>-PS_PSP_PNR TO E_DISPLAY-PS_PSP_PNR,
<FS_STRUCT2>-ARKTX TO E_DISPLAY-ARKTX.
APPEND E_DISPLAY TO T_DISPLAY_ITAB.
CLEAR E_DISPLAY.
ADD 1 TO W_INDEX.
READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> INDEX W_INDEX.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDLOOP.
ENDFORM. " GET_DATA3
*& Form Fieldcatlog
text
--> p1 text
<-- p2 text
FORM F_FIELDCATLOG .
W_FIELDCATALOG-FIELDNAME = TEXT-001.
W_FIELDCATALOG-SELTEXT_L = TEXT-002.
MOVE : 1 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-003.
W_FIELDCATALOG-SELTEXT_L = TEXT-004.
MOVE : 2 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-005.
W_FIELDCATALOG-SELTEXT_L = TEXT-006.
MOVE : 3 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-007.
W_FIELDCATALOG-SELTEXT_L = TEXT-008.
MOVE : 4 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-009.
W_FIELDCATALOG-SELTEXT_L = TEXT-010.
MOVE : 5 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-011.
W_FIELDCATALOG-SELTEXT_L = TEXT-012.
MOVE : 6 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-013.
W_FIELDCATALOG-SELTEXT_L = TEXT-014.
MOVE : 7 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-015.
W_FIELDCATALOG-SELTEXT_L = TEXT-016.
MOVE : 8 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-017.
W_FIELDCATALOG-SELTEXT_L = TEXT-018.
MOVE : 9 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
ENDFORM. " Fieldcatlog
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM F_DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
I_CALLBACK_TOP_OF_PAGE = 'AAAAAAAAADDAADA' "TEXT-021
I_GRID_TITLE = TEXT-020
IT_FIELDCAT = T_FIELDCATALOG1
TABLES
T_OUTTAB = T_DISPLAY_ITAB.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
CLEAR: W_REPID.
CLEAR: T_FIELDCATALOG1.
ENDFORM. " DISPLAY_DATA
*& Form F_Clear_fields
text
--> p1 text
<-- p2 text
FORM F_CLEAR_FIELDS .
FREE: T_VBRK_ITAB.
FREE: T_VBRP_ITAB.
FREE: T_DISPLAY_ITAB.
CLEAR: W_FIELDCATALOG.
ENDFORM. " F_Clear_fields
Regards
DineshIn ALV oops,
1. You need screen on which you must create a custom container. - screen 100
2. In PBO of 100, create module for displaying ALV
MODULE DISPLAY_ALV OUTPUT
PERFORM CREATE_CONTAINER "IN WHICH YOU USE THE CREATE OBJECT METHOD OF CL_GUI_CUSTOM_CONTAINER
PERFORM CREATE_ALV "IN WHICH YOU USE CREATE_OBJECT METHOD OF CL_GUI_ALV_GRID.
PERFORM PREPARE_FIELDCAT "creating fcat using LVC_S_FCAT structure
PERFORM DISPLAY "here you use the SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class,
where you provide the internal table name and fieldcat internal table
ENDMODULE -
I am using ALV OOPs. I need to link F4 help to field in Selection Screen, Instead of normal method F4IF_INT_TABLE_VALUE_REQUEST, I need to implement this in ALV OOPs. Can anybody help on this.
Regards,
Naseer.Hi Naseer!
At Selection Screen you don't call method to create the ALV OO yet.
So you can you the FM 'F4IF_INT_TABLE_VALUE_REQUEST' in the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR your_parameter.
I hope its helpful. -
Hi
Im using ALV OOPS.o/p I have 10 records with checkbox(at user command I have to select record selected by check box). Now on the menu bar I hav a button for "SELECT ALL". If "selected all" 10 recored will be selected. If I filter upon some criteria no. of records will be 3..Now in GUI if I select SELECT all it will display 3 records r selected, but I have to process further internally ,,,but internally 10 records are selected. So how to write code for that is after filterring 3 records r selected and I "select all"..only 3 records will be selected instead of 10?
Part of my code like this..
SELECT all
CALL METHOD G_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
IF L_VALID EQ 'X'.
LOOP AT PT_OUTTAB INTO LS_OUTTAB.
DATA LS_CELLTAB TYPE LVC_S_STYL.
LOOP AT PS_OUTTAB-CELLTAB INTO LS_CELLTAB.
IF LS_CELLTAB-FIELDNAME = 'CHECKBOX'.
IF LS_CELLTAB-STYLE EQ CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
P_LOCKED = 'X'.
ELSE.
P_LOCKED = SPACE.
ENDIF.
ENDIF.
ENDLOOP.
IF L_LOCKED IS INITIAL
AND NOT LS_OUTTAB-CHECKBOX EQ '-'.
LS_OUTTAB-CHECKBOX = 'X'.
ENDIF.
MODIFY PT_OUTTAB FROM LS_OUTTAB.
ENDLOOP.
CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY.
ENDIF.Hello Kaushik
Using method go_grid->GET_FILTERED_ENTRIES you get an index list of the filtered entries.
DATA: lt_filtered TYPE lvc_t_fidx,
ld_indx LIKE LINE OF lt_filtered.
CALL METHOD go_grid->GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = lt_filtered.
LOOP AT lt_filtered INTO ld_indx.
READ TABLE gt_outtab INTO ls_outtab INDEX ld_indx.
ENDLOOP.
Regards
Uwe -
To set HOTSPOT for a field in ALV-oops and when clecked should call transac
Hi,
I need to set HOTSPOT for a field in O/P list using ALV-oops and when clecked should take me to Transaction VA01. Please help....
Thanks,
PrabhuHi,
Please go through this code it may help u.
REPORT zcls_alv_oops MESSAGE-ID z1.
TABLES : mara.
Types Declaration..\
TYPES :
BEGIN OF t_mara,
matnr TYPE matnr,
mtart TYPE mtart,
maktx TYPE maktx,
END OF t_mara,
BEGIN OF t_marc,
matnr TYPE matnr,
werks TYPE werks_d,
mtart TYPE mtart,
maktx TYPE maktx,
END OF t_marc.
Internal Tables Declaration..\
DATA :
i_mara TYPE TABLE OF t_mara,
i_marc TYPE TABLE OF t_marc,
i_fcat1 TYPE lvc_t_fcat,
i_fcat2 TYPE lvc_t_fcat.
Constants Declaration..\
CONSTANTS :
c_cont1 TYPE scrfname VALUE 'CONT1',
c_cont2 TYPE scrfname VALUE 'CONT2'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS:
s_matnr FOR mara-matnr NO INTERVALS.
SELECTION-SCREEN SKIP 1.
PARAMETERS :
p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X',
p_bttn RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b1.
\* Class forward referncing.
CLASS lcl_rcvr_class DEFINITION DEFERRED.
\* Pointers Declaration..
DATA :
lp_rcvr TYPE REF TO lcl_rcvr_class,
lp_cont1 TYPE REF TO cl_gui_custom_container,
lp_cont2 TYPE REF TO cl_gui_custom_container,
lp_grid1 TYPE REF TO cl_gui_alv_grid,
lp_grid2 TYPE REF TO cl_gui_alv_grid.
\* Local Class Definiton.
CLASS lcl_rcvr_class DEFINITION.
PUBLIC SECTION.
METHODS :
hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
\* Local Class Implementation.
CLASS lcl_rcvr_class IMPLEMENTATION.
METHOD hotspot_click.
DATA :
wa_mara TYPE t_mara,
wa_marc TYPE t_marc.
DATA :
l_index TYPE sy-tabix.
READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
IF sy-subrc EQ 0.
REFRESH i_marc.
SELECT matnr
werks
INTO TABLE i_marc
FROM marc
WHERE matnr EQ wa_mara-matnr.
IF sy-subrc EQ 0.
LOOP AT i_marc INTO wa_marc.
l_index = sy-tabix.
wa_marc-mtart = wa_mara-mtart.
wa_marc-maktx = wa_mara-maktx.
MODIFY i_marc FROM wa_marc INDEX l_index
TRANSPORTING mtart maktx.
ENDLOOP.
CALL SCREEN 200.
ELSE.
MESSAGE e121 WITH text-005 wa_mara-matnr.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD handle_double_click.
DATA :
wa_mara TYPE t_mara,
wa_marc TYPE t_marc.
DATA :
l_index TYPE sy-tabix.
READ TABLE i_mara INTO wa_mara INDEX e_row-index.
IF sy-subrc EQ 0.
REFRESH i_marc.
SELECT matnr
werks
INTO TABLE i_marc
FROM marc
WHERE matnr EQ wa_mara-matnr.
IF sy-subrc EQ 0.
LOOP AT i_marc INTO wa_marc.
l_index = sy-tabix.
wa_marc-mtart = wa_mara-mtart.
wa_marc-maktx = wa_mara-maktx.
MODIFY i_marc FROM wa_marc INDEX l_index
TRANSPORTING mtart maktx.
ENDLOOP.
CALL SCREEN 200.
ELSE.
MESSAGE e121 WITH text-005 wa_mara-matnr.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
\* Start of Selection
START-OF-SELECTION.
\* Extract the Material Master data for the Input Material.
SELECT a~matnr
a~mtart
b~maktx
INTO TABLE i_mara
FROM mara AS a
INNER JOIN makt AS b
ON a~matnr EQ b~matnr
WHERE a~matnr IN s_matnr
AND b~spras EQ sy-langu.
END-OF-SELECTION.
IF NOT i_mara\[\] IS INITIAL.
\* Call Screen to display the Material Master data.
CALL SCREEN 100.
ELSE.
MESSAGE s121 WITH text-006.
ENDIF.
\*& Module DISP_GRID OUTPUT
\* text
MODULE disp_grid OUTPUT.
\* Build the Field catelog for Material Master data.
PERFORM build_fcat.
\* Display the Material Master data using ALV.
PERFORM disp_alv.
ENDMODULE. " DISP_GRID OUTPUT
\*& Module USER_COMMAND_0100 INPUT
\* text
MODULE user_command_0100 INPUT.
\*when exit or cancel is clicked program has to come out
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
\*& Form build_fcat
\* text
\* \--> p1 text
\* <-\- p2 text
FORM build_fcat.
DATA : ws_fcat TYPE lvc_s_fcat.
ws_fcat-fieldname = 'MATNR'.
ws_fcat-scrtext_m = text-001.
ws_fcat-tabname = 'I_MARA'.
IF p_hotspt EQ 'X'.
ws_fcat-hotspot = 'X'.
ENDIF.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MTART'.
ws_fcat-scrtext_m = text-002.
ws_fcat-tabname = 'I_MARA'.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MAKTX'.
ws_fcat-scrtext_m = text-003.
ws_fcat-tabname = 'I_MARA'.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ENDFORM. " build_fcat
\*& Form disp_alv
\* text
\* \--> p1 text
\* <-\- p2 text
FORM disp_alv.
IF lp_cont1 IS INITIAL.
\* Create the Container Object of Material Master.
CREATE OBJECT lp_cont1
EXPORTING
container_name = c_cont1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6 .
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Create the Object for Grid of Material Master.
CREATE OBJECT lp_grid1
EXPORTING
i_parent = lp_cont1
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Dipslay Material Master data by calling method.
CALL METHOD lp_grid1->set_table_for_first_display
CHANGING
it_outtab = i_mara
it_fieldcatalog = i_fcat1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Set Handler for the Hot Spot Event.
CREATE OBJECT lp_rcvr.
IF p_hotspt EQ 'X'.
SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
ELSE.
SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " disp_alv
\*& Module STATUS_0100 OUTPUT
\* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN_STAT'.
SET TITLEBAR 'T_100'.
ENDMODULE. " STATUS_0100 OUTPUT
\*& Module STATUS_0200 OUTPUT
\* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'PLANT_STAT'.
SET TITLEBAR 'T_200'.
ENDMODULE. " STATUS_0200 OUTPUT
\*& Module DISP_GRID_plant OUTPUT
\* text
MODULE disp_grid_plant OUTPUT.
\* Build the Field catelog for Material Plant data.
PERFORM build_fcat_plant.
\* Display the Material Master Plant data using ALV.
PERFORM disp_alv_plant.
ENDMODULE. " DISP_GRID_plant OUTPUT
\*& Module USER_COMMAND_0200 INPUT
\* text
MODULE user_command_0200 INPUT.
\*when exit or cancel is clicked program has to come out
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
\*& Form build_fcat_plant
\* text
\* \--> p1 text
\* <-\- p2 text
FORM build_fcat_plant.
DATA : ws_fcat TYPE lvc_s_fcat.
ws_fcat-fieldname = 'MATNR'.
ws_fcat-scrtext_m = text-001.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'WERKS'.
ws_fcat-scrtext_m = text-004.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MTART'.
ws_fcat-scrtext_m = text-002.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MAKTX'.
ws_fcat-scrtext_m = text-003.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ENDFORM. " build_fcat_plant
\*& Form disp_alv_plant
\* text
\* \--> p1 text
\* <-\- p2 text
FORM disp_alv_plant.
IF lp_cont2 IS INITIAL.
\* Create the Container Object of Material Plant data.
CREATE OBJECT lp_cont2
EXPORTING
container_name = c_cont2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Create the Object for Grid of Material Plant data.
CREATE OBJECT lp_grid2
EXPORTING
i_parent = lp_cont2
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Dipslay Material Plant data by calling method.
CALL METHOD lp_grid2->set_table_for_first_display
CHANGING
it_outtab = i_marc
it_fieldcatalog = i_fcat2
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ELSE.
\* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
CALL METHOD lp_grid2->refresh_table_display.
ENDIF.
ENDFORM. " disp_alv_plant -
Problem while placing a button in the Output using ALV OOPs
Hi,
I am using ALV OOPs to display report output.
In the toolbar i have to palce an update button and if i click on that update it should then call the selection screen 500 .
So,please help me to achieve this using ALV OOPs.
THANKS & REGARDS,
Kiranmai.Hi,
you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
Regards,
Siddarth -
Event handling in alv oops With buttons
Hi Experts
I have some doubt in ALV OOPS using Events. Could any one please tell me the procedure to how to handle events in oops ( Like interactive reports using events ).
Thank you
Satyendra.Hello Satyendra
The following sample report shows you how to handle the event HOTSPOT_CLICK and BUTTON_CLICK.
DATA: gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA: gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS: p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender, " grid instance that raised the event
handle_button_click FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING
es_col_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CASE e_column_id-fieldname.
WHEN 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'ERNAM'.*
SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
ENDCASE.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
is_row_id = e_row_id
is_column_id = ls_col_id.
ENDMETHOD. "handle_hotspot_click
METHOD handle_button_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX es_row_no-row_id.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDMETHOD. "handle_button_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1,
lcl_eventhandler=>handle_button_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'KUNNR' OR
fieldname = 'ERNAM' OR
fieldname = 'BUKRS' ).
IF ( ls_fcat-fieldname = 'BUKRS' ).
ls_fcat-style = cl_gui_alv_grid=>mc_style_button. " column appears as button
ELSE.
ls_fcat-hotspot = abap_true.
ENDIF.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
Req:Download of purchase order item details using ALV oops
Hi all,
How to download the purchase order item details using ALV oops from the output of header detailsHi all,
How to download the purchase order item details using ALV oops from the output of header details -
LED in field of ALV(OOPs oriented)- Traffic lights in ALV filter popup
Hi experts,
Am showing LED in field of ALV(OOPs oriented)and when i click on ALV filter for led field..it shows me Traffic lights in poup for filter.Please help me to get LED in filter popup also.
Thanks,
Sajay.Hi,
Use the fuction module 'ICON_CREATE' as follows.
CALL FUNCTION 'ICON_CREATE'
"To create Red/Yellow/Green traffic icons
EXPORTING
name = wrk_light
IMPORTING
RESULT = ip_status.
wrk_light can be;
'ICON_RED_LIGHT'
'ICON_YELLOW_LIGHT'
or 'ICON_GREEN_LIGHT' according to your scenario, that you can use the logic for your scondition.
Use it in PBO.
Regards,
Renjith Michael. -
HI GUYS,
CAN ANYONE PLS HELP ME OUT HANDLING EVENTS IN ALV(OOPS)....iS THERE ANY CLASS TO BE DEFINED ?????? PLS HELP IF ANYONE HAS THE CODE FOR THAT...........Hi,
Declare as below.
CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
DATA : O_ALVGRID TYPE REF TO CL_GUI_ALV_GRID ,
O_DOCKINGCONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER ,
O_EVENTRECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
Then class definition should be as follows:
CLASS LCL_EVENT_RECEIVER DEFINITION.
Event receiver definitions for ALV actions
PUBLIC SECTION.
CLASS-METHODS:
Row Double click for dirll down.
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN
ES_ROW_NO.
ENDCLASS.
Then implementation should be as follows:
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
*& Method handle_double_click
This method is called when the user double clicks on a line to drill
down.
The following are exported from the ALV
LVC_S_ROW
LVC_S_COL
LVC_S_ROID
METHOD HANDLE_DOUBLE_CLICK.
The double click drill down processing should be
coded in the form below.
PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW
E_COLUMN
ES_ROW_NO.
ENDMETHOD.
ENDCLASS.
*& Form F9007_HANDLE_DOUBLE_CLICK
This form is called when the user double clicks on a line to drill
down.
-->P_E_ROW_ID - Row ID text
-->P_E_COLUMN_ID - Column ID
-->P_ES_ROW_NO - Row number
FORM f9007_handle_double_click USING p_row
p_column
p_row_no.
DATA: lw_output LIKE LINE OF i_output.
Need to check that a subtotal or grand total line has *not been double-clicked, otherwise the report will *produce a short dump!
check p_row+0(1) is initial.
READ TABLE i_output INDEX p_row INTO lw_output.
CASE p_column.
WHEN 'KNUMA'.
IF NOT lw_output-knuma IS INITIAL.
SET PARAMETER ID 'VBO' FIELD lw_output-knuma.
CALL TRANSACTION 'VBO3' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. " F9007_HANDLE_DOUBLE_CLICK
In PBO of the screen,
MODULE status_9001 OUTPUT.
IF o_dockingcontainer IS INITIAL.
SET HANDLER o_eventreceiver->handle_double_click FOR o_alvgrid.
ENDMODULE. " STATUS_9001 OUTPUT
In this I have mentioned double click event.
Similarly you have to do for others.
Regards,
J.Jayanthi -
Change the data in fieldcat and update the database table in alv oops
Hi,
my requirement is i have displayed a fieldcat in change mode and when i change the data and click on save it has to be updated the database table..
this has to be done using alv oops...Hi,
This code will reflect all the changes into the internal table that is being displayed.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
Now after this code is executed the internal table is modified as per the changes done in alv output.
Now you can use this internal table to update the database table.
Hope this helps you.
Regards,
Tarun -
How to create field catalog using field-symbols in normal alv report?
hi all,
how to create field catalog using field-symbols in normal alv report? i.e, using function modules...reuse_alv_list_display/grid_display?
regards,
jackHI
LIKE THIS
TYPE-POOLS : slis.
DATA : t_fieldcat TYPE slis_t_fieldcat_alv,
st_fieldcat TYPE slis_fieldcat_alv.
st_fieldcat-fieldname = 'STATUS'.
st_fieldcat-seltext_l = 'STATUS INDICATOR'.
st_fieldcat-outputlen = 17.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'VBELN'.
st_fieldcat-do_sum = ' '.
st_fieldcat-seltext_l = 'Sales Document No.'.
st_fieldcat-outputlen = 10.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'AUDAT'.
st_fieldcat-do_sum = ' '.
st_fieldcat-seltext_l = 'Document Date'.
st_fieldcat-outputlen = 10.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'VBTYP'.
st_fieldcat-do_sum = ' '.
st_fieldcat-seltext_l = 'Document Type'.
st_fieldcat-outputlen = 4.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'AUART'.
st_fieldcat-do_sum = ' '.
st_fieldcat-seltext_l = 'Category'.
st_fieldcat-outputlen = 1.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'AUGRU'.
st_fieldcat-do_sum = ' '.
st_fieldcat-seltext_l = 'Reason'.
st_fieldcat-outputlen = 3.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'NETWR'.
st_fieldcat-do_sum = 'X'.
st_fieldcat-seltext_l = 'Net Amount'.
st_fieldcat-outputlen = 15.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
st_fieldcat-fieldname = 'WAERK'.
st_fieldcat-do_sum = ' '.
st_fieldcat-seltext_l = 'Unit'.
st_fieldcat-outputlen = 5.
APPEND st_fieldcat TO t_fieldcat.
CLEAR st_fieldcat.
*sortinfo
st_sort-fieldname = 'AUART'.
st_sort-up = 'X'.
st_sort-subtot = 'X'.
APPEND st_sort TO t_sort.
CLEAR st_sort.
st_sort-fieldname = 'VBTYP'.
st_sort-up = 'X'.
st_sort-subtot = ' '.
APPEND st_sort TO t_sort.
CLEAR st_sort.
st_sort-fieldname = 'WAERK'.
st_sort-up = 'X'.
st_sort-subtot = 'X'.
APPEND st_sort TO t_sort.
CLEAR st_sort.
st_sort-fieldname = 'VBELN'.
st_sort-up = ' '.
st_sort-subtot = 'X'.
APPEND st_sort TO t_sort.
CLEAR st_sort.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_eventcat
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.
IF grid = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = g_program
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = t_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = t_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
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.
REWARD IF USEFULL -
Issuw with Fieldcatalog in ALV OOPS
Hi All,
I am displaying output using ALV OOPs. in output table ihave dropdown field called Manual Processing status.
to get dropdown i used below logic.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'OPEN'(016).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'CLOSED'(012).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'CANCELLED'(014).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'NO ACTION REQUIRED'(015).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = ' '.
APPEND ls_dropdown TO lt_dropdown.
CALL METHOD grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.
when i a, displaying the output lenth of this field is '9'(i mentioned while building the fieldcatalog) but in output its size is more. I used the below field catalog for this field.
ls_feildcat-fieldname = pv_field.
ls_feildcat-outputlen = pc_length.
ls_feildcat-coltext = pv_header.
ls_feildcat-just = pc_true.
ls_feildcat-no_out = gc_space.
ls_feildcat-drdn_hndl = '1'.
ls_feildcat-fix_column = 'X'.
when i comment ls_feildcat-drdn_hndl = '1' then its working fine but i am not getting dropdown. ANybody can sugeest me how to approach in this case.
Regards,
MaheedharHi,
Not sure to get your point...could this be in relation with your layout settings (e.g by passing is_layout-cwidth_opt = 'X' to method set_table_for_first_display) ?
Kr,
m. -
Handle single click event in ALV OOPS
Hi,
I have to display 2 ALV grid...one above the other.
Top ALV will contain Header info and bottom ALV witll display line item.
I am use ALV OOPS.
Now when user will click on the top ALV ...bottom ALV should show corresponding data.
I don't have to use HOTSPOT or Double click event.
How can I handle single click event.
Please guide me..thanks in advance
Regards,
Prasoonhi,
for this in ALV OOPS take <b>2 custom containers( cl_gui_custom_container)</b>in the same screen and on the 1st container display the header data<b>(use set_tale_for_first_display method of class cl_gui_alv_grid)</b>.
On the 2nd screen item data for this use<b> EVENT</b> handling(you want <b>single click</b>). use<b> hotspot_click</b> or <b>button_click </b>events.
for this you have to register the events. the code for that.
<b>CLASS lcl_event_handler DEFINITION .</b>
PUBLIC SECTION .
METHODS:
*--Hotspot click control
handle_hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no ,
*--To control button clicks
handle_button_click
FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING e_oject e_ucomm .
PRIVATE SECTION.
ENDCLASS.
<b>CLASS lcl_event_handlerIMPLEMENTATION .</b>
*--Handle Hotspot Click
METHOD handle_hotspot_click .
PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
ENDMETHOD .
METHOD handle_button_click .
PERFORM handle_button_click USING e_object e_ucomm .
ENDMETHOD .
ENDCLASS .
DATA gr_event_handler TYPE REF TO lcl_event_handler .
<b>*--Creating an instance for the event handler</b>
CREATE OBJECT gr_event_handler.
<b>*--Registering handler methods to handle ALV Grid events</b>
SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_button_click FOR gr_alvgrid .
do n't forget to use<b> refresh_table_display
</b> other wise only the record which you first you clicked will display in the 2nd container.
<b>Reward points for useful Answers</b>
Maybe you are looking for
-
Opening documents in Content Search Webpart
Hi, I have configured Office Web app server with my SharePoint farm. It is working fine with document libraries. I have added the content search web part on home page. Office web app is not opening documents from CSWP. If i click in the document in
-
Where's my "Power On" function?
I just hooked up my Apple ADC/DVI adapter to link my 20" Cinema Display to my MacPro, and the "Power" glowing button just permanently glows now. I can't turn on my computer using this button anymore like I could with my G4. Is this right? I have chec
-
HI AL how i know the names of all reports in sap and if can to know the perpose for every report?
-
Please help I can not launch Adobe Reader XI
My adobe reader suddenly stopped working yesterday. I was running version 8 or 9 under windos 7 and it suddenly gave me a strange error message that the Core DLL failed to load. I have never seen this happen before. It's also asking me if I want to
-
Hello Friends, I am trying to start up Tomcat server, but keep getting error that TOMCAT_HOME is not set. I am using Windows 98. I tried to set the Tomcat_home using SET TOMCAT_HOME = C:\Tomcat in autoexec.bat but it gives error - out of enviromental