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: 

logo and address

Former Member
0 Kudos
114

hello,

i want to add our logo and address in the standard report of purchase order, please let me know how to do the same and what are steps to followed.

please explain the entire details and steps and oblige.

thanks

suja

5 REPLIES 5

Former Member
0 Kudos
83

Hi

i am sending you a code

in which i had inserted a logo and the address

see this i think you can understand very easyly

if usefull reward me

*&---------------------------------------------------------------------*
*& Report  ZTEST_ALV_LOGO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ztest_alv_logo.

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.                    "user_command
*&---------------------------------------------------------------------*

*&      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.                    "top_of_page
*&---------------------------------------------------------------------*

*&      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'.
  w_fieldcat-edit = 'x'.
* 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

0 Kudos
83

hi sujatha

&----


*& Report ZSAMP_ALV_DISPLAY *

*& *

&----


*& *

*& *

&----


REPORT zsamp_alv_display .

TYPE-POOLS: slis.

TABLES : t001,t005t.

TYPES : BEGIN OF struct1,

bukrs LIKE t001-bukrs,

butxt LIKE t001-butxt,

land LIKE t001-land1,

spras LIKE t001-spras,

periv LIKE t001-periv,

landx LIKE t005t-landx,

numb(3) TYPE n,

END OF struct1.

TYPES: BEGIN OF struct2,

land1 LIKE t005t-land1,

landx1 LIKE t005t-landx,

END OF struct2.

TYPES: tab1 TYPE STANDARD TABLE OF struct1,

tab2 TYPE STANDARD TABLE OF struct2.

DATA: itab1 TYPE tab1,

itab2 TYPE tab2,

itab_temp TYPE tab1,

wa1 TYPE struct1,

wa2 TYPE struct2,

i_fieldcat TYPE slis_t_fieldcat_alv.

SELECT-OPTIONS: s_bukrs FOR t001-bukrs.

START-OF-SELECTION.

PERFORM get_data.

PERFORM enhance_data TABLES itab1.

itab_temp[] = itab1.

SORT itab_temp BY land.

DELETE ADJACENT DUPLICATES FROM itab_temp.

CLEAR itab_temp.

LOOP AT itab1 INTO wa1.

READ TABLE itab2 INTO wa2 WITH KEY land1 = wa2-land1.

IF sy-subrc = 0 .

wa1-land = wa2-land1.

MODIFY itab1 FROM wa1 TRANSPORTING landx WHERE land = wa2-land1.

ENDIF.

ENDLOOP.

  • PERFORM alv_merge.

PERFORM fieldcat TABLES i_fieldcat.

PERFORM alv_display.

&----


*& Form GET_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

SELECT bukrs

butxt

land1

spras

periv FROM t001 INTO CORRESPONDING FIELDS OF TABLE itab1

WHERE bukrs IN s_bukrs.

SELECT land1

landx

FROM t005t INTO CORRESPONDING FIELDS OF TABLE itab2

FOR ALL ENTRIES IN itab1 WHERE land1 = itab1-land.

ENDFORM. " GET_DATA

&----


*& Form ENHANCE_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM enhance_data TABLES p_tab TYPE tab1 .

DATA wa_tab TYPE struct1.

LOOP AT p_tab INTO wa_tab.

wa_tab-numb = sy-tabix.

MODIFY p_tab FROM wa_tab TRANSPORTING numb.

ENDLOOP.

ENDFORM. " ENHANCE_DATA

&----


*& Form ALV_MERGE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alv_merge .

*TABLES P_I_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'I_TAB1'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = sy-repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = i_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 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.

ENDFORM. " ALV_MERGE

&----


*& Form ALV_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alv_display .

DATA : returncode(200) .

DATA: BEGIN OF fields OCCURS 2.

INCLUDE STRUCTURE sval.

DATA: END OF fields.

CLEAR fields.

fields-tabname = 'RLGRAP'.

  • fields-fieldname = 'FILENAME'.

  • fields-value = p_file.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_bypassing_buffer = 'X'

  • filename = filestring

  • write_field_separator = ','

i_grid_title = 'MERGE TABLES'

it_fieldcat = i_fieldcat

i_callback_top_of_page = 'F_HEADER'

i_callback_program = sy-repid

TABLES

t_outtab = itab1

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. " ALV_DISPLAY

&----


*& Form FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fieldcat TABLES p_i_fieldcat TYPE slis_t_fieldcat_alv..

DATA: l_fieldcat TYPE slis_fieldcat_alv.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 1.

