Application Development 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: 

I need to print logo in alv grid

Former Member
0 Kudos

I need to print logo in alv grid .As of now its getting displayed but it cannot be printed .Kindly tell me wether there is any option to print it .Eitjer using ALV or Object oriented ALV.Please reply soon

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hii Deepthi,

<b>IN ALV grid, Logo and BOLD letters are only for display</b>, when try to print the list, system is making ALV List of that. <b>And in ALV List we can not print BOLD fonts or LOGO.</b>

IT CAN'T PRINT A LOGO.

<b>You can print a LOGO only in a sapscript and smartform, not in a ABAP LIST.</b>

The ALV Grid print an abap list.

for the process look at this :

Use transaction code <b>OAER</b> to upload your company logo.

For class name, enter in <b>PICTURES</b>

For class type, enter in <b>OT</b>

For object key, enter in name for the object, for instances <b>Z_YOUR_COMPANY_LOGO</b>(obviously using your company name).

Click execute.

On the next screen, expand the standard doc types tree and double click on the Screen item.

Pick your company logo file from your local drive and upload.

Now use what every name you gave the logo when calling the function module.

call function <b>'REUSE_ALV_COMMENTARY_WRITE'</b>

exporting

i_logo = <b>'Z_YOUR_COMPANY_LOGO'</b>

it_list_commentary = <b>GT_LIST_TOP_OF_PAGE</b>.

Thanks&Regards

Naresh

11 REPLIES 11

Former Member
0 Kudos

Hii Deepthi,

<b>IN ALV grid, Logo and BOLD letters are only for display</b>, when try to print the list, system is making ALV List of that. <b>And in ALV List we can not print BOLD fonts or LOGO.</b>

IT CAN'T PRINT A LOGO.

<b>You can print a LOGO only in a sapscript and smartform, not in a ABAP LIST.</b>

The ALV Grid print an abap list.

for the process look at this :

Use transaction code <b>OAER</b> to upload your company logo.

For class name, enter in <b>PICTURES</b>

For class type, enter in <b>OT</b>

For object key, enter in name for the object, for instances <b>Z_YOUR_COMPANY_LOGO</b>(obviously using your company name).

Click execute.

On the next screen, expand the standard doc types tree and double click on the Screen item.

Pick your company logo file from your local drive and upload.

Now use what every name you gave the logo when calling the function module.

call function <b>'REUSE_ALV_COMMENTARY_WRITE'</b>

exporting

i_logo = <b>'Z_YOUR_COMPANY_LOGO'</b>

it_list_commentary = <b>GT_LIST_TOP_OF_PAGE</b>.

Thanks&Regards

Naresh

former_member181962
Active Contributor
0 Kudos

What do you get when you press the print preview button?

Regards,

Ravi

0 Kudos

If you are using Function modules to display (You can also use Class), you will have to use GRID display for displaying the logo. Its not possible in List display.

Use the Function module REUSE_ALV_GRID_DISPLAY and pass the parameter "I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE' ". This TOP_OF_PAGE is the subroutine (FORM - ENDFORM) in which the actual top of page code will be written (for showing the logo).

The picture must be uploaded into transaction OAOR with classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions.

FORM TOP_OF_PAGE.

DATA: WA_HEADER TYPE SLIS_LISTHEADER. REFRESH: GT_LIST_TOP_OF_PAGE.

H = HEADER LARGE FONT, S = STANDARD FONT, A = ITALICS

WA_HEADER-TYP = 'H'. WA_HEADER-INFO = 'TEST REPORT'. APPEND WA_HEADER TO GT_LIST_TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING I_LOGO = 'LOGO' IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.

ENDFORM. " TOP_OF_PAGE

Former Member
0 Kudos

Hi deepthi,

we can't print a logo in ALV grid.While printing it can be automatically convert into list and print will come in list display.

plz reward points if it is helpful.

Thanks,

suma.

rahulkavuri
Active Contributor
0 Kudos

This is the code

FORM TOP.

IF LIST = 'X'.

WRITE:/ SY-ULINE.

WRITE:/ 'DATE:', SY-DATUM,55 'ISA'.

WRITE:/ 'TIME:', SY-UZEIT.

WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.

WRITE:/ 'PAGE', SY-PAGNO.

