Adding icon to ALV Coulmn in powerlists (POWL)
Hi Experts,
I have one requirement in POWL. For one Column in ALV i need to add ICON.
Can any body help in this problem.
Regards,
Sri
Thx Chandra for promt reply,
I know your given field name. But i am not getting 100% clarity.
Let me explain what i have return in my progrm.
In FieldCatalog method:
*Comments
wa_fieldcat-colid = 'COMMENT'.
wa_fieldcat-colpos = '13'.
wa_fieldcat-col_visible = abap_true.
wa_fieldcat-enabled = abap_true.
wa_fieldcat-icon_src_ref = 'COMMENT'.
wa_fieldcat-header = 'Approver Comments'.
wa_fieldcat-allow_filter = abap_true.
wa_fieldcat-allow_sort = abap_true.
INSERT wa_fieldcat INTO TABLE it_fieldcat[].
can clarify in this one.
Advance thx for helping.
Similar Messages
-
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 -
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 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
JahanThis 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 -
Creation of icon in alv toolbar
Hi All,
i need to create a icon in alv toolbar.
But i have not created any 'Z' program.
i have created one function module, through that function module i am displaying the ALV grid.
when i am copying the standard pf-status it is asking for program name. but i am using only the function module.
pls help me on this for creating the icon in alv toolbar.
thanks in advance.Hello Aishvarya,
Perhaps the code below will help guide you along.
FUNCTION z_alv_screen .
*"*"Local Interface:
*" CHANGING
*" REFERENCE(ITAB) TYPE ZSFLIGHT_TT
DATA: gr_table TYPE REF TO cl_salv_table.
* ALV
*... Create Instance
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = itab[].
CATCH cx_salv_msg.
ENDTRY.
gr_table->set_screen_status(
pfstatus = 'SALV_STANDARD'
report = 'SAPLZRAE'
set_functions = gr_table->c_functions_all ).
*... Display Table
gr_table->display( ).
ENDFUNCTION.
Edited by: Rae Ellen Woytowiez on Mar 21, 2011 5:17 PM -
How to set the focus on the new added line in ALV list (OO)
Dear Friends,
I have an ALV list based on OO(using alv_grid->set_table_for_first_display), when I click the 'new' button to add a new line, the mouse arrow is always pointing to the first line - not the new created line for user to input!!.
So how to set the focus (mouse arrow) on the new added line in ALV list for user to input it friendly?
Thanks a lot!!Hello,
To get the selected line row first we have get all the rows in the internal table.
When u click on the button when it is creating the new line we have to pass the row number to the call method
CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->get_selected_rows
IMPORTING
ET_INDEX_ROWS = <internal table of type LVC_T_ROW > (obsolete)
ET_ROW_NO = <internal table of type LVC_T_ROID > .
CALL METHOD<ref.var. to CL_GUI_ALV_GRID>->set_selected_rows
EXPORTING
IT_ROW_NO = <internal table of type LVC_T_ROID>
or alternatively
IT_INDEX_ROWS = <internal table of type LVC_T_ROW>
IS_KEEP_OTHER_SELECTIONS = <type CHAR01>.
http://help.sap.com/saphelp_erp2004/helpdata/EN/22/a3f5ecd2fe11d2b467006094192fe3/content.htm -
Revision: 10017
Author: [email protected]
Date: 2009-09-04 06:43:44 -0700 (Fri, 04 Sep 2009)
Log Message:
Adding a style sheet, adding a backdrop to the examples list, adding icons to play and pause icons. Setting theme color to red.
Modified Paths:
osmf/trunk/apps/samples/framework/ExamplePlayer/ExamplePlayer.mxml
osmf/trunk/apps/samples/framework/ExamplePlayer/org/openvideoplayer/view/MainWindowLayout .mxml
Added Paths:
osmf/trunk/apps/samples/framework/ExamplePlayer/assets/
osmf/trunk/apps/samples/framework/ExamplePlayer/assets/ExamplePlayer.css
osmf/trunk/apps/samples/framework/ExamplePlayer/assets/assets.swfRevision: 10017
Author: [email protected]
Date: 2009-09-04 06:43:44 -0700 (Fri, 04 Sep 2009)
Log Message:
Adding a style sheet, adding a backdrop to the examples list, adding icons to play and pause icons. Setting theme color to red.
Modified Paths:
osmf/trunk/apps/samples/framework/ExamplePlayer/ExamplePlayer.mxml
osmf/trunk/apps/samples/framework/ExamplePlayer/org/openvideoplayer/view/MainWindowLayout .mxml
Added Paths:
osmf/trunk/apps/samples/framework/ExamplePlayer/assets/
osmf/trunk/apps/samples/framework/ExamplePlayer/assets/ExamplePlayer.css
osmf/trunk/apps/samples/framework/ExamplePlayer/assets/assets.swf -
Two Icons on ALV tree in same row
Hi all,
I need to show 2 ICONS instead of regular one icon on ALV Tree,at the same node like the easy cost planning on CJ20N.
I use the SALV Tree.
Thanks,
Omer gHi Omer,
You can achieve this by playing with is_node_layout and it_item_layout parameters of the method add_node:
set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@01@'.
ls_item_layout-fieldname = o_tree->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
add node
l_node_text = 'node_text'.
data: ls_node type lvc_s_layn.
ls_node-n_image = '@02@'.
ls_node-exp_image = '@02@'.
call method o_tree->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_outtab
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
Hope it helps,
Kr -
Okay, I'm a newbie at Java. I have a problem that I'm trying to solve. I added icons to the File menu item, that was easy, but how do I add icons to the other menu items? They are DefaultEditorKit. actions (cut copy paste undo redo) I can't seem to change their names either.
I'm also having problems with saving the changes I make in the text area.
Here's the whole code.
package components;
import java.awt.*;
import java.awt.event.*;
import java.util.HashMap;
import java.io.*;
import javax.swing.*;
import javax.swing.AbstractButton;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.undo.*;
public class TextComponentDemo extends JFrame implements ActionListener {
JTextPane textPane;
AbstractDocument doc;
JTextArea changeLog;
JButton newButton, openButton, saveButton, undoButton, redoButton, /*cutButton, copyButton, pasteButton,*/ boldButton, italicButton, underlineButton;
protected String newline = "\n";
HashMap<Object, Action> actions;
File fFile = new File("default.txt");
JavaFilter fJavaFilter = new JavaFilter();
protected UndoAction undoAction;
protected RedoAction redoAction;
protected UndoManager undo = new UndoManager();
public TextComponentDemo() {
super("Notepad v1.0");
//Create the text pane and configure it.
textPane = new JTextPane();
textPane.setCaretPosition(0);
textPane.setMargin(new Insets(5,5,5,5));
StyledDocument styledDoc = textPane.getStyledDocument();
if (styledDoc instanceof AbstractDocument) {
doc = (AbstractDocument)styledDoc;
} else {
System.err.println("Text pane's document isn't an AbstractDocument!");
System.exit(-1);
JScrollPane scrollPane = new JScrollPane(textPane);
scrollPane.setPreferredSize(new Dimension(600, 350));
newButton = new JButton ("", createImageIcon("images/new.png"));
newButton.setBackground(Color.white);
// newButton.setActionCommand("nou");
// newButton.addActionListener(this);
openButton = new JButton("", createImageIcon("images/open.png"));
openButton.setBackground(Color.white);
openButton.setActionCommand("deschide");
openButton.addActionListener(this);
saveButton = new JButton("", createImageIcon("images/save.png"));
saveButton.setBackground(Color.white);
saveButton.setActionCommand("salveaza");
saveButton.addActionListener(this);
Action actionBold = new StyledEditorKit.BoldAction();
actionBold.putValue(Action.NAME, "Bold");
boldButton = new JButton(actionBold);
boldButton.setBackground(Color.white);
Action actionItalic = new StyledEditorKit.ItalicAction();
actionItalic.putValue(Action.NAME, "Italic");
italicButton = new JButton(actionItalic);
italicButton.setBackground(Color.white);
Action actionUnderline = new StyledEditorKit.UnderlineAction();
actionUnderline.putValue(Action.NAME, "Underline");
underlineButton = new JButton(actionUnderline);
underlineButton.setBackground(Color.white);
String[] fontStrings = { "Arial", "Arial Black", "Comic Sans MS", "Georgia", "Serif", "SansSerif", "Times New Roman", "Trebuchet MS", "Verdana" };
JComboBox fontList = new JComboBox(fontStrings);
fontList.setSelectedIndex(0);
fontList.setBackground(Color.white);
fontList.setActionCommand("font");
fontList.addActionListener(this);
String[] sizeStrings = { "12", "14", "16", "18", "20", "22", "24", "36", "48" };
JComboBox sizeList = new JComboBox(sizeStrings);
sizeList.setSelectedIndex(0);
sizeList.setBackground(Color.white);
sizeList.setActionCommand("size");
sizeList.addActionListener(this);
JPanel buttonPanel = new JPanel(); //use FlowLayout
buttonPanel.add(newButton);
buttonPanel.add(openButton);
buttonPanel.add(saveButton);
// buttonPanel.add(cutButton);
// buttonPanel.add(copyButton);
// buttonPanel.add(pasteButton);
buttonPanel.add(boldButton);
buttonPanel.add(italicButton);
buttonPanel.add(underlineButton);
buttonPanel.add(fontList);
buttonPanel.add(sizeList);
getContentPane().add(buttonPanel, BorderLayout.PAGE_START);
getContentPane().add(scrollPane, BorderLayout.CENTER);
//Set up the menu bar.
createActionTable(textPane);
JMenu fileMenu = createFileMenu();
JMenu editMenu = createEditMenu();
JMenu fontMenu = createFontMenu();
JMenu ajutorMenu = createAjutorMenu();
JMenuBar mb = new JMenuBar();
mb.add(fileMenu);
mb.add(editMenu);
mb.add(fontMenu);
mb.add(ajutorMenu);
setJMenuBar(mb);
//Start watching for undoable edits and caret changes.
doc.addUndoableEditListener(new MyUndoableEditListener());
//This one listens for edits that can be undone.
protected class MyUndoableEditListener
implements UndoableEditListener {
public void undoableEditHappened(UndoableEditEvent e) {
//Remember the edit and update the menus.
undo.addEdit(e.getEdit());
undoAction.updateUndoState();
redoAction.updateRedoState();
private ImageIcon createImageIcon (String fileName) {
return new ImageIcon(fileName);
protected JMenu createFileMenu() {
JMenu menu = new JMenu("Fisier");
menu.setMnemonic(KeyEvent.VK_F);
JMenuItem menuItem;
ImageIcon iconNou = new ImageIcon("images/new.png");
menuItem = new JMenuItem("Nou", iconNou);
menuItem.setMnemonic(KeyEvent.VK_N);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
// menuItem.setActionCommand("nou");
// menuItem.addActionListener(this);
menu.add(menuItem);
menu.addSeparator();
ImageIcon iconOpen = new ImageIcon("images/open.png");
menuItem = new JMenuItem("Deschide", iconOpen);
menuItem.setMnemonic(KeyEvent.VK_O);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
menuItem.setActionCommand("deschide");
menuItem.addActionListener(this);
menu.add(menuItem);
ImageIcon iconSave = new ImageIcon("images/save.png");
menuItem = new JMenuItem("Salveaza", iconSave);
menuItem.setMnemonic(KeyEvent.VK_S);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
menuItem.setActionCommand("deschide");
menuItem.addActionListener(this);
menu.add(menuItem);
menu.addSeparator();
ImageIcon iconQuit = new ImageIcon("images/quit.png");
menuItem = new JMenuItem("Iesire", iconQuit);
menuItem.setMnemonic(KeyEvent.VK_Q);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
menuItem.setActionCommand("iesire");
menuItem.addActionListener(this);
menu.add(menuItem);
return menu;
public void actionPerformed(ActionEvent e) {
boolean status = false;
/* if ("nou".equals(e.getActionCommand())) {
nou();
if ("deschide".equals(e.getActionCommand())) {
status = openFile();
if(!status)
JOptionPane.showMessageDialog(
null,
"Eroare la deschiderea fisierului!", "Fisierul nu a putut fi deschis.",
JOptionPane.ERROR_MESSAGE
/* if ("salveaza".equals(e.getActionCommand())) {
status = saveFile();
if(!status)
JOptionPane.showMessageDialog(
null,
"Eroare IO in salvarea fisierului!", "Fisierul nu a putut fi salvat.",
JOptionPane.ERROR_MESSAGE
if ("iesire".equals(e.getActionCommand())) {
System.exit(-1);
if ("font".equals(e.getActionCommand())) {
JComboBox cb = (JComboBox)e.getSource();
String fontName = (String)cb.getSelectedItem();
String t = new String(textPane.getSelectedText());
// t.setText("fontName");
// t.setFont(new java.awt.Font(fontName, 0, 12));
// StyledEditorKit.FontFamilyAction font = new StyledEditorKit.FontFamilyAction(fontName, fontName);
boolean openFile() {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Deschide Fisier");
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setCurrentDirectory(new File ("."));
fc.setFileFilter(fJavaFilter);
int result = fc.showOpenDialog(this);
if(result == JFileChooser.CANCEL_OPTION) {
return true;
else if(result == JFileChooser.APPROVE_OPTION) {
fFile = fc.getSelectedFile();
String file_string = readFile(fFile);
if(file_string != null) {
textPane.setText(file_string);
else
return false;
else {
return false;
return true;
public String readFile (File file) {
StringBuffer fileBuffer;
String fileString=null;
String line;
try {
FileReader in = new FileReader (file);
BufferedReader dis = new BufferedReader (in);
fileBuffer = new StringBuffer () ;
while ((line = dis.readLine ()) != null) {
fileBuffer.append (line + "\n");
in.close ();
fileString = fileBuffer.toString ();
catch (IOException e ) {
return null;
return fileString;
/* boolean saveFile () {
File file = null;
JFileChooser fc = new JFileChooser ();
fc.setCurrentDirectory (new File ("."));
fc.setFileFilter (fJavaFilter);
fc.setSelectedFile (fFile);
int result = fc.showSaveDialog (this);
if (result == JFileChooser.CANCEL_OPTION) {
return true;
} else if (result == JFileChooser.APPROVE_OPTION) {
fFile = fc.getSelectedFile ();
if (fFile.exists ()) {
int response = JOptionPane.showConfirmDialog (null,
"Overwrite existing file?","Confirm Overwrite",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.CANCEL_OPTION) return false;
return writeFile (fFile, textPane.getText ());
} else {
return false;
protected JMenu createEditMenu() {
JMenu menu = new JMenu("Editare");
menu.setMnemonic(KeyEvent.VK_E);
JMenuItem menuItem;
undoAction=new UndoAction();
menu.add(undoAction);
redoAction = new RedoAction();
menu.add(redoAction);
menu.addSeparator();
menu.add(getActionByName(DefaultEditorKit.cutAction));
menu.add(getActionByName(DefaultEditorKit.copyAction));
menu.add(getActionByName(DefaultEditorKit.pasteAction));
menu.addSeparator();
menu.add(getActionByName(DefaultEditorKit.selectAllAction));
return menu;
//Create the style menu.
protected JMenu createFontMenu() {
JMenu menu = new JMenu("Font");
menu.setMnemonic(KeyEvent.VK_F);
JMenu subMenu = new JMenu ("Stil ");
Action action = new StyledEditorKit.BoldAction();
action.putValue(Action.NAME, "Bold");
subMenu.add(action);
action = new StyledEditorKit.ItalicAction();
action.putValue(Action.NAME, "Italic");
subMenu.add(action);
action = new StyledEditorKit.UnderlineAction();
action.putValue(Action.NAME, "Underline");
subMenu.add(action);
menu.add(subMenu);
menu.addSeparator();
JMenu subMenu2 = new JMenu ("Marime ");
subMenu2.add(new StyledEditorKit.FontSizeAction("12", 12));
subMenu2.add(new StyledEditorKit.FontSizeAction("14", 14));
subMenu2.add(new StyledEditorKit.FontSizeAction("16", 16));
subMenu2.add(new StyledEditorKit.FontSizeAction("18", 18));
subMenu2.add(new StyledEditorKit.FontSizeAction("20", 20));
subMenu2.add(new StyledEditorKit.FontSizeAction("22", 22));
subMenu2.add(new StyledEditorKit.FontSizeAction("24", 24));
subMenu2.add(new StyledEditorKit.FontSizeAction("36", 36));
subMenu2.add(new StyledEditorKit.FontSizeAction("48", 48));
menu.add(subMenu2);
menu.addSeparator();
JMenu subMenu3 = new JMenu ("Familie ");
subMenu3.add(new StyledEditorKit.FontFamilyAction("Arial", "Arial"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Arial Black", "Arial Black"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Comic Sans MS", "Comic Sans MS"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Georgia", "Georgia"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Serif", "Serif"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("SansSerif", "SansSerif"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Times New Roman", "Times New Roman"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Trebuchet MS", "Trebuchet MS"));
subMenu3.add(new StyledEditorKit.FontFamilyAction("Verdana", "Verdana"));
menu.add(subMenu3);
menu.addSeparator();
JMenu subMenu4 = new JMenu ("Culoare ");
subMenu4.add(new StyledEditorKit.ForegroundAction("Rosu", Color.red));
subMenu4.add(new StyledEditorKit.ForegroundAction("Verde", Color.green));
subMenu4.add(new StyledEditorKit.ForegroundAction("Albastru", Color.blue));
subMenu4.add(new StyledEditorKit.ForegroundAction("Galben", Color.yellow));
subMenu4.add(new StyledEditorKit.ForegroundAction("Gri", Color.gray));
subMenu4.add(new StyledEditorKit.ForegroundAction("Gri inchis", Color.darkGray));
subMenu4.add(new StyledEditorKit.ForegroundAction("Negru", Color.black));
menu.add(subMenu4);
return menu;
protected JMenu createAjutorMenu() {
JMenu menu = new JMenu("Ajutor");
menu.setMnemonic(KeyEvent.VK_J);
return menu;
private void createActionTable(JTextComponent textComponent) {
actions = new HashMap<Object, Action>();
Action[] actionsArray = textComponent.getActions();
for (int i = 0; i < actionsArray.length; i++) {
Action a = actionsArray;
actions.put(a.getValue(Action.NAME), a);
private Action getActionByName(String name) {
return actions.get(name);
class UndoAction extends AbstractAction {
public UndoAction() {
super("Undo");
setEnabled(false);
public void actionPerformed(ActionEvent e) {
try {
undo.undo();
} catch (CannotUndoException ex) {
System.out.println("Unable to undo: " + ex);
ex.printStackTrace();
updateUndoState();
redoAction.updateRedoState();
protected void updateUndoState() {
if (undo.canUndo()) {
setEnabled(true);
putValue(Action.NAME, undo.getUndoPresentationName());
} else {
setEnabled(false);
putValue(Action.NAME, "Undo");
class RedoAction extends AbstractAction {
public RedoAction() {
super("Redo");
setEnabled(false);
public void actionPerformed(ActionEvent e) {
try {
undo.redo();
} catch (CannotRedoException ex) {
System.out.println("Unable to redo: " + ex);
ex.printStackTrace();
updateRedoState();
undoAction.updateUndoState();
protected void updateRedoState() {
if (undo.canRedo()) {
setEnabled(true);
putValue(Action.NAME, undo.getRedoPresentationName());
} else {
setEnabled(false);
putValue(Action.NAME, "Redo");
private static void createAndShowGUI() {
final TextComponentDemo frame = new TextComponentDemo();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
UIManager.put("swing.boldMetal", Boolean.FALSE);
createAndShowGUI();
class JavaFilter extends javax.swing.filechooser.FileFilter
public boolean accept (File f) {
return f.getName ().toLowerCase ().endsWith (".txt")
|| f.isDirectory ();
public String getDescription () {
return "Fisiere text (*.txt)";Hi,
unfortunatly you cannot change the properties of Action object as you would do with JavaBeans. Instead you have to use the 'put' method.
eg.:
myAction.put(Action.SMALL_ICON, new ImageIcon(...));IMHO this was a bad decision, because it's not like the JavaBeans standard and you loose static type information. :-/
-Puce
Message was edited by:
Puce -
Adding Icons to AIR App?
I could not find much on the web or this form but I am trying add my own desktop icon for my flex/air app. Only thing I have done so far is to open up the app.xml file and add the following to it.
<icon>
<image16x16>assets/gfx_1_16.png</image16x16>
<image32x32>assets/gfx_1_32.png</image32x32>
<image48x48>assets/gfx_1_48.png</image48x48>
<image128x128>assets/gfx_1_128.png</image128x128>
</icon>
After this when I build my app I get the following error.
I also made sure the copy non-embeded was check here.
Any ideas what I am doing wrong? Doesn anyone know of a setup by step tutorial on adding icons to your AIR app?You need to make sure the file paths are correct. And you need to make sure they are included in Export.
-
Old icons on ALV report dissappears when new ones are added
Hi friends
I have created an ALV report. However, when I tried adding new icons using Set PF-STATUS,
the original icons are not being shown. THey are totally dissappearing from the screen.
Is there a way to avoid this.
Any feed back will be greatly appreciated.
Thanks
RamHi,
How did you create the GUI status..
you have to copy the standard gui status..STANDARD from the program SAPLKKBL and then add the button..
GO to SE41..
Press Copy status button..
Frm
program - SAPLKKBL
Status - Standard
To
Program - Your program name
Status - Your Status
Once it is copied..
In the new status add your buttons and activate..
Now it will show the custom buttons along with the standard..
Thanks,
Naren -
ALV Sorting Not Working after Adding Checkbox to ALV
Hi All.
I am currently doing an ALV report using REUSE_ALV_GRID_DISPLAY function. I am sorting the list by Employee Name and Personnel Area. It works fine where the personnel are field and employee name field are merger together for same personnel are and employee name. But afterwards I added a checkbox field to the internal table and the list outputs a checkbox for each line. Afer putting the checkbox the list no long merges the same personnel are and employee name fields according to original sorting.
Can anyone explain if there is a way to solve this?
Thanks a lot.
Lilyyes there is a way. Just see this..
There is no Straight forward solution. There is a work around.
REPORT ztest_check_box .
TYPE-POOLS: slis,icon.
DATA: BEGIN OF it_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
matnr LIKE vbap-matnr,
posnr LIKE vbap-posnr,
kunnr LIKE vbak-kunnr,
kwmeng LIKE vbap-kwmeng,
check TYPE c,
id TYPE icon-id,
END OF it_vbap.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv.
DATA: x_fieldcat TYPE slis_fieldcat_alv.
DATA: it_sort TYPE slis_t_sortinfo_alv,
x_sort TYPE slis_sortinfo_alv.
SELECT vbak~vbeln
vbak~kunnr
vbap~posnr
vbap~matnr
vbap~kwmeng
INTO CORRESPONDING FIELDS OF TABLE it_vbap
FROM vbak JOIN vbap
ON vbak~vbeln = vbap~vbeln.
SORT it_vbap BY matnr.
DELETE it_vbap WHERE matnr IS INITIAL.
LOOP AT it_vbap.
it_vbap-id = '@T9@'.
MODIFY it_vbap.
ENDLOOP.
x_fieldcat-fieldname = 'ID'.
x_fieldcat-seltext_l = 'CHECK'.
x_fieldcat-outputlen = 4.
x_fieldcat-icon = 'X'.
x_fieldcat-col_pos = 1.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'MATNR'.
x_fieldcat-seltext_l = 'MATNR'.
x_fieldcat-col_pos = 2.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'KUNNR'.
x_fieldcat-seltext_l = 'KUNNR'.
x_fieldcat-col_pos = 3.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-col_pos = 4.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-col_pos = 5.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'KWMENG'.
x_fieldcat-seltext_l = 'KWMENG'.
x_fieldcat-col_pos = 6.
x_fieldcat-do_sum = 'X'.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_sort-fieldname = 'MATNR'.
x_sort-spos = 1.
x_sort-up = 'X'.
x_sort-group = 'X'.
x_sort-subtot = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort.
x_sort-fieldname = 'KUNNR'.
x_sort-spos = 2.
x_sort-up = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort.
x_sort-fieldname = 'VBELN'.
x_sort-spos = 3.
x_sort-up = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort.
*DATA:x_layout TYPE lvc_s_layo.
*x_layout-box_fname = 'CHECK'.
*x_layout-no_rowmark = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* is_layout = x_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_vbap[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
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.
*& Form itab_user_command
* text
* -->WHATCOMM text
* -->WHATROW text
FORM user_command USING whatcomm TYPE sy-ucomm selfield TYPE
slis_selfield.
IF selfield-fieldname = 'ID'.
READ TABLE it_vbap INDEX selfield-tabindex.
IF sy-subrc = 0.
IF it_vbap-check = ''.
it_vbap-id = '@R7@'.
it_vbap-check = 'X'.
ELSE.
it_vbap-id = '@T9@'.
it_vbap-check = ''.
ENDIF.
MODIFY it_vbap INDEX selfield-tabindex.
ENDIF.
ENDIF.
selfield-refresh = 'X'.
ENDFORM. "itab_user_command
if you want to make the above code to work in lower versions then you have to do this..
then maintain the ICON using the view V_ICON from SM30 add the New Entry.
get the properties from the below screen shot.
http://img404.imageshack.us/img404/3338/testig9.png -
Display icon in alv report ?
Hi All,
I am using class 'cl_gui_alv_grid' to generate an alv report. I want to display status icons like red, yellow and green in one of the coulmns. Please let me know how to achieve the same.
Regards,
Navneeth K.Try to follow the below code.
Add
icon TYPE icon-id, "Status
to your output table
Constants
CONSTANTS: c_green TYPE icon-id VALUE '@08@',
c_yellow TYPE icon-id VALUE '@09@',
c_red TYPE icon-id VALUE '@0A@'.
Put your condition in which you want to display which color.
IF CONDITION.
MOVE c_yellow TO wa_out-icon.
MODIFY it_out
from wa_out.
ENDIF.
Add it in your catalog
FORM populate_fieldcat USING p_table TYPE c.
**status
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'ICON'.
wa_fieldcat-seltext_l = text-010.
wa_fieldcat-outputlen = 15.
wa_fieldcat-icon = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
i_structure_name = 'MARA'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = it_out[]
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4. -
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
Maybe you are looking for
-
Tested with Ford, Volkswagen, and with a fiscon-mobile hands-free... regards mleonhard
-
previously had sucess with soft start up... but it is done for this time... i plug it in, it shows me the motorola icon, then shows my battery percentage... no matter how long it has charged from a wall charger... it quickly goes to five, ten and str
-
Oracle database does not start timezone mismatch
Hi I am new on oracle database. My server has restart and now when I try to start oracle database I get this error can anyone help to come out this error. oracle@host [~]# /home/u01/app/oracle/oracle/product/10.2.0/db_1/bin/emctl start dbconsole TZ s
-
Missing tools in photoshop CS4
Hi there, I've just taken the plunge and bought Photoshop CS4. I installed it but when I first went to use it it appears that the tool palette is incomplete. The magic eraser isn't there. The plain old eraser is, but there is nothing behind it. T
-
Write a view with function in oracle
Dear all, I have a table named borders, contains borders of some countries. and then i made a view, to have symmetric data , meaning if i have a record {ch,DE} then i should have { DE,ch}. then i want another view, preferably with the help of func