l_fieldcat-fieldname = 'NUMB'.

l_fieldcat-seltext_l = 'SR.NO.'.

l_fieldcat-key = 'X'.

l_fieldcat-edit = 'X'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 2.

l_fieldcat-fieldname = 'BUKRS'.

l_fieldcat-ref_tabname = 'T001'.

l_fieldcat-ref_fieldname = 'BUKRS'.

l_fieldcat-edit = 'X'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 3.

l_fieldcat-fieldname = 'BUTXT'.

l_fieldcat-ref_tabname = 'T001'.

l_fieldcat-ref_fieldname = 'BUTXT'.

l_fieldcat-edit = 'X'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 4.

l_fieldcat-fieldname = 'LAND'.

l_fieldcat-ref_tabname = 'T001'.

l_fieldcat-ref_fieldname = 'LAND1'.

l_fieldcat-edit = 'X'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 5.

l_fieldcat-fieldname = 'SPRAS'.

l_fieldcat-ref_tabname = 'T001'.

l_fieldcat-ref_fieldname = 'SPRAS'.

l_fieldcat-edit = 'X'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 6.

l_fieldcat-fieldname = 'PERIV'.

l_fieldcat-ref_tabname = 'T001'.

l_fieldcat-edit = 'X'.

l_fieldcat-ref_fieldname = 'PERIV'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

l_fieldcat-col_pos = 7.

l_fieldcat-fieldname = 'LANDX'.

l_fieldcat-ref_tabname = 'T005T'.

l_fieldcat-ref_fieldname = 'LANDX'.

l_fieldcat-edit = 'X'.

APPEND l_fieldcat TO p_i_fieldcat.

CLEAR l_fieldcat.

ENDFORM. " FIELDCAT

&----


*& Form f_header

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f_header .

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

t_line LIKE wa_header-info,

ld_lines TYPE i,

ld_linesc(10) TYPE c.

  • Title

wa_header-typ = 'A'.

wa_header-info = 'Purchase Requistion Report'.

APPEND wa_header TO t_header.

CLEAR wa_header.

  • Date

wa_header-typ = 'A'.

wa_header-info = 'Date: '.

CONCATENATE sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum(4) INTO wa_header-info."todays date

APPEND wa_header TO t_header.

CLEAR: wa_header.

  • Total No. of Records Selected

DESCRIBE TABLE itab1 LINES ld_lines.

ld_linesc = ld_lines.

CONCATENATE 'Total No. of Records : ' ld_linesc

INTO t_line SEPARATED BY space.

*T_LINE = 'Requisation Report,'.

wa_header-typ = 'A'.

wa_header-info = t_line.

APPEND wa_header TO t_header.

CLEAR: wa_header, t_line.

t_line ='Its my Report:'.

wa_header-typ = 'A'.

wa_header-info = t_line .

APPEND wa_header TO t_header.

CLEAR: wa_header, t_line.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_header

i_logo = 'HCL_LOGO'.

ENDFORM. " f_header

&----


*& Form f_top_list

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f_top_list .

FORMAT COLOR COL_HEADING ON.

WRITE: /10 text-h10, text-h09.

FORMAT COLOR OFF.

WRITE: /10 text-h11, sy-datum.

WRITE: /10 text-h12, sy-pagno.

ENDFORM. " f_top_list

&----


*& Form f_user_command

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f_user_command .

ENDFORM. " f_user_command

regards

kumar.

0 Kudos
83

hello,

thanks for your reply, i want to add our logo and adddress in the standard purchase order, i.e. me23n, please explain the steps .

thanks

suja

0 Kudos
83

hello,

thanks for your reply, i want to add our logo and adddress in the standard purchase order, i.e. me23n, please explain the steps .

thanks

suja

0 Kudos
83

Hi,

If it is Script.

First Copy the Standard Script 'MEDRUCk " To YMEDRUCK " and then do the follwoing changes:

First import the logo to R/3 (thru SE78) .

Cretae a new window for logo.

Then in the Script text editor of LOGO window, Menu--> Insert --> Grapics.

Next cretae a Address window .

Then go Text element of Adresss window, then Add ur address " Mr. XYZ comp, ...US"

Note : After creation of window, adjust the layout of ur script by adjusting window size.

After changes , Go to NACE tcode and assigne YMEDRUCK to the dRIVER program.

Revert back if any issues,

Rewrad with points if helpful.

regards,

Naveen

Message was edited by:

Naveen Deva