Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

report zmat_char.

type-pools : slis.

tables : mara.

types : begin of ty_mara,

matnr type mara-matnr,

end of ty_mara.

types : begin of ty_makt,

matnr type mara-matnr,

maktx type makt-maktx,

end of ty_makt.

types : begin of ty_marc,

matnr type mara-matnr,

werks type marc-werks,

end of ty_marc.

types : begin of ty_final,

matnr type mara-matnr,

maktx type makt-maktx,

class type klah-class,

desc1 type char100,

value1 type atwrt,

desc2 type char100,

value2 type atwrt,

desc3 type char100,

value3 type atwrt,

desc4 type char100,

value4 type atwrt,

desc5 type char100,

value5 type atwrt,

desc6 type char100,

value6 type atwrt,

desc7 type char100,

value7 type atwrt,

desc8 type char100,

value8 type atwrt,

desc9 type char100,

value9 type atwrt,

desc10 type char100,

value10 type atwrt,

desc11 type char100,

value11 type atwrt,

desc12 type char100,

value12 type atwrt,

desc13 type char100,

value13 type atwrt,

desc14 type char100,

value14 type atwrt,

desc15 type char100,

value15 type atwrt,

desc16 type char100,

value16 type atwrt,

desc17 type char100,

value17 type atwrt,

desc18 type char100,

value18 type atwrt,

desc19 type char100,

value19 type atwrt,

desc20 type char100,

value20 type atwrt,

desc21 type char100,

value21 type atwrt,

desc22 type char100,

value22 type atwrt,

desc23 type char100,

value23 type atwrt,

desc24 type char100,

value24 type atwrt,

desc25 type char100,

value25 type atwrt,

desc26 type char100,

value26 type atwrt,

desc27 type char100,

value27 type atwrt,

desc28 type char100,

value28 type atwrt,

desc29 type char100,

value29 type atwrt,

desc30 type char100,

value30 type atwrt,

desc131 type char100,

value31 type atwrt,

desc32 type char100,

value32 type atwrt,

desc33 type char100,

value33 type atwrt,

desc34 type char100,

value34 type atwrt,

desc35 type char100,

value35 type atwrt,

desc36 type char100,

value36 type atwrt,

desc37 type char100,

value37 type atwrt,

desc38 type char100,

value38 type atwrt,

desc39 type char100,

value39 type atwrt,

desc40 type char100,

value40 type atwrt,

end of ty_final.

types:begin of ty_ausp,

objek type objnum,

atinn type atinn,

atwrt type atwrt,

name type char100,

end of ty_ausp.

types : begin of ty_mara1,

matnr type char50,

end of ty_mara1.

types : begin of ty_klah,

clint type klah-clint,

class type klah-class,

end of ty_klah.

data: it_mara type table of ty_mara with header line,

it_marc type table of ty_marc with header line,

it_makt type table of ty_makt with header line,

it_ausp type table of ty_ausp with header line,

it_final type table of ty_final with header line,

it_kssk type table of kssk with header line,

it_mara1 type table of ty_mara1 with header line,

it_klah type table of ty_klah with header line.

data : it_fieldcat type slis_t_fieldcat_alv,

wa_fieldcat like line of it_fieldcat,

it_layout type slis_layout_alv,

it_list type slis_t_listheader with header line.

data : v_atinn type atinn,

v_out type char100,

v_count type char2,

v_flag1 ,

v_flag2 ,

v_flag3 ,

v_flag4,

v_flag5,

v_flag6 ,

v_flag7 ,

v_flag8 ,

v_flag9 ,

v_flag10 ,

v_flag11 ,

v_flag12 ,

v_flag13 ,

v_flag14 ,

v_flag15 ,

v_flag16 ,

v_flag17 ,

v_flag18 ,

v_flag19 ,

v_flag20 ,

v_name type string.

field-symbols : <fs>.

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

select-options : s_matnr for mara-matnr,

s_mtart for mara-mtart no intervals no-extension obligatory default 'ERSA'.

