Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV-path problem

Former Member
0 Likes
1,385

hi all

i hav tried to display picture by getting the path from desktop....but its taking path but the path name is not appearing in the selection screen and morover how to display it....

&----


*& Report ZFOTO

*&

&----


*&

*&

&----


REPORT ZFOTO.

tables : zemployee.

type-pools : cndp.

type-pools : slis,icon.

data : d_fieldcat type slis_t_fieldcat_alv,

d_fieldcat_wa type slis_fieldcat_alv.

DATA : t_header type slis_t_listheader,

wa_header type slis_listheader.

data url type cndp_url.

data : gd_layout type slis_layout_alv.

DATA : BEGIN OF itab_vmoksha OCCURS 0,

empid like zvmoksha-empid,

empname like zvmoksha-empname,

division like zvmoksha-division,

visitors(20) type c,

duration TYPE time,

END OF itab_vmoksha.

data : line(30) type c,

linecount(30) type c.

data : itab_employee like zemployee OCCURS 0 with HEADER LINE,

wa_employee like LINE OF itab_employee.

selection-screen : begin of block blk1 with frame title text-001.

parameters : p_empid like zemployee-empid,

p_name like zemployee-empname,

visitors like itab_vmoksha-visitors,

duration like itab_vmoksha-duration.

parameters : path type rlgrap-filename.

selection-screen : end of block blk1.

select empid empname division from zvmoksha into TABLE itab_vmoksha where empid = itab_vmoksha-empid.

if sy-subrc = 0.

write 😕 itab_vmoksha-empid,

10 itab_vmoksha-empname,

30 itab_vmoksha-division,

50 itab_vmoksha-visitors,

70 itab_vmoksha-duration.

endif.

path = 'C:\Documents and Settings\ashab.VMOKSHA\Desktop\anuradha05.jpg'.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'FILE'

IMPORTING

FILE_NAME = path

.

anybody help me out...

Apt answers wil be rewarded....

17 REPLIES 17
Read only

Former Member
0 Likes
1,332

Hi

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'PATH' -


> "FILE'

IMPORTING

FILE_NAME = path <--comment it

Revrt back if any issues,

REwrad if helpful.

regardss,

Naveen

Read only

0 Likes
1,332

Hi naveen

I executed the program, and selected the filename(anuradha05.jpg) from desktop but it is not appearing on my selection screen.I can again execute to display the image only after the file name appearing on selection screen...

so wat can i do?

regards

asha

Read only

0 Likes
1,332

Hi Asha banu,

Have u changed the Parameters as i said in the Function module.

Revert back.

regards,

Naveen

Read only

0 Likes
1,332

hi

ya changed as u said...but still the prob remains...

Read only

0 Likes
1,332

&----


*& Report ZFOTO

*&

&----


*&

*&

&----


REPORT ZFOTO.

tables : zemployee.

type-pools : cndp.

type-pools : slis,icon.

data : d_fieldcat type slis_t_fieldcat_alv,

d_fieldcat_wa type slis_fieldcat_alv.

DATA : t_header type slis_t_listheader,

wa_header type slis_listheader.

data url type cndp_url.

data : gd_layout type slis_layout_alv.

DATA : BEGIN OF itab_vmoksha OCCURS 0,

empid like zvmoksha-empid,

empname like zvmoksha-empname,

division like zvmoksha-division,

visitors(20) type c,

duration TYPE time,

END OF itab_vmoksha.

data : line(30) type c,

linecount(30) type c.

data : itab_employee like zemployee OCCURS 0 with HEADER LINE,

wa_employee like LINE OF itab_employee.

selection-screen : begin of block blk1 with frame title text-001.

parameters : p_empid like zemployee-empid,

p_name like zemployee-empname,

visitors like itab_vmoksha-visitors,

duration like itab_vmoksha-duration.

parameters : path type rlgrap-filename.

selection-screen : end of block blk1.

select empid empname division from zvmoksha into TABLE itab_vmoksha where empid = itab_vmoksha-empid.

INITIALIZATION.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'FILE'

IMPORTING

FILE_NAME = path.

if sy-subrc = 0.

write 😕 itab_vmoksha-empid,

10 itab_vmoksha-empname,

30 itab_vmoksha-division,

50 itab_vmoksha-visitors,

70 itab_vmoksha-duration.

endif.

Read only

0 Likes
1,332

hi Babu

Thankyou so much now the Path is appearin on selection-screen but not displayin...wat should i do further to display the image along with the other selection screen fields?

Read only

0 Likes
1,332

Hi Asha,

I can't understand ur requirement. can u please elaborate it.