WRITE:/ SY-ULINE.

ENDIF.

IF GRID = 'X'.

DATA: LS_LINE TYPE SLIS_LISTHEADER,

E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

  • Listenüberschrift: Typ H

CLEAR LS_LINE.

LS_LINE-TYP = 'H'.

  • LS_LINE-KEY: not used for this type

LS_LINE-INFO = 'Summary'.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

  • Kopfinfo: Typ S

CLEAR LS_LINE.

LS_LINE-TYP = 'S'.

LS_LINE-KEY = 'IGA'.

LS_LINE-INFO = ''.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'ASIA'.

LS_LINE-INFO = 'PVT LTD'.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

  • Aktionsinfo: Typ A

CLEAR LS_LINE.

LS_LINE-TYP = 'A'.

  • LS_LINE-KEY: not used for this type

LS_LINE-INFO = 'truman'.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE

I_LOGO = 'ENJOY_SAP_LOGO'.

ENDIF.

ENDFORM. "TOP</b>

0 Kudos

Hi all,

I want to populate LIPS-CHARG as 'XXXXXXXX' (some text) in an outbound delivery created for a sales order. I am using the 'BAPI_DELIVERYPROCESSING_EXEC' to achieve this.

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'

TABLES

request = i_request

createditems = i_createditems

return = return.

Everything expect this field BATCH is getting populated properly. The batch field for the main item is grayed out in the delivery. But all the sub items have this field enabled and manually I am able to enter a value to batch.

Can any one please help me solve this issue? The batch field gets properly populated when I use the same BAPI to create an inbound delivery for a purchase order.

Thanks in advance

Deepthi

Former Member
0 Kudos

HI

GOOD

Fullscreen ALV uses DD class (CL_DD_DOCUMENT) for its header. The OO version has an event "TOP-OF-PAGE" which takes a DD reference as parameter. So, you can prepare a DD object and pass it to the ALV grid.

In fact, I've never required and thus tried the solution above.

A second alternative may be to use a splitter container and directly implementing DD object at the above region and the ALV grid at the below.

Another solution is to put a picture container as mentioned before.

-


THANKS

MRUTYUN

0 Kudos

MRUTYUN , Thanks for your reply can you give me a more elaborate answer so that i can fix my issue .I havent used object oriented concepts.So your help will be greatly appreciated.

Thanks for others help also..

0 Kudos

Hi Deepthi,

i think printing logo is not possible using ALV.

Regards

vijay

former_member927251
Active Contributor
0 Kudos

Hi Deepti,

Refer the code below.

report sy-repid.

type-pools : slis.

*ALV Formatting tables /structures

data: gt_fieldcat type slis_t_fieldcat_alv.

data: gt_events type slis_t_event.

data: gs_layout type slis_layout_alv.

data: gt_page type slis_t_listheader.

data: gs_page type slis_listheader.

data: v_repid like sy-repid.

*ALV Formatting work area

data: w_fieldcat type slis_fieldcat_alv.

data: w_events type slis_alv_event.

data: gt_bsid type table of bsid with header line.

initialization.

perform build_events.

perform build_page_header.

start-of-selection.

*perform build_comment. "top_of_page - in initialization at present

select * from bsid into table gt_bsid up to 10 rows.

*perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.

*USING = Row, Column, Field name, display length, table name, heading

*OR

perform build_fieldcat.

gs_layout-zebra = 'X'.

*top of page event does not work without I_callback_program

v_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = v_repid

i_structure_name = 'BSID'

  • i_background_id = 'ALV_BACKGROUND'

i_grid_title = 'This is the grid title'

  • I_GRID_SETTINGS =

is_layout = gs_layout

it_fieldcat = gt_fieldcat[]

it_events = gt_events[]

tables

t_outtab = gt_bsid.

  • Form..............: populate_for_fm

  • Description.......: Populates fields for function module used in ALV

form populate_for_fm using p_row

p_col

p_fieldname

p_len

p_table

p_desc.

w_fieldcat-row_pos = p_row. "Row Position

w_fieldcat-col_pos = p_col. "Column Position

w_fieldcat-fieldname = p_fieldname. "Field name

w_fieldcat-outputlen = p_len. "Column Lenth

