Application Development and Automation 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: 
Read only

ALV

Former Member
0 Likes
700

Hi guru,

how can u create header data n item datas by using alv?can u explain briefly with examples

thxs in advance

Hi guru,

how can u create header data n item datas by using alv?can u explain briefly with examples

thxs in advance

5 REPLIES 5
Read only

anversha_s
Active Contributor
0 Likes
664
Read only

Former Member
0 Likes
664

Hi,

in ALV u can call all the header and item datas and filter as per your requirement. But in the case of normal list output, u can create as header and footer (imean items)

Choose te better one

Read only

Former Member
0 Likes
664

Hi ...

DATA: BEGIN OF wa_pur_reg occurs 0,

ebeln like ekko-ebeln,

bedat like ekko-bedat,

lifnr like ekko-lifnr,

END OF wa_pur_reg.

data : begin of wa_pur_itm occurs 0,

ebeln like ekpo-ebeln,

ebelp like ekpo-ebelp,

txz01 like ekpo-txz01,

meins like ekpo-meins,

menge like ekpo-menge,

banfn like ekpo-banfn,

bnfpo like ekpo-bnfpo,

tebeln like ekbe-ebeln,

lfbnr like ekbe-lfbnr,

cpudt like ekbe-cpudt,

charg like ekbe-charg,

bwart like ekbe-bwart,

eindt like eket-eindt,

wepos like eban-wepos,

end of wa_pur_itm.

DATA : t_pur_reg LIKE wa_pur_reg occurs 0 with header line,

t_pur_itm like wa_pur_itm occurs 0 with header line.

select aebeln aaedat a~lifnr from ekko as a

inner join ekpo as b

on aebeln = bebeln

into corresponding fields of table t_pur_reg

where

a~ebeln eq t_ekkn-ebeln and

a~FRGKE eq 'R' and

a~bstyp eq 'F' and

b~loekz eq space and

b~ebelp eq '10'.

LOOP AT t_pur_reg INTO wa_pur_reg." where sfdat = a_lfdat.

MODIFY t_pur_reg FROM wa_pur_reg.

write: 6(4) count,

10 sy-vline, 11(10) wa_pur_reg-ebeln hotspot on,

21 sy-vline, 22(10) wa_pur_reg-bedat,

32 sy-vline, 33(15) salno hotspot on,

48 sy-vline, 49(30) vennam,

178 sy-vline.

uline (178).

format color off.

format color col_group intensified on.

write : / sy-vline, 2 'Item No',

10 sy-vline, 11(37) 'Material Description',

48 sy-vline, 49(20) 'Batch',

69 sy-vline, 70(5) 'UOM',

75 sy-vline, 76(15) 'Req Qty',

91 sy-vline, 92(15) 'PO Qty',

107 sy-vline, 108(15) 'GR Qty',

endloop.

Read only

Former Member
0 Likes
664

Hi,

Check this example using the ALV function module REUSE_ALV_HIERSEQ_LIST_DISPLAY..

TYPE-POOLS: slis.

DATA: BEGIN OF itab OCCURS 0,

vbeln TYPE vbeln,

expand,

END OF itab.

DATA: BEGIN OF itab1 OCCURS 0,

vbeln TYPE vbeln,

posnr TYPE posnr,

netpr TYPE netpr,

END OF itab1.

DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.

DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

s_fieldcatalog-col_pos = '1'.

s_fieldcatalog-fieldname = 'VBELN'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'VBELN'.

APPEND s_fieldcatalog TO t_fieldcatalog.

s_fieldcatalog-col_pos = '1'.

s_fieldcatalog-fieldname = 'VBELN'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'VBELN'.

APPEND s_fieldcatalog TO t_fieldcatalog.

s_fieldcatalog-col_pos = '2'.

s_fieldcatalog-fieldname = 'POSNR'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'POSNR'.

APPEND s_fieldcatalog TO t_fieldcatalog.

s_fieldcatalog-col_pos = '3'.

s_fieldcatalog-fieldname = 'NETPR'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'NETPR'.

s_fieldcatalog-do_sum = 'X'.

APPEND s_fieldcatalog TO t_fieldcatalog.

DATA: s_layout TYPE slis_layout_alv.

s_layout-subtotals_text = 'SUBTOTAL TEXT'.

s_layout-key_hotspot = 'X'.

s_layout-expand_all = 'X'.

s_layout-expand_fieldname = 'EXPAND'.

SELECT vbeln UP TO 10 ROWS

FROM

vbak

INTO TABLE itab.

IF NOT itab[] IS INITIAL.

SELECT vbeln posnr

FROM vbep

INTO TABLE itab1

FOR ALL ENTRIES IN itab

WHERE vbeln = itab-vbeln.

ENDIF.

DATA: v_repid TYPE syrepid.

v_repid = sy-repid.

DATA: s_keyinfo TYPE slis_keyinfo_alv.

s_keyinfo-header01 = 'VBELN'.

s_keyinfo-item01 = 'VBELN'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

is_layout = s_layout

it_fieldcat = t_fieldcatalog

i_tabname_header = 'ITAB'

i_tabname_item = 'ITAB1'

is_keyinfo = s_keyinfo

TABLES

t_outtab_header = itab

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

Thanks,

Naren

Read only

Former Member
0 Likes
664

hi ramakrishna

u can create header data n line items by using alv thru

function module

<u><i><b>REUSE_ALV_HIERSEQ_LIST_DISPLAY</b></i></u> or

<u><i><b>'REUSE_ALV_TREE_DISPLAY'</b></i></u>

the parameters in these function modules will definitely help u creating header n line items in simplest way !!!!!!!!!!!