You are on page 1of 17

29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

GetStarted

Solutions Support Training Community Developer Partner

About

Community / Blogs Actions

VerysimpleALVinpopup
window
May7,2014 | 4,847Views |
GeorgeShlyahov
morebythisauthor

ABAPDevelopment
alv

share
0 share
0 tweet share
0 2
like

Follow

Hello,colleagues!

Itmaybeusefulineverydayprogrammingtousequickandsimple
solutions.

So,IwroteafunctionmoduleZ_VERY_SIMPLE_ALVwhichallowsyou
todisplayanALVgridinapopupwindowatrailwayspeed.

HereyoucanseetheFM:

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 1/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

FUNCTIONz_very_simple_alv.
*"
*"*"Localinterface:
*"IMPORTING
*"REFERENCE(I_START_COLUMN)TYPEIDEFAULT25
*"REFERENCE(I_START_LINE)TYPEIDEFAULT6
*"REFERENCE(I_END_COLUMN)TYPEIDEFAULT100
*"REFERENCE(I_END_LINE)TYPEIDEFAULT10
*"REFERENCE(I_TITLE)TYPESTRINGDEFAULT'ALV'
*"REFERENCE(I_POPUP)TYPEFLAGDEFAULT''
*"TABLES
*"IT_ALVTYPESTANDARDTABLE
*"

DATAgo_alvTYPEREFTOcl_salv_table.

TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table=go_alv
CHANGING
t_table=it_alv[]).

CATCHcx_salv_msg.
ENDTRY.

DATA:lr_functionsTYPEREFTOcl_salv_functions_list.

lr_functions=go_alv>get_functions().
lr_functions>set_all('X').

IFgo_alvISBOUND.
IFi_popup='X'.
go_alv>set_screen_popup(
start_column=i_start_column
end_column=i_end_column
start_line=i_start_line
end_line=i_end_line).
ENDIF.

go_alv>display().

ENDIF.

ENDFUNCTION.

Youcanuseitlikethis:

REPORTz_very_simple_alv.

DATAgt_tabTYPESTANDARDTABLEOFsflights.

SELECT*FROMsflightsINTOTABLEgt_tab.

CALLFUNCTION'Z_VERY_SIMPLE_ALV'
https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 2/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs
TABLES
it_alv=gt_tab.

Asaresult,youwillseetheALVinafullscreenwindow:

TheALVgriddisplaysinafullscreenwindowbydefault,butifyouset
optionalI_POPUPimportingparameterasXthentheALVwillbe
displayedinapopupwindow:

REPORTz_very_simple_alv_popup.

DATAgt_tabTYPESTANDARDTABLEOFsflights.

SELECT*
FROMsflights
INTOTABLEgt_tab.

CALLFUNCTION'Z_VERY_SIMPLE_ALV'
EXPORTING
i_popup='X'
TABLES
it_alv=gt_tab.

TheALVgridinapopupwindow:

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 3/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

Bestregards,
GeorgiyShlyahov

AlertModerator

22Comments

vamsilakshmanpendurti

May7,2014at12:37pm

GoodJob!
Butinse24thatclass(cl_reca_gui_f4_popup)wasnotfound..
howcouldwecallthatclasswithoutthereinsap..
itwillasklikeasfollowscreenshot..
justseethis..

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 4/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

Regards,
vamsii

GeorgeShlyahov Postauthor

May14,2014at7:34am

HiVamsilakshman,
IupdatedthecodeasitwasadvisedbySuhasSaha,so,nowyou
maybeabletouseitinyourSAPsystem.
Bestregards,

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 5/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

GeorgeShlyahov

vamsilakshmanpendurti

May14,2014at10:54am

HiGeorge
thanksforreply..
nowitsworking.
Regards
vamc

TomasBuryanek

May7,2014at2:10pm

HiGeorge,
anyspecialreasonwhyhaveyoudecidedtousecl_reca_gui_f4_popupover
commoncl_salv_table?Alsoyouarenotreturninganyvalue(thatiswhatisF4
usedfor)

vamsilakshmanpendurti

May8,2014at4:51am

HiGeorge.
IcheckedmysystemComponentversion:SAPECC6.0.
And
UsingsystemvariableSYSAPRLinmyprogram..
itwillshowmelike700..
Soumeantosayitsnotworkingbecozof700.?RT..?



Thanks

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 6/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

Vamc

SuhasSaha

May8,2014at4:51pm

TheclassCL_RECA_GUI_F4_POPUPispartofsoftware
componentEAAPPL.Soitsavailabilityisnotdependentonyour
ABAP/Basisrelease.
Iwouldnotsuggestanyoneusingthisclass.Youcancheckthe
demoprogramSALV_DEMO_TABLE_POPUP,ituses
CL_SALV_TABLEtoshowtheALVaspopup.
BR,
Suhas

GeorgeShlyahov Postauthor

May14,2014at10:29am

