Skip to Content
0
Former Member
Dec 02, 2005 at 03:20 AM

alv problem

27 Views

Hi,

I have created the program with alv list display.When i run the program only one value getting displayed.Where might be the problem.Itab having the data.

<b>And how to pass the itab data into ALV list.</b>

here is the code...

REPORT YQM_NOTIFICATION MESSAGE-ID ZM NO STANDARD PAGE HEADING

LINE-SIZE 255.

TYPE-POOLS: SLIS.

tables: qpct,

qpgt,

qmel,

ihpa.

DATA: fieldcat TYPE slis_t_fieldcat_alv,

ITAB_EXTAB TYPE SLIS_T_EXTAB.

DATA: it_field TYPE slis_t_fieldcat_alv,

w_layout TYPE slis_layout_alv,

it_exclu TYPE slis_t_extab,

GS_EXTAB TYPE SLIS_EXTAB.

data: begin of t_hdr occurs 0,

group like qpgt-CODEGRUPPE,

code like qpct-code,

TEXT like qpct-KURZTEXT,

name like qpgt-KURZTEXT,

end of t_hdr.

data: begin of t_det occurs 0,

sno type i,

QMNUM like qmel-QMNUM, " notification number(ref no)

REFNUM like qmel-refnum, " contract no

parnr like ihpa-parnr,

qmtxt like qmel-qmtxt,

QMGRP like qmel-QMGRP,

QMCOD like qmel-QMCOD,

objnr like qmel-objnr,

desc(72),

end of t_det.

data: sno type i.

DATA: v_repid TYPE sy-repid.

data: ITAB_LINES LIKE tline OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.

select-options:s_QMNUM for qmel-QMNUM,

s_qmart for qmel-qmart,

s_qmdat for qmel-QMDAT.

SELECTION-SCREEN END OF BLOCK a1.

start-of-selection.

perform get_data.

perform display_alv.

end-of-selection.

&----


*& Form display_alv

&----


  • text

----


form display_alv.

PERFORM field_cat USING fieldcat.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = fieldcat

IT_EXCLUDING = ITAB_EXTAB

TABLES

t_outtab = t_det

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

&----


*& Form field_cat

&----


  • text

----


  • -->P_FIELDCAT text

----


FORM field_cat USING p_fieldcat.

  • FIELD CATELOG FOR ALV DISPLAY.

DATA: i_fieldcat TYPE slis_fieldcat_alv.

CLEAR i_fieldcat.

i_fieldcat-fieldname = 'sno'.

i_fieldcat-tabname = 't_det'.

i_fieldcat-no_out = ' '.

i_fieldcat-seltext_l = 'S.no'.

i_fieldcat-outputlen = 4.

APPEND i_fieldcat TO fieldcat.

i_fieldcat-fieldname = 'QMNUM'.

i_fieldcat-tabname = 't_det'.

i_fieldcat-no_out = ' '.

i_fieldcat-seltext_l = 'Ref.no'.

i_fieldcat-outputlen = 18.

APPEND i_fieldcat TO fieldcat.

i_fieldcat-fieldname = 'refnum'.

i_fieldcat-tabname = 't_det'.

i_fieldcat-no_out = ' '.

i_fieldcat-seltext_l = 'Contract no'.

i_fieldcat-outputlen = 18.

APPEND i_fieldcat TO fieldcat.

i_fieldcat-fieldname = 'parnr'.

i_fieldcat-tabname = 't_det'.

i_fieldcat-no_out = ' '.

i_fieldcat-seltext_l = 'A-Div'.

i_fieldcat-outputlen = 10.

APPEND i_fieldcat TO fieldcat.

i_fieldcat-fieldname = 'qmtxt'.

i_fieldcat-tabname = 't_det'.

i_fieldcat-no_out = ' '.

i_fieldcat-seltext_l = 'Description'.

i_fieldcat-outputlen = 25.

APPEND i_fieldcat TO fieldcat.

i_fieldcat-fieldname = 'desc'.

i_fieldcat-tabname = 't_det'.

i_fieldcat-no_out = ' '.

i_fieldcat-seltext_l = 'Defect'.

i_fieldcat-outputlen = 100.

APPEND i_fieldcat TO fieldcat.

ENDFORM. "FIED_CAT

&----


*& Form get_data

&----


  • text

----


form get_data.

*to get header

select codegruppe code kurztext from qpct into table t_hdr.

loop at t_hdr.

select single * from qpgt where codegruppe = t_hdr-group.

if sy-subrc = 0.

t_hdr-name = qpgt-KURZTEXT.

modify t_hdr.

clear t_hdr.

endif.

endloop.

*to get details

select qmnum refnum QMDAT qmtxt objnr qmgrp QMCOD from qmel

into corresponding fields of table t_det

where qmnum in s_qmnum and

qmart in s_qmart and

qmdat in s_qmdat.

loop at t_det.

select single * from ihpa where objnr = t_det-objnr.

if sy-subrc = 0.

t_det-parnr = ihpa-parnr.

modify t_det.

clear t_det.

endif.

endloop.

loop at t_det.

delete t_hdr where group ne t_det-qmgrp.

endloop.

endform.

points guaranteed...

cheers

kaki

Message was edited by: Kaki R