or please paste ur full code.

Thanks

Kasinatth Babu.

Read only

0 Likes
1,332

hi baby

k lemme explain u clearly....iam developing a report to display company's visitors ID card....so i need their foto also to b displayed....so i hav created a dummy/local table zemployee...and i need the foto which is stored in desktop to b displayed along with the employee details...

so now wat happens is,wen i execute the code below,it ask for the filename and i select the foto which is in desktop...but the foto is not displayed in the out put wat should i do to print it....

this is my code

&----


*& Report ZFOTO

*&

&----


*&

*&

&----


REPORT ZFOTO.

tables : zemployee.

type-pools : cndp.

type-pools : slis,icon.

data : d_fieldcat type slis_t_fieldcat_alv,

d_fieldcat_wa type slis_fieldcat_alv.

DATA : t_header type slis_t_listheader,

wa_header type slis_listheader.

data url type cndp_url.

data : gd_layout type slis_layout_alv.

DATA : BEGIN OF itab_vmoksha OCCURS 0,

empid like zvmoksha-empid,

empname like zvmoksha-empname,

division like zvmoksha-division,

visitors(20) type c,

duration TYPE time,

END OF itab_vmoksha.

data : line(30) type c,

linecount(30) type c.

data : itab_employee like zemployee OCCURS 0 with HEADER LINE,

wa_employee like LINE OF itab_employee.

selection-screen : begin of block blk1 with frame title text-001.

parameters : p_empid like zemployee-empid,

p_name like zemployee-empname,

visitors like itab_vmoksha-visitors,

duration like itab_vmoksha-duration.

parameters : path type rlgrap-filename.

selection-screen : end of block blk1.

select empid empname division from zvmoksha into TABLE itab_vmoksha where empid = itab_vmoksha-empid.

if sy-subrc = 0.

write 😕 itab_vmoksha-empid,

10 itab_vmoksha-empname,

30 itab_vmoksha-division,

50 itab_vmoksha-visitors,

70 itab_vmoksha-duration.

endif.

path = 'C:\Documents and Settings\ashab.VMOKSHA\Desktop\anuradha05.jpg'.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'FILE'

  • IMPORTING

  • FILE_NAME = path

.

Read only

0 Likes
1,332

hi babu,

In normal report we can display image in the o/p list.because Reports wont support for GUI.

so now we can only display images in ALVs

first you need to get the object or register the object for you image by T.code oAER

you can try from the T.code se78 as well where you can see you image stored on docment server.

after you register your images in the OAER.

you have to use the F.M 'REUSE_ALV_COMMENTARY_WRITE' to display the image .

thanks

arun

.

Read only

0 Likes
1,332

Hi Asha,

At first ur code has no logic for displaying the image.

u can use the class cl_gui_picture for displaying the pictures.

But u have to code it in the form of module pool for that.

Here is a sample program for displaying the picture. I think which will be usefull to u to meet ur requirement.

REPORT zalv440.

TABLES : mara.

TYPES: BEGIN OF t_mara,

matnr TYPE mara-matnr,

END OF t_mara.

DATA : gi_mara TYPE STANDARD TABLE OF t_mara,

gs_mara TYPE t_mara,

GW_VALUE_MATERIAL type matnr.

*--- Custom container instance reference

DATA gw_container TYPE REF TO cl_gui_custom_container.

*Declaration for ALV Header

DATA:

gw_picture TYPE REF TO cl_gui_picture.

DATA: graphic_url(255),

g_result TYPE i.

----


  • SELECTION SCREEN DEFINITION *

----


SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS : s_matnr FOR mara-matnr NO INTERVALS.

SELECTION-SCREEN END OF BLOCK b1.

----


  • START-OF-SELECTION *

----


START-OF-SELECTION.

SELECT single

matnr

FROM mara

INTO gs_mara

WHERE matnr IN s_matnr.

IF sy-dbcnt NE 0.

GW_VALUE_MATERIAL = gs_mara-matnr.

graphic_url = 'file://D:\A320.JPG'.

CALL SCREEN 0002.

ENDIF.

*&----


*

*& Module STATUS_0001 OUTPUT

*&----


*

  • text

*----


*

MODULE status_0002 OUTPUT.

SET PF-STATUS '0001'.

SET TITLEBAR '001'.

PERFORM display.

ENDMODULE. " STATUS_0001 OUTPUT

*&----


*

*& Module USER_COMMAND_0001 INPUT

*&----


*

  • text

*----


*

MODULE user_command_0002 INPUT.

CASE sy-ucomm.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'SAVE'.