HiSuhas!
TofollowyouradviceIupdatedthecodeinthis
documentinsuchawayastouseCL_SALV_TABLE
class.
However,ifyouhavetodisplayamodestpopup
windowwithcustomtitleanduserabilitytoselectone
orseveralrows,whichyouwillworkwith,iassumeitis
muchbettertouseCL_RECA_GUI_F4_POPUPclass.
Ithashandymethodsforthisascomparedwith
CL_SALV_TABLEclass.
YoucanseebelowtheFMwhichdisplayssimpleALV
gridinapopupwindow:

FUNCTIONz_very_simple_alv_f4_popup.
*
**Localinterface:
*IMPORTING
*REFERENCE(I_START_COLUMN)TYPEIDEFAULT25
*REFERENCE(I_START_LINE)TYPEIDEFAULT6
*REFERENCE(I_END_COLUMN)TYPEIDEFAULT100

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 7/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

*REFERENCE(I_END_LINE)TYPEIDEFAULT10
*REFERENCE(I_TITLE)TYPESTRINGDEFAULTALV
*TABLES
*IT_ALVTYPESTANDARDTABLE
*

DATA:
go_popupTYPEREFTOcl_reca_gui_f4_popup,
gf_choiceTYPEflag.

CALLMETHODcl_reca_gui_f4_popup=>factory_grid
EXPORTING
it_f4value=it_alv[]
if_multi=abap_false
id_title=i_title
RECEIVING
ro_f4_instance=go_popup.

CALLMETHODgo_popup>display
EXPORTING
id_start_column=i_start_column
id_start_line=i_start_line
id_end_column=i_end_column
id_end_line=i_end_line
IMPORTING
et_result=it_alv[]
ef_cancelled=gf_choice.

ENDFUNCTION.


Youcanuseitlikethis:

REPORTz_test.

DATAgt_tabTYPESTANDARDTABLEOFsflights.

SELECT*
FROMsflights
INTOTABLEgt_tab.

CALLFUNCTION'Z_VERY_SIMPLE_ALV_F4_POPUP'
TABLES
it_alv=gt_tab.

ItisclearthatCL_RECA_GUI_F4_POPUPclassdoest
replaceCL_GUI_ALV_GRIDclass.Butitisquiteuseful
todisplaysimplegridswithsmallrangeoffunctionality.

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 8/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

Bestregards,
GeorgeShlyahov

SuhasSaha

May15,2014at8:42am

Itisclearthat
CL_RECA_GUI_F4_POPUPclass
doestreplace
CL_GUI_ALV_GRIDclass.Butit
isquiteusefultodisplaysimple
gridswithsmallrangeof
functionality.

TheRECAclassusestheSALVOMto
displaythepopup,nottheGUIclasses
directly.

whichyouwillworkwith,iassume
itismuchbettertouse
CL_RECA_GUI_F4_POPUP
class.Ithashandymethodsfor
thisascomparedwith
CL_SALV_TABLEclass.

TheRECAclassjustencapsulatesthe
SALVOMmethodsintheDISPLAY()
method.
Maybeyoudidnotgetmypoint.Iamnot
sayingnottouseit,ifitsavailableinyour
systemuseit.TheRECAclassisinthe
EAAPPLs/warecomponentandIMO
thereisnotguaranteethatitisavailablein
everySAPinstallation.Thecorrect
https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 9/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

approachshouldbetheonefollowedby
EitanRosenberg.
Inmycurrentproject,ihavecreateda
MenuexitwhereihaveusedtheSALV
OMtodisplaythepopup&handleseveral
userinteractions.
BR,
Suhas

GaurabBanerji

May8,2014at8:45am

worksformeonEHP7forSAPERP6.0.thanksforthecodeitsveryuseful..
bookmarkingit

zgnEFE

May14,2014at10:59am

HiGeorge
Itisveryuseful.Thanks.
Regards.
zgn

EitanRosenberg

May15,2014at6:45am

Hi,
ThisisathoughtinspiringpostsoIdidthesamethingbutwithaclass.
AlsoIaddtheoptiontogetadouble_clickinfo.
ThisisalocalclassbutitcanbetransformdtoglobalABAPclasses(SE24).
Regards.

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 10/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

REPORTy_r_eitan_test_08_18.

*
*
*
*
CLASSmy_cl_salv_pop_upDEFINITION.

PUBLICSECTION.

CLASSDATA:BEGINOFst_double_click.
CLASSDATA:rowTYPEsalv_de_row,
columnTYPEsalv_de_column.
CLASSDATA:ENDOFst_double_click.

CLASSMETHODS:popup
IMPORTING
start_lineTYPEiDEFAULT2
end_lineTYPEiDEFAULT15
start_columnTYPEiDEFAULT25
end_columnTYPEiDEFAULT150
popupTYPEbooleanDEFAULT''
value(t_table)TYPEtable.

CLASSMETHODS:double_clickFOREVENTdouble_clickOFcl_
salv_events_table
IMPORTINGrowcolumn.

