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: 

How to upload Logo in ALV reports ?

Former Member
0 Kudos
151

Hello ,

I want to upload logo in ALV reports i am working in ECC6.0 version the codefor which i am getting logo in SAP4.7 is not working In ECC6.0.

The code i am using in ECC6.0..

*ALV TOP-OF-PAGE DECLATRACTION

DATA : W_LISTHEADER TYPE SLIS_LISTHEADER,

T_LISTHEADER TYPE SLIS_T_LISTHEADER.

FORM SUB_TOP_OF_PAGE .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = T_LISTHEADER

I_LOGO = 'LOGO'

.

ENDFORM. " SUB_TOP_OF_PAGE

This LOGO i have uploaded from OAER Txcode.

Or suggest me how to achieve Logo in ALV reports.

Thks

5 REPLIES 5

Former Member
0 Kudos
71

Hi,

Pl ch the link which is useful...

http://wiki.ittoolbox.com/index.php/Logo_in_alv_report

Regards.

GauthamV
Active Contributor
0 Kudos
71

hi,

check this sample code.u can do using classes .

generally u get logo on right side but using classes u

can get logo on left side of ur screen also.

Report ZGM_LOGO_ON_LEFT.

TABLES VBAK.

TYPE-POOLS SLIS.

*Data Declaration

TYPES: BEGIN OF T_VBAK,

VBELN TYPE VBAK-VBELN,

ERDAT TYPE VBAK-ERDAT,

ERNAM TYPE VBAK-ERNAM,

AUDAT TYPE VBAK-AUDAT,

VBTYP TYPE VBAK-VBTYP,

NETWR TYPE VBAK-NETWR,

VKORG TYPE VBAK-VKORG,

VKGRP TYPE VBAK-VKGRP,

RN TYPE I,

END OF T_VBAK.

DATA IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0 WITH HEADER LINE.

*ALV Data Declaration

DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV,

W_FLDCAT TYPE SLIS_FIELDCAT_ALV,

GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

GD_REPID TYPE SY-REPID.

selection-screen :begin of block b1.

SELECT-OPTIONS: VBELN FOR VBAK-VBELN.

selection-screen :end of block b1.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

END-OF-SELECTION.

PERFORM BLD_FLDCAT.

PERFORM BLD_LAYOUT.

PERFORM DISPLAY_ALV_REPORT.

*Build Field Catalog for ALV Report

FORM BLD_FLDCAT.

W_FLDCAT-FIELDNAME = 'VBELN'.

W_FLDCAT-SELTEXT_M = 'Sales_Document'.

W_FLDCAT-COL_POS = 1.

*W_FLDCAT-EMPHASIZE = 'C411'.

*CXYZ: C=COLOR,X=COLOR NUMBER(1-9),Y=BOLD(0/1),Z=INVERSE(0/1)

W_FLDCAT-OUTPUTLEN = 15.

W_FLDCAT-KEY = 'X'.

W_FLDCAT-ICON = 'X'.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'ERDAT'.

W_FLDCAT-SELTEXT_L = 'Record_Date_created'.

W_FLDCAT-COL_POS = 2.

W_FLDCAT-KEY = 'X'.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'ERNAM'.

W_FLDCAT-SELTEXT_L = 'Cteated_Person_Name'.

W_FLDCAT-COL_POS = 3.

W_FLDCAT-EMPHASIZE = 'C011'.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'AUDAT'.

W_FLDCAT-SELTEXT_M = 'Document_Date'.

W_FLDCAT-COL_POS = 4.

W_FLDCAT-EMPHASIZE = 'C110'.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'VBTYP'.

W_FLDCAT-SELTEXT_L = 'SDDocument_category'.

W_FLDCAT-COL_POS = 5.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'NETWR'.

W_FLDCAT-SELTEXT_L = 'Net_Value'.

W_FLDCAT-COL_POS = 6.

W_FLDCAT-OUTPUTLEN = 10.

W_FLDCAT-DO_SUM = 'X'.

W_FLDCAT-DATATYPE = 'CURR'.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'VKORG'.

W_FLDCAT-SELTEXT_L = 'Sales_Organization'.

W_FLDCAT-COL_POS = 7.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'VKGRP'.

W_FLDCAT-SELTEXT_M = 'Sales_Group'.

W_FLDCAT-COL_POS = 8.

W_FLDCAT-EMPHASIZE = 'C801'.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

W_FLDCAT-FIELDNAME = 'RN'.

W_FLDCAT-SELTEXT_S = 'RN'.

W_FLDCAT-COL_POS = 0.

APPEND W_FLDCAT TO FLDCAT.

CLEAR W_FLDCAT.

ENDFORM.

*Build Layout for ALV Grid Report

FORM BLD_LAYOUT.

*****************GD_LAYOUT-NO_INPUT = 'X'.

*GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

*GD_LAYOUT-NO_SCROLLING = 'X'.

*GD_LAYOUT-BOX_FIELDNAME = 'VBELN'.

ENDFORM.

*Display report using ALV grid

FORM DISPLAY_ALV_REPORT.

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = GD_REPID

IS_LAYOUT = GD_LAYOUT

I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP_OF_PAGE_SPLIT'

IT_FIELDCAT = FLDCAT[]

I_SAVE = 'X'

TABLES

T_OUTTAB = IT_VBAK

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.

