Skip to Content
author's profile photo Former Member
Former Member

screen dump in the alv report

hello everybody iam getting screen dump when executing the following alv report can you please rectify my error.

REPORT Zmaterial message-id zinfo

----


*DATA DECLARATION

----


type-pools: slis.

tables: mara.

types: begin of ty_mara,

matnr type matnr,

ernam type ernam,

mtart type mtart,

mbrsh type mbrsh,

matkl type matkl,

meins type meins,

end of ty_mara,

begin of ty_mbew,

matnr type matnr,

bwkey type bwkey,

bwtar type bwtar_d,

lbkum type lbkum,

salk3 type salk3,

end of ty_mbew,

begin of ty_mard,

matnr type matnr,

werks type werks_d,

lgort type lgort_d,

umlme type umlmd,

end of ty_mard,

begin of ty_final,

matnr type matnr,

ernam type ernam,

mtart type mtart,

mbrsh type mbrsh,

matkl type matkl,

meins type meins,

bwkey type bwkey,

bwtar type bwtar_d,

lbkum type lbkum,

salk3 type salk3,

werks type werks_d,

lgort type lgort_d,

umlme type umlmd,

end of ty_final.

data: wa_mara type ty_mara,

wa_mbew type ty_mbew,

wa_mard type ty_mard,

wa_final type ty_final,

it_mara type standard table of ty_mara,

it_mbew type standard table of ty_mbew,

it_mard type standard table of ty_mard,

it_final type standard table of ty_final.

data: gt_fieldcat type slis_t_fieldcat_alv,

fieldcat_ln type slis_fieldcat_alv,

repid type sy-repid,

ls_line type slis_listheader,

gt_list_top_of_page type slis_t_listheader.

  • SELECTION SCREEN *

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

select-options: p_matnr for mara-matnr.

parameter: s_matnr type matnr.

selection-screen: end of block b1.

  • SELECTION SCREEN VALIDATION *

at selection-screen on p_matnr.

data:lv_matnr type matnr.

select single matnr from mara into lv_matnr where matnr in p_matnr.

if sy-subrc <> 0.

message e000.

endif.

  • start of selection *

start-of-selection.

perform top-of-page.

perform alv_fieldcat.

perform get_data.

perform alv_display.

----


  • alv header declaration

----


form top-of-page.

  • alv header declaration

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 = 'h'.

wa_header-info = text-001.

append wa_header to t_header.

clear wa_header.

  • date *

wa_header-typ = 's'.

wa_header-info = 'date:'.

concatenate sy-datum6(2) '.' sy-datum4(2) '.'

sy-datum+4 into wa_header-info.

append wa_header to t_header.

clear wa_header.

  • Total number of Records *

describe table it_final lines ld_lines.

ld_linesc = ld_lines.

concatenate 'total number of records selected:' ld_linesc

into t_line separated by space.

wa_header-typ = 'a'.

wa_header-info = t_line.

append wa_header to t_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = t_header.

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

endform.

  • form alv_fieldcat *

form alv_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'matnr'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'materialnumber'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'ernam'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'personname'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'mtart'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'materialtype'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'mbrsh'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'industry'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'matkl'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'materialgroup'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'meins'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'unitofmeasure'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'bwkey'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'valuationarea'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'bwtar'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'valuationtype'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'lbkum'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'total valuatedstock'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'salk3'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'valuetotalvaluatedstock'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'werks'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'plant'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'lgort'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'storagelocation'.

append fieldcat_ln to gt_fieldcat.

clear fieldcat_ln.

fieldcat_ln-fieldname = 'umlme'.

fieldcat_ln-tabname = 'it_final'.

fieldcat_ln-seltext_l = 'stockintransfer'.

append fieldcat_ln to gt_fieldcat.

endform.

  • getdata *

form get_data.

select matnr

ernam

mtart

mbrsh

matkl

meins from mara into table it_mara where matnr in p_matnr.

loop at it_mara into wa_mara.

wa_final-matnr = wa_mara-matnr.

wa_final-ernam = wa_mara-ernam.

wa_final-mtart = wa_mara-mtart.

wa_final-mbrsh = wa_mara-mbrsh.

wa_final-matkl = wa_mara-matkl.

wa_final-meins = wa_mara-meins.

append wa_final to it_final.

endloop.

sort it_final by matnr.

if not it_mara is initial.

select matnr

bwkey

bwtar

lbkum

salk3 from mbew into table it_mbew for all entries in it_mara

where matnr = it_mara-matnr.

endif.

sort it_mbew by matnr.

loop at it_mbew into wa_mbew.

wa_final-matnr = wa_mbew-matnr.

wa_final-bwkey = wa_mbew-bwkey.

wa_final-bwtar = wa_mbew-lbkum.

wa_final-lbkum = wa_mbew-salk3.

append wa_final to it_final.

endloop.

sort it_final by matnr.

if not it_mbew is initial.

select matnr

werks

lgort

umlme from mard into table it_mard for all entries in it_mara

where matnr = it_mara-matnr.

endif.

sort it_mard by matnr.

loop at it_final into wa_final.

read table it_mard into wa_mard with key matnr = wa_final-matnr

binary search.

wa_final-matnr = wa_mard-matnr.

wa_final-werks = wa_mard-werks.

wa_final-lgort = wa_mard-lgort.

wa_final-umlme = wa_mard-umlme.

modify it_final

from wa_final.

endloop.

endform.

  • alv display *

form alv_display.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = repid

I_CALLBACK_HTML_TOP_OF_PAGE = 'top-of-page'

IT_FIELDCAT = gt_fieldcat

I_SAVE = 'x'

TABLES

T_OUTTAB = it_final

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 12:21 AM

    Priya,

    Maintain all quoted literals in UPPER CASE.

    EX:

    fieldcat_ln-fieldname = 'meins'. to 'MEINS'

    fieldcat_ln-tabname = 'it_final'. to 'IT_FINAL'

    Regards,

    Satish

    Message was edited by:

    Satish Panakala

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hello satish my report is displaying all field values but it is not displaying the top-of-page .i checked using break-point the structure t_header is not holding text in the function reuse_alv_commentary_write.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 06:27 AM

    HI

    YOUR logic is working fine , But when your executing the progrrm by useing REUSE_ALV_GRID_DISPLAY

    in this FM your not calling properly

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.