Anda di halaman 1dari 5

GettingStarted Newsletters

Hi,Guest

LogOn

JoinUs

Products

Services&Support

AboutSCN

Downloads

Industries

Training&Education

Partnership

DeveloperCenter

Activity

LinesofBusiness

UniversityAlliances

Events&Webinars

Innovation

Browse

AddaSelectionScreentoaTable
MaintenanceDialog

Version3

createdbyEricPetersononAug22,20132:52AM,lastmodifiedbyEricPetersononAug29,201310:54PM

Share

Tweet

Like

Whenenduserswillmaintainaztablewith100+rows,ithelpstobeabletorestricttheselectionbyanynumberof
selectioncriteria.Thisdocumentattemptstodefinea"bestpractice"methodforcallingatablemaintenancedialog
fromaselectionscreen.

CurrentTableMaintenance

ThestandardwaytoshowatablemaintenancedialogisviaSM30,CallViewMaintenance

oracustomparametertransactionthatcallsSM30foraspecifictable,withparametersVIEWNAMEandUPDATE=
'X'.

Neitheroftheseprovideaninitialselectionscreen.Entriescanberestrictedbycheckingthe"Enterconditions"
radiobutton,butusersaremorefamiliarwithselectionscreensthanwiththedialogboxthatpopsup.Thereforeitis
goodUItouseaselectionscreeninsteadofthe"Enterconditions"radiobutton.

ExampleSelectionScreenDefinition

Inthisexample,anexecutablereporthasbeencreatedwithselectionscreen.

REPORTz_maintain_mytable.

DATAmytableTYPEz_mytable.
DATAselectionsTYPETABLEOFvimsellist.
DATAselectionTYPEvimsellist.

SELECTOPTIONS:so_selop1FORmytablemyfield1,
so_selop2FORmytablemyfield2.

PARAMETERS:p_param1TYPEz_mytablemyfield3,
p_param2TYPEz_mytablemyfield4.

Store

SearchtheCommunity

Communications

Actions

CallingFunctionModules
Whentheuserclicksexecute,theprogramneedstoreadtheirselectionsandcallthetablemaintenancedialog.The
followingcodeshowshowthisiseasilydonebyusingfunctionmodules'VIEW_RANGETAB_TO_SELLIST'and
'VIEW_MAINTENANCE_CALL'.

STARTOFSELECTION.

DEFINEaddsel.
CALLFUNCTION'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
fieldname=&1
append_conjunction='AND'
TABLES
sellist=selections
rangetab=&2[].
ENDOFDEFINITION.

DEFINEaddparam.
IF&2ISNOTINITIAL.
CLEARselection.
selectionviewfield=&1.
selectionvalue=&2.
selectionand_or='AND'.
selectionoperator='EQ'.
APPENDselectionTOselections.
ENDIF.
ENDOFDEFINITION.

add_sel'MYFIELD1'so_selop1.
add_sel'MYFIELD2'so_selop2.

add_par'MYFIELD3'p_param1.
add_par'MYFIELD4'p_param2.

CALLFUNCTION'VIEW_MAINTENANCE_CALL'
EXPORTING
action='U'"forUpdate
view_name='Z_MYTABLE'
complex_selconds_used='X'
TABLES
dba_sellist=selections
EXCEPTIONS
OTHERS=1.
IFsysubrc=1.
MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgno
WITHsymsgv1symsgv2symsgv3symsgv4.
ENDIF.

Horray!Thatisall.Inonly46lines(plustwoforeveryselectoptionorparameter),thiswillbringtheusertofromthe
selectionscreentothetablemaintenancescreen.


Thisisacollaborativedocument.Iftherearebetterwaysofachievingthisfunctionalitydon'thesitatetochimeinand
contribute!

8402Views
Topics:abapTags:user_interface,selection_screen,z_table,table_maintenance_generator,ztable,table_maintenance_dialog

AverageUserRating
(4ratings)

Share

Tweet

2 Like

15Comments
VarunKumarSahuOct17,201311:42AM

Niceone.Averygoodwaytoaddselectionscreen.

Regards,
VarunKumarSahu
Like(0)

ShakeeluddinKhajaNov20,20137:51AM

Thanksforsharing.usefulInformation.

Regards.
Like(0)

MartinAdamDec17,20135:15PM

Excellentarticle,thankyou!
Regards,
Martin
Like(0)

PraveenNenawaJan20,20143:00PM

Hi,
JustaFunctionmoduletodothejob....
Niceonetoknow.

Like(0)

MichaelFallenbchelFeb17,20143:06PM

Greatwork!Butnotperfect.

Let'ssayyouhaveatablewithafieldtypeQUAN13,3.
Nowyoudoyourselectioninthedynamicselectionscreenforthisfieldfrom1to5.

