18
7/25/2019 Report ALV http://slidepdf.com/reader/full/report-alv 1/18 Display Variant From Selection Screen for ALV Reports  ALV Display Variant/Layout The term Display Variant/Layout refers to display format for ABAP reports. As of Release 4.!" these are called #layouts#. Layout $i%es more fle&i'ility to customers for ad(ustin$ the report to meet %arious re)uirements. *t $i%es the freedom to customers for modifyin$ the output layout li+e chan$e the column se)uence" sortin$ the list" and hidin$ irrele%ant data. *t also $i%es fle&i'ility o%er creatin$ totals and su'totals. Sa%in$ Layouts Layouts can 'e sa%ed for specific users or for all users. ,ser-specific layouts are only %isi'le to the users ho ha%e created them. Layouts for all users can 'e selected 'y e%ery user usin$ this report. These layouts alays start ith a forard slash in the name for e&ample" /Standard0.The layouts are report-dependent and you can only create" chan$e or delete them ithin the display of the respecti%e ALV list. ,ser-specific layouts can only 'e chan$ed or deleted 'y the user ho created them. 1hen callin$ the ALV display function R2,S23ALV3R*D3D*SPLA5 the chec+ function parameter *3SAV2 determines hether the layout can 'e sa%ed as user-specific" for all users or can 'e sa%ed in 'oth types.  676 lo'al Sa%in$  6,6 ,ser Specific Sa%in$  6A6 !orresponds to 7 and , Transportin$ Layouts 5ou can transport layouts for all users usin$ the layout administration. 5ou create a !ustomi8in$ re)uest for this. 5ou cannot transport user-specific layouts. 9oe%er" you can import 'oth from another client. 5ou can also access this function usin$ the layout administration. *mportant Function :odules ,sed For ALV Display Variant Processin$

Report ALV

Embed Size (px)

Citation preview

Page 1: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 1/18

Display Variant From Selection Screen for ALV Reports

 ALV Display Variant/Layout

The term Display Variant/Layout refers to display format for ABAP reports. As of Release 4.!" these are called #layouts#.

Layout $i%es more fle&i'ility to customers for ad(ustin$ the report to meet %arious re)uirements. *t $i%es the freedom tocustomers for modifyin$ the output layout li+e chan$e the column se)uence" sortin$ the list" and hidin$ irrele%ant data. *t

also $i%es fle&i'ility o%er creatin$ totals and su'totals.

Sa%in$ Layouts

Layouts can 'e sa%ed for specific users or for all users. ,ser-specific layouts are only %isi'le to the users ho ha%e created

them. Layouts for all users can 'e selected 'y e%ery user usin$ this report. These layouts alays start ith a forard slash

in the name for e&ample" /Standard0.The layouts are report-dependent and you can only create" chan$e or delete them

ithin the display of the respecti%e ALV list. ,ser-specific layouts can only 'e chan$ed or deleted 'y the user ho created

them.

1hen callin$ the ALV display function R2,S23ALV3R*D3D*SPLA5 the chec+ function parameter *3SAV2 determines

hether the layout can 'e sa%ed as user-specific" for all users or can 'e sa%ed in 'oth types.

  676 lo'al Sa%in$

  6,6 ,ser Specific Sa%in$

  6A6 !orresponds to 7 and ,

Transportin$ Layouts

5ou can transport layouts for all users usin$ the layout administration. 5ou create a !ustomi8in$ re)uest for this. 5ou cannot

transport user-specific layouts. 9oe%er" you can import 'oth from another client. 5ou can also access this function usin$the layout administration.

*mportant Function :odules ,sed For ALV Display VariantProcessin$

Page 2: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 2/18

R2,S23ALV3VAR*A;T3D2FA,LT32T

The %ariants in the list display can 'e 'oth user-specific and $eneral. The user can pro$rammatically set the initial default0

%ariant for list display. The default %ariant can 'e found usin$ the function module

R2,S23ALV3VAR*A;T3F4The user can choose from the list of e&istin$ %ariants usin$ the function module. The function module returns the possi'le

entry help for %ariants.

LV!3VAR*A;T327*ST2;!23!92!<

