How to display image on alv display screen
Hi All,
I am using "REUSE_ALV_GRID_DISPLAY" function module for display a simple report.
I want to add a logo also on that output screen. Can anyone tell me how i can do that?
Thanks and Regards,
Nidhi Srivastava.
Yes.
But you have to paint the image after the native component has painted the text, to avoid the native component from erasing your image. Something like this should work.
class MyTextField extends TextField implements Runnable
public void paint(Graphics g)
super.paint(g);
new Thread(this).start();
public void run()
Thread.yield();
Graphics g = getGraphics();
g.drawImage(....)
Similar Messages
-
WD4A : Displaying images in ALV table
Hi,
Does anyone know how to display images in ALV tables in Webdynpro?Hello,
You can define an attribute in the context with the type CHAR 30 and define it value like an icon from WDA (like ~Icon/GreenLed). And then you need to create an method to define the attributes of the column that will have the image like follows:
METHOD display_alv .
DATA: lr_alv_usage TYPE REF TO if_wd_component_usage,
lr_config TYPE REF TO cl_salv_wd_config_table,
lr_col_header TYPE REF TO cl_salv_wd_column_header,
lr_function_wd TYPE REF TO cl_salv_wd_function,
lr_button TYPE REF TO cl_salv_wd_fe_button,
lr_image TYPE REF TO cl_salv_wd_uie_image,
lr_header TYPE REF TO cl_salv_wd_header,
lr_uie_link TYPE REF TO cl_salv_wd_uie_link_to_action,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_function_set TYPE REF TO if_salv_wd_function_settings,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_column_settings TYPE REF TO if_salv_wd_column_settings.
DATA: lt_columns TYPE salv_wd_t_column_ref,
ls_column TYPE salv_wd_s_column_ref,
lv_text TYPE string.
* Instantiate ALV Component
lr_alv_usage = wd_this->wd_cpuse_all_alv( ).
IF lr_alv_usage->has_active_component( ) IS INITIAL.
lr_alv_usage->create_component( ).
ENDIF.
* get reference to model
lr_if_controller = wd_this->wd_cpifc_all_alv( ).
lr_config = lr_if_controller->get_model( ).
* modify visible rows
lr_config->if_salv_wd_table_settings~set_visible_row_count( iv_rows ).
lr_config->if_salv_wd_table_settings~set_selection_mode(
wd_assist->co_alv_selmode ).
* create function
lr_function_set ?= lr_config.
lr_function_wd = lr_function_set->create_function(
wd_assist->co_func_det_nfe ).
CREATE OBJECT lr_button.
*read text
lv_text = wd_assist->read_text( iv_key = '002' ).
lr_button->set_text( lv_text ).
lv_text = wd_assist->read_text( iv_key = '001' ).
lr_button->set_tooltip( lv_text ).
lr_button->set_image_source( wd_assist->co_icon_seldet ).
lr_function_wd->set_editor( lr_button ).
* set table header
lr_table_settings ?= lr_config.
lr_header = lr_table_settings->get_header( ).
lv_text = wd_assist->read_text( iv_key = '003' ).
lr_header->set_text( lv_text ).
lv_text = wd_assist->read_text( iv_key = '004' ).
lr_header->set_tooltip( lv_text ).
lr_header->set_image_source( wd_assist->co_icon_list ).
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
LOOP AT lt_columns INTO ls_column.
CASE ls_column-id.
WHEN 'ICON'.
CREATE OBJECT lr_image.
lr_image->set_source_fieldname( ls_column-id ).
lr_image->set_tooltip_fieldname( 'ICON_TOOLTIP' ).
ls_column-r_column->set_cell_editor( lr_image ).
WHEN 'ID'.
CREATE OBJECT lr_uie_link.
lr_uie_link->set_text_fieldname( ls_column-id ).
ls_column-r_column->set_cell_editor( lr_uie_link ).
WHEN 'ICON_TOOLTIP' or 'LOGSYS'.
ls_column-r_column->set_visible(
cl_wd_uielement=>e_visible-none ).
ENDCASE.
*set header binding of medium description, otherwise title
lr_col_header = ls_column-r_column->get_header( ).
lr_col_header->set_ddic_binding_field(
if_salv_wd_c_column_settings=>ddic_bind_medium ).
ENDLOOP.
ENDMETHOD.
Here will be showed an icon (column ICON) and an link (column ID).
Regards, -
Hi Gurus,
Am developing ALV report using OOPS. In that i have to insert company logo. By using the below code it is coming good
CREATE OBJECT CONTAINER
EXPORTING
CONTAINER_NAME = 'PICTURE'.
CREATE OBJECT PIC
EXPORTING
PARENT = CONTAINER.
CALL METHOD pic->set_display_mode
EXPORTING
display_mode = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER
EXCEPTIONS
ERROR = 1
others = 2
CALL METHOD pic->load_picture_from_url
EXPORTING
url = 'file://D:\kk.GIF'
IMPORTING
RESULT =
EXCEPTIONS
ERROR = 1
others = 2
But here am hardcoding the url of the logo. Instead of that upload the image into SAP and how to insert that logo in that screen? Can anyone give me suggestions regarding this.
Points will be awarded
Thanks
RaviHi
In the transaction OAOR, you should be able to insert your company Logo.
GOTO - OAOR (Business Document Navigator)
Give Class Name - PICTURES Class Type - OT..... then Execute
It will show you the list, then select ENJOYSAP_LOGO.
On that list, you will find one control with a "create" tab.
Click std. doc types.
Select SCREEN and double-click.
It will push FILE selection screen.
Select your company logo (.gif) and press OK.
It will ask for a description- for instance: "company logo".
It will let you know your doc has been stored successfully.
You can find your logo under ENJOYSAP_LOGO->Screen->company logo.
Just run your ALV program, you should find your company logo in place of the EnjoySAP logo.
FORM TOP-OF-PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING[]
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID ='GT_LIST_TOP_OF_PAGE'.
ENDFORM. "TOP-OF-PAGE
Here 'ENJOYSAP_LOGO' will replace by ur created logo.
Refer this link
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm
http://www.sap-img.com/abap/alv-logo.htm
http://www.sap-img.com/fu002.htm
Re: Logo on Login screen
Re: To change image into main menu of sap
Reward points for useful Answers
Regards
Anji -
How to use filter for alv display in webdynpro
hi,
i have use select-options and what ever data is coming from the data base i display it using alv.
i also want to include functionality like filter and all that , that comes in normal alv.please guide me how can i do it.
thankshi please remind that this is not the proper forum for this ...go to this
Expert Forums » ABAP Development » UI Programming -
External display, image not filling entire screen.
I just bought a tv to use as a external monitor for my mac however when i boot into windows 7 the resolution (1080p) is fine but its not filling the screen completely, there is 1 inch of black on the top and bottom and about 1.5 inches of black on the left and right sides. it does not do this when i am booted into osx.
i think this could be because of how hdtv's are made and the resolution isn't exact (usually a little bit greater) so windows isn't "stretching" the image to fill the screen. i think osx does it automatically but windows doesn't. if this is the problem how do i get windows to stretch the image? i tried switching the screen mode on my tv's remote but that didn't work.
thanks for the help everybody and merry christmas!exactly the same for me. fulla hd tv, no problem tv/mac ->full screen; but with bootcamp/win7 no way, even with the new 9.12 Ati driver...
thnks for help and happy new year -
What is the difference between ALV list FM display and OO ALV Display?
What is the difference between ALV Function Modules and Object Oriented ALV Display?
Hi Sathish ,
There is not much diffrence , it is only another way of implementing it.
Regards
Arun -
To Display Image in Alv Grid....
Hello Gurus,
I want to display an image/icon ( custom icon ) in the ALV grid.
I know to display standard icons in ALV. But i dont know how to store custom icons in the system.
I want to display an icon or image depending upon certain conditions. i need to display these images/icons for each row of the ALV grid.
Please let me know if i can show images or icons ( not standard ) for each row in ALV grid.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 25, 2008 10:20 AMcheck out CL_GUI_PICTURE and the demo programs
SAP_PICTURE_DEMO
SAP_PICTURE_DEMO_ICON
RSDEMO_PICTURE_CONTROL
you can fit the picture in to the control with the following modes.
DISPLAY_MODE_FIT
other options
DISPLAY_MODE_NORMAL
DISPLAY_MODE_STRETCH
DISPLAY_MODE_NORMAL_CENTER
DISPLAY_MODE_FIT_CENTER
Regards
Raja -
I've noticed some discrepancies between times recorded in my image EXIF data as well as the time displayed with images in Bridge and Photoshop Elements Organizer. For instance I may have a series of images shot within a few minutes of each other. After having done some manipulation of a subset of the images and later on showing the sequence in both Bridge and PSE Organizer, I have noticed that the time associated with some of the images has changed. Bridge and PSE Organizer may actually show times that differ by several hours. It almost looks like the time is converted from the original camera time to UTC and then possibly back to the time zone where my computer is located. The pattern is not completely consistent and may depend on what Adobe products have been used to adjust or catalog the images. I'm looking for a good and complete description of how each product handles the image date and time stamp. I suspect that there is some inconsistency in how this is done across the products. I'm currently using Bridge / Photoshop CS6 Extended and Photoshop Elements Organizer 10.0 which were recently upgraded from CS 5 and 8.0 respectively. I also use Adobe Camera Raw 7.1 to edit the Nikon raw files. This problem appears to predate the upgrade of my products.
Well, it must be a system-specific bug of some sort that's been introduced, because I was able to create a 4200 x 3500 image made by mapping an image of similar size to a cylinder, and the cylinder would move/rotate in real time. Of course, I have a completely different video card and system than you do, but I'm just verifying that it's not broken everywhere.
Rendering isn't hugely fast, but that's not unexpected with a larger image.
Maybe being more specific would help. Is your mesh complex?
Is it something you'd be willing to share online or describe how to create? I would be happy to try to match what you're doing more thoroughly to see whether I can reproduce the slowdowns.
Beyond that, I'm not sure what to suggest... You don't have a lot of RAM to be working on 15 megapixel images, but as you say the thing to concentrate on is that you're seeing quite different performance from the Ps CS6 beta version.
-Noel -
Displaying Image on the Front screen
Hi all,
I am developing a screen programming.
it has 10 screens.
I have uploaded image using SMW0 transaction code and cl_gui_docking_container, cl_gui_picture classes in the 1st screen.
But it is replicating into all the remaining screens also.
I have called this subroutine in 1st screen PBO module only.
But i am unable to understand why it is getting into other screens.
Please suggest me.
Thanks in advance.
EswarHi,
Once you are naviagting to other screen by calling the following method:
CALL METHOD conatiner_name->FREE
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
Thanks & Regards,
Navneeth K. -
How to convert this into alv display and also change parameterstoselect opt
tables :mara,marc,stpo.
parameters: p_werks like t001w-werks obligatory,
p_matnr like mara-matnr obligatory.
*select-options : p_matnr for mara-matnr obligatory.
*parameters: p_werks like marc-werks obligatory,
*p_matnr like marc-matnr obligatory.
constants c_x value 'X'.
data: begin of it_comp occurs 0,
idnrk like stpox-idnrk,
ojtxp like stpox-ojtxp,
menge like stpox-menge,
meins like stpox-meins,
matkl like stpox-matmk,
end of it_comp.
data: w_topmat like cstmat.
start-of-selection.
perform explode_assembly.
end-of-selection.
perform write_report.
top-of-page.
perform print_header.
form print_header.
write: /(18) 'Component'(h00),
(40) 'Description'(h01),
'Mat.Group'(h02),
(18) 'Quantity'(h03).
uline.
endform.
form write_report.
write: / w_topmat-matnr under text-h00 color col_heading,
w_topmat-maktx under text-h01 color col_heading.
loop at it_comp.
write: /
it_comp-idnrk under text-h00,
it_comp-ojtxp under text-h01,
it_comp-matkl under text-h02,
it_comp-menge unit it_comp-meins under text-h03,
it_comp-meins.
endloop.
uline.
endform.
form explode_assembly.
data: it_stb like stpox occurs 0 with header line,
it_stb2 like stpox occurs 0 with header line,
it_stb3 like stpox occurs 0 with header line,
w_msg(255) type c.
Explode highest level:
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = p_matnr
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
exit.
endif.
Don't process documents
delete it_stb where idnrk is initial.
Don't process valid from furure:
delete it_stb where datuv >= sy-datum.
Explode phantom assemblies up to last level
*do.
it_stb2[] = it_stb[].
*delete it_stb2 where dumps is initial.
*if it_stb2[] is initial.
*exit.
*endif.
*delete it_stb where not dumps is initial.
delete it_stb where VPRSV <> 'S' OR MMSTA = '61'.
loop at it_stb2.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01'
auskz = c_x
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = it_stb2-idnrk
werks = p_werks
tables
stb = it_stb3
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
else.
delete it_stb3 where idnrk is initial.
delete it_Stb3 where sobsl = 50.
loop at it_stb3 .
multiply it_stb3-menge by it_stb2-menge.
modify it_stb3 transporting menge.
endloop.
append lines of it_stb3 to it_stb.
endif.
endloop.
*enddo.
Build table of components collecting the same components from
all levels
loop at it_stb.
it_comp-matkl = it_stb-matmk.
it_comp-idnrk = it_stb-idnrk.
it_comp-ojtxp = it_stb-ojtxp.
it_comp-menge = it_stb-menge.
it_comp-meins = it_stb-meins.
collect it_comp.
clear it_comp.
endloop.
ENDFORM.
using this i got the bom explosion and also i tried to use the following code
to diplay alv diplay,but i got the errormsg,
here i got only one material input,instead of i want to use
select options to from to ,if i give 1 to 10 material
ouput is
material 1
descripn
bom and components
materials 2
desc
bom comp
TYPE-POOLS : SLIS.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_FIELDCAT_LN LIKE LINE OF IT_FIELDCAT.
DATA : IT_EVENTCAT TYPE SLIS_T_EVENT.
DATA : WA_EVENTCAT_LN LIKE LINE OF IT_EVENTCAT.
DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: S_COL_POS TYPE I.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_FIELDCAT_LN LIKE LINE OF IT_FIELDCAT.
DATA : IT_EVENTCAT TYPE SLIS_T_EVENT.
DATA : WA_EVENTCAT_LN LIKE LINE OF IT_EVENTCAT.
DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: S_COL_POS TYPE I.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_FIELDCAT_LN LIKE LINE OF IT_FIELDCAT.
DATA : IT_EVENTCAT TYPE SLIS_T_EVENT.
DATA : WA_EVENTCAT_LN LIKE LINE OF IT_EVENTCAT.
DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: S_COL_POS TYPE I.
FORM BUILD_FIELDCATALOG.
PERFORM BUILD_FIELDCAT USING 'MATKL'.
PERFORM BUILD_FIELDCAT USING 'IDNRK.
PERFORM BUILD_FIELDCAT USING 'OJTXP.
PERFORM BUILD_FIELDCAT USING 'MENGE'.
PERFORM BUILD_FIELDCAT USING 'MEINS'.
ENDFORM.
FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME S_TEXT LIKE DD03P-SCRTEXT_M.
CLEAR WA_FIELDCAT_LN.
ADD 1 TO S_COL_POS.
WA_FIELDCAT_LN-REF_TABNAME = 'IT_COMP'.
WA_FIELDCAT_LN-FIELDNAME = L_FIELDNAME.
WA_FIELDCAT_LN-SELTEXT_M = S_TEXT.
WA_FIELDCAT_LN-COL_POS = S_COL_POS.
WA_FIELDCAT_LN-QFIELDNAME = SPACE.
WA_FIELDCAT_LN-HOTSPOT = SPACE.
WA_FIELDCAT_LN-JUST = 'R'.
APPEND WA_FIELDCAT_LN TO IT_FIELDCAT.
ENDFORM.
FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
FORM DATA_DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = TEXT-001
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_COMP
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.
GIVE ME SOLUTION FOR THAT ON, VERY URGENT
THANKS IN ADVANCE
regards
dsHi
declare select-options instead of parameters
for converting a report to ALV
create a field catalog.
for this two option declare a itab with
fcat TYPE slis_t_fieldcat_alv
and pass the field name,descr etc to fcat and append the same.
or create structur same as your itab and pass the same with FM
'REUSE_ALV_FIELDCATALOG_MERGE'
use either <b>reuse_alv_grid_display or reuse_alv_list_display</b> .
and pass the itab.
thanks
Shiva -
How to upload images on WebDynpro(ABAP) screens
Hello All,
Could any one please help on how to create/change the image (jpeg/any file) dynamically on WebDynpro screen. I have seen couple of examples for uploading the text files in WDR_TEST_EVENTS, WDR_TEST_WEB_ICONS, but not found any standard program that explains about uploading images.
Requirement: User has to select any image/thumbnail from local PC and it should be displayed on main screen, it's not only from MIME directory.
We have the same logic in BSP Application (CFX_RFC_UI) to upload the thumbnail but am not sure whether we can use the same logic in WDC or not?
I have seen the same logic for WebDynpro (JAVA) here:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
I would really appreciate if you could provide me the code/process ASAP.
Thanks & Regards,
Hari.Hi,
I have written the code as per given logic with no errors, after selecting jpeg file from local PC when I click on 'upload' button it is giving a following short dump.
Could you please let me know how to rectify it.
Error when processing your request
What has happened?
The URL http://rocpld02.wwwint.corp:8000/sap/bc/webdynpro/sap/zms_image_01/ was not called due to an error.
Note
The following error text was processed in the system PLD : Exception condition "CNTL_ERROR" raised.
The error occurred on the application server rocpld02_PLD_00 and in the work process 1 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: CONSTRUCTOR of program CL_GUI_CUSTOM_CONTAINER=======CP
Method: ONACTIONONBUTTONCLICK of program /1BCWDY/1I6RRYQYFWRI2HBZ5MAK==CP
Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/1I6RRYQYFWRI2HBZ5MAK==CP
Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP
Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP
Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
Regards,
Hari. -
How to display image in selection-screen of a report
Dear all ,
i want to show my image from url or from desktop to the report selection-screen . i have searched sdn and found some code . after applying it i am not able to display image in the selection-screen although it is displaying the box in which the image should appear . here i am sending my code plz verify where is the mistake .
REPORT ZPIC2.
DATA: docking TYPE REF TO cl_gui_docking_container,
picture_control_1 TYPE REF TO cl_gui_picture,
url(256) TYPE c .
PARAMETERS: A(4) DEFAULT '4' .
PARAMETERS: B(4) DEFAULT '5' .
AT SELECTION-SCREEN OUTPUT.
PERFORM show_pic.
**& Form show_pic
FORM show_pic.
CREATE OBJECT picture_control_1 EXPORTING parent = docking.
CHECK sy-subrc = 0.
CALL METHOD picture_control_1->set_3d_border
EXPORTING
border = 5.
CALL METHOD picture_control_1->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_stretch.
CALL METHOD picture_control_1->set_position
EXPORTING
height = 100
left = 150
top = 58
width = 350.
CALL METHOD picture_control_1->load_picture_from_url
EXPORTING
url = 'C:\abc.jpg' .
endif .
IF sy-subrc NE 0.
ENDIF.
ENDFORM.
CORECT ANSWERS WILL BE HIGHLY APPRECIATED AND SURELY REWARED .
THANKS ,
AMIT RANJANHi,
Try this code. hope it will work.
DATA: DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,
PICTURE_CONTROL_1 TYPE REF TO CL_GUI_PICTURE,
URL(256) TYPE C,
PIC_DATA TYPE TABLE OF W3MIME WITH HEADER LINE,
PIC_SIZE TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS: A(4) DEFAULT '4' .
PARAMETERS: B(4) DEFAULT '5' .
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN OUTPUT.
PERFORM SHOW_PIC.
*& Form SHOW_PIC
FORM SHOW_PIC .
CREATE OBJECT PICTURE_CONTROL_1
EXPORTING PARENT = DOCKING.
CHECK SY-SUBRC = 0.
CALL METHOD PICTURE_CONTROL_1->SET_3D_BORDER
EXPORTING
BORDER = 5.
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_STRETCH.
CALL METHOD PICTURE_CONTROL_1->SET_POSITION
EXPORTING
HEIGHT = 200
LEFT = 100
TOP = 20
WIDTH = 400.
CHANGE POSITION AND SIZE ABOVE**************************
IF URL IS INITIAL.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
TYPE = 'image'
SUBTYPE = CNDP_SAP_TAB_UNKNOWN
SIZE = PIC_SIZE
LIFETIME = CNDP_LIFETIME_TRANSACTION
TABLES
DATA = PIC_DATA
CHANGING
URL = URL
EXCEPTIONS
OTHERS = 1.
ENDIF.
CALL METHOD PICTURE_CONTROL_1->LOAD_PICTURE_FROM_URL
EXPORTING
URL = 'file://D:\img.jpg'.
ENDFORM. " SHOW_PIC -
hi,
plz any one tell how to change colors in alv display or how to set colors in alv
Regards,
jyotsnaREPORT z_alv_cell_color.
Example of ALV with Cell color *
Macro definition
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '30' OBLIGATORY. "#EC *
SELECTION-SCREEN END OF LINE.
TYPES :
BEGIN OF ty_data,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
END OF ty_data,
Data displayed
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
tabcolor TYPE lvc_t_scol, " Cell Color
END OF ty_vbak.
DATA:
gt_data TYPE TABLE OF ty_data,
Data displayed
gt_vbak TYPE TABLE OF ty_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'. "#EC NOTEXT
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_fill_color.
PERFORM f_display_data.
Form f_read_data_vbak
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM vbak UP TO p_max ROWS.
ENDFORM. " F_READ_DATA
Form f_fill_color
FORM f_fill_color.
DATA :
ls_data TYPE ty_data,
ls_vbak TYPE ty_vbak.
LOOP AT gt_data INTO ls_data.
CLEAR ls_vbak.
MOVE-CORRESPONDING ls_data TO ls_vbak.
PERFORM f_modify_color USING 'NETWR' CHANGING ls_vbak.
PERFORM f_modify_color USING 'VBELN' CHANGING ls_vbak.
Fill gt_vbak
APPEND ls_vbak TO gt_vbak.
ENDLOOP.
ENDFORM. " F_FILL_COLOR
Form F_modify_color
FORM f_modify_color USING u_fieldname TYPE lvc_fname
CHANGING us_vbak TYPE ty_vbak.
DATA :
l_rnd_value TYPE integer2,
ls_tabcolor TYPE lvc_s_scol.
Random value
CALL FUNCTION 'RANDOM_I2'
EXPORTING
rnd_min = 0
rnd_max = 3
IMPORTING
rnd_value = l_rnd_value.
CLEAR ls_tabcolor.
ls_tabcolor-fname = u_fieldname.
CASE l_rnd_value.
WHEN 0.
ls_tabcolor-color-col = 1. " Blue.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 1.
ls_tabcolor-color-col = 3. " Yellow.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 2.
ls_tabcolor-color-col = 5. " Green.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 3.
ls_tabcolor-color-col = 6. " Red.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
ENDCASE.
INSERT ls_tabcolor INTO TABLE us_vbak-tabcolor.
ENDFORM. " F_MODIFY_COLOR
Form f_display_data
FORM f_display_data.
DATA:
ls_layout TYPE slis_layout_alv,
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
Build the field catalog
m_fieldcat 'VKORG' 'VBAK'.
m_fieldcat 'KUNNR' 'VBAK'.
m_fieldcat 'VBELN' 'VBAK'.
m_fieldcat 'NETWR' 'VBAK'.
Fill Layout
ls_layout-coltab_fieldname = 'TABCOLOR'.
Display the list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
END OF PROGRAM Z_ALV_CELL_COLOR ********************* -
After refreshing ALV display, set it to the current cell that was modified.
Hello Experts,
I am currently using cl_gui_alv_grid for my ALV grid display. I have 1 editable column
which lets users input values. Now, When users press 'ENTER' in the keyboard I refresh
the ALV display to reflect the changes done. But the display always "moves back" to the first column
so it is tiresome to find the current cell that was modified. My question is, how do I set the ALV
display to just "stay put" in the current cell that was modified after pressing 'ENTER'?
Hope you can help me guys.Thank you and take care!Check this link
ALV scroll bar -
Toolbar in alv display using oops alv
i have written code for displaying toolbar in alv display using oops, but it is not displaying please find the below code and let me know reason.
*& Report ZTRANSFER_ORDER2 *
REPORT ZTRANSFER_ORDER2 .
*& Report ZTRANSFER_ORDER *
TABLES:sflight.
TYPE-POOLS : icon.
* G L O B A L I N T E R N A L T A B L E S
CLASS lcl_event_receiver DEFINITION DEFERRED.
types : begin of ty_mara,
matnr type matnr,
mtart type mtart,
mbrsh type mbrsh,
matkl type matkl,
bismt type bismt,
meins type meins,
end of ty_mara.
DATA: t_mara type STANDARD TABLE OF ty_mara.
* G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_mara type ty_mara.
DATA : t_fcat type LVC_T_FCAT.
DATA : l_VAR TYPE disvariant.
DATA : gs_layout type lvc_s_layo.
* Declare reference variables to the ALV grid and the container
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
data : it_toolbar TYPE stb_button,
event_receiver TYPE REF TO lcl_event_receiver.
* S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
CALL SCREEN 100 .
*CLASS lcl_event_receiver DEFINITION.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
*handling toolbar for interactive
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
*handling menu button
handle_menu_button
FOR EVENT menu_button OF cl_gui_alv_grid
IMPORTING e_object e_ucomm,
*On click of the menu button
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
handle toolbar
CLEAR it_toolbar.
MOVE 'DETAIL' TO it_toolbar-function.
MOVE icon_detail TO it_toolbar-icon.
MOVE 2 TO it_toolbar-butn_type.
APPEND it_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
handle own menubuttons
IF e_ucomm = 'DETAIL'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'DISPLAY'
text = 'DISPLAY'.
ENDIF.
ENDMETHOD. "handle_menu_button
METHOD handle_user_command.
*On click
CASE e_ucomm.
WHEN 'DISPLAY'.
MESSAGE 'Menu Clicked' TYPE 'I'.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
sET PF-STATUS 'STATUS'.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT matnr mtart mbrsh matkl bismt meins
FROM mara
INTO corresponding fields of TABLE t_mara.
PERFORM fld_cate changing T_fcat.
l_var-report = sy-repid.
gs_layout-grid_title = 'Analysis Report'.
gs_layout-NO_TOOLBAR = 'X'.
gs_layout-BOX_FNAME = 'Selection'.
Load data into the grid and display them
caLL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'S_MVKE'
i_save = 'A'
is_variant = l_var
is_layout = gs_layout
CHANGING
it_outtab = t_mara[]
it_fieldcatalog = t_fcat.
endform.
*& Module pai INPUT
text
MODULE pai INPUT.
data: l_valid type c.
clear ok_code.
break-point.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
call method go_grid->check_changed_data
importing
e_valid = l_valid.
loop at t_mara into g_wa_mara.
endloop.
ENDCASE.
ENDMODULE. " pai INPUT
*& Form fld_cate
text
<--P_T_FCAT text
FORM fld_cate CHANGING P_T_FCAT TYPE lvc_t_fcat.
DATA : s_fcat type LVC_S_FCAT .
REFRESH: t_fcat.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX1'.
s_fcat-coltext = 'Box1'.
s_fcat-seltext = 'Box1'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 1.
s_fcat-col_pos = 1.
s_fcat-fieldname = 'MATNR'.
s_fcat-ref_field = 'MATNR'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material'.
s_fcat-seltext = 'Material'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 2.
s_fcat-col_pos = 2.
s_fcat-fieldname = 'MTART'.
s_fcat-ref_field = 'MTART'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material type'.
s_fcat-seltext = 'Material type'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX2'.
s_fcat-coltext = 'Box2'.
s_fcat-seltext = 'Box2'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 3.
s_fcat-col_pos = 3.
s_fcat-fieldname = 'MBRSH'.
s_fcat-ref_field = 'MBRSH'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Industry Sector'.
s_fcat-seltext = 'Industry Sector'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 4.
s_fcat-col_pos = 4.
s_fcat-fieldname = 'MATKL'.
s_fcat-ref_field = 'MATKL'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material Group'.
s_fcat-seltext = 'Material Group'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 5.
s_fcat-col_pos = 5.
s_fcat-fieldname = 'BISMT'.
s_fcat-ref_field = 'BISMT'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Old material number'.
s_fcat-seltext = 'Old material number'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 6.
s_fcat-col_pos = 6.
s_fcat-fieldname = 'MEINS'.
s_fcat-ref_field = 'MEINS'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Base Unit of Measure'.
s_fcat-seltext = 'Base Unit of Measure'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX3'.
s_fcat-coltext = 'Box3'.
s_fcat-seltext = 'Box3'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
ENDFORM. " fld_cate .MOVE 2 TO it_toolbar-butn_type.
Try changing the 2 (menu) to 0 (button) and see if that helps
also you need to set the event handler after you create your alv object
set handler handle_toolbar for [whatever object is called].
Edited by: Kev Mycock on Jul 24, 2008 7:59 AM
Maybe you are looking for
-
Creation of cost elements automatically
Hi, When I selected "manual creation of cost elements" in OB13, Then we can create a group of cost elements in OKB2 followed by OKB3 and SM35. Even I need to do same thing I when I select " automatic creation of cost elements" ?? I tried selecting "
-
Copy and paste using Voice Over
Hello, I use Voice Over on Leopard 10.5 and am having problems using cut, copy, and paste via Finder. 1. Command+X for cut never seems to work. The CUT option in the Finder edit menu is always dimmed. 2. Finder seems to always hang if I paste a file
-
Soap Router versus Web Service Servlet
Hello: I am trying to understand the fundamental difference between a SOAP Router versus Web Service Servlet?. In websphere there is a concept called WSG(Web Service Gateway) on which we can configure an handler to intercept the incoming soap request
-
Hi, I am trying to do a file-XI-HTTP scenario. There seems to be a problem. When i saw the trace file in SMICM i got the following warnign message. *[Thr 1] *** WARNING => maximum number of sockets supported on this* host (1992) less than parameter
-
Can anyone tell me that is it possible to import data from a text file as we can import in access without converting it to script or is there any utility to do so? Your help will be highly appreciated! Thanx........ Muhammad Umair