ABAPwilldump,saying"ASSIGN_OFFSET_NOTALLOWED".

"Partofthesourcefield"<VALUE>"wasassignedtoafieldsymbol,
butthisisnotallowedforfieldsoftype"P"."

Anyonehasasolutionforthis?
Like(0)

FrankStiefelingFeb18,20141:22PM(inresponsetoMichaelFallenbchel)

HiMichael,
I'mdealingwiththesameproblem.Formeitseemstobeabuginform
TRANSLATE_SELLIST_TO_WHERETABofprogramSAPLSVIX.
ItriedmanythingsbuthavenosolutionyethowtofillDBA_SELLIST.
I'mstillworking...
Like(0)

MichaelFallenbchelFeb18,20141:27PM(inresponsetoFrankStiefeling)

Correct,themistakeisinTRANSLATE_SELLIST_TO_WHERETAB.

IalreadymadeacallatSAP,firsttheytoldmeVIEW_MAINTENANCE_CALLisnot
released,Itoldthemitis(seehelp"Thefunctionmoduelhasbeenreleased"),
nothingmoresincelastcontactyesterday.

IfthereareanyupdatesIwillletyouknow...
Like(0)

SuhasSahaFeb18,20141:30PM(inresponsetoMichaelFallenbchel)

HelloMichael,

DidyoutrythismethodUsingselectionscreeninTableMaintenance
GeneratorABAPDevelopmentSCNWiki?

BR,
Suhas
Like(0)

SuhasSahaFeb18,20141:29PM

HelloEric,

Sorryforseeingthistoolate

Ihadadifferenttakeonthisproblem&haddocumenteditasaWiKiUsingselectionscreeninTable
MaintenanceGeneratorABAPDevelopmentSCNWiki.

BR,
Suhas
Like(1)

FrankStiefelingFeb18,20141:57PM

HelloSuhas,
IusefunctionFREE_SELECTIONS_DIALOGtocreatedynamicselectionsforapoolofdifferent
tablesofourapplication.
ThenIconvertexportparameterEX_FIELD_RANGEStoDBA_SELLISTtocall
VIEW_MAINTENACE_CALL.
FortheconversionIuseVIEW_RANGETAB_TO_SELLISTandsomecodeofmyown,dependingon
fieldtype.

Butthatdoesn'tworkforfieldsoftypeP.
BR
Frank
Like(0)

MichaelFallenbchelFeb18,20142:07PM(inresponsetoFrankStiefeling)

Samehere:

1.FREE_SELECTIONS_INIT
2.FREE_SELECTIONS_DIALOG
3.VIEW_RANGETAB_SO_SELLIST

4.VIEW_MAINTENANCE_CALL
Like(0)

SuhasSahaFeb18,20143:18PM(inresponsetoMichaelFallenbchel)

HelloGentlemen,

Idon'tusetheVIEW_MAINTENANCE_CALLfunction.IusetheTMGeventAAand
calltheselectionscreeninthere.
IalreadymadeacallatSAP,firsttheytoldme
VIEW_MAINTENANCE_CALLisnotreleased

Interesting,ithoughtthattheFMis"released".Butifyouseethedateitisblank

Somethingfishyisgoingonthere

BR,
Suhas
Like(0)

RaymondGiuseppiFeb18,20143:27PM(inresponsetoSuhasSaha)

Foritmeans"hasalwaysbeenreleased"or"releasedintimesooldthat
nooneinWalldorfremembers".

Youcanalsocheckindocumentationathelp.sap.comthatSAPsuggest
theirusage(FromMiddlelevelentryBCExtendedApplicationsFunction
LibrarySAPLibraryforERP6.0toMiddlelevelentryforgoodold4.0)

Regards,
Raymond
Like(2)

SuhasSahaFeb18,20143:39PM(inresponsetoRaymondGiuseppi)

HelloAll,

Justtoclarify,whenisaid
Idon'tusetheVIEW_MAINTENANCE_CALL
function
imeantforthisscenario.IhaveusedthisFMmanytimes&ithas
alwaysworkedlikeacharm

BR,
Suhas
Like(1)

EricPetersonFeb18,20144:02PM(inresponsetoMichaelFallenbchel)

Thanksforthefeedbackeveryone!I'mlearningaton.

IlikehowSuhas'methodusesthestandardeventsinsteadofslappingan
executablereportonthefrontend.Perhapswecancombineourdocumentand
wikianddetermineabestpractice.

Myonlyconcernwithhismethodisthefilteringontheapplicationserverandnot
thedatabaseisthattherightchoiceinthisscenario?Anddoes
VIEW_MAINTENANCE_CALLdothesamething?
Like(0)

SiteIndex
Privacy

ContactUs
TermsofUse

SAPHelpPortal
LegalDisclosure

Copyright

FollowSCN

Anda mungkin juga menyukai