!hec+ for the e&istence of the %ariant passed to the pro$ram" can 'e used for %alidatin$ the input %ariant.

Sample Pro$ram shoin$ the functionalities*&amp;---------------------------------------------------------------------**&amp; Report ZFR_VARIENT*&amp;

*&amp;---------------------------------------------------------------------*

*&amp; This is a sample program for passing display ariant for an A!V

*&amp; Report form the sele"tion #ith F$ help and alidation to "he"% the*&amp; eistan"e of the passed

*&amp;---------------------------------------------------------------------*

 

RE'(RT 

)fr_arient

TA+!E,  sflight

T.'E-'((!, slis**INTERNA! TA+!E /E0!ARTI(N

/ATA 

#a_sflight T.'E 

sflight1  it_sflight T.'E TA+!E (F sflight

**/ATA /E0!ARTI(N/ATA field"atalog T.'E

 

slis_t_field"at_al 2IT3 

3EA/ER 

!INE1

  gd_layo4t T.'E 

slis_layo4t_al1

  gd_repid !I5E sy-repid1

  g_sae T.'E " VA!6E 7871  g_ariant T.'E disariant1

  g_ariant T.'E disariant1  g_eit T.'E

 

"1

  ispfli T.'E 

TA+!E 

(F spfli

* To 4nderstand the importan"e of the follo#ing parameter1 "li"% here

**,E!E0TI(N ,0REEN /ETAI!,,E!E0TI(N-,0REEN +E9IN (F +!(05 : 2IT3 FRA<E TIT!E tet-==>

'ARA<ETER, ariant !I5E 

disariant-ariant,E!E0TI(N-,0REEN EN/ (F +!(05 :

**9ETTIN9 /EFA6!T VARIANTINITIA!IZATI(N

  g_ariant-report ? sy-repid

  0A!! F6N0TI(N 7RE6,E_A!V_VARIANT_/EFA6!T_9ET7

  E8'(RTIN9  i_sae ? g_sae

  03AN9IN9

Page 3: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 3/18

  "s_ariant ? g_ariant

  E80E'TI(N,

  not_fo4nd ? >  IF sy-s4:r" ? =

  ariant ? g_ariant-ariant  EN/IF

** F$ 3elp for VarientAT

 

,E!E0TI(N-,0REEN 

(N 

VA!6E-RE@6E,T 

F(R 

ariant

**-- /isplay all eisting ariants

  g_ariant-report ? sy-repid

* 6tili)ing the name of the report1 this f4n"tion mod4le #ill sear"h for a list of* ariants and #ill fet"h the sele"ted one into the parameter field for ariants

  0A!! F6N0TI(N 7RE6,E_A!V_VARIANT_F$7  E8'(RTIN9

  is_ariant ? g_ariant

  i_sae ? g_sae

  I<'(RTIN9  e_eit ? g_eit

  es_ariant ? g_ariant  E80E'TI(N,

  not_fo4nd ? >  IF

 

sy-s4:r" ? >

  <E,,A9E I/ sy-msgid T.'E 7,7  N6<+ER sy-msgno

  2IT3 sy-msg sy-msg> sy-msg sy-msg$  E!,E

  IF 

g_eit ? spa"e

  ariant ? g_ariant-ariant

  EN/IF  EN/IF

 

**'ERF(R< /E0!ARATI(N,,TART-(F-,E!E0TI(N

  'ERF(R< data_retriel

  'ERF(R< 

:4ild_field"atalog  'ERF(R< "he"%_ariant  'ERF(R<

 

display_al_report

*&amp;---------------------------------------------------------------------*

*&amp; Form +6I!/_FIE!/0ATA!(9

*&amp;---------------------------------------------------------------------*

* tet

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

* --B 

p tet

* C-- p> tet

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

F(R< :4ild_field"atalog   field"atalog-fieldname ? 70ARRI/7

  field"atalog-seltet_m ? 7Airline 0ode7  field"atalog-"ol_pos ? =

  A''EN/ field"atalog T( field"atalog

  0!EAR  field"atalog  field"atalog-fieldname ? 70(NNI/7

  field"atalog-seltet_m ? 7Flight 0onne"tion N4m:er7  field"atalog-"ol_pos ?

  A''EN/ 

field"atalog T( 

field"atalog

  0!EAR  field"atalog field"atalog-fieldname ? 7F!/ATE7

Page 4: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 4/18

  field"atalog-seltet_m ? 7Flight date7

  field"atalog-"ol_pos ? >

  A''EN/ field"atalog T( field"atalog

  0!EAR  field"atalog field"atalog-fieldname ? 7'RI0E7

  field"atalog-seltet_m ? 7Airfare7

  field"atalog-"ol_pos ?

  field"atalog-o4tp4tlen ? >=  A''EN/ 

field"atalog T( 

field"atalog

  0!EAR 

field"atalog

EN/F(R< D +6I!/_FIE!/0ATA!(9

*&---------------------------------------------------------------------**& Form /I,'!A._A!V_RE'(RT

*&---------------------------------------------------------------------*F(R< display_al_report

  gd_repid ? sy-repid

  g_ariant-ariant ? ariant

  0A!! F6N0TI(N 7RE6,E_A!V_9RI/_/I,'!A.7  E8'(RTIN9

  i_"all:a"%_program ? gd_repid  i_"all:a"%_top_of_page ? 7T('-(F-'A9E7 Dsee F(R<

  i_"all:a"%_4ser_"ommand ? 76,ER_0(<<AN/7  it_field"at ? field"atalog

  i_sae ? 787

  is_ariant ? g_ariant

  TA+!E,  t_o4tta: ? it_sflight

  E80E'TI(N,  program_error ?

  (T3ER,  ? >

  IF sy-s4:r" CB =* <E,,A9E I/ ,.-<,9I/ T.'E ,.-<,9T. N6<+ER ,.-<,9N(

* 2IT3 ,.-<,9V ,.-<,9V> ,.-<,9V ,.-<,9V$

  EN/IFEN/F(R< D/I,'!A._A!V_RE'(RTD

 

/I,'!A._A!V_RE'(RT

*&amp;---------------------------------------------------------------------**&amp; Form /ATA_RETRIVE!

*&amp;---------------------------------------------------------------------*

F(R< data_retriel

  ,E!E0T * FR(< sflight INT( TA+!E it_sflightEN/F(R< D /ATA_RETRIVE!

*-------------------------------------------------------------------** Form T('-(F-'A9E *

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

* A!V Report 3eader *

*-------------------------------------------------------------------*F(R< top-of-page

*A!V 3eader de"larations  /ATA t_header T.'E slis_t_listheader1

  #a_header T.'E slis_listheader1  t_line !I5E #a_header-info1

  ld_lines T.'E i1

  ld_lines"G=H T.'E "

* Title  #a_header-typ ? 737

  #a_header-info ? 7,F!I93T Ta:le Report7  A''EN/ #a_header T( t_header

Page 5: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 5/18

  0!EAR #a_header

* /ate

  #a_header-typ ? 7,7  #a_header-%ey ? 7/ate 7

  0(N0ATENATE sy-dat4mJG>H 77  sy-dat4m$G>H 77

  sy-dat4mG$H INT( #a_header-info DToday7s date  A''EN/ #a_header T( t_header

  0!EAR #a_header

  0A!! F6N0TI(N 7RE6,E_A!V_0(<<ENTAR._2RITE7

  E8'(RTIN9  it_list_"ommentary ? t_header

EN/F(R< DTop-of-page*&---------------------------------------------------------------------*

*& Form 03E05_VARIANT

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

F(R< "he"%_ariant   g_ariant-ariant ? ariant

  g_ariant-report ? sy-repid  0A!! F6N0TI(N 7!V0_VARIANT_E8I,TEN0E_03E057 D0he"% for display ariant

  E8'(RTIN9  i_sae ? spa"e DVariants 0an :e ,aed

  03AN9IN9

  "s_ariant ? g_ariant DVariant information

  E80E'TI(N,  #rong_inp4t ? DIn"onsistent inp4t parameters

  not_fo4nd ? > DVariant not fo4nd  program_error ? D'rogram Errors

  D !V0_VARIANT_E8I,TEN0E_03E05

  IF sy-s4:r" ? >

  <E,,A9E 7/isplay Variant Not Fo4nd1 /isplaying /efa4lt Variant7  T.'E 7,7

  EN/IF  0A!! F6N0TI(N 7RE6,E_A!V_VARIANT_/EFA6!T_9ET7

  E8'(RTIN9  i_sae ? g_sae

  03AN9IN9

  "s_ariant ? g_ariant

  E80E'TI(N,  not_fo4nd ? >

  IF sy-s4:r" ? =  ariant ? g_ariant-ariant

  EN/IF

EN/F(R< D03E05_VARIANT

Page 6: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 6/18

 ABAP - Pro$ram for ALV Bloc+ list

S+ip to end of metadata

•  Added 'y ;arendran :uthu+umaran" last edited 'y :anish <umar on =un >?" >@ %ie chan$e0

• sho comment

o to start of metadata

Author: ;arendran :uthu+umaran

Submitted: April >?" >@@?

Description: A sample pro$ram to display ALV Bloc+ list usin$ the folloin$ function modules.

R2,S23ALV3BLC!<3L*ST3*;*T

R2,S23ALV3BLC!<3L*ST3APP2;D

R2,S23ALV3BLC!<3L*ST3D*SPLA5.

RE'(RT 

)_al_:lo"%_list

 

* Type-pools

T.'E-'((!, slis

 

* /ata de"larations

/ATA +E9IN (F t_:a% (006R, =1

  :eln T.'E :eln1

  :stn% T.'E 

:a%-:stn%1

  erdat T.'E 

:a%-erdat1

  %4nnr T.'E :a%-%4nnr1

  EN/ (F t_:a%

 

/ATA +E9IN (F t_:ap (006R, =1

  :eln T.'E 

:eln1

  matnr T.'E 

:ap-matnr1

  netpr T.'E 

:ap-netpr1

  #aer% T.'E 

:ap-#aer%1

  %#meng T.'E :ap-%#meng1

Page 7: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 7/18

  meins T.'E 

:ap-meins1

  EN/ (F t_:ap

 

/ATA t_field"atalog T.'E 

slis_t_field"at_al

/ATA t_field"atalog> T.'E 

slis_t_field"at_al

/ATA _repid T.'E syrepid

/ATA s_layo4t T.'E slis_layo4t_al

/ATA _ta:name T.'E 

slis_ta:name

/ATA t_eents T.'E 

slis_t_eent

 

* start-of-sele"tion eent

,TART-(F-,E!E0TI(N

 

_repid ? sy-repid

 

* 9et the field"atalog for the first :lo"%

  'ERF(R< 

get_field"at 03AN9IN9 t_field"atalog

 

* 9et the field"atalog for the se"ond :lo"%

  'ERF(R< 

get_field"at> 03AN9IN9 t_field"atalog>

 

* 9et the data for the first :lo"%

  ,E!E0T 

:eln :stn% erdat %4nnr 6' T( 

= R(2,

  INT( 

TA+!E 

t_:a%

  FR(< :a% 23ERE :eln B 7==J======7

 

* 9et the data for the se"ond :lo"%

  ,E!E0T 

:eln matnr netpr #aer% %#meng meins 6' T( 

= R(2,

  INT( 

TA+!E 

t_:ap

  FR(< :ap 23ERE :eln B 7==J======7

Page 8: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 8/18

 

* init

  0A!! F6N0TI(N 7RE6,E_A!V_+!(05_!I,T_INIT7

  E8'(RTIN9

  i_"all:a"%_program ? _repid

 

* First :lo"%

  _ta:name ? 7ITA+7

  0A!! 

F6N0TI(N 

7RE6,E_A!V_+!(05_!I,T_A''EN/7

  E8'(RTIN9

  is_layo4t ? s_layo4t

  it_field"at ? t_field"atalog

  i_ta:name ? _ta:name

  it_eents ? t_eents

  TA+!E,

  t_o4tta: ? t_:a%

 

* ,e"ond :lo"%

  _ta:name ? 7ITA+>7

  0A!! F6N0TI(N 7RE6,E_A!V_+!(05_!I,T_A''EN/7

  E8'(RTIN9

  is_layo4t ? s_layo4t

  it_field"at ? t_field"atalog>

  i_ta:name ? _ta:name

  it_eents ? t_eents

  TA+!E,

  t_o4tta: ? t_:ap

Page 9: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 9/18

 

*/isplay

  0A!! F6N0TI(N 7RE6,E_A!V_+!(05_!I,T_/I,'!A.7

 

 

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

* F(R< 9ET_FIE!/0AT *

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

* 9et the field "atalog for the first :lo"% *

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

F(R< get_field"at 03AN9IN9 lt_field"atalog T.'E slis_t_field"at_al

 

/ATA s_field"atalog T.'E 

slis_field"at_al

 

* (rder n4m:er

  s_field"atalog-"ol_pos ? 77

  s_field"atalog-fieldname ? 7V+E!N7  s_field"atalog-ta:name ? 7T_V+A57

  s_field"atalog-ref_ta:name ? 7V+A57

  s_field"atalog-ref_fieldname ? 7V+E!N7

  A''EN/ 

s_field"atalog T( 

lt_field"atalog

  0!EAR s_field"atalog

 

* 04stomer p4r"hase order

  s_field"atalog-"ol_pos ? 7>7

  s_field"atalog-fieldname ? 7+,TN57

  s_field"atalog-ta:name ? 7T_V+A57

  s_field"atalog-ref_ta:name ? 7V+A57

  s_field"atalog-ref_fieldname ? 7+,TN57

Page 10: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 10/18

  A''EN/ 

s_field"atalog T( 

lt_field"atalog

  0!EAR 

s_field"atalog

 

* 0reation date

  s_field"atalog-"ol_pos ? 77

  s_field"atalog-fieldname ? 7ER/AT7

  s_field"atalog-ta:name ? 7T_V+A57

  s_field"atalog-ref_ta:name ? 7V+A57

  s_field"atalog-ref_fieldname ? 7ER/AT7

  A''EN/ s_field"atalog T( lt_field"atalog

  0!EAR 

s_field"atalog

 

* 04stomer

  s_field"atalog-"ol_pos ? 7$7

  s_field"atalog-fieldname ? 756NNR7

  s_field"atalog-ta:name ? 7T_V+A57

  s_field"atalog-ref_ta:name ? 7V+A57

  s_field"atalog-ref_fieldname ? 756NNR7

  A''EN/ s_field"atalog T( lt_field"atalog

  0!EAR 

s_field"atalog

 

EN/F(R<

 

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

* F(R< 9ET_FIE!/0AT> *

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

* 9et the field "atalog for the se"ond :lo"% *

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

F(R< get_field"at> 03AN9IN9 lt_field"atalog T.'E slis_t_field"at_al

 

/ATA s_field"atalog T.'E 

slis_field"at_al

Page 11: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 11/18

 

* (rder n4m:er

  s_field"atalog-"ol_pos ? 77

  s_field"atalog-fieldname ? 7V+E!N7

  s_field"atalog-ta:name ? 7T_V+A'7

  s_field"atalog-ref_ta:name ? 7V+A'7

  s_field"atalog-ref_fieldname ? 7V+E!N7

 

A''EN/ 

s_field"atalog T( 

lt_field"atalog

  0!EAR 

s_field"atalog

 

* <aterial n4m:er

  s_field"atalog-"ol_pos ? 7>7

  s_field"atalog-fieldname ? 7<ATNR7

  s_field"atalog-ta:name ? 7T_V+A'7

  s_field"atalog-ref_ta:name ? 7V+A'7

  s_field"atalog-ref_fieldname ? 7<ATNR7

  A''EN/ s_field"atalog T( lt_field"atalog

  0!EAR 

s_field"atalog

 

* Net pri"e

  s_field"atalog-"ol_pos ? 77

  s_field"atalog-fieldname ? 7NET'R7

  s_field"atalog-ta:name ? 7T_V+A'7

  s_field"atalog-ref_ta:name ? 7V+A'7

  s_field"atalog-ref_fieldname ? 7NET'R7

  s_field"atalog-"fieldname ? 72AER57

  s_field"atalog-"ta:name ? 7T_V+A'7

  A''EN/ s_field"atalog T( lt_field"atalog

  0!EAR s_field"atalog

 

Page 12: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 12/18

* 04rren"y

  s_field"atalog-"ol_pos ? 7$7

  s_field"atalog-fieldname ? 72AER57

  s_field"atalog-ta:name ? 7T_V+A'7

  s_field"atalog-ref_ta:name ? 7V+A'7

  s_field"atalog-ref_fieldname ? 72AER57

  A''EN/ 

s_field"atalog T( 

lt_field"atalog

  0!EAR 

s_field"atalog

 

* @4antity

  s_field"atalog-"ol_pos ? 7K7

  s_field"atalog-fieldname ? 752<EN97

  s_field"atalog-ta:name ? 7T_V+A'7

  s_field"atalog-ref_ta:name ? 7V+A'7

  s_field"atalog-ref_fieldname ? 752<EN97

  s_field"atalog-Lfieldname ? 7<EIN,7

  s_field"atalog-Lta:name ? 7T_V+A'7

  A''EN/ s_field"atalog T( lt_field"atalog

  0!EAR 

s_field"atalog

 

* 6(<

  s_field"atalog-"ol_pos ? 7J7

  s_field"atalog-fieldname ? 7<EIN,7

  s_field"atalog-ta:name ? 7T_V+A'7

  s_field"atalog-ref_ta:name ? 7V+A'7

  s_field"atalog-ref_fieldname ? 7<EIN,7

  A''EN/ s_field"atalog T( lt_field"atalog

  0!EAR s_field"atalog

EN/F(R<

Page 13: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 13/18

 ABAP - 9ierarchical Se)uence List in ALV

9ierarchical display is used for displayin$ data that are related. Li+e sales order and item

details. 9ere sales order details can 'e the header data hereas them items in the sales order

can 'e the item data.

Function module R2,S23ALV39*2RS23L*ST3D*SPLA5

•   I_tabname_header  E ;ame of the internal ta'le in the pro$ram containin$ the output

data of the hi$hest hierarchy le%el.

•   I_tabname_item E ;ame of the internal ta'le in the pro$ram containin$ the output data

of the loest hierarchy le%el.

•   Is_keyinfo E This structure contains the header and item ta'le field names hich lin+ the

to ta'les shared +ey0.

Tables

•   t_outtab_header  E 9eader ta'le ith data to 'e output

•   t_outtab_item E ;ame of the internal ta'le in the pro$ram containin$ the output data of

the loest hierarchy le%el.

Page 14: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 14/18

REPORT )test_notepad .

TABLES:

  e%%o,e%po.

TYPE-POOLS:

  slis.

SELECTION-SCREEN BEGIN OF BLOCK  : WITH FRAME TITLE tet-001.

SELECT-OPTIONS:

  so_e%org FOR  e%%o-e%org,

  so_e:eln FOR  e%%o-e:eln,

  so_aedat FOR  e%%o-aedat.

PARAMETERS: r RADIOBUTTON GROUP rad,

  r> RADIOBUTTON GROUP rad,

  r RADIOBUTTON GROUP rad.

SELECTION-SCREEN END OF BLOCK  :.

TYPES:

  BEGIN OF ty_e%%o,

  e:eln TYPE e%%o-e:eln,

  e%org TYPE e%%o-e%org,

  aedat TYPE e%%o-aedat,

  lifnr TYPE e%%o-lifnr,

  END OF ty_e%%o.

TYPES:

  BEGIN OF ty_e%po,

  e:eln TYPE e%%o-e:eln,"Change

  e:elp TYPE e%po-e:elp,  matnr TYPE e%po-matnr,

  #er%s TYPE e%po-#er%s,

  t)= TYPE e%po-t)=,

  menge TYPE e%po-menge,

  END OF ty_e%po.

DATA : it_e%po TYPE TABLE OF ty_e%po,

  #a_e%po TYPE ty_e%po.

DATA : it_e%%o TYPE TABLE OF ty_e%%o,

  #a_e%%oTYPE

 ty_e%%o.

DATA :

  it_f"at TYPE slis_t_field"at_al,

  #a_f"at TYPE slis_field"at_al.

DATA :

  repid LIKE sy-repid VALUE sy-repid,

  ke TYPE slis_%eyinfo_al.

Page 15: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 15/18

DATA :

  g_e%%o TYPE slis_ta:name VALUE 7IT_E55(7, g_e%po

TYPE

  slis_ta:name VALUE 7IT_E5'(7.

START-OF-SELECTION.

  PERFORM  get_data.

  PERFORM  field_"at.

  PERFORM  fm_hir_dis.

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

*& Form GET_DATA 

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

* text

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

* --> p1 text * <-- p2 text

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

FORM  get_data .

  SELECT e:eln e%org aedat lifnr

  FROM  e%%o

  INTO TABLE it_e%%o

   WHERE e%org IN so_e%org

   AND e:eln IN so_e:eln

   AND aedat IN so_aedat.

  SELECT e:eln e:elp matnr #er%s t)= menge

  FROM  e%po  INTO TABLE it_e%po

  FOR  A!! ENTRIE, IN it_e%%o

   WHERE e:eln ! it_e%%o-e:eln.

ENDFORM .  "get_data

" GET_DATA 

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

*& Form FIELD_CAT 

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

* text*----------------------------------------------------------------------*

* --> p1 text * <-- p2 text

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

FORM  field_"at .

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E55(7.

  #a_f"at-fieldname ! 7E+E!N7.

Page 16: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 16/18

  #a_f"at-seltet_l ! 7'( (R/ER N6<+ER7.

  APPEND #a_f"at TO it_f"at.

  CLEAR   #a_f"at.

  #a_f"at-ta:name ! 7IT_E55(7.

  #a_f"at-fieldname ! 7E5(R97.

  #a_f"at-seltet_l ! 7'( (R97.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E55(7.

  #a_f"at-fieldname ! 7AE/AT7.

  #a_f"at-seltet_l ! 7/ATE7.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E55(7.

  #a_f"at-fieldname ! 7!IFNR7.

  #a_f"at-seltet_l ! 7VEN/(R7.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E5'(7.

  #a_f"at-fieldname ! 7E+E!'7.  #a_f"at-seltet_l ! 7ITE<,7.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E5'(7.

  #a_f"at-fieldname ! 7<ATNR7.

  #a_f"at-seltet_l ! 7<ATERIA!7.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E5'(7.

  #a_f"at-fieldname ! 72ER5,7.

  #a_f"at-seltet_l ! 7'!ANT7.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E5'(7.

Page 17: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 17/18

  #a_f"at-fieldname ! 7T8Z=7.

  #a_f"at-seltet_l ! 7,3(RT TE8T7.

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

  #a_f"at-ta:name ! 7IT_E5'(7.

  #a_f"at-fieldname ! 7<EN9E7.

  #a_f"at-seltet_l ! [email protected].

  APPEND #a_f"at TO it_f"at.

  CLEAR  #a_f"at.

ENDFORM . " FIELD_CAT 

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

*& Form F_!I_DI# 

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

* text

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

* --> p1 text * <-- p2 text

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

FORM  fm_hir_dis .

  ke-header= ! 7E+E!N7.

  ke-item= ! 7E+E!N7.

  CALL FUNCTION 7RE6,E_A!V_3IER,E@_!I,T_/I,'!A.7

  E"PORTING

  i_"all:a"%_program ! repid  it_field"at ! it_f"at

  i_ta:name_header ! 7IT_E55(7

  i_ta:name_item ! 7IT_E5'(7

  is_%eyinfo ! ke

  TABLES

  t_o4tta:_header ! it_e%%o

  t_o4tta:_item ! it_e%po.

ENDFORM .  "$m_h%r_d%

. " F_!I_DI# 

Page 18: Report ALV

7/25/2019 Report ALV

http://slidepdf.com/reader/full/report-alv 18/18