LEAVE TO SCREEN 0.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0001 INPUT

*&----


*

*& Form build_alv_display

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM display .

PERFORM create_picture.

ENDFORM. " build_alv_display

*&----


*

*& Form create_alv_grid

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM create_picture.

IF gw_container IS INITIAL.

CREATE OBJECT gw_container

EXPORTING

container_name = 'CC_PICTURE'.

  • Display ALV grid

IF NOT gw_container IS INITIAL.

CREATE OBJECT gw_picture

EXPORTING

parent = gw_container.

CALL METHOD gw_picture->load_picture_from_url

EXPORTING

url = graphic_url

IMPORTING

RESULT = g_result.

ENDIF.

ENDIF.

ENDFORM. " create_alv_grid

If u have further queries regarding this, let me know.

Reward points if helpfull.

Read only

0 Likes
1,332

hi

I have already tried in Module Pool programming...I can dispaly the image using it but now my requirement is i want to display it using ALV...

How should i code it to get the image been displayed?

Thanks

Asha

Read only

0 Likes
1,332

hi Arun

how to register images using Tcode OAER.....can u tel me step by step...

thanks

asha

Read only

0 Likes
1,332

Hi Asha,

if u want to display a picture through ALV,

Here is a sample program wherein I have used a splitter container and displayed the picture inthe header and my data in an ALV grid in the body. for this I have uploaded my picture in SE78 in bmp format.

I think it will be helpfull to u.

REPORT zalv440.

TABLES : mara.

*Decalration for class lcl_event_handler

CLASS lcl_event_receiver DEFINITION DEFERRED.

TYPES: BEGIN OF t_mara,

matnr TYPE mara-matnr,

lvorm TYPE mara-lvorm,

mtart TYPE mara-mtart,

mbrsh TYPE mara-mbrsh,

matkl TYPE mara-matkl,

meins TYPE mara-meins,

brgew TYPE mara-brgew,

ntgew TYPE mara-ntgew,

gewei TYPE mara-gewei,

END OF t_mara.

DATA : gi_mara TYPE STANDARD TABLE OF t_mara,

gs_mara TYPE t_mara.

*-- Global data definitions for ALV

*--- ALV Grid instance reference

DATA : gw_alvgrid TYPE REF TO cl_gui_alv_grid.

*--- Custom container instance reference

DATA gw_container TYPE REF TO cl_gui_custom_container.

*--- Field catalog table

DATA : gi_fieldcat TYPE lvc_t_fcat,

gs_fieldcat TYPE lvc_s_fcat.

*--- Layout structure

DATA : gs_layout TYPE lvc_s_layo.

*Declaration for ALV Header

DATA:

  • Reference to document

gw_event_reciever TYPE REF TO lcl_event_receiver,

  • Reference to split container

gw_splitter TYPE REF TO cl_gui_splitter_container,

gw_splitter1 TYPE REF TO cl_gui_splitter_container, "a++

  • Reference to grid container

gw_parent_grid TYPE REF TO cl_gui_container,

gw_dyndoc_id TYPE REF TO cl_dd_document,

gw_parent_html TYPE REF TO cl_gui_container,

gw_picture TYPE REF TO cl_gui_picture.

data: graphic_url(255),

graphic_refresh(1),

g_result type i.

data: begin of graphic_table occurs 0,

line(255) type x,

end of graphic_table.

data: graphic_size type i.

  • LOCAL CLASSES: Definition

****************************************************************

*===============================================================

  • class lcl_event_receiver: local class to

  • define and handle own functions.

*

  • Definition:

  • ~~~~~~~~~~~

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS:

  • For ALV Header Display

top_of_page FOR EVENT top_of_page

OF cl_gui_alv_grid

IMPORTING e_dyndoc_id.

PRIVATE SECTION.

ENDCLASS. "lcl_event_receiver DEFINITION

*

  • lcl_event_receiver (Definition)

*===============================================================

****************************************************************

  • LOCAL CLASSES: Implementation

****************************************************************

*===============================================================

  • class lcl_event_receiver (Implementation)

*

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD top_of_page. "implementation

  • Top-of-page event

PERFORM event_top_of_page USING gw_dyndoc_id.

ENDMETHOD. "top_of_page

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

*----


*

  • SELECTION SCREEN DEFINITION *

*----


*

SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS : s_matnr FOR mara-matnr NO INTERVALS,

s_mtart FOR mara-mtart NO INTERVALS.

SELECTION-SCREEN END OF BLOCK b1.

TABLES:sscrfields.

**Create the Additional Selection screen to input filename