parameters : p_werks type marc-werks.

selection-screen end of block b1 .

selection-screen begin of block b2 with frame title text-002.

selection-screen end of block b2 .

start-of-selection.

select matnr

from mara

into table it_mara

where matnr in s_matnr

and mtart in s_mtart.

if sy-subrc = 0.

select matnr

maktx

from makt

into table it_makt

for all entries in it_mara

where matnr = it_mara-matnr.

if p_werks is not initial.

select matnr

werks

from marc

into table it_marc

for all entries in it_mara

where matnr = it_mara-matnr

and werks = p_werks .

endif.

loop at it_mara.

if p_werks is not initial.

read table it_marc with key matnr = it_mara-matnr.

check sy-subrc = 0.

endif.

it_mara1-matnr = it_mara-matnr.

append it_mara1.

clear it_mara1.

endloop.

select *

from kssk

into table it_kssk

for all entries in it_mara1

where objek = it_mara1-matnr and

klart = '001'.

if it_kssk[] is initial.

select clint

class

from klah

into table it_klah

for all entries in it_kssk

where clint = it_kssk-clint.

endif.

*---fill classification table

select objek

atinn

atwrt

from ausp

into table it_ausp

for all entries in it_mara1

where objek = it_mara1-matnr

and klart = '001'.

endif.

end-of-selection.

loop at it_mara.

it_final-matnr = it_mara-matnr.

if p_werks is not initial.

read table it_marc with key matnr = it_mara-matnr.

check sy-subrc = 0.

endif.

read table it_makt with key matnr = it_mara-matnr.

if sy-subrc = 0.

it_final-maktx = it_makt-maktx.

endif.

read table it_mara1 with key matnr = it_mara-matnr.

if sy-subrc ne 0.

clear it_mara1.

endif.

read table it_kssk with key objek = it_mara1-matnr.

if sy-subrc ne 0.

clear it_kssk.

endif.

read table it_klah with key clint = it_kssk-clint.

if sy-subrc ne 0.

clear it_klah.

endif.

loop at it_ausp where objek = it_mara1-matnr.

v_count = v_count + 1.

v_atinn = it_ausp-atinn.

call function 'CONVERSION_EXIT_ATINN_OUTPUT'

exporting

input = v_atinn

importing

output = v_out.

condense v_count.

concatenate 'IT_FINAL-DESC' v_count into v_name.

assign (v_name) to <fs>.

<fs> = v_out.

concatenate 'IT_FINAL-VALUE' v_count into v_name.

assign (v_name) to <fs>.

<fs> = it_ausp-atwrt.

clear : it_ausp,

v_atinn,

v_out.

concatenate 'V_FLAG' v_count into v_name.

assign (v_name) to <fs>.

<fs> = 'X'.

endloop.

call function 'CONVERSION_EXIT_MATN1_OUTPUT'

exporting

input = it_final-matnr

importing

output = it_final-matnr.

append it_final.

clear : it_final,

it_kssk,

it_klah,

v_count.

endloop.

wa_fieldcat-fieldname = 'MATNR'.

wa_fieldcat-reptext_ddic = 'Material'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'MAKTX'.

wa_fieldcat-reptext_ddic = 'Material Desc'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

clear : v_count.

do 40 times.

v_count = v_count + 1.

condense v_count.

concatenate 'V_FLAG' v_count into v_name.

assign (v_name) to <fs>.

if <fs> = 'X'.

wa_fieldcat-no_out = ''.

else.

wa_fieldcat-no_out = 'X'.

endif.

concatenate 'DESC' v_count into v_name.

wa_fieldcat-fieldname = v_name.

wa_fieldcat-reptext_ddic = 'Charistics'.

wa_fieldcat-emphasize = 'C700'.

append wa_fieldcat to it_fieldcat.

concatenate 'VALUE' v_count into v_name.

wa_fieldcat-fieldname = v_name.

wa_fieldcat-reptext_ddic = 'Value'.

wa_fieldcat-emphasize = 'C300'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