ENDCLASS."my_cl_salv_pop_upDEFINITION
*
*
*
*
CLASSmy_cl_salv_pop_upIMPLEMENTATION.

METHODpopup.

DATA:ob_salv_tableTYPEREFTOcl_salv_table.

TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table=ob_salv_table
CHANGING
t_table=t_table).

CATCHcx_salv_msg.
ENDTRY.
https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 11/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs


CHECKob_salv_tableISBOUND.

ob_salv_table>set_screen_popup(
start_column=start_column
end_column=end_column
start_line=start_line
end_line=end_line).

DATA:ob_salv_eventsTYPEREFTOcl_salv_events_table.

ob_salv_events=ob_salv_table>get_event().

SETHANDLERdouble_clickFORob_salv_events.

ob_salv_table>display().

ENDMETHOD."popup
*
*
METHODdouble_click.

st_double_clickrow=row.
st_double_clickcolumn=column.

ENDMETHOD."raise_double_click
*
*

ENDCLASS."my_cl_salv_pop_upIMPLEMENTATIO
N

*
*

STARTOFSELECTION.
PERFORMat_start_of_selection.

*
*
*
*
FORMat_start_of_selection.

DATAit_sflightsTYPETABLEOFsflights.

SELECT*INTOTABLEit_sflights
FROMsflightsUPTO100ROWS.

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 12/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs


my_cl_salv_pop_up=>popup(EXPORTINGt_table=it_sflights
).

MESSAGEs000(oo)WITH
my_cl_salv_pop_up=>st_double_clickrow
my_cl_salv_pop_up=>st_double_clickcolumn.


ENDFORM."at_start_of_selection

AhmadFeisalAbdulHalim

May15,2014at7:01am

Hi,
Thankyou.Veryeasyanduseful.

YIGITFIRTINA

May15,2014at7:24am

HiGeorge
ItriedtocreatethefunctioninSE37butwhenIwanttoactivatethe
function,thereisanerrorlikebelow
FieldIT_ALV[]isunknown.Itisneitherinoneofthespecified

tablesnordefinedbyaDATAstatement..........

Canyouhelpaboutthat?
Regards
Frtna

AhmadFeisalAbdulHalim

May15,2014at8:12am
https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 13/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

FirstclickonTabsTablesandfillin:
IT_ALVTYPESTANDARD
TABLE
Next,TabsImport:
I_START_LINETYPEIDEFAULT6
I_END_COLUMNTYPEIDEFAULT100
I_END_LINETYPEIDEFAULT10
I_TITLETYPESTRINGDEFAULTALV
I_POPUPTYPEFLAGDEFAULT

YIGITFIRTINA

May15,2014at8:30am

HiFeisal
WhenIenteredtheTabletablikethat
IT_ALVTYPESTANDARD

TABLE

errormesaage:TABLESparametersareobsolete!

Regards

AhmadFeisalAbdulHalim

May15,2014at8:34am

HiFirtina,
Giveyouscreenshots

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 14/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

YIGITFIRTINA

May15,2014at8:59am

Feisal
Thanksalot.Nowitsworking.
Regards

santoshbaratam

May15,2014at8:51am

HiYigit,
ItisjustaWarningMessage.Youcango
aheadbypressinganenter.
PleasefindSAPDocumentationas
follows,inregardtoTABLESparameters,
TABLESparametersaretable
parameters.Tableparametersare
obsolete
CHANGINGparametersthataretypedas
internalstandardtableswithaheader
line.Ifaninternaltablewithoutaheader
lineoratablebodyispassedasan
actualparametertosuchaformal
parameter,anemptyheaderlineis
generated
inthefunctionmodule.Ifaninternaltable
withaheaderlineisusedasan
actualparameter,boththetablebodyand
theheaderlinearepassedtothe
functionmodule.Inthecaseofformal
parametersdefinedwithTABLES,no
value
transmissionispossible.
FormalparametersdefinedwithTABLES
canbereplacedbyformalparameters
definedwithCHANGING.Alocalwork

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 15/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

areacanbecreatedinthefunction
modulefortheinternaltableusingthe
additionLIKELINEOFitaboftheDATA
statementinthefunctionmodule.
Thanks,
SantoshKB.

LokeshDoggala

May15,2014at11:16am

Good..InaprojectwithheavyALVwork..Thiscancutoutalotofwork..

MaximKazimirchenko

May15,2014at12:26pm

Good,itsverysimple,analogprogramSALV_DEMO_TABLE_REAL_SIMPLE

GanuK

October31,2016at12:13am

isitpossibletoaddahotspotinsidethepopupwindowandcallatransaction?

MohamedHamdy

December27,2016at8:11pm

ITSWORKING
THANKYOUUUUU

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 16/17
29/4/2017 VerysimpleALVinpopupwindow|SAPBlogs

AddComment

Share & Follow


Privacy TermsofUse LegalDisclosure Copyright Trademark Sitemap Newsletter

https://blogs.sap.com/2014/05/07/verysimplealvinpopupwindow/ 17/17

You might also like