SELECTION-SCREEN: BEGIN OF SCREEN 10.

PARAMETERS: p_file TYPE rlgrap-filename.

SELECTION-SCREEN: END OF SCREEN 10.

**Create Application Toolbar Button on the Standard selection Screen

SELECTION-SCREEN FUNCTION KEY 1. "Its fcode will be FC01

PARAMETERS : p_werks TYPE marc-werks.

INITIALIZATION.

sscrfields-functxt_01 = 'Enter File'. "Assign the Text to the Button

AT SELECTION-SCREEN.

CASE sscrfields-ucomm. "Check the Fcode

WHEN 'FC01'.

CALL SELECTION-SCREEN 10 STARTING AT 5 8 ENDING AT 85 20.

ENDCASE.

*----


*

  • START-OF-SELECTION *

*----


*

START-OF-SELECTION.

SELECT matnr

lvorm

mtart

mbrsh

matkl

meins

brgew

ntgew

gewei

FROM mara

INTO TABLE gi_mara

WHERE matnr IN s_matnr

AND mtart IN s_mtart.

IF sy-dbcnt NE 0.

SORT gi_mara BY matnr.

ENDIF.

CALL SCREEN 0001.

*&----

-


*

*& Module STATUS_0001 OUTPUT

*&----

-


*

  • text

*----

-


*

MODULE status_0001 OUTPUT.

SET PF-STATUS '0001'.

SET TITLEBAR '001'.

PERFORM build_alv_display.

ENDMODULE. " STATUS_0001 OUTPUT

*&----

-


*

*& Module USER_COMMAND_0001 INPUT

*&----

-


*

  • text

*----

-


*

MODULE user_command_0001 INPUT.

CASE sy-ucomm.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'SAVE'.

LEAVE TO SCREEN 0.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0001 INPUT

*&----

-


*

*& Form build_alv_display

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM build_alv_display .

PERFORM build_fieldcat.

PERFORM build_layout.

  • PERFORM create_alv_grid.

PERFORM display_alv_grid.

ENDFORM. " build_alv_display

*&----

-


*

*& Form build_fieldcat

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM build_fieldcat .

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'MATNR'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Material Number'.

gs_fieldcat-outputlen = '18'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '1'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'LVORM'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Deletion'.

gs_fieldcat-outputlen = '8'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '2'.

gs_fieldcat-checkbox = 'X'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'MTART'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Material Type'.

gs_fieldcat-outputlen = '13'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '3'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'MBRSH'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Industry sector'.

gs_fieldcat-outputlen = '15'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '4'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'MATKL'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Material group'.

gs_fieldcat-outputlen = '14'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '5'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'MEINS'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Base Unit of Measure'.

gs_fieldcat-outputlen = '20'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '6'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'BRGEW'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Gross weight'.

gs_fieldcat-outputlen = '13'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '7'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'NTGEW'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Net weight'.

gs_fieldcat-outputlen = '13'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '8'.

APPEND gs_fieldcat TO gi_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'GEWEI'.

gs_fieldcat-tabname = 'MARA'.

gs_fieldcat-coltext = 'Weight Unit'.

gs_fieldcat-outputlen = '11'.

gs_fieldcat-edit = ' '.

gs_fieldcat-just = 'C'.

gs_fieldcat-col_pos = '9'.

APPEND gs_fieldcat TO gi_fieldcat.

ENDFORM. " build_fieldcat

*&----

-


*

*& Form build_layout

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM build_layout .

gs_layout-sel_mode = 'A'.

gs_layout-edit = ' '.

gs_layout-no_toolbar = ' '.

gs_layout-grid_title = 'Material Data'.

gs_layout-no_headers = ' '.

gs_layout-weblook = 'X'.

ENDFORM. " build_layout

*&----

-


*

*& Form create_alv_grid

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM create_alv_grid .

IF gw_container IS INITIAL.

CREATE OBJECT gw_container

EXPORTING

container_name = 'CC_ALV'.

  • Display ALV grid

IF gw_alvgrid IS INITIAL.

CREATE OBJECT gw_alvgrid

EXPORTING

i_parent = gw_container.

ENDIF.

ENDIF.

ENDFORM. " create_alv_grid

*&----

-


*

*& Form display_alv_grid

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM display_alv_grid .

IF gw_container IS INITIAL.

CREATE OBJECT gw_container

EXPORTING container_name = 'CC_ALV'.

  • Create Splitter for custom_container

CREATE OBJECT gw_splitter

EXPORTING parent = gw_container

rows = 2

columns = 1.

  • Assigning the html container as parent container to 1st split

