How to show icons in ALV grid ...
Hi guyz ,
A lill query ....
In an ALV gird ,if i need to display icons in one of the columns , say i have
a field called Status , where i need show some icons like green , yellow and
red circles , depending on some other fileds say invoice reciept date .
So can i get icons in ALV colums.
Please advise .
Thanks
Jahan
This is very easy. IN your status field in your internal table, you simply write the icon to it. Make sure that the status field is defined as a character field with a length of 4. Then write the icon to it.
Type-pools: icon.
write icon_green_light as icon to itab-status.
Then when filling the field catalog, set the ICON flag. This puts the icon in the center of the cell in ALV.
xfc-icon = 'X'.
append xfc to ifc.
Regards,
Rich Heilman
Similar Messages
-
Microsoft Excel Icon in ALV Grid Report
Hi all,
We have a customized report. When we execute that reports, it open in ALV Grid format. When we choose "Microsoft Excel" Icon to change layout to Excel, it then shows the report in excel without any data.
Can any one please tell me that why there is no data? should i need to do any settings in excel for this?
Please respond.
Best Regards,
AIHi,
Refer these:
Microsoft Excel Icon in ALV Grid Report
Re: Not able display the Excel Icon in ALV List Display
Hope it helps
Regards
Mansi -
How to implement 'hypelink' in ALV GRID
Hi,everybody,please tell me how to implement 'hypelink' in ALV GRID?
I just try to design a ALV GRID report but I do not kown the way of using 'hypelink'. I refer to some documents but failsed. somebody can help me and give a example including entire code.1. Create a table where hyperlinks & corresponding handles are stored (TYpe LVC_T_HYPE)
DATA ls_hype TYPE lvc_s_hype .
data lt_hype type lvc_t_hype.
ls_hype-handle = '1' .
ls_hype-href = 'http://www.company.com/carrids/car1' .
APPEND ls_hype TO lt_hype .
2. In your list data table create additional field of type INT4 which will contain the handle of the hyper link (ex. '1' for above hyperlink)
DATA carrid_handle TYPE int4 .
3. For the field which shall contain the hyperlink, make an entry in the field catalog indicating the field name which contains handle for the hyperlink. This is done by setting the handle field name in WEB_FIELD.
ls_fieldcat-fieldname = 'CARRID'
ls_fieldcat-web_field = 'CARRID_HANDLE'.
4. While calling set_table_for_first_display, pass the hyperlink table created in step 1 to parameter 'it_hyperlink'
~Piyush Patil -
How can i show details in ALV GRID with double click in a row?
Hello, ich try to show the details of a row with double click in the line,
but it doesn't work!?
I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
Have anybody any ideas!?Hello Lars
The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
*& Report ZUS_SDN_ALVGRID_EVENTS_1
REPORT zus_sdn_alvgrid_events_1.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_t001 TYPE t001,
ls_col_id TYPE lvc_s_col.
CHECK ( sender = go_grid1 ).
READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
CHECK ( ls_t001-bukrs IS NOT INITIAL ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = ls_t001-bukrs.
IF ( syst-subrc NE 0 ).
MESSAGE 'No customers found' TYPE 'S'.
ELSE.
* Trigger PAI of dynpro '0100' and set new ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
ENDIF.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
REFRESH: gt_knb1.
* 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 OBJECT go_docking2
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.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
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_double_click FOR go_grid1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'T001'
CHANGING
it_outtab = gt_t001
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.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
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.
CALL METHOD go_docking2->link
EXPORTING
repid = syst-repid
dynnr = '0200'
* 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
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'CALL_SCREEN_0200'.
go_grid2->refresh_table_display( ). " necessary
CALL SCREEN '0200'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
Uwe -
How to Hide, or Don't show colums in ALV Grid?
I am using the standard cataloging and Function Module, REUSE_ALV_DISPLAY to pass an internal table to display fields to my ALV output.
However, I'd like to give the user options on what the report will calculate, thus having the need to only diaply certain columns on the report. Because some columns will be blank.
How can I restrain certain columns from displying on my ALV grid? Is there some logic, or parameter manipulation I need to invoke prior to my calling REUSE_ALV_DISPLAY in order to do this?
Thank-YouHi
You have to change the parameter of catalog table, if you don't want to see some fields set NO_OUT = 'X'.
LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.
CASE LT_FIELDCAT-FIELDNAME.
WHEN ....
LT_FIELDCAT-NO_OUT = 'X'.
MODIFY GT_FIELDCAT FROM LT_FIELDCAT.
ENDCASE.
ENDLOOP.
If you don't want those fields you can delete them from catalog too.
LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.
CASE LT_FIELDCAT-FIELDNAME.
WHEN ....
delete GT_FIELDCAT.
ENDCASE.
ENDLOOP.
Max -
How to write ICONS in ALV TOP of Page
Hai experts,
How to ICON in ALV Top of PAGE
i want to wrire
ICON_LED_RED for cancellation Invioce
ICON_LED_GREEN for Invioce
but i pass this values to wa_header-info it comes @5C@ @5B@
thanks
sitaramHi...
I think this code is help full for u....
*& Report ZFI_TEST *
REPORT ZFI_ICON_TEST MESSAGE-ID zz .
*& TABLES DECLARATION *
TABLES: vbak.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: slis.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF itab OCCURS 0,
icon TYPE icon-id, "itab-icon = '@08@' -> Green ; '@09@' -> Yellow ; '@0A@' -> Red
vbeln LIKE vbak-vbeln,
audat LIKE vbak-audat,
vbtyp LIKE vbak-vbtyp,
auart LIKE vbak-auart,
augru LIKE vbak-augru,
netwr LIKE vbak-netwr,
waerk LIKE vbak-waerk,
END OF itab.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
DATA: it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event,
*INTERNAL TABLE FOR SORTING
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
*INTERNAL TABLE FOR LAYOUT
wa_layout TYPE slis_layout_alv.
*& VARIABLE DECLARATION *
DATA : v_repid TYPE sy-repid,
v_pagno(4) TYPE n,
v_date(8) TYPE c.
*& CONSTANTS *
CONSTANTS: c_x TYPE c VALUE 'X'.
*& SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_vbtyp FOR vbak-vbtyp DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-003.
PARAMETERS: p_list RADIOBUTTON GROUP rad1 DEFAULT 'X'.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-004.
PARAMETERS: p_grid RADIOBUTTON GROUP rad1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN.
PERFORM validate_screen.
*& START OF SELECTION *
START-OF-SELECTION.
CLEAR: itab, itab[].
V_REPID = SY-REPID.
PERFORM get_data.
PERFORM display_data.
*& END OF SELECTION *
END-OF-SELECTION.
*--DO ALV Process
v_repid = sy-repid.
*--Sort the Output Fields
PERFORM sort_fields.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
PERFORM set_layout.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
FORM get_data .
SELECT vbeln
audat
vbtyp
auart
augru
netwr
waerk
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbak
WHERE vbeln IN s_vbeln AND
audat > '04.04.2005'
AND netwr > 0.
LOOP AT itab.
IF itab-netwr < 10000.
itab-icon = '@08@'.
ELSEIF itab-netwr > 10000 AND itab-netwr < 100000.
itab-icon = '@09@'.
ELSEIF itab-netwr > 100000.
itab-icon = '@0A@'.
ENDIF.
MODIFY itab INDEX sy-tabix.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form sort_fields
FORM sort_fields .
CLEAR wa_sort.
wa_sort-fieldname = 'VBTYP'.
wa_sort-spos = '1'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'NETWR'.
wa_sort-spos = '2'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
ENDFORM. " sort_fields
*& Form set_layout
FORM set_layout .
IF p_list = c_x .
wa_layout-window_titlebar = 'LIST DISPLAY'(016).
wa_layout-zebra = 'X'.
+
+
ALV LIST DISPLAY
PERFORM list_display TABLES itab.
o
+
+ ALV GRID DISPLAY
ELSEIF p_grid = c_x.
wa_layout-window_titlebar = 'GRID DISPLAY'(017).
wa_layout-zebra = 'X'.
PERFORM grid_display TABLES itab.
ENDIF.
ENDFORM. " set_layout
*& Form list_display
FORM list_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
i_save = 'U'
TABLES
t_outtab = itab
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. " list_display
*& Form GRID_DISPLAY
FORM grid_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
it_events = it_event
TABLES
t_outtab = itab
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. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM validate_screen .
DATA: lv_vbeln LIKE vbak-vbeln.
IF NOT s_vbeln IS INITIAL.
SELECT vbeln
INTO lv_vbeln
UP TO 1 ROWS
FROM vbak
WHERE vbeln IN s_vbeln.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'INVALID SALES DOC'.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
DEFINE m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-ref_tabname = 'VBAK'.
wa_fieldcat-do_sum = &2.
wa_fieldcat-cfieldname = &3.
append wa_fieldcat to it_fieldcat.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
ENDFORM. " display_data[/code]
Regards,
Rahul
Edited by: Rahul Reddy on Apr 14, 2008 12:33 PM -
How to add Icons to ALV Reprt?
Hi,
I need to display icons (red, yellow) in my ALV Report in the first column in my report.
In my field catalog fieldcat-icon = 'X' has been taken into consideration, but still I am not able to see in my report. In the final internal table that is to display I created a field for this Icon type ICON_D. Is this the correct procedure to work with or else kindly let me know how to proceed?
Regards,
Raghu Ram.This is the code that has been incorporated in order to display Icon in the ALV Report.
* TABLES Declarations *
Tables: PROJ, " Project definition
PRPS, " WBS (Work Breakdown Structure) Element Master Data
ICON.
* TYPE POOLS *
TYPE-POOLS: SLIS, " Globale Typen für generische Listbausteine
ICON.
* ALV Data Declarations *
DATA:
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GT_REPID TYPE SY-REPID.
* Type Declarations *
TYPES:
* STRUCTURE OF TABLE PROJ
BEGIN OF TY_PROJ,
PSPNR TYPE PROJ-PSPNR,
PSPID TYPE PROJ-PSPID,
POST1 TYPE PROJ-POST1,
OBJNR TYPE PROJ-OBJNR,
VERNR TYPE PROJ-VERNR,
VERNA TYPE PROJ-VERNA,
END OF TY_PROJ,
* STRUCTURE OF TABLE PRPS
BEGIN OF TY_PRPS,
PSPNR TYPE PRPS-PSPNR,
POSID TYPE PRPS-POSID,
POST1 TYPE PRPS-POST1,
OBJNR TYPE PRPS-OBJNR,
PSPHI TYPE PRPS-PSPHI,
VERNR TYPE PRPS-VERNR,
END OF TY_PRPS,
BEGIN OF TY_FINAL,
LIGHT TYPE ICON_D,
PSPNR TYPE PROJ-PSPNR,
PSPID TYPE PROJ-PSPID,
POST1 TYPE PROJ-POST1,
OBJNR TYPE PROJ-OBJNR,
VERNR TYPE PROJ-VERNR,
VERNA TYPE PROJ-VERNA,
PSPNR_1 TYPE PRPS-PSPNR,
POSID TYPE PRPS-POSID,
POST1_1 TYPE PRPS-POST1,
OBJNR_1 TYPE PRPS-OBJNR,
PSPHI TYPE PRPS-PSPHI,
VERNR_1 TYPE PRPS-VERNR,
END OF TY_FINAL.
* Internal Table Declarations *
DATA:
IT_PROJ TYPE STANDARD TABLE OF TY_PROJ,
IT_PRPS TYPE STANDARD TABLE OF TY_PRPS,
IT_FINAL TYPE STANDARD TABLE OF TY_FINAL.
* Work Area Declarations *
DATA:
WA_PROJ TYPE TY_PROJ,
WA_PRPS TYPE TY_PRPS,
WA_FINAL TYPE TY_FINAL.
* Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
SELECT-OPTIONS: S_PSPNR FOR PROJ-PSPNR.
SELECTION-SCREEN END OF BLOCK BLK.
* Start Of Selection *
START-OF-SELECTION.
PERFORM DATA_RETREVIAL.
PERFORM BUILD_FIELDCAT.
PERFORM DISPLAY_ALV.
* Data Retrevial Logic *
*& Form DATA_RETREVIAL
form DATA_RETREVIAL .
DATA: status_icon TYPE icons-text,
icon_name(20) TYPE c,
icon_text(10) TYPE c.
ICON_NAME = 'ICON_RED_LIGHT'.
ICON_TEXT = 'RED'.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = ICON_NAME
TEXT = ICON_TEXT
* INFO = ' '
ADD_STDINF = 'X'
IMPORTING
RESULT = STATUS_ICON
EXCEPTIONS
ICON_NOT_FOUND = 1
OUTPUTFIELD_TOO_SHORT = 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.
SELECT PSPNR
PSPID
POST1
OBJNR
VERNR
VERNA
FROM PROJ
INTO TABLE IT_PROJ
WHERE PSPNR IN S_PSPNR.
SELECT PSPNR
POSID
POST1
OBJNR
PSPHI
VERNR
FROM PRPS
INTO TABLE IT_PRPS
FOR ALL ENTRIES IN IT_PROJ
WHERE PSPHI EQ IT_PROJ-PSPNR.
LOOP AT IT_PROJ INTO WA_PROJ.
LOOP AT IT_PRPS INTO WA_PRPS.
WA_FINAL-PSPNR = WA_PROJ-PSPNR.
WA_FINAL-PSPID = WA_PROJ-PSPID.
WA_FINAL-POST1 = WA_PROJ-POST1.
WA_FINAL-OBJNR = WA_PROJ-OBJNR.
WA_FINAL-VERNR = WA_PROJ-VERNR.
WA_FINAL-VERNA = WA_PROJ-VERNA.
WA_FINAL-PSPNR_1 = WA_PRPS-PSPNR.
WA_FINAL-POSID = WA_PRPS-POSID.
WA_FINAL-POST1_1 = WA_PRPS-POST1.
WA_FINAL-OBJNR_1 = WA_PRPS-OBJNR.
WA_FINAL-PSPHI = WA_PRPS-PSPHI.
WA_FINAL-VERNR_1 = WA_PRPS-VERNR.
WA_FINAL-light = STATUS_ICON.
APPEND WA_FINAL TO IT_FINAL.
CLEAR: WA_FINAL.
ENDLOOP.
ENDLOOP.
endform. " DATA_RETREVIAL
* Field Catalog *
*& Form BUILD_FIELDCAT
form BUILD_FIELDCAT .
* DATA: FIELDCAT TYPE GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'LIGHTS'.
GT_FIELDCAT-SELTEXT_M = 'STAUTS'.
GT_FIELDCAT-COL_POS = 0.
GT_FIELDCAT-ICON = 'X'.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPNR'.
GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION(INTERNAL)'.
GT_FIELDCAT-COL_POS = 1.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPID'.
GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION'.
GT_FIELDCAT-COL_POS = 2.
GT_FIELDCAT-OUTPUTLEN = 24.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'POST1'.
GT_FIELDCAT-SELTEXT_M = 'PROJECT DESC'.
GT_FIELDCAT-COL_POS = 3.
GT_FIELDCAT-OUTPUTLEN = 40.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'OBJNR'.
GT_FIELDCAT-SELTEXT_M = 'Object number'.
GT_FIELDCAT-COL_POS = 4.
GT_FIELDCAT-OUTPUTLEN = 22.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'VERNR'.
GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
GT_FIELDCAT-COL_POS = 5.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'VERNA'.
GT_FIELDCAT-SELTEXT_M = 'Responsible Person Desc'.
GT_FIELDCAT-COL_POS = 6.
GT_FIELDCAT-OUTPUTLEN = 25.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPNR_1'.
GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
GT_FIELDCAT-COL_POS = 7.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'POSID'.
GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
GT_FIELDCAT-COL_POS = 8.
GT_FIELDCAT-OUTPUTLEN = 24.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'POST1_1'.
GT_FIELDCAT-SELTEXT_M = 'WBS DESC'.
GT_FIELDCAT-COL_POS = 9.
GT_FIELDCAT-OUTPUTLEN = 40.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'OBJNR_1'.
GT_FIELDCAT-SELTEXT_M = 'Object number'.
GT_FIELDCAT-COL_POS = 10.
GT_FIELDCAT-OUTPUTLEN = 22.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPHI'.
GT_FIELDCAT-SELTEXT_M = 'Currnet Projct'.
GT_FIELDCAT-COL_POS = 11.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'VERNR_1'.
GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
GT_FIELDCAT-COL_POS = 12.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
endform. " BUILD_FIELDCAT
* Display ALV Grid *
*& Form DISPLAY_ALV
form DISPLAY_ALV .
GT_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GT_REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_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 = GT_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_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.
endform. " DISPLAY_ALV -
Hello.
Could You tell me how to display icon in cell of ALV Grid? MAybe You have a link to some tutorial?
I'm trying make such thing:
to my itab I'm adding
icon1 LIKE icon-id
then I fill itab, to fieldcatalog give
PERFORM append_wsfield USING
ws_field_st ws_fieldcat_st 'ICON1' '' 0 1 0 '' 2 'X' ''.
When I debug code, there is an icon in the itab, but in grid it doesnt appears.
I'd be thankful for help. Greetings. P.
Message was edited by:
Piotr WojciechowskiGo to the type pool ICON and you can find the code for each icon there. Depending on the icon that you want assign the code for that icon to the column in the ALV Grid (Icon field in the internal table). The icon will be displayed automatically.
Please mark points if the solution was useful.
Regards,
Manoj -
How to add radiobuttons in ALV Grid
Hi,
I refered the threads in SDN but i am not able to get proper solution for my requirement.
I am displaying output in ALV Grid format. After displaying the output i mean in the output screen i need few buttons and radio buttons . when user selects the record and clicks the radio button accordingly my logic should work. Anybody can tell me how to add the radiobuttons in the output of the screen. Please find the below output format for the requirement is
Push button1 Pushbutton2 Radiobutton1 Radio button2
MY program output in Grid format.
Anybody can suggest me how to approach.
Regards,
MaheedharCheck if this link helps..
http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT -
Hide/Remove Subtotal Icon in ALV Grid report output.
Hi,
Is ther a way to remove or hide the Subtotal icon in the ALV Grid report output?
Thanks & Regards,
Praveen.Hi,
You can add names of the buttons(which you want to hide) to internal table and pass this internal table for tool bar excluding parameter while calling ALV.
Here as shown in below code, 'Sorting, Ascending,Descending' buttons are removed from the tool bar list.
data : lt_exclude TYPE ui_functions.
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT.
APPEND ls_exclude TO lt_exclude .
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_ASC.
APPEND ls_exclude TO lt_exclude .
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_DSC.
APPEND ls_exclude TO lt_exclude .
CALL METHOD alvgd->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = lt_exclude
Regards,
Maharshi Vyas -
How to supress dialog while ALV Grid output is send to Spool
Hi,
I need to get the ALV grid output in spool.But when i am executing my program using ALV grid function module with print parameter passed,first its giving a popup with default printer and number of copies and when i press ok for the popup ,spool request is created.But i dont want this popup to come while executing my program.It should create the spool request directly. How to solve this issue.
Regards
ShibinHi Shibin,
Try the below parameter in IS_PRINT Structure:
is_print-print = 'N'.
This will Supress the Dialog and create a Spool with no Immeadiate Output.
Hope This Helps you..
Thanks & Regards,
Suresh Karri -
How can i validate on ALV grid for the user
Dear Freinds,
I have developed one custom report using ALV Grid program , as per the requirement i have to enter on the
data and when i press the value save the program sumits the data into my custom table . Till here every thing is fine
but one particular field i have declared as Char1 in my internal table , on the ALV output it is allowing me to enter
more than one character eg : it is allowing me to enter as Hyderabad .........even though i have declared as char 1 in the internal table ....however it is saving in the database table as H only that is correct.......but it is giving confusion to user
i want to validate that user shouldnt allow to enter more than one character in the alv output of the input field .
Please could any one let me know how can i validate.
regard
divyaHi,
check that field length in the final internal table .
might be that filed lenth in final internal table declartion is more than 1 char.
regards,
Rama reddy
Edited by: ram reddy on Jul 15, 2009 7:57 AM -
How to display tooltip in ALV GRID CELL?
Hello,
I'm trying to display dynamic tootips for data in ALV GRID Cells.
My ALV Gid Cells content does not display Icon or symbol or Exception but pure data (In my case dates).
Is there a way to do display a toolip that will change dynamicaly according to a rule.
I took a look at the BCALV_DEMO_TOOLTIP program
but it does not answer my expectation since it display
toltip for Icon or symbol or Exception.
Can someone help on this case.
Best regards
HarryHai Harry
icon
value set: SPACE, 'X' 'X' = column contents to be output as an icon.
The caller must consider the printability of icons.
symbol
value set: SPACE, 'X' 'X' = column contents are to be output as a symbol.
The internal output table column must be a valid symbol character.
The caller must consider the printability of symbols.
Symbols can usually be printed, but may not always be output correctly, depending on the printer configuration.
Thanks & regards
Sreenu -
How to upload logo for alv grid when we are using classes
Hi am using cl_gui_alv_tree for displaying alv grid. i want to upload logo in the heade section. as we do in simple alvs using resuse_alv_commentary_write.
plz update me in this regard.
regards
venkatWelcome to SDN.
Check the following threads -
How To use TOP OF PAGE event in OOPS ALV?
Logo & TOP_OF_PAGE in OO ALV
Regards,
Amit
Reward all helpful replies. -
How to Set Checkbox of ALV Grid Dark on Display Mode
ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
Help me solve this problem, please.
Part of my codes are as follows.
Part 1:
IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
set_enable( iv_flag = 1 ).
LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
CLEAR ls_celltab.
IF <lfs_acct_group_item>-celltab IS INITIAL.
CLEAR ls_celltab.
ls_celltab-fieldname = 'CHECK_BOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'XPORE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
ELSE.
LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
<lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
ENDLOOP.
ENDIF.
ENDLOOP.
ELSE.
set_enable( iv_flag = 0 ).
LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
IF <lfs_acct_group_item>-celltab IS INITIAL.
CLEAR ls_celltab.
ls_celltab-fieldname = 'CHECK_BOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'XPORE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
ELSE.
LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
<lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
CALL METHOD gr_grid->refresh_table_display
* EXPORTING
* is_stable =
* i_soft_refresh =
EXCEPTIONS
finished = 1
OTHERS = 2
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Part 2:
METHOD set_enable.
gr_grid->set_ready_for_input(
i_ready_for_input = iv_flag
ENDMETHOD.Hi Liu,
Please go through the below code.
*& Report YEDIT_DISPLAY
REPORT YEDIT_DISPLAY.
TABLES : VBAK.
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_VBAK,
VBELN TYPE VBAK-VBELN,
END OF TY_VBAK,
BEGIN OF TY_FINAL,
BOX TYPE C,
VBELN TYPE VBAK-VBELN,
END OF TY_FINAL.
DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
WA_VBAK TYPE TY_VBAK,
IT_FINAL TYPE TABLE OF TY_FINAL,
WA_FINAL TYPE TY_FINAL,
IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
WA_FCAT TYPE SLIS_FIELDCAT_ALV.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM FCAT_DATA.
PERFORM DISPLAY.
*& Form FETCH_DATA
* text
* --> p1 text
* <-- p2 text
FORM FETCH_DATA .
SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
LOOP AT IT_VBAK INTO WA_VBAK.
WA_FINAL-VBELN = WA_VBAK-VBELN.
APPEND WA_FINAL TO IT_FINAL.
CLEAR : WA_FINAL , WA_VBAK.
ENDLOOP.
ENDFORM. " FETCH_DATA
*& Form FCAT_DATA
* text
* --> p1 text
* <-- p2 text
FORM FCAT_DATA .
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'BOX'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'BOX'.
wa_fcat-checkbox = 'X'.
WA_FCAT-EDIT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'Sales Document'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
ENDFORM. " FCAT_DATA
*& Form DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
IT_FIELDCAT = IT_FCAT
* I_DEFAULT = 'X'
* I_SAVE = ' '
TABLES
T_OUTTAB = IT_FINAL
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " DISPLAY
FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
RTAB TYPE slis_selfield.
CASE UCOMM.
WHEN '&IC1'.
MESSAGE 'SUCESSFUL' TYPE 'S'.
WHEN '&DATA_SAVE'.
PERFORM FIL_FCAT.
PERFORM DISPLAY1.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
LEAVE TO SCREEN 0.
ENDCASE.
ENDFORM.
*& Form FIL_FCAT
* text
* --> p1 text
* <-- p2 text
FORM FIL_FCAT .
CLEAR IT_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'BOX'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'BOX'.
wa_fcat-checkbox = 'X'.
** WA_FCAT-EDIT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'Sales Document'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
ENDFORM. " FIL_FCAT
*& Form DISPLAY1
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_TOP_OF_PAGE = ' '
IT_FIELDCAT = IT_FCAT
* I_DEFAULT = 'X'
* I_SAVE = ' '
TABLES
T_OUTTAB = IT_FINAL
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " DISPLAY1
Here i written code under the SAVE button , if requires you create your own status and apply.
Regards,
Krishna
Maybe you are looking for
-
Issue with Delta in Function Module
Hi Team, I have an issue with delta in Genric extraction using function module.Full load is working fine and i have taken post_date as delta field.plz chk the code if any delta related statements are missing. FUNCTION ZRSAX_BIW_MANGEMENT_RAT . ""Loca
-
Hi Im trying to display the cost parts share in percent of the total cost. in normal cases i would use the Scope argument to divide the cost parts against total cost but this time i have no sumaraized level for total cost to use as Scope parameter. I
-
Get current step number and handling max steps exceptions
We are using IPCC Express Premium 4.0.4 and would like to know: 1. Is it possible to determine the execution number for the current step? For example, x number of steps have been executed up until a certain point in the script. Possibly via a Set ste
-
Has anyone successfully deployed the ALBPM 5.7 portlets in IBM WebSphere Portal 6? If so, please provide tips/pointers. I have been able to generate and deploy the ALBPM portlet war file in the Websphere Portal. And I'm able to put the portlet into a
-
I have burned to cd from this computer before but now when I try it tells me that burner software is not found. What to do?