enddo.

it_layout-colwidth_optimize = 'X'.

it_layout-zebra = 'X'.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = it_layout

it_fieldcat = it_fieldcat

tables

t_outtab = it_final.

*&--------------------------------------------------------------------*

* get the top-of-page and display

*---------------------------------------------------------------------*

form top_of_page.

*--Display the header of the report

perform header.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = it_list[].

endform. "top_of_page

*&---------------------------------------------------------------------*

*& Form HEADER

*&---------------------------------------------------------------------*

* Get the header of the alv

*----------------------------------------------------------------------*

form header .

*----variables for output header of the alv

data : date_s(10) type c,

date_e(10) type c,

company_name(50) type c value 'XXXXXXXXXXXXXXX',

head_line(60) type c,

today(10) type c,

curr_time(10) type c,

page_no(5) type c,

len type i,

wa_num1 type i,

wa_num2 type i,

pos type i,

linex type i,

v_stext(40) type c,

v_f4flag type c.

write sy-datum mm/dd/yyyy to today.

write sy-uzeit to curr_time.

write sy-pagno to page_no left-justified.

refresh it_list.

clear it_list.

it_list-typ = 'S'.

it_list-key = 'Plant'.

if p_werks is initial.

concatenate 'All Plants' ''

into it_list-info separated by space.

else.

concatenate p_werks ''

into it_list-info separated by space.

endif.

append it_list to it_list.

it_list-typ = 'S'.

it_list-key = 'Material Type'.

concatenate s_mtart-low ''

into it_list-info separated by space.

append it_list to it_list.

*---- REPORT PROGRAM NAME AND CLINT

it_list-typ = 'S'.

it_list-key = 'Report'.

concatenate sy-repid '(' sy-sysid(3) sy-mandt ')'

into it_list-info separated by space.

append it_list to it_list.

*---- USER NAME

clear it_list.

it_list-typ = 'S'.

it_list-key = 'User'.

concatenate '' sy-uname

into it_list-info separated by space.

append it_list to it_list.

*------DATE / TIME STAMP

clear it_list.

it_list-typ = 'S'.

it_list-key = 'Date/Time'.

concatenate '' today curr_time

into it_list-info separated by space.

append it_list to it_list.

*------PAGE NUMBER

clear it_list.

it_list-typ = 'S'.

it_list-key = 'Page'.

concatenate '' page_no

into it_list-info separated by space.

append it_list to it_list.

clear it_list.

it_list-typ = 'S'.

it_list-key = space.

concatenate ' ' ' '

into it_list-info separated by space.

append it_list to it_list.

*------COMPANY NAME

* determine the starting position to center the company name

len = strlen( company_name ).

wa_num1 = 60 - len.

pos = wa_num1 / 2.

if pos lt 1.

pos = 1.

endif.

len = 60 - pos.

clear it_list.

it_list-typ = 'H'.

it_list-key = space.

it_list-info+pos(len) = company_name.

append it_list to it_list.

*-------REPORT TITLE

data: v_string type char100.

v_string = 'Material Characterisitic Values Display'.

* determine the starting position to center the report title

len = strlen( v_string ).

wa_num1 = 60 - len.

pos = wa_num1 / 2.

if pos lt 1.

pos = 1.

endif.

len = 60 - pos.

clear it_list.

it_list-typ = 'H'.

it_list-key = space.

it_list-info+pos(len) = v_string.

append it_list to it_list.

* determine the starting position to center the report title

len = strlen( sy-title ).

wa_num1 = 60 - len.

pos = wa_num1 / 2.

if pos lt 1.

pos = 1.

endif.

len = 60 - pos.

len = strlen( head_line ).

wa_num1 = 60 - len.

pos = wa_num1 / 2.

if pos lt 1.

pos = 1.

endif.

len = 60 - pos.

clear it_list.

it_list-typ = 'H'.

it_list-info+pos(len) = head_line.

append it_list.

clear it_list.

endform. " HEADER

  • No labels