CALL METHOD gw_splitter->get_container

EXPORTING

row = 1

column = 1

RECEIVING

container = gw_parent_html.

  • Assigning the grid container as parent container to 2nd split

CALL METHOD gw_splitter->get_container

EXPORTING

row = 2

column = 1

RECEIVING

container = gw_parent_grid.

  • Setting the height of 1st split

CALL METHOD gw_splitter->set_row_height

EXPORTING

id = 1

height = 50.

  • Creating the grid object.

CREATE OBJECT gw_alvgrid

EXPORTING i_parent = gw_parent_grid.

  • Registering the grid events

CALL METHOD gw_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

  • Creating the event receiver for handling the grid eevnts.

CREATE OBJECT gw_event_reciever.

  • Setting the events for event receiver object

SET HANDLER gw_event_reciever->top_of_page FOR gw_alvgrid.

CALL METHOD cl_gui_control=>set_focus

EXPORTING

control = gw_alvgrid.

  • Setting the grid for first display

CALL METHOD gw_alvgrid->set_table_for_first_display

EXPORTING

i_buffer_active = ' '

i_bypassing_buffer = ' '

i_structure_name = 'T_MARA'

is_layout = gs_layout

CHANGING

it_outtab = gi_mara[]

it_fieldcatalog = gi_fieldcat[]

EXCEPTIONS

OTHERS = 0.

  • § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.

CALL METHOD gw_alvgrid->set_toolbar_interactive.

  • Create TOP-Document

CREATE OBJECT gw_dyndoc_id

EXPORTING style = 'ALV_GRID'.

  • ********************** test code********************************

  • Initializing document

CALL METHOD gw_dyndoc_id->initialize_document.

  • Processing events

CALL METHOD gw_alvgrid->list_processing_events

EXPORTING

i_event_name = 'TOP_OF_PAGE'

i_dyndoc_id = gw_dyndoc_id.

                                            • test code********************************

ELSE.

CALL METHOD gw_alvgrid->set_frontend_fieldcatalog

EXPORTING

it_fieldcatalog = gi_fieldcat[].

CALL METHOD gw_alvgrid->refresh_table_display.

ENDIF.

ENDFORM. " display_alv_grid

*&----

-


*

*& Form EVENT_TOP_OF_PAGE

*&----

-


*

  • text

*----

-


*

  • -->P_gw_DYNDOC_ID text

*----

-


*

FORM event_top_of_page USING gw_dyndoc_id TYPE REF TO cl_dd_document.

data: l_graphic_xstr type xstring,

l_graphic_conv type i,

l_graphic_offs type i.

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

EXPORTING

p_object = 'GRAPHICS'

p_name = 'ZX_A380' "IMAGE NAME - Image name from SE78

p_id = 'BMAP'

p_btype = 'BCOL' "(BMON = black&white, BCOL = colour)

RECEIVING

p_bmp = l_graphic_xstr.

graphic_size = XSTRLEN( l_graphic_xstr ).

CHECK graphic_size > 0.

l_graphic_conv = graphic_size.

l_graphic_offs = 0.

WHILE l_graphic_conv > 255.

graphic_table-line = l_graphic_xstr+l_graphic_offs(255).

APPEND graphic_table.

l_graphic_offs = l_graphic_offs + 255.

l_graphic_conv = l_graphic_conv - 255.

ENDWHILE.

graphic_table-line = l_graphic_xstr+l_graphic_offs(L_GRAPHIC_CONV).

APPEND graphic_table.

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

type = 'image' "#EC NOTEXT

subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'

size = graphic_size

lifetime = cndp_lifetime_transaction "'T'

TABLES

data = graphic_table

CHANGING

url = graphic_url

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.

EXIT.

ENDIF.

CREATE OBJECT gw_picture

EXPORTING

parent = gw_parent_html.

call method gw_picture->load_picture_from_url

exporting url = graphic_url

importing result = g_result.

ENDFORM. " EVENT_TOP_OF_PAGE

Hope this will help resolve your issue.

Regards,

Kasinath Babu.

Read only

0 Likes
1,332

hi babu

i have tried like wat you said,but still the prob arises....no output is being displayed...

i have changed your code according to my req like

TABLES : zemployee,zdepartment.

*Decalration for class lcl_event_handler

CLASS lcl_event_receiver DEFINITION DEFERRED.

TYPES : BEGIN OF ty_emp,

empid type zempid,

empname type zempname,

city type zcity,

detid type zdeptid,

END OF ty_emp.

TYPES : BEGIN OF ty_dep,

detid type zdeptid,