*Retrieve data from VBAK table and populate itab IT_VBAK

FORM DATA_RETRIEVAL.

SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG

FROM VBAK

INTO TABLE IT_VBAK

WHERE VBELN IN VBELN.

LOOP AT IT_VBAK.

IT_VBAK-RN = SY-TABIX.

MODIFY IT_VBAK INDEX SY-TABIX.

ENDLOOP.

ENDFORM.

FORM TOP_OF_PAGE_SPLIT USING R_TOP TYPE REF TO CL_DD_DOCUMENT.

DATA: S_TAB TYPE SDYDO_TEXT_TABLE,

C_AREA TYPE REF TO CL_DD_AREA,

TEXT TYPE SDYDO_TEXT_ELEMENT.

TYPES: BEGIN OF TAB_TEXT,

TEXT TYPE SDYDO_TEXT_ELEMENT,

END OF TAB_TEXT.

DATA: I_TEXT TYPE TABLE OF TAB_TEXT.

DATA: W_TEXT TYPE TAB_TEXT.

CALL METHOD R_TOP->INITIALIZE_DOCUMENT.

CALL METHOD R_TOP->VERTICAL_SPLIT

EXPORTING

SPLIT_AREA = R_TOP

SPLIT_WIDTH = '70%'

IMPORTING

RIGHT_AREA = C_AREA.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

W_TEXT-TEXT = 'ABAP CONSULTANT'.

APPEND W_TEXT TO I_TEXT.

W_TEXT-TEXT = 'SAP SUPPORT TEAM'.

APPEND W_TEXT TO I_TEXT.

W_TEXT-TEXT = 'MUMBAI'.

APPEND W_TEXT TO I_TEXT.

W_TEXT-TEXT = 'INDIA'.

APPEND W_TEXT TO I_TEXT.

S_TAB = I_TEXT.

CALL METHOD C_AREA->ADD_TEXT

EXPORTING

TEXT_TABLE = S_TAB

FIX_LINES = 'X'

SAP_FONTSIZE = CL_DD_DOCUMENT=>MEDIUM

SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG.

CALL METHOD R_TOP->NEW_LINE.

CALL METHOD R_TOP->ADD_PICTURE

EXPORTING

picture_id = 'ENJOYSAP_LOGO'.

ENDFORM.

former_member156446
Active Contributor
0 Kudos
71

check this [link|http://www.saptechnical.com/Tutorials/ALV/LogoInALV.htm]

Former Member
0 Kudos
71

U need to upload the logo in ECC6.0 server using SMW0..... then use the code...

if it is already there then use SMW0 tx and check it.....

Former Member
0 Kudos
71

Hai,

If logo is already present in sap you can directly execute the following code duely changfing logo to your logo name.

If logo is not present in SAP if you want to upload from desktop or so use the T-code OAER.

There you give the class name picture and class type ot and object key any name (name of logo). Then execute . Then expand standard document type. Double click attachment.Choose logo path and press enter. Then logo will be uploaded into sap.

Then you can use this code.

REPORT ZALV5 .

type-pools slis.

data: fcat type slis_t_fieldcat_alv,

wa_fcat type slis_fieldcat_alv.

data: event type slis_t_event,

wa_event type slis_alv_event.

tables mara.

select-options s_matnr for mara-matnr matchcode object zsh1.

TYPES: BEGIN OF TY_MARA,

MATNR TYPE MARA-MATNR,

MBRSH TYPE MARA-MBRSH,

MTART TYPE MARA-MTART,

NTGEW TYPE MARA-NTGEW,

END OF TY_MARA.

DATA: IMARA TYPE STANDARD TABLE OF TY_MARA,

WA_MARA TYPE TY_MARA.

SELECT MATNR

MBRSH

MTART

NTGEW FROM MARA INTO TABLE IMARA

WHERE MATNR IN S_MATNR.

DEFINE MAC1.

WA_FCAT-SELTEXT_L = &1.

WA_FCAT-TABNAME = &2.

WA_FCAT-FIELDNAME = &3.

WA_FCAT-COL_POS = &4.

APPEND WA_FCAT TO FCAT.

CLEAR WA_FCAT.

END-OF-DEFINITION.

MAC1 'MATERIAL NUMBER' 'IMARA' 'MATNR' '1' .

MAC1 'INDUSTRY SECTOR' 'IMARA' 'MBRSH' '2' .

MAC1 'MATERIAL TYPE' 'IMARA' 'MTART' '3' .

MAC1 'MATERIAL TYPE' 'IMARA' 'NTGEW' '4' .

wa_event-name = 'TOP_OF_PAGE'.

WA_EVENT-FORM = 'TOP'.

APPEND WA_EVENT TO EVENT.

CLEAR WA_EVENT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • 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 = FCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = EVENT[]

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = IMARA

  • 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.

FORM TOP.

DATA: LIST TYPE SLIS_T_LISTHEADER,

WA_LIST TYPE SLIS_LISTHEADER.

WA_LIST-TYP = 'S'.

WA_LIST-INFO = 'DATA FROM MARA'.

WA_LIST-KEY = 'ALV REPORT'.

APPEND WA_LIST TO LIST.

CLEAR WA_LIST.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = LIST[]

I_LOGO = 'YLOGO'

  • I_END_OF_LIST_GRID =

.

ENDFORM.