7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 1/20
ALV Grid Display with checkbox to processselected records at runtime
*&---------------------------------------------------------------------* *& Report ZPM_WO
*&---------------------------------------------------------------------*
*& Author : Tarun Gambhir
*& Description : To generate an A! report "isp#a$ to trac%
*& "amage-t$pe or% or"ers an" pen"ing comp#etion status
*& hose or"er status is PM'( or PM') in or"er to ensure
*& time#$ comp#etions
*&---------------------------------------------------------------------*
*& Disp#a$ recor"s in +irst screen in A! Gri" Disp#a$ ith chec%bo,es
*& appen"e" ith each recor" an" per+orm an user action to "isp#a$ the
*& se#ecte" recor"s into another A! Gir"
*& or user can use their on co"e as per their reuirements
*&---------------------------------------------------------------------*
REPORT pm!wo "O #TA"DARD PAGE $EAD%"G &E##AGE'%D ms(!wo)
*&---------------------------------------------------------------------*
* T.P/ POO0
*&---------------------------------------------------------------------*
T*PE'POOL# + slis) 1 use" +or A! output
*&---------------------------------------------------------------------*
* T.P/ D/2ARAT3O4
*&---------------------------------------------------------------------*
T*PE# +
* +or tab#e au+% 5or% or"er "etai#s6
,EG%" O- t!au.k/
au.nr T*PE au.k'au.nr/ 1 or"er number
ktext T*PE au.k'ktext/ 1 "escription
ob0nr T*PE au.k'ob0nr/ 1 ob7ect number
E"D O- t!au.k/
* +or tab#e 7est 5ob7ect status "etai#s6
,EG%" O- t!0est/
ob0nr T*PE 0est'ob0nr/ 1 ob7ect number
E"D O- t!0est/
* +or tab#e a+%o 5basic +inish "ate "etai#s6
,EG%" O- t!a.ko/
au.nr T*PE a.ko'au.nr/ 1 or"er number
(ltrp T*PE a.ko'(ltrp/ 1basic +inish "ate
E"D O- t!a.ko/
* +or tab#e me# 5noti+ication number "etai#s6
,EG%" O- t!1mel/
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 2/20
au.nr T*PE 1mel'au.nr/ 1 or"er number
1mnum T*PE 1mel'1mnum/ 1 noti+ication number
E"D O- t!1mel/
* +ina# tab#e +rom hich the recor"s nee" to be "isp#a$e"
,EG%" O- t!.inal/
au.nr T*PE au.k'au.nr/ 1 or"er number ktext T*PE au.k'ktext/ 1 "escription
1mnum T*PE 1mel'1mnum/ 1 noti+ication number
.la(234/ 1 +or se#ection o+ recor"s
E"D O- t!.inal/
* tab#e hich contains the se#ecte" recor"s to be processe"
,EG%" O- t!process/
au.nr T*PE au.k'au.nr/ 1 or"er number
ktext T*PE au.k'ktext/ 1 "escription
1mnum T*PE 1mel'1mnum/ 1 noti+ication number
E"D O- t!process/
* tab#e +or messages
,EG%" O- t!messa(e/
au.nr T*PE au.k'au.nr/ 1or"er number
ms(25664/ 1message te,t
E"D O- t!messa(e)
*&---------------------------------------------------------------------*
* 2O4TA4T0 D/2ARAT3O4
*&---------------------------------------------------------------------*
7O"#TA"T# + c!check234 VAL8E 9:9/ 1 8a#ue use" to set 9 +or a +ie#"
c!lan(u234 VAL8E 9E9/ 1 #anguage use"
c!ustat2;4 VAL8E 9TE7O9) 1 ob7ect status "escription
*&---------------------------------------------------------------------*
* RA4G/0 D/2ARAT3O4
*&---------------------------------------------------------------------*
* RA4G/ !A/ TO ;/ 0/D <OR T=/ ORD/R T.P/
*&---------------------------------------------------------------------*
RA"GE# + r!auart -OR au.k'auart) 1+or or"er t$pe
*&---------------------------------------------------------------------*
* PARAM/T/R0 <OR 0//2T3O4-02R//4
*&---------------------------------------------------------------------*
* 0//2T3O4 02R//4 ;O2> <OR T=/ !AR3A4T 4AM/
*&---------------------------------------------------------------------*
#ELE7T%O"'#7REE" ,EG%" O- ,LO7< b3 =%T$ -RA&E T%TLE text'663)
PARA&ETER# + p!>ar T*PE dis>ariant'>ariant) 1 8ariant parameter
#ELE7T%O"'#7REE" E"D O- ,LO7< b3)
*&---------------------------------------------------------------------*
* !AR3A;/ D/2ARAT3O40
*&---------------------------------------------------------------------*
DATA + >!rep!id T*PE sy'repid/ 1 report i"
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 3/20
>!istat T*PE t065t'istat/ 1 or"er status
>!cdate T*PE sy'datum/ 1 current s$stem "ate
>!line!count T*PE i/ 1 number o+ #ines in +ina# interna# tab#e
>!.ilename T*PE strin() 1 path +or "on#oa" error #og
*&---------------------------------------------------------------------*
* 34T/R4A TA;/ & WOR> AR/A D/2ARAT3O40*&---------------------------------------------------------------------*
* T.P/ O< T_A<>
* interna# tab#e to se#ect recor"s +or "amage" or"er t$pes
DATA + it!au.k T*PE #TA"DARD TA,LE O- t!au.k/
* or% area +or "amage" or"er t$pes
wa!au.k T*PE t!au.k)
* T.P/ O< T_?/0T
* interna# tab#e to se#ect ob7ect number base" upon user status
DATA + it!0est T*PE #TA"DARD TA,LE O- t!0est/
* or% area to se#ect ob7ect number base" upon user status
wa!0est T*PE t!0est)
* T.P/ O< T_A<>O
* interna# tab#e to se#ect the basic +inish "ate corresopn"ing to or% or"er
DATA + it!a.ko T*PE #TA"DARD TA,LE O- t!a.ko/
* or% area to se#ect the basic +inish "ate corresopn"ing to or% or"er
wa!a.ko T*PE t!a.ko)
* T.P/ O< T_@M/
* interna# tab#e to se#ect the noti+ication number corresopn"ing to ob7ect number
DATA + it!1mel T*PE #TA"DARD TA,LE O- t!1mel/
* or% area to se#ect the noti+ication number corresopn"ing to ob7ect number
wa!1mel T*PE t!1mel)
* T.P/ O< T_<34A
* +ina# interna# tab#e to se#ect +ina# recor"s to be "isp#a$e"
DATA + it!.inal T*PE #TA"DARD TA,LE O- t!.inal/
* +ina# or% area to se#ect +ina# recor"s to be "isp#a$e"
wa!.inal T*PE t!.inal)
* T.P/ O< T_PRO2/00
* +ina# interna# tab#e to se#ect +ina# recor"s to be "isp#a$e"
DATA + it!process T*PE #TA"DARD TA,LE O- t!process/
* +ina# or% area to se#ect +ina# recor"s to be "isp#a$e"
wa!process T*PE t!process)
* <OR !AR3A4T
DATA + wa!>ariant T*PE dis>ariant)
* <OR !AR3A4T 3MPORT
DATA + wa!i!>ariant T*PE dis>ariant)
*&---------------------------------------------------------------------*
* A! 34T/R4A TA;/ & WOR> AR/A D/2ARAT3O40
*&---------------------------------------------------------------------*
* <3/D 2ATAOG
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 4/20
DATA + it!.ield T*PE slis!t!.ieldcat!al>/ 1interna# tab#e +or +ie#" cata#og
wa!.ield T*PE slis!.ieldcat!al>) 1or% area +or +ie#" cata#og
* 0ORT34G 34<O
DATA + it!sort T*PE slis!t!sortin.o!al>/ 1interna# tab#e +or sorting +ie#"
wa!sort T*PE slis!sortin.o!al>) 1or% area +or sorting +ie#"
* <OR A.OT O< A! GR3D
DATA + wa!layout T*PE slis!layout!al>) 1or% area +or #a$out "esign
*&---------------------------------------------------------------------*
* A! 34T/R4A TA;/ & WOR> AR/A D/2ARAT3O40
*&---------------------------------------------------------------------*
* <3/D 2ATAOG
DATA + it!.ield3 T*PE slis!t!.ieldcat!al>/ 1interna# tab#e +or +ie#" cata#og
wa!.ield3 T*PE slis!.ieldcat!al>) 1or% area +or +ie#" cata#og
* 0ORT34G 34<O
DATA + it!sort3 T*PE slis!t!sortin.o!al>/ 1interna# tab#e +or sorting +ie#"
wa!sort3 T*PE slis!sortin.o!al>) 1or% area +or sorting +ie#"
* <OR A.OT O< A! GR3D
DATA + wa!layout3 T*PE slis!layout!al>) 1or% area +or #a$out "esign
*&---------------------------------------------------------------------*
* 343T3A3ZAT3O4
*&---------------------------------------------------------------------*
* TO 343T3A3Z/ A T=/ !AR3A;/0 TO ;/ 0/D
* 34 T=/ PROGRAM
*&---------------------------------------------------------------------*
%"%T%AL%?AT%O")
>!rep!id @ sy'repid) 1 report i"
r!auart'si(n @ 9%9) 1 +or inc#usi8e
r!auart'option @ 9,T9) 1 +or beteen operator
r!auart'low @ 9P&639) 1 or"er t$pe5#o 8a#ue6
r!auart'hi(h @ 9P&659) 1 or"er t$pe5high 8a#ue6
APPE"D r!auart) 1 appen" 8a#ues +or range
>!cdate @ sy'datum ' ) 1 ta%e "ate "a$s be+ore current "ate
wa!>ariant'report @ >!rep!id) 1 report +or using 8ariants
*&---------------------------------------------------------------------*
* AT 0//2T3O4-02R//4 OTPT
*&---------------------------------------------------------------------*
* TO 2/AR T=/ !A/ O< T=/ !AR3A4T PARAM/T/R W=/4 0/R
* R/TR40 <ROM T=/ OTPT 02R//4 TO T=/ 0//2T3O4 02R//4
*&---------------------------------------------------------------------*
AT #ELE7T%O"'#7REE" O8TP8T)
7LEAR p!>ar) 1c#ear 8ariant 8a#ue
*&---------------------------------------------------------------------*
* AT-0//2T3O4 02R//4 O4 !A/ R/@/0T
*&---------------------------------------------------------------------*
* TO G/T T=/ <B =/P <OR /930T34G !AR3A4T0
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 5/20
*&---------------------------------------------------------------------*
AT #ELE7T%O"'#7REE" O" VAL8E'REB8E#T -OR p!>ar)
PER-OR& .;!>ariant!help 8#%"G p!>ar)
*&---------------------------------------------------------------------*
* AT-0//2T3O4 02R//4
*&---------------------------------------------------------------------* * TO PA00 T=/ D/<AT !A/ O< T=/ !AR3A4T 3< T=/ PARAM/T/R
* <OR !AR3A4T 30 /<T A0 ;A4>
*&---------------------------------------------------------------------*
AT #ELE7T%O"'#7REE")
*&---------------------------------------------------------------------*
* 3< T=/ 0/R DO/04CT /4T/R0 A4. !A/ <OR !AR3A4T
* T=/4 T=/ D/<AT !AR3A4T 0=OD ;/ 0/D TO D30PA.
*&---------------------------------------------------------------------*
%- p!>ar EB 9 9)
PER-OR& (et!de.ault!>ariant 8#%"G p!>ar)
*&---------------------------------------------------------------------* * 3< T=/ 0/R /4T/R0 0OM/ !AR3A4T 4AM/ <OR T=/ 0//2T3O4
* 02R//4 W=32= 4//D TO ;/ !A3DAT/D AGA340T T=/ /930T34G
* !AR3A4T0
*&---------------------------------------------------------------------*
EL#E)
PER-OR& check!>ariant!existence 8#%"G p!>ar)
E"D%-)
*&---------------------------------------------------------------------*
* 0TART-O<-0//2T3O4
*&---------------------------------------------------------------------*
#TART'O-'#ELE7T%O")
*&---------------------------------------------------------------------*
* 2/AR A T=/ 2O4T/4T0 O< A 34T/R;A TA;/0
*&---------------------------------------------------------------------*
RE-RE#$ it!0est)
RE-RE#$ it!au.k)
RE-RE#$ it!a.ko)
RE-RE#$ it!1mel)
RE-RE#$ it!.inal)
*&---------------------------------------------------------------------*
* se#ect user status +rom T?')T +or T9T'B5status o+ an ob7ect6
* into 8ariab#e !_30TAT
*&---------------------------------------------------------------------*
#ELE7T #%"GLE
istat
-RO& t065t
%"TO 2>!istat4
=$ERE
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 6/20
txt6; EB c!ustat A"D
spras EB c!lan(u)
*&---------------------------------------------------------------------*
* se#ect ob7ect number base" upon the user status se#ecte"
*&---------------------------------------------------------------------*
#ELE7T ob0nr
-RO& 0est
%"TO TA,LE it!0est
=$ERE
stat EB >!istat)
%- sy'subrc C 6)
&E##AGE e66)
EL#E)
*&---------------------------------------------------------------------*
* se#ect into it_au+% tab#e: ob7ect number "escription an"
* ob7ect number base" on ob7ect number se#ecte" an" or"er t$pe
* in PM'( an" PM')
*&---------------------------------------------------------------------*
#ELE7T
au.nr
ktext
ob0nr
-RO& au.k
%"TO TA,LE it!au.k
-OR ALL E"TR%E# %" it!0est
=$ERE
ob0nr EB it!0est'ob0nr A"D
auart %" r!auart)
%- sy'subrc C 6)
&E##AGE e665)
EL#E)
*&---------------------------------------------------------------------*
* se#ect into it_a+%o tab#e: or"er number an" basic +inish "ate
* base" upon or"er number se#ecte" an" basic +inish "ate as
* 8_c"ate 8ariab#e
*&---------------------------------------------------------------------*
#ELE7T
au.nr
(ltrp
-RO& a.ko
%"TO TA,LE it!a.ko
-OR ALL E"TR%E# %" it!au.k
=$ERE
au.nr EB it!au.k'au.nr A"D
(ltrp LE >!cdate)
*&---------------------------------------------------------------------*
* se#ect into it_me# tab#e: or"er number an" noti+ication
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 7/20
* number base" on the or"er number se#ecte"
*&---------------------------------------------------------------------*
#ELE7T
au.nr
1mnum
-RO& 1mel
%"TO TA,LE it!1mel
-OR ALL E"TR%E# %" it!au.k
=$ERE
au.nr EB it!au.k'au.nr)
E"D%-)
E"D%-)
*&---------------------------------------------------------------------*
* R/AD T=/ R/2ORD0 <OMR T=/ A;O!/ POPAT/D 34T/R4A TA;/
* 34TO WOR> AR/A A4D T=/4 POPAT/ T=/ <34A 34T/R4A
* TA;/
*&---------------------------------------------------------------------*
* rea" interna# tab#e it_7est into or% area a_7est
LOOP AT it!0est %"TO wa!0est)
* rea" it_au+% base" on ob7ect number +rom a_7est
READ TA,LE it!au.k %"TO wa!au.k =%T$ <E* ob0nr @ wa!0est'ob0nr)
* i+ recor"s +oun"
%- sy'subrc EB 6)
* rea" it_a+%o +or or"er number an" "escription base" on or"er number
READ TA,LE it!a.ko %"TO wa!a.ko =%T$ <E* au.nr @ wa!au.k'au.nr)
* i+ recor"s +oun"
%- sy'subrc EB 6)
wa!.inal'au.nr @ wa!a.ko'au.nr) 1mo8e or"er number to it_+ina#
wa!.inal'ktext @ wa!au.k'ktext) 1mo8e "escription to it_+ina#
EL#E)
* i+ no recor" +oun" then mo8e to ne,t #oop pass
7O"T%"8E)
E"D%-)
EL#E)
* i+ no recor" +oun" then mo8e to ne,t #oop pass
7O"T%"8E)
E"D%-)
* rea" it_me# +or "escription base" on the or"er number se#ecte" abo8e
READ TA,LE it!1mel %"TO wa!1mel =%T$ <E* au.nr @ wa!.inal'au.nr)
* i+ recor"s +oun" %- sy'subrc EB 6)
wa!.inal'1mnum @ wa!1mel'1mnum) 1mo8e noti+ication number to it_+ina#
E"D%-)
* +ina##$ appen" the recor"s into the +ina# interna# tab#e
APPE"D wa!.inal TO it!.inal) 1appen" a_+ina# into it_+ina#
7LEAR wa!.inal) 1c#ear or% area
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 8/20
7LEAR wa!au.k) 1c#ear or% area
7LEAR wa!1mel) 1c#ear or% area
E"DLOOP)
*&---------------------------------------------------------------------*
* TO 2O4T T=/ 4M;/R O< R/2ORD0 34 T=/ <34A 34T/R4A
* TA;/ A4D R/TR4 TO 0//2T3O4 02R//4
* 3< 4O R/2ORD0 /930T0 T=/4 A4 34<ORMAT3O4 M/00G/ 30 D30PA./D
*&---------------------------------------------------------------------*
DE#7R%,E TA,LE it!.inal
L%"E# >!line!count)
%- 2 >!line!count EB 6 4)
&E##AGE i665) 1error message
E:%T)
E"D%-)
*&---------------------------------------------------------------------*
* /4D-O<-0//2T3O4
*&---------------------------------------------------------------------*
E"D'O-'#ELE7T%O")
*&---------------------------------------------------------------------*
* <3/D 2ATAOG <OR <3R0T GR3D D30PA.
*&---------------------------------------------------------------------*
PER-OR& .ield!catalo()
*&---------------------------------------------------------------------*
* 0ORT WRT WOR> ORD/R 4M;/R <OR <3R0T GR3D D30PA.
*&---------------------------------------------------------------------*
PER-OR& sort!.ield)
*&---------------------------------------------------------------------* * <OR A.OT <OR <3R0T GR3D D30PA.
*&---------------------------------------------------------------------*
PER-OR& set!layout)
*&---------------------------------------------------------------------*
* D30PA. R/2ORD0 34 A! GR3D <OR <3R0T GR3D D30PA.
*&---------------------------------------------------------------------*
PER-OR& al>!display)
*&---------------------------------------------------------------------*
*& 0;ROT34/ D/<343T3O40
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& <orm <3/D_2ATAOG
*&---------------------------------------------------------------------*
* 0;-ROT34/ <3/D_2ATAOG 0/D TO 0/T T=/ 2OM40 <OR
* T=/ A! GR3D 5OTPT <ORMAT6
* 0/T0 T=/ 2OM4 4AM/ A4D T=/ OTPT /4GT= <OR T=/ <3/D0
*----------------------------------------------------------------------*
-OR& .ield!catalo( )
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 9/20
wa!.ield'.ieldname @ 9-LAG9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield'tabname @ 9%T!-%"AL9) 1 interna# tab#e name
wa!.ield'outputlen @ 5) 1 output #ength on screen
wa!.ield'checkbox @ c!check) 1 print as chec%bo,
wa!.ield'edit @ c!check) 1 ma%e +ie#" open +or input
wa!.ield'seltext!l @ 9 9) 1 hea"er in+ormation
APPE"D wa!.ield TO it!.ield) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield) 1 c#ear +ie#" cata#og or% area
wa!.ield'.ieldname @ 9A8-"R9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield'tabname @ 9%T!-%"AL9) 1 interna# tab#e name
wa!.ield'outputlen @ 56) 1 output #ength on screen
wa!.ield'seltext!l @ text'66) 1 hea"er in+ormation
APPE"D wa!.ield TO it!.ield) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield) 1 c#ear +ie#" cata#og or% area
wa!.ield'.ieldname @ 9<TE:T9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield'tabname @ 9%T!-%"AL9) 1 interna# tab#e name
wa!.ield'outputlen @ ;F) 1 output #ength on screen wa!.ield'seltext!l @ text'66;) 1 hea"er in+ormation
APPE"D wa!.ield TO it!.ield) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield) 1 c#ear +ie#" cata#og or% area
wa!.ield'.ieldname @ 9B&"8&9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield'tabname @ 9%T!-%"AL9) 1 interna# tab#e name
wa!.ield'outputlen @ 55) 1 output #ength on screen
wa!.ield'seltext!l @ text'66F) 1 hea"er in+ormation
APPE"D wa!.ield TO it!.ield) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield) 1 c#ear +ie#" cata#og or% area
E"D-OR&) 1 <3/D_2ATAOG
*&---------------------------------------------------------------------*
*& <orm 0ORT_<3/D
*&---------------------------------------------------------------------*
* 0;-ROT34/ 0ORT_<3/D 30 0/D TO 0ORT T=/ R/2ORD0 34 T=/
* 34T/R4A TA;/ ;A0/D O4 T=/ G3!/4 <3/D A4D 4ATR/ O<
* 0ORT34G TO ;/ DO4/ 5A02/4D34G OR D/02/4D34G6
*----------------------------------------------------------------------*
-OR& sort!.ield )
wa!sort'spos @ 3) 1 sort priorit$
wa!sort'.ieldname @ 9A8-"R9) 1 +ie#" on hich recor"s sorte"
wa!sort'tabname @ 9%T!-%"AL9) 1 interna# tab#e name
wa!sort'up @ c!check) 1 sort ascen"ing
APPE"D wa!sort TO it!sort) 1 appen" sort in+o interna# tab#e
7LEAR wa!sort) 1 c#ear sort in+o or% area
E"D-OR&) 1 0ORT_<3/D
*&---------------------------------------------------------------------*
*& <orm 0/T_A.OT
*&---------------------------------------------------------------------*
* 0;-ROT34/ 0/T_A.OT 30 0/D TO 0/T T=/ D30PA. O< T=/
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 10/20
* A! GR3D 34/0 34 AT/R4AT3!/ 2OOR0
*----------------------------------------------------------------------*
-OR& set!layout )
wa!layout'ebra @ c!check) 1 so set co#ors o+ #ine a#ternati8e#$
E"D-OR&) 1 0/T_A.OT
*&---------------------------------------------------------------------*
*& <orm A!_D30PA.
*&---------------------------------------------------------------------*
* 0;-ROT34/ A!_D30PA. 30 0/D TO 0/T T=/ PARAM/T/R0
* <OR T=/ <42T3O4 MOD/ R/0/_A!_GR3D_D30PA.
* A4D PA00 T=/ 34T/R4A TA;/ /930T34G T=/ R/2ORD0 TO ;/
* D30PA./D 34 T=/ GR3D <ORMAT
*----------------------------------------------------------------------*
-OR& al>!display )
7ALL -8"7T%O" 9RE8#E!ALV!GR%D!D%#PLA*9
E:PORT%"G* 3_34T/R<A2/_2=/2> E C C
* 3_;.PA0034G_;<</R E C C
* 3_;<</R_A2T3!/ E C C
i!callback!pro(ram @ >!rep!id 1 report i"
i!callback!p.!status!set @ 9P-9 1 +or P<-0TAT0
i!callback!user!command @ 98#ER!7O&&A"D9 1 +or ser-2omman"
* 3_2A;A2>_TOP_O<_PAG/ E C C
* 3_2A;A2>_=TM_TOP_O<_PAG/ E C C
* 3_2A;A2>_=TM_/4D_O<_30T E C C
* 3_0TR2TR/_4AM/ E
* 3_;A2>GRO4D_3D E C C
* 3_GR3D_T3T/ E
* 3_GR3D_0/TT34G0 E
is!layout @ wa!layout 1 +or #a$out
it!.ieldcat @ it!.ield 1 +ie#" cata#og
* 3T_/92D34G E
* 3T_0P/23A_GROP0 E
it!sort @ it!sort 1 sort in+o
* 3T_<3T/R E
* 30_0/_=3D/ E
* 3_D/<AT E C9C
* i_sa8e E CAC
* is_8ariant E a_8ariant 1 8ariant name
* 3T_/!/4T0 E
* 3T_/!/4T_/93T E
* 30_PR34T E
* 30_R/PR/P_3D E
* 3_02R//4_0TART_2OM4 E '
* 3_02R//4_0TART_34/ E '
* 3_02R//4_/4D_2OM4 E '
* 3_02R//4_/4D_34/ E '
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 11/20
* 3_=TM_=/3G=T_TOP E '
* 3_=TM_=/3G=T_/4D E '
* 3T_A!_GRAP=320 E
* 3T_=.P/R34> E
* 3T_ADD_<3/D2AT E
* 3T_/92/PT_@34<O E
* 3R_0A!_<02R//4_ADAPT/R E
* 3MPORT34G
* /_/93T_2A0/D_;._2A/R E
* /0_/93T_2A0/D_;._0/R E
TA,LE#
t!outtab @ it!.inal 1 interna# tab#e
E:7EPT%O"#
pro(ram!error @ 3
OT$ER# @ 5)
%- sy'subrc C 6)
&E##AGE %D sy'ms(id T*PE sy'ms(ty "8&,ER sy'ms(no
=%T$ sy'ms(>3 sy'ms(>5 sy'ms(> sy'ms(>;)
E"D%-)
E"D-OR&) 1 A!_D30PA.
*&---------------------------------------------------------------------*
*& <orm p+
*&---------------------------------------------------------------------*
* 0;-ROT34/ P< 30 0/D TO 0/T T=/ P<-0TAT0 O< T=/ 02R//4
* O4 W=32= T=/ A! GR3D 30 D30PA./D
*----------------------------------------------------------------------*
* --FRT_/9TA;
*----------------------------------------------------------------------*
-OR& p. 8#%"G rt!extab T*PE slis!t!extab)
#ET P-'#TAT8# 9?TG!#TAT9)
E"D-OR&) 1p+
*&---------------------------------------------------------------------*
*& <orm 0/R_2OMMA4D
*&---------------------------------------------------------------------*
* 0;-ROT34/ 0/R_2OMMA4D 30 0/D TO =A4D/ T=/ 0/R A2T3O4
* A4D /9/2T/ T=/ APPROP3AT/ 2OD/
*----------------------------------------------------------------------*
* --F!_O>2OD/ use" to capture the +unction co"e
* o+ the user-"e+ine" push-buttons
* --F_0/<3/D te,t
*----------------------------------------------------------------------*
-OR& user!command 8#%"G l>!okcode L%<E sy'ucomm l!sel.ield T*PE slis!sel.ield)
* assign the +unction co"e to 8ariab#e 8_o%co"e
l>!okcode @ sy'ucomm)
* han"#e the co"e e,ecution base" on the +unction co"e encountere"
7A#E l>!okcode)
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 12/20
* hen the +unction co"e is /9/2T/ then process the se#ecte" recor"s
=$E" 9E:E78TE9)
* re+resh it_process hen user processes se#ecte" recor"s
RE-RE#$ it!process)
* to re+#ect the "ata change" into interna# tab#e
DATA + re.!(rid T*PE RE- TO cl!(ui!al>!(rid) 1ne
%- re.!(rid %# %"%T%AL)
7ALL -8"7T%O" 9GET!GLO,AL#!-RO&!#LV7!-8LL#7R9
%&PORT%"G
e!(rid @ re.!(rid)
E"D%-)
%- "OT re.!(rid %# %"%T%AL)
7ALL &ET$OD re.!(rid'check!chan(ed!data)
E"D%-)
*----------------------------------------------------------------------*
* sort the interna# tab#e b$ +#ag "escen"ing so that the se#ecte"
* recor"s are appen"e" at the beginning o+ interna# tab#e
*----------------------------------------------------------------------*
#ORT it!.inal ,* .la( DE#7E"D%"G)
*----------------------------------------------------------------------*
* mo8e the se#ecte" recor"s +rom +ina# interna# tab#e into another
* interna# tab#e so that the$ can be processe"
*----------------------------------------------------------------------*
LOOP AT it!.inal %"TO wa!.inal =$ERE .la( @ 9:9)
wa!process'au.nr @ wa!.inal'au.nr)
wa!process'ktext @ wa!.inal'ktext)
wa!process'1mnum @ wa!.inal'1mnum)
APPE"D wa!process TO it!process)
E"DLOOP)
* re+resh the A! Gri" output +rom interna# tab#e
l!sel.ield're.resh @ c!check)
* no a## the se#ecte" recor"s b$ the user at run-time are appen"e" into
* into a ne interna# tab#e hich can no be use" to processe" as per the
* user reuirements
DATA + line!count3 T*PE i)
DE#7R%,E TA,LE it!process
L%"E# line!count3)
%- line!count3 GE 3)
PER-OR& user!action)
EL#E)
&E##AGE e665)
E"D%-)
=$E" 9#EL!ALL9)
* to se#ect a## the recor"s "isp#a$e" in A! Gri"
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 13/20
LOOP AT it!.inal %"TO wa!.inal)
wa!.inal'.la( @ 9:9)
&OD%-* it!.inal -RO& wa!.inal)
E"DLOOP)
* re+resh the A! Gri" output +rom interna# tab#e
l!sel.ield're.resh @ c!check)
=$E" 9DE#EL!ALL9)
* to "ese#ect a## the recor"s "isp#a$e" in A! Gri"
LOOP AT it!.inal %"TO wa!.inal)
wa!.inal'.la( @ 9 9)
&OD%-* it!.inal -RO& wa!.inal)
E"DLOOP)
* re+resh the A! Gri" output +rom interna# tab#e
l!sel.ield're.resh @ c!check)
E"D7A#E)
E"D-OR&) 10/R_2OMMA4D
*&---------------------------------------------------------------------*
*& <orm <B_!AR3A4T_=/P
*&---------------------------------------------------------------------*
* 0;-ROT34/ +B_8ariant_he#p TO G/T A <B =/P <OR !AR3A4T
* 0//2T3O4 A4D D30PA. DATA A22ORD34G.
*----------------------------------------------------------------------*
* --P_P_!AR te,t
*----------------------------------------------------------------------*
-OR& .;!>ariant!help 8#%"G p!p!>ar)
7ALL -8"7T%O" 9RE8#E!ALV!VAR%A"T!-;9
E:PORT%"G
is!>ariant @ wa!>ariant 1 e,port 8ariant
* 3_TA;4AM/_=/AD/R E
* 3_TA;4AM/_3T/M E
* 3T_D/<AT_<3/D2AT E
i!sa>e @ 9A9 1 #a$out +or a## users
i!display!>ia!(rid @ 9:9 1 gri" 8ie o+ 8ariants
%&PORT%"G
* /_/93T E
es!>ariant @ wa!i!>ariant 1 import 8ariant
E:7EPT%O"#
not!.ound @ 3
pro(ram!error @ 5
OT$ER# @ )
%- sy'subrc @ 6)
* PA00 T=/ 0//2T/D !AR3A4T TO T=/ 0//2T3O4 02R//4 <3/D
p!p!>ar @ wa!i!>ariant'>ariant)
EL#E%- sy'subrc C 6)
&E##AGE %D sy'ms(id T*PE sy'ms(ty "8&,ER sy'ms(no
=%T$ sy'ms(>3 sy'ms(>5 sy'ms(> sy'ms(>;)
E"D%-)
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 14/20
E"D-OR&) 1 <B_!AR3A4T_=/P
*&---------------------------------------------------------------------*
*& <orm G/T_D/<AT_!AR3A4T
*&---------------------------------------------------------------------*
* 0;-ROT34/ G/T_D/<AT_!AR3A4T TO PA00 T=/ D/<AT !AR3A4T
* 3< 0/R DO/04CT /4T/R0 A4. !A/ <OR T=/ !AR3A4T
*----------------------------------------------------------------------*
* --P_P_!AR 8ariant name
*----------------------------------------------------------------------*
-OR& (et!de.ault!>ariant 8#%"G l!p!>ar)
7ALL -8"7T%O" 9RE8#E!ALV!VAR%A"T!DE-A8LT!GET9
E:PORT%"G
i!sa>e @ 9A9
7$A"G%"G
cs!>ariant @ wa!>ariant 18ariant name
E:7EPT%O"#
wron(!input @ 3
not!.ound @ 5
pro(ram!error @
OT$ER# @ ;)
* 3< D/<AT !AR3A4T <O4D
%- sy'subrc @ 6)
* PA00 T=/ D/<AT !AR3A4T TO T=/ 0//2T3O4 02R//4 <3/D
l!p!>ar @ wa!>ariant'>ariant)
EL#E%- sy'subrc C 6)
&E##AGE %D sy'ms(id T*PE sy'ms(ty "8&,ER sy'ms(no
=%T$ sy'ms(>3 sy'ms(>5 sy'ms(> sy'ms(>;)
E"D%-)
E"D-OR&) 1 G/T_D/<AT_!AR3A4T
*&---------------------------------------------------------------------*
*& <orm 2=/2>_!AR3A4T_/930T/42/
*&---------------------------------------------------------------------*
* 0;-ROT34/ 2=/2>_!AR3A4T_/930T/42/ TO !A3DAT/ T=/ !AR3A4T
* 4AM/ /4T/R/D ;. T=/ 0/R
* 3< !AR3A4T <O4D T=/4 /9/2T/
* /0/ D30PA. /RROR M/00AG/
*----------------------------------------------------------------------*
* --P_P_!AR 8ariant name
*----------------------------------------------------------------------*
-OR& check!>ariant!existence 8#%"G l!p!>ar)
*&---------------------------------------------------------------------*
* A003G4 T=/ !A/ O< T=/ !AR3A4T /4T/R/D ;. 0/R TO T=/
* WOR> AR/A <3/D A4D 2=/2> <OR 3T0 /930T/42/
*&---------------------------------------------------------------------*
wa!>ariant'>ariant @ l!p!>ar)
*&---------------------------------------------------------------------*
* TO 2=/2> T=/ /930T/42/ <OR !AR3A4T 2ORR/0PO4D34G TO
* /930T34G !AR3A4T 3< T=/ 0/R /4T/R0 0OM/ !A/ <OR
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 15/20
* T=/ PARAM/T/R
*&---------------------------------------------------------------------*
7ALL -8"7T%O" 9RE8#E!ALV!VAR%A"T!E:%#TE"7E9
E:PORT%"G
i!sa>e @ 9A9
7$A"G%"G
cs!>ariant @ wa!>ariant 1 8ariant name
E:7EPT%O"#
wron(!input @ 3
not!.ound @ 5
pro(ram!error @
OT$ER# @ ;)
%- sy'subrc C 6)
&E##AGE e663)
E"D%-)
E"D-OR&) 1 2=/2>_!AR3A4T_/930T/42/
*&---------------------------------------------------------------------*
*& <orm 0/R_A2T3O4
*&---------------------------------------------------------------------*
* 0;-ROT34/ 0/R_A2T3O4 2A4 ;/ 0/D A0 P/R T=/ 0/R R/@3R/M/4T
* TO PRO2/00 T=/ 0//2T/D R/2ORD0 34 A! GR3D D30PA.
*----------------------------------------------------------------------*
-OR& user!action)
* user co"e to process se#ecte" recor"s in interna# tab#e
* it_process
*&---------------------------------------------------------------------*
* <3/D 2ATAOG <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
PER-OR& .ield!catalo(3)
*&---------------------------------------------------------------------*
* 0ORT WRT WOR> ORD/R 4M;/R <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
PER-OR& sort!.ield3)
*&---------------------------------------------------------------------*
* <OR A.OT <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
PER-OR& set!layout3)
*&---------------------------------------------------------------------*
* D30PA. R/2ORD0 34 A! GR3D <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
PER-OR& al>!display3)
E"D-OR&) 1 <B_<3/_R/@/0T
*&---------------------------------------------------------------------*
*& <orm <3/D_2ATAOG( <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
* 0;-ROT34/ <3/D_2ATAOG 0/D TO 0/T T=/ 2OM40 <OR
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 16/20
* T=/ A! GR3D 5OTPT <ORMAT6
* 0/T0 T=/ 2OM4 4AM/ A4D T=/ OTPT /4GT= <OR T=/ <3/D0
*----------------------------------------------------------------------*
-OR& .ield!catalo(3 )
RE-RE#$ it!.ield3)
7LEAR wa!.ield3)
wa!.ield3'.ieldname @ 9A8-"R9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield3'tabname @ 9%T!PRO7E##9) 1 interna# tab#e name
wa!.ield3'outputlen @ 56) 1 output #ength on screen
wa!.ield3'seltext!l @ text'66) 1 hea"er in+ormation
APPE"D wa!.ield3 TO it!.ield3) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield3) 1 c#ear +ie#" cata#og or% area
wa!.ield3'.ieldname @ 9<TE:T9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield3'tabname @ 9%T!PRO7E##9) 1 interna# tab#e name
wa!.ield3'outputlen @ ;F) 1 output #ength on screen
wa!.ield3'seltext!l @ text'66;) 1 hea"er in+ormation
APPE"D wa!.ield3 TO it!.ield3) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield3) 1 c#ear +ie#" cata#og or% area
wa!.ield3'.ieldname @ 9B&"8&9) 1 name o+ +ie#" +rom interna# tab#e
wa!.ield3'tabname @ 9%T!PRO7E##9) 1 interna# tab#e name
wa!.ield3'outputlen @ 55) 1 output #ength on screen
wa!.ield3'seltext!l @ text'66F) 1 hea"er in+ormation
APPE"D wa!.ield3 TO it!.ield3) 1 appen" +ie#" cata#og interna# tab#e
7LEAR wa!.ield3) 1 c#ear +ie#" cata#og or% area
E"D-OR&) 1 <3/D_2ATAOG(
*&---------------------------------------------------------------------*
*& <orm 0ORT_<3/D( <OR 0//2T/D R/2ORD0*&---------------------------------------------------------------------*
* 0;-ROT34/ 0ORT_<3/D 30 0/D TO 0ORT T=/ R/2ORD0 34 T=/
* 34T/R4A TA;/ ;A0/D O4 T=/ G3!/4 <3/D A4D 4ATR/ O<
* 0ORT34G TO ;/ DO4/ 5A02/4D34G OR D/02/4D34G6
*----------------------------------------------------------------------*
-OR& sort!.ield3)
wa!sort3'spos @ 3) 1 sort priorit$
wa!sort3'.ieldname @ 9A8-"R9) 1 +ie#" on hich recor"s sorte"
wa!sort3'tabname @ 9%T!PRO7E##9) 1 interna# tab#e name
wa!sort3'up @ c!check) 1 sort ascen"ing
APPE"D wa!sort3 TO it!sort3) 1 appen" sort in+o interna# tab#e
7LEAR wa!sort3) 1 c#ear sort in+o or% area
E"D-OR&) 1 0ORT_<3/D(
*&---------------------------------------------------------------------*
*& <orm 0/T_A.OT( <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
* 0;-ROT34/ 0/T_A.OT 30 0/D TO 0/T T=/ D30PA. O< T=/
* A! GR3D 34/0 34 AT/R4AT3!/ 2OOR0
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 17/20
*----------------------------------------------------------------------*
-OR& set!layout3 )
wa!layout3'ebra @ c!check) 1 so set co#ors o+ #ine a#ternati8e#$
E"D-OR&) 1 0/T_A.OT(
*&---------------------------------------------------------------------*
*& <orm A!_D30PA.( <OR 0//2T/D R/2ORD0
*&---------------------------------------------------------------------*
* 0;-ROT34/ A!_D30PA. 30 0/D TO 0/T T=/ PARAM/T/R0
* <OR T=/ <42T3O4 MOD/ R/0/_A!_GR3D_D30PA.
* A4D PA00 T=/ 34T/R4A TA;/ /930T34G T=/ R/2ORD0 TO ;/
* D30PA./D 34 T=/ GR3D <ORMAT
*----------------------------------------------------------------------*
-OR& al>!display3)
7ALL -8"7T%O" 9RE8#E!ALV!GR%D!D%#PLA*9
E:PORT%"G
* 3_34T/R<A2/_2=/2> E C C
* 3_;.PA0034G_;<</R E C C
* 3_;<</R_A2T3!/ E C C
i!callback!pro(ram @ >!rep!id 1 report i"
* i_ca##bac%_p+_status_set E C C
* i_ca##bac%_user_comman" E C C
* 3_2A;A2>_TOP_O<_PAG/ E C C
* 3_2A;A2>_=TM_TOP_O<_PAG/ E C C
* 3_2A;A2>_=TM_/4D_O<_30T E C C
* 3_0TR2TR/_4AM/ E
* 3_;A2>GRO4D_3D E C C
* 3_GR3D_T3T/ E
* 3_GR3D_0/TT34G0 E
is!layout @ wa!layout3 1 +or #a$out
it!.ieldcat @ it!.ield3 1 +ie#" cata#og
* 3T_/92D34G E
* 3T_0P/23A_GROP0 E
it!sort @ it!sort3 1 sort in+o
* 3T_<3T/R E
* 30_0/_=3D/ E
* 3_D/<AT E C9C
* i_sa8e E C C
* is_8ariant E
* 3T_/!/4T0 E
* 3T_/!/4T_/93T E* 30_PR34T E
* 30_R/PR/P_3D E
* 3_02R//4_0TART_2OM4 E '
* 3_02R//4_0TART_34/ E '
* 3_02R//4_/4D_2OM4 E '
* 3_02R//4_/4D_34/ E '
* 3_=TM_=/3G=T_TOP E '
* 3_=TM_=/3G=T_/4D E '
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 18/20
* 3T_A!_GRAP=320 E
* 3T_=.P/R34> E
* 3T_ADD_<3/D2AT E
* 3T_/92/PT_@34<O E
* 3R_0A!_<02R//4_ADAPT/R E
* 3MPORT34G
* /_/93T_2A0/D_;._2A/R E
* /0_/93T_2A0/D_;._0/R E
TA,LE#
t!outtab @ it!process 1 interna# tab#e
E:7EPT%O"#
pro(ram!error @ 3
OT$ER# @ 5)
%- sy'subrc C 6)
&E##AGE %D sy'ms(id T*PE sy'ms(ty "8&,ER sy'ms(no
=%T$ sy'ms(>3 sy'ms(>5 sy'ms(> sy'ms(>;)
E"D%-)
E"D-OR&) 1 A!_D30PA.(
Output Display #creen'shots+'
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 19/20
#election screen .or >ariant
selection+'
-; help pro>ided .or >ariant selection)
%. no input .or >ariant selection/ then DE-A8LT >ariant used)
7/23/2019 ALV Grid Display With Checkbox to Process Selected Records at Runtime
http://slidepdf.com/reader/full/alv-grid-display-with-checkbox-to-process-selected-records-at-runtime 20/20
Report based on the >ariant
used+'
%. no records selected and user click E:E78TE button/ error messa(e 9"O RE7ORD# #ELE7TED9 displayed
Else %. records selected and E:E78TE button is pressed/ the seleected records to be displayed in another ALV
Grid)
These selected records can also be processed as per user re1uirements)