deptname type zdeptname,

designation type zdesignation,

END OF ty_dep.

TYPES : BEGIN OF ty_final,

empid type zempid,

empname type zempname,

city type zcity,

detid type zdeptid,

deptname type zdeptname,

designation type zdesignation,

END OF ty_final.

TYPES : tt_emp type STANDARD TABLE OF ty_emp,

tt_dep TYPE STANDARD TABLE OF ty_dep,

tt_final TYPE STANDARD TABLE OF ty_final.

data : wa_emp TYPE ty_emp,

wa_dep TYPE ty_dep,

wa_final TYPE ty_final.

data : itab_emp TYPE tt_emp,

itab_dep TYPE tt_dep,

itab_final TYPE tt_final.

*-- Global data definitions for ALV

*--- ALV Grid instance reference

DATA : gw_alvgrid TYPE REF TO cl_gui_alv_grid.

*--- Custom container instance reference

DATA gw_container TYPE REF TO cl_gui_custom_container.

*--- Field catalog table

DATA : gi_fieldcat TYPE lvc_t_fcat,

gs_fieldcat TYPE lvc_s_fcat.

*--- Layout structure

DATA : gs_layout TYPE lvc_s_layo.

*Declaration for ALV Header

DATA:

  • Reference to document

gw_event_reciever TYPE REF TO lcl_event_receiver,

  • Reference to split container

gw_splitter TYPE REF TO cl_gui_splitter_container,

gw_splitter1 TYPE REF TO cl_gui_splitter_container, "a++

  • Reference to grid container

gw_parent_grid TYPE REF TO cl_gui_container,

gw_dyndoc_id TYPE REF TO cl_dd_document,

gw_parent_html TYPE REF TO cl_gui_container,

gw_picture TYPE REF TO cl_gui_picture.

data: graphic_url(255),

graphic_refresh(1),

g_result type i.

data: begin of graphic_table occurs 0,

line(255) type x,

end of graphic_table.

data: graphic_size type i.

  • LOCAL CLASSES: Definition

****************************************************************

*===============================================================

  • class lcl_event_receiver: local class to

  • define and handle own functions.

*

  • Definition:

  • ~~~~~~~~~~~

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS:

  • For ALV Header Display

top_of_page FOR EVENT top_of_page

OF cl_gui_alv_grid

IMPORTING e_dyndoc_id.

PRIVATE SECTION.

ENDCLASS. "lcl_event_receiver DEFINITION

*

  • lcl_event_receiver (Definition)

*===============================================================

****************************************************************

  • LOCAL CLASSES: Implementation

****************************************************************

*===============================================================

  • class lcl_event_receiver (Implementation)

*

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD top_of_page. "implementation

  • Top-of-page event

PERFORM event_top_of_page USING gw_dyndoc_id.

ENDMETHOD. "top_of_page

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

*----


*

  • SELECTION SCREEN DEFINITION *

*----


*

SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS : s_empid FOR zemployee-empid NO INTERVALS.

SELECTION-SCREEN END OF BLOCK b1.

TABLES:sscrfields.

**Create the Additional Selection screen to input filename

SELECTION-SCREEN: BEGIN OF SCREEN 10.

PARAMETERS: p_file TYPE rlgrap-filename.

SELECTION-SCREEN: END OF SCREEN 10.

**Create Application Toolbar Button on the Standard selection Screen

SELECTION-SCREEN FUNCTION KEY 1. "Its fcode will be FC01

PARAMETERS : p_detid TYPE zemployee-detid.

INITIALIZATION.

sscrfields-functxt_01 = 'Enter File'. "Assign the Text to the Button

AT SELECTION-SCREEN.

CASE sscrfields-ucomm. "Check the Fcode

WHEN 'FC01'.

CALL SELECTION-SCREEN 10 STARTING AT 5 8 ENDING AT 85 20.

ENDCASE.

*----


*

  • START-OF-SELECTION *

*----


*

START-OF-SELECTION.

SELECT empid empname city detid FROM zemployee INTO CORRESPONDING FIELDS OF TABLE itab_emp WHERE empid in s_empid.

if NOT itab_emp is INITIAL.

SELECT detid deptname designation FROM zdepartment INTO CORRESPONDING FIELDS OF TABLE itab_dep for all entries in itab_emp where detid = itab_emp-detid.

endif.

loop at itab_emp into wa_emp.

wa_final-empid = wa_emp-empid.

wa_final-empname = wa_emp-empname.

wa_final-city = wa_emp-city.

wa_final-detid = wa_emp-detid.