w_fieldcat-tabname = p_table. "Table name

w_fieldcat-reptext_ddic = p_desc. "Field Description

w_fieldcat-input = '1'.

append w_fieldcat to gt_fieldcat.

clear w_fieldcat.

endform. " populate_for_fm

&----


*& Form build_events

&----


form build_events.

data: ls_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = gt_events.

read table gt_events with key name = slis_ev_user_command

into ls_event.

if sy-subrc = 0.

move slis_ev_user_command to ls_event-form.

append ls_event to gt_events.

endif.

read table gt_events with key name = slis_ev_top_of_page

into ls_event.

if sy-subrc = 0.

move slis_ev_top_of_page to ls_event-form.

append ls_event to gt_events.

endif.

endform. " build_events

&----


*& Form USER_COMMAND

&----


  • When user command is called it uses 2 parameters. The itab

  • passed to the ALV is in whatever order it currently is on screen.

  • Therefore, you can read table itab index rs_selfield-tabindex to get

  • all data from the table. You can also check r_ucomm and code

  • accordingly.

&----


form user_command using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

read table gt_bsid index rs_selfield-tabindex.

  • error checking etc.

set parameter id 'KUN' field gt_bsid-kunnr.

call transaction 'XD03' and skip first screen.

endform.

&----


*& Form top_of_page

&----


  • Your own company logo can go here if it has been saved (OAOR)

  • If the logo is larger than the size of the headings in gt_page,

  • the window will not show full logo and will have a scroll bar. Thus,

  • it is a good idea to have a standard ALV header if you are going to

  • use logos in your top of page.

&----


form top_of_page.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = gt_page

i_logo = 'ENJOYSAP_LOGO'.

endform.

&----


*& Form build_fieldcat

&----


*Many and varied fields are available here. Have a look at documentation

*for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE

----


form build_fieldcat.

w_fieldcat-fieldname = 'BUDAT'.

w_fieldcat-seltext_m = 'Dte pst'.

w_fieldcat-ddictxt(1) = 'M'.

  • Can change the position of fields if you do not want them in order

  • of the DDIC or itab

  • w_fieldcat-row_pos = '1'.

  • w_fieldcat-col_pos = '10'.

append w_fieldcat to gt_fieldcat.

clear w_fieldcat.

endform. " build_fieldcat

&----


*& Form build_page_header

&----


  • gt_page is used in top of page (ALV subroutine - NOT event)

  • *H = Header, S = Selection, A = Action

----


form build_page_header.

  • For Headers, Key is not printed and is irrelevant. Will not cause

  • a syntax error, but is not used.

gs_page-typ = 'H'.

gs_page-info = 'Header 1'.

append gs_page to gt_page.

gs_page-typ = 'H'.

gs_page-info = 'Header 2'.

append gs_page to gt_page.

  • For Selections, the Key is printed (bold). It can be anything up to 20

  • bytes. It gets printed in order of code here, not by key value.

gs_page-typ = 'S'.

gs_page-key = 'And the winner is:'.

gs_page-info = 'Selection 1'.

append gs_page to gt_page.

gs_page-typ = 'S'.

gs_page-key = 'Runner up:'.

gs_page-info = 'Selection 2'.

append gs_page to gt_page.

  • For Action, Key is also irrelevant.

gs_page-typ = 'A'.

gs_page-info = 'Action goes here'.

append gs_page to gt_page.

endform. " build_page_header

Settings for the Logo :

01) GOTO - OAOR (Business Document Navigator)

02) Give Class Name - PICTURES

Class Type - OT

Object type - whatever you want to call your area EG: OURCOMP.... then Execute

03) Top left will say PICTURES. Bottom left will have multi tab. Select Create and double-click on Screen.

04) Select your image from the appropriate directory.

05) Give the image an appropriate name (not Screen)

06) It will tell you document stored successfully.

07) You can now find your logo under the heading OURCOMP in top left window.

08) You can reference the logo in things like FM REUSE_ALV_COMMENTARY_WRITE or any other area which may reference these things. EG: I_LOGO = 'OURCOMP'. You can preview image by double-clicking it.

<b>Please reward points if it helps.</b>

Regards,

Amit Mishra

Message was edited by: Amit Mishra