APPEND wa_final to itab_final.

clear : wa_final,wa_emp.

ENDLOOP.

loop at itab_final into wa_final.

read TABLE itab_dep INTO wa_dep with key detid = wa_final-detid.

if sy-SUBRC = 0.

wa_final-designation = wa_dep-designation.

wa_final-deptname = wa_dep-deptname.

MODIFY itab_final from wa_final TRANSPORTING designation deptname.

endif.

endloop.

  • IF sy-dbcnt NE 0.

  • SORT gi_emp BY empid.

  • ENDIF.

*

  • CALL SCREEN 0001.

*&----

-


*

*& Module STATUS_0001 OUTPUT

*&----

-


*

  • text

*----

-


*

MODULE status_0001 OUTPUT.

SET PF-STATUS '0001'.

SET TITLEBAR '001'.

PERFORM build_alv_display.

ENDMODULE. " STATUS_0001 OUTPUT

*&----

-


*

*& Module USER_COMMAND_0001 INPUT

*&----

-


*

  • text

*----

-


*

MODULE user_command_0001 INPUT.

CASE sy-ucomm.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'SAVE'.

LEAVE TO SCREEN 0.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0001 INPUT

*&----

-


*

*& Form build_alv_display

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM build_alv_display .

PERFORM build_fieldcat.

PERFORM build_layout.

  • PERFORM create_alv_grid.

PERFORM display_alv_grid.

ENDFORM. " build_alv_display

*&----

-


*

*& Form build_fieldcat

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM build_fieldcat .

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'EMPID'.

gs_fieldcat-seltext = 'Employee Id' .

gs_fieldcat-col_pos = '1'.

gs_fieldcat-emphasize = 'C710'.

APPEND gs_fieldcat to gi_fieldcat.

clear gs_fieldcat.

gs_fieldcat-fieldname = 'EMPNAME'.

gs_fieldcat-seltext = 'Employee Name' .

gs_fieldcat-col_pos = '2'.

gs_fieldcat-emphasize = 'C710'.

APPEND gs_fieldcat to gi_fieldcat.

clear gs_fieldcat.

gs_fieldcat-fieldname = 'CITY'.

gs_fieldcat-seltext = 'City' .

gs_fieldcat-col_pos = '3'.

gs_fieldcat-emphasize = 'C710'.

APPEND gs_fieldcat to gi_fieldcat.

clear gs_fieldcat.

gs_fieldcat-fieldname = 'DETID'.

gs_fieldcat-seltext = 'Department Id' .

gs_fieldcat-col_pos = '4'.

gs_fieldcat-emphasize = 'C710'.

APPEND gs_fieldcat to gi_fieldcat.

clear gs_fieldcat.

gs_fieldcat-fieldname = 'DEPTNAME'.

gs_fieldcat-seltext = 'Department Name' .

gs_fieldcat-col_pos = '5'.

gs_fieldcat-emphasize = 'C710'.

APPEND gs_fieldcat to gi_fieldcat.

clear gs_fieldcat.

gs_fieldcat-fieldname = 'DESIGNATION'.

gs_fieldcat-seltext = 'Designation' .

gs_fieldcat-col_pos = '6'.

gs_fieldcat-emphasize = 'C710'.

APPEND gs_fieldcat to gi_fieldcat.

clear gs_fieldcat.

ENDFORM. " build_fieldcat

*&----

-


*

*& Form build_layout

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM build_layout .

gs_layout-sel_mode = 'A'.

gs_layout-edit = ' '.

gs_layout-no_toolbar = ' '.

gs_layout-grid_title = 'visitors card'.

gs_layout-no_headers = ' '.

gs_layout-weblook = 'X'.

ENDFORM. " build_layout

*&----

-


*

*& Form create_alv_grid

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM create_alv_grid .

IF gw_container IS INITIAL.

CREATE OBJECT gw_container

EXPORTING

container_name = 'CC_ALV'.

  • Display ALV grid

IF gw_alvgrid IS INITIAL.

CREATE OBJECT gw_alvgrid

EXPORTING

i_parent = gw_container.

ENDIF.

ENDIF.

ENDFORM. " create_alv_grid

*&----

-


*

*& Form display_alv_grid

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM display_alv_grid .

IF gw_container IS INITIAL.

CREATE OBJECT gw_container

EXPORTING

container_name = 'CC_ALV'.

  • Create Splitter for custom_container

CREATE OBJECT gw_splitter

EXPORTING

parent = gw_container

rows = 2

columns = 1.

  • Assigning the html container as parent container to 1st split

CALL METHOD gw_splitter->get_container

EXPORTING

row = 1

column = 1

RECEIVING

container = gw_parent_html.

  • Assigning the grid container as parent container to 2nd split

CALL METHOD gw_splitter->get_container

EXPORTING

row = 2

column = 1

RECEIVING

container = gw_parent_grid.

  • Setting the height of 1st split

CALL METHOD gw_splitter->set_row_height

EXPORTING

id = 1

height = 50.

  • Creating the grid object.

CREATE OBJECT gw_alvgrid

EXPORTING

i_parent = gw_parent_grid.

  • Registering the grid events

CALL METHOD gw_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

  • Creating the event receiver for handling the grid eevnts.

CREATE OBJECT gw_event_reciever.

  • Setting the events for event receiver object

SET HANDLER gw_event_reciever->top_of_page FOR gw_alvgrid.

CALL METHOD cl_gui_control=>set_focus

EXPORTING

control = gw_alvgrid.

  • Setting the grid for first display

CALL METHOD gw_alvgrid->set_table_for_first_display

EXPORTING

i_buffer_active = ' '

i_bypassing_buffer = ' '

i_structure_name = 'T_EMP'

is_layout = gs_layout

CHANGING

it_outtab = itab_emp[]

it_fieldcatalog = gi_fieldcat[]

EXCEPTIONS

OTHERS = 0.

  • § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.

CALL METHOD gw_alvgrid->set_toolbar_interactive.

  • Create TOP-Document

CREATE OBJECT gw_dyndoc_id

EXPORTING

style = 'ALV_GRID'.

  • ********************** test code********************************

  • Initializing document

CALL METHOD gw_dyndoc_id->initialize_document.

  • Processing events

CALL METHOD gw_alvgrid->list_processing_events

EXPORTING

i_event_name = 'TOP_OF_PAGE'

i_dyndoc_id = gw_dyndoc_id.

                                            • test code********************************

ELSE.

CALL METHOD gw_alvgrid->set_frontend_fieldcatalog

EXPORTING

it_fieldcatalog = gi_fieldcat[].

CALL METHOD gw_alvgrid->refresh_table_display.

ENDIF.

ENDFORM. " display_alv_grid

*&----

-


*

*& Form EVENT_TOP_OF_PAGE

*&----

-


*

  • text

*----

-


*

  • -->P_gw_DYNDOC_ID text

*----

-


*

FORM event_top_of_page USING gw_dyndoc_id TYPE REF TO cl_dd_document.

data: l_graphic_xstr type xstring,

l_graphic_conv type i,

l_graphic_offs type i.

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

EXPORTING

p_object = 'GRAPHICS'

p_name = 'ZX_A380' "IMAGE NAME - Image name from SE78

p_id = 'BMAP'

p_btype = 'BCOL' "(BMON = black&white, BCOL = colour)

RECEIVING

p_bmp = l_graphic_xstr.

graphic_size = XSTRLEN( l_graphic_xstr ).

CHECK graphic_size > 0.

l_graphic_conv = graphic_size.

l_graphic_offs = 0.

WHILE l_graphic_conv > 255.

graphic_table-line = l_graphic_xstr+l_graphic_offs(255).

APPEND graphic_table.

l_graphic_offs = l_graphic_offs + 255.

l_graphic_conv = l_graphic_conv - 255.

ENDWHILE.

graphic_table-line = l_graphic_xstr+l_graphic_offs(L_GRAPHIC_CONV).

APPEND graphic_table.

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

type = 'image' "#EC NOTEXT

subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'

size = graphic_size

lifetime = cndp_lifetime_transaction "'T'

TABLES

data = graphic_table

CHANGING

url = graphic_url

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.

EXIT.

ENDIF.

CREATE OBJECT gw_picture

EXPORTING

parent = gw_parent_html.

call method gw_picture->load_picture_from_url

EXPORTING

url = graphic_url

IMPORTING

result = g_result.

but still output is not displayed....

plz help me out....

Read only

0 Likes
1,332

Hi Asha,

If possible can u send a screen shot how u want to display the visitor data to my mailid capricimage@gmail.com. so that I can sort some thing from ur code.

Thanks,

Kasinath Babu

Read only

Former Member
0 Likes
1,332

hi

I want the visitors name below the picture displayed using ALV...wat to do...

Read only

0 Likes
1,332

Hi Asha,

If u want to display the visitors name itself below the picture in ALV. Take the internal table with only the name field and display the internal table in the grid below.

for this u have to pass the ALV layout with field NO_HEADERS = 'X' so as to not to display the the header of the grid.

Hope this will help u.