Professional Documents
Culture Documents
Chapter 3 - ABAP Dictionary - Data Dictionary - DDIC - 2 - SAP ABAP - Hands-On Test Projects With Business Scenarios PDF
Chapter 3 - ABAP Dictionary - Data Dictionary - DDIC - 2 - SAP ABAP - Hands-On Test Projects With Business Scenarios PDF
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Recent
Topics
Tutorials
NEXT
PREV
Highlights
Chapter 4: ABAP
Language Basics
CHAPTER3
Settings
Feedback
ABAPDictionary/DataDictionary/DDIC2
Sign Out
CreationofcustomDDICobjectscontinuesinthischapter.Youwill
createDDICobjects:viewsandsearchhelps.Youwillcreateviewsand
searchhelpsusingcustomtablesaswellastheSAPdeliveredtables.The
searchhelpsusingtheSAPdeliveredtablesaretestedusingABAP
programs.ABAPprogrammingisintroducedinthischapteronapreview
basis.
Settings
10 days left in your trial. Subscribe.
Feedback
DDICObjectsViews
IntheDDIC,youcancreatethefollowingfourtypesofviews:
Sign Out
1. Database
2. Projection
3. Maintenance
4. Help
Inthischapter,theviewtypes1and2willbecreatedanddemonstrated
theviewtype3willbedescribed.Viewtype4willbecoveredinChapter7
entitledModularization.
DatabaseViews
Adatabaseviewcanconsistofoneormoretables.Mostlyitis
multipletables.
Databaseviewsconsistingofmultipletablesimplementaninner
join.Thatis,whenyouconsidertwotablesatatime,arowhasto
existinboththetablesforittoappearintheresult.Theviewisa
crossproductofthetwotables.Thejoiningconditionisgenerally
withtheprimarykeyfieldsinonetableandforeignkeyfieldsin
theothertable,butitneednotbeso.Ajoinconditioncanbe
establishedonnonkeyfieldsaswell.
Ifyouconsiderthescenarioofcreatingadatabaseviewwithyourcustom
tablesYCL_CH02_WAITMandYCL_CH02_BILLH,andthefield
WAIT_NOjoiningthetwotables,youwillgetaresultwhereonlythe
waitershavebills.Ofcourse,awaiterhavingmultiplebillswillappear
thatmanytimesintheresult(crossproduct).Thewaitershavingnobills
willnotappearintheresult.Yourfirsthandsonexercisewillimplement
thisscenario.
Ifthedatabaseviewconsistsofmultipletables,itisdesignatedasa
readonlyview,andtheparticipatingtablesofdatabaseview
cannotbeupdated(insert,update,delete)throughtheview.Ifthe
databaseviewconsistsofasingletable,thistablecanbeupdated
(insert,update,delete)throughtheview.
WhenyouactivateaDDICdatabaseviewforthefirsttime,aview
iscreatedinthedatabasemetadata.
Adatabaseviewcanconsistofonlytransparenttables.
ThedatabaseviewcanbeusedintheOpenSQLSELECTstatement
justlikeatable.
Adatabaseview(infact,allthefourtypesofviews)canbereferred
todeclaredatainanABAPprogram.
WiththeplethoraoftablesintheSAPenvironment,datarequired
inanABAPprogramisspreadacrossmanytables.Anefficientway
ofretrievingthisdataspreadacrossmanytablesistocreate
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
1/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
databaseview/sandretrievedatawithsimpleSELECTstatements
insteadofusingcomplexSELECTstatementsimplementingthe
innerjoinsasimpleprocessofdatagathering.Thedatabaseview
alsoservesthepurposeofreusability.Asingledatabaseviewcould
beusedinmultipleABAPprograms.
Adatabaseviewjustlikethetableshastechnicalsettings.So
bufferingcanbesetupifdesired.
Databaseviewretrievalwillperformfasterthantheretrievalwith
individualtables.
DatabaseViewsInnerJoin
Itisbettertoexplaintheinnerjoin(thatadatabaseviewuses)witha
simpleexampleinvolvingyourcustomtables:
SupposethedatainthetableYCL_CH02_WAITMisasfollows:(5rows)
WAIT_NO...
01...
02...
03
04
05
ThedatainthetableYCL_CH02_BILLHisasfollows(10rows)
YouperformaninnerjoinonthetwotablesusingthefieldWAIT_NO.
ThisfieldisaprimarykeyinYCL_CH02_WAITMandaforeignkeyin
thetableYCL_CH02_BILLH.Theresultoftheinnerjoinwillbetodrop
theWAIT_NOvalues01and03originatingfromtable
YCL_CH02_WAITMintheresultastheydonothaveanycorresponding
rowinthetableYCL_CH02_BILLH.The10rowsfromthetable
YCL_CH02_BILLHwillappearintheresult.Waitershavingnobills
willnotappearintheresult.
Thiswashypotheticaldatacontrivedforexplanation.Thetablesdonot
containthisdata.
NowletadatabaseviewbecreatedwiththeseverytablesinDDIC.The
interfaceofthedatabaseviewcreationispeculiarandhastobe
understood.
CreateDatabaseViewwithTablesYCL_CH02_WAITMand
YCL_CH02_BILLH
IntheSE11openingscreen,selecttheradiobuttonView.Enterthename
oftheviewtobecrested.(Namespace,liketables,are16characters.)Let
thenameofthedatabaseviewbeYCL_CH03_WBH.ClickontheCreate
buttonorpressfunctionkeyF5.Thesystemwillpromptfortheviewtype
tobecreatedasshowninFigure31.
Figure31.CreateDatabaseViewChooseViewType
Selectthedatabaseview,whichisalsothedefault,andpressthe
button.Thescreentocreatedatabaseview,as
showninFigure32,appears.
Figure32.CreateDatabaseViewTable/JoinConditionstab
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
2/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
EntersuitabletextinthefieldShortDescription.
Ontheleftside,inthesinglecolumn,youenterthetablenames.Onthe
rightside,therearefourcolumnstoenterthetablenameoftheleftside
table,firstfieldnameoftheleftsidetabletablenameoftherightside
table,firstfieldnameoftherightsidetable,andsoon.
Theentriesinthetablecolumnaswellasthejoincolumnsareformost
partenteredbythesystem.Sometimestheyareenteredmanually.
Inthepresentscenariotheentriesshouldlooklikethis:
YCL_CH02_BILLHYCL_CH02_WAITMWAIT_NOYCL_CH02_BILLHWAIT_NO
YCL_CH02_WAITMThepresentexerciseisofaverysimplescenario:
onlytwotablesonlyonefieldinthejoincondition.Arealworld
scenariowouldconsistofmorethantwotablesandmorethanonefield
inajoincondition.Insuchsituations,itisalwaysbettertodefinea
hierarchy.Ofcourse,inahierarchy,atatimeyouaretacklingtwotables
foraninnerjoincondition.Inaninnerjoinconditionoftwotables,itis
immaterialwhichtableappearsontheleftsideofjoinconditionand
whichtableappearsontherightside.Butitisagoodpracticetofollowthe
RDBMShierarchywherepossible.
Inthepresenthandsonexercise,thetableYCL_CH02_WAITMisthe
checktable,andthetableYCL_CH02_BILLHistheforeignkeytable.So
youwillhavethetableYCL_CH02_WAITMontheleftsideofthejoin
conditionandthetableYCL_CH02_BILLHontherightsideofthejoin
condition.
TherearefivetabsincludingtheAttributestab,whichismaintainedby
thesystem.YouareontheTable/JoinConditionstab.Youneedtoenter
theparticipatingtablesandthejoinconditions.
Whenyouwantthejoinconditiontobegeneratedbythesystem,the
procedureistoenterthenameoftheforeignkeytableunderthecolumn
Table,andclickonthebuttonRelationships,whichisatthebottom.The
systemwillextractthechecktable/sfromtheforeignkeyrelationship
youdefinedwhencreatingthetabledefinitionsandlistoutthesewitha
promptasshowninFigure33.
Figure33.CreateDatabaseViewRelationshipsofTable
YCL_CH02_BILLH
ThereisoneentryunderReferencedtables.Inthisdialogbox,thetable
ontheleft(YCL_CH02_BILLH)istheforeignkeytable,andthetableon
therightisthechecktable(YCL_CH02_WAITM).
UndertheDependenttables,thereisoneentry.Thetableontheleft
againistheforeignkeytable(YCL_CH02_BILLI),andthetableonthe
rightisthechecktable(YCL_CH02_BILLH).
TheentriesundertheheadingReferencedtablesareofinteresttoyou.
ThetableYCL_CH02_BILLHyouenteredunderthecolumnTablesof
theTables/JoinConditionstabisaforeignkeytable,andinclickingthe
buttonRelationships,youareseekingthechecktable,whichisthetable
YCL_CH02_WAITM.Enablethecheckboxofthisrowandpressthe
button.ThescreenwilllooklikethatinFigure34.
Figure34.CreateDatabaseViewJoinConditionGenerationby
theSystem
Thesystemhasgeneratedthejoinconditionandenteredthechecktable
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
3/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
undertheforeignkeytable.
Whenyouaremanuallyenteringthejoinconditionsyoumustbearthis
inmind:Thejoinconditionsmustbeenteredfromtoptobottomina
hierarchalwayandthetablesunderthecolumnTablesareenteredin
reverseorder(i.e.,tableshigherinthehierarchymustappearatthe
bottom,andtableslowerinthehierarchymustappearatthetop).
Havingenteredthetablesandjoinconditions,proceedtothenexttab
ViewFldswhereyouselectfieldswhichshouldappearintheview.Inthe
caseofyourcustomtables,thereareonlyafewfields,soyoucanselect
allthefields.IncaseoftheSAPdeliveredtables,thenumberoffieldsis
oftheorderof100ormore.Fieldselectionbecomesanecessary
exerciseyoucannotselectallfields.Fieldsshouldbeselecteddepending
onthescenariorequirements.
TheViewFldstabscreenisshowninFigure35.
Figure35.CreateDatabaseViewViewFldstab
Youcanmanuallyfillinthefields,butabetterwayistoselectthemfrom
lists.Thefieldsnamesintheviewcanbedifferentfromtheir
correspondingnamesinthetables,butitisbettertoretainfieldnamesof
tablesintheview.Toselectfields,clickontheTablefieldsbutton.Apop
updialogboxasshowninFigure36appears.
Figure36.CreateDatabaseViewChooseTableforField
Selection
Youhavetoselectthetablefromwhichtomakefieldselections.Proceed
inahierarchalmanner.YouselectYCL_CH02_WAITMfirst.Soeither
doubleclickonthattablenameorpositionthecursoronthetablename
andclickonthe
button.Thefieldselectionscreen
asshowninFigure37appears.
Figure37.CreateDatabaseViewFieldSelectionfromTable
YCL_CH02_WAITM
Youcanselectfieldsbyenablingthecheckboxagainstthefield.Select
thetwofields,WAIT_NOandWAIT_NAMEbyenablingtheircheck
boxes.Thenclickonthe
buttonatthebottomofthe
dialogbox.Inasimilarmannerselectthefieldsfromthetable
YCL_CH02_BILLH.SelectthethreefieldsBILL_NO,BILL_DATE,and
NET_AMT.Afterthesethreefieldshavebeenfetched,thescreenwillbe
asshowninFigure38.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
4/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure38.CreateDatabaseViewSelectedFields
Alwaysselecttheprimarykeyfieldseitherfromthetablewheretheyare
primarykeyfieldsorwheretheyareforeignkeyfields.Havingfetched
therequiredfieldsfromthetwotables,theyneedtobeordered.Allthe
primarykeyfields(fieldswiththeKeycheckboxenabled)ofdifferent
tablesshouldbeatthebeginningandinthehierarchalorder.Inthe
presentcontext,thefirstfieldshouldbeWAIT_NO,andthesecondfield
shouldbeBILL_NO.Repositionthefieldsbycuttingandpasting.Usethe
buttons:
abovethefields.Theorder
ofrestofthefieldsisimmaterial.Ifthesamefieldwiththesamenameis
selectedfrommorethanonetableintheviewforsomereason,thefields
shouldberenamed,becausetheviewfieldsnames,likeintables,should
beunique.Afterthefieldshavebeenorderedandtheviewsaved,the
screenwillbeasinFigure39.
Figure39.CreateDatabaseViewPrimaryKeyFieldsordered
hierarchically
ClicktheSelectionConditionstaboftheview.Youcanentersimple,
compound(withlogicaloperatorsAND/OR)WHEREconditionstofilter
data.OneconstraintisthatthevalueontherightsideoftheWHERE
conditionhastobealiteral(Noruntimedecision).Ascreenshotofthe
SelectionConditionstabappearsinFigure310.
Figure310.CreateDatabaseViewSelectionConditionstab
Fornow,youwillnotenteranySelectionCondition.
ThenexttabisMaint.Status.Likeinatable,youcansetthe
maintenancestatus.Butsinceyourviewisconsistingoftwotables,itisa
readonlyview.AscreenshotoftheMaint.StatustabisshowninFigure
311.
Figure311.CreateDatabaseViewMaint.Statustab
Performaviewconsistencycheck(
Buttonorkeys<Ctrl>+<F2>).
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
5/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Awarningmessagewillappearstatingthisisareadviewonly.(Warning
messagesintheSAPenvironmentappearinYellowcolor)Thisisshown
inFigure312.
Figure312.CreateDatabaseViewConsistencyCheckMessage
Ifanyothererror/soccurstroubleshootandfixthem.
Activatethedatabaseview(
Buttonorkeys<Ctrl>+<F3>).
Youcandisplaythecontentsoftheviewbyclickingontheapplication
toolbar
button,thenpressingfunctionkeyF8(execute)inthe
SelectionScreen.Thedataintheparticipatingtables
YCL_CH02_WAITMandYCL_CH02_BILLHisavailableinFigures3
13and314.ThecontentsoftheviewareshowninFigure315.
Figure313.TableContentsYCL_CH02_WAITM
Figure314.TableContentsYCL_CH02_BILLH
Figure315.DatabaseViewContentsYCL_CH03_WBH
Thereare4rowsintableYCL_CH02_WAITM:WAIT_NOvalues=
01,02,03,04.
Thereare2rowsinYCL_CH02_BILLH:WAIT_NOvalues=02,01.
InthedatabaseviewYCL_CH03_WBHWAIT_NOvalues=01,02
appear.WAIT_NO=03,04aredropped,astherearenobillsforthese
valuesofWAIT_NO.
CreateDatabaseViewwithSAPdeliveredTablesKNA1and
VBAK
Adatabaseviewwascreatedwithyourcustomcreated,populatedtables.
Thetablesweresimple,consistingofafewfields,andtherewashardly
anydata.
LetadatabaseviewbecreatedwiththeSAPfunctionalmoduletables.
(RecallfromChapter1thatallSAPfunctionalmoduletablesareclient
dependent.Thatis,thefirstfieldinthesetablesisofDDICTYPECLNT
anddataoftheclientyouhaveloggedinisonlyvisibleandretrievable).
LetadatabaseviewwiththefollowingSAPdeliveredtablesbecreated:
KNA1CustomerPrimarytable
VBAKSalesDocumentheader
ThetwotablesarerelatedbythefieldKUNNR,whichisthecustomer
code.ThefieldKUNNRispartoftheprimarykeyintableKNA1anditisa
foreignkeyinthetableVBAK.CheckthisoutinSE11.
ThecustomerinformationiscontainedinmultipletablesKNA1isthe
primarytableforcustomerinformation.
TableVBAKcontainsSalesDocumentheaderdata.ThereisaSales
Documentitemtable:VBAP.YouwillonlyusethetwotablesKNA1and
VBAK.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
6/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Thespecificationsfortheproposeddatabaseview:
ObjectSpecification
Databaseviewname:YCL_CH03_KNVK
Tables:(1)KNA1(CustomerPrimary)(2)VBAK(SalesDocumentHeader)
RelationshipfieldsMANDT,(ClientCode)KUNNR(CustomerCode)
Hierarchy:KNA1
|
VBAK
FieldsfromKNA1MANDTClientcode
KUNNRCustomerCode
NAME1CustomerName
STRASStreet
ORT01City
PSTLZPostalCode
FieldsfromVBAKVBELNDocumentNumber
AUDATDocumentDate
NETWRNetAmountinDocumentCurrency
WAERKDocumentCurrency
SelectionConditionVBTYP=C.FilteroutthedataofSalesOrder
(VBTYPisindicatorforSalesDocumentType)
ObjectCreation
OntheSE11openingscreen,selecttheradiobuttonforView.
EntertheviewnameYCL_CH03_KNVK.ClicktheCreatebuttonorpress
functionkeyF5.SelecttheDatabaseview(default)ontheChooseView
Typescreenandclickonthe
button.Youwillgetto
theTable/JoinConditionstab.EnterShortdescription.Underthe
Tables,enterthenameofyourforeignkeytableVBAK.Clickonthe
buttonRelationships.ThescreenshotofthedialogboxisshowninFigure
316.
Figure316.CreateDatabaseViewRelationships
ArelationshipinvolvingKNA1andVBAKisappearingtwiceinthelist.
Whichoneistobeselected?Doubleclickonbothandthescreenasshown
inFigure317willappear.
Figure317.CreateDatabaseViewRelationshipsexpanded
Whentherelationshipshavebeenexpandedbydoubleclickingonthe
relationshiplines,youobservethatthefieldKNKLIisappearinginone
proposal,andthefieldKUNNRisappearingintheotherproposal.Since
yourspecificationsmentionthefieldKUNNR,disablethecheckboxof
KNKLI,enablethecheckboxofKUNNR,andclickonthecopybutton.
ThesystementersKNA1(primarytable)underthecolumnTablesand
generatesthejoincondition.Thescreenwiththejoinconditionisshown
inFigure318.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
7/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure318.CreateDatabaseViewJoinConditions
NoticethattheDDICTYPECLNTfieldMANDTisonthefirstlineofjoin
condition,becausethefieldMANDTisthefirstfieldineveryclient
dependenttable.Whenenteringthejoinconditionmanually,bearthis
inmind.
Withthejoinconditioninplace,proceedtotheViewFldstab.Selectthe
fieldsasperthespecifications.Recallfromthepreviousexercisethatyou
havetousetheTablefieldsbuttontoselectthetableandthenselectthe
fieldsofthechosentable.
Recallfromthepreviousexercisethatfieldshavetobeordered.The
primarykeyfields(withtheKeycheckenabledhavetobelocatedatthe
beginningandshouldbeinorderoftablehierarchy.Theorderof
primarykeysshouldbeasfollows:
MANDT
KUNNR
VBELN
Therestofthefieldscanbeinanyorder.
NoticethatyoucanselectthefieldKUNNRfromeitheroneofthetables
KNA1orVBAK.IfyouselectthefieldfromthetableKNA1whereitispart
ofprimarykey,itwillhavetheKeycheckboxenabledintheviewifyou
chooseKUNNRfromthetableVBAK,whereitisaforeignkey,itwill
havetheKeycheckboxdisabledintheview.IfyouhaveselectedKUNNR
fromtableKNA1,youneedtoputthefirstthreefieldsintheorder
mentionedabove.IfyouhaveselectedKUNNRfromtableVBAK,then
thefirsttwofieldsshouldbe:
MANDT
VBELN
YouhaveselectedthefieldKUNNRfromtableKNA1.Ascreenshotofthe
selectedfieldsasperthespecificationsandorderedasexpectedby
interfaceisshowninFigure319.
Figure319.CreateDatabaseViewFieldsSelected,Ordered
Next,clickontheSelectConditionstab.Accordingtothespecifications,
youhavetoenteraconditionastofilteroutrowsinwhichthefield
VBTYP=C.ThefieldVBTYPisinthetableVBAK.TableVBAKcontains
differenttypesorkindsofsalesdocuments.ThefieldVBTYP(DDIC
TYPECHAR&length1)contains1charactercodeforeachdocument
type.ItcontainsCforsalesorders.Whenacustomerofanenterprise
placesanorder,asalesorderisgenerated.Inthepresentdatabaseview,
youwillfilteroutrowswhereVBTYP=C(salesorders).
UsethebuttonTablefieldstoselectthetable(VBAK)Field(VBTYP).
Selecttherelationaloperatorfromthelist(functionkeyF4)EQ/=.
UndertheComparisonValuecolumnenterC.(EncloseCwithinsingle
quotes.RecallCisthecodeforsalesorders).AscreenshotoftheSelection
ConditionstabafterthefieldsareenteredisshowninFigure320.
Figure320.CreateDatabaseViewSelectionConditions
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
8/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Save.Performaconsistencycheck(
Activatethedatabaseview(
Buttonorkeys<Ctrl>+<F2>).
Buttonorkeys<Ctrl>+<F3>).
Foranyobjectyoucreateanddeliver,youmusthaveassuranceaboutits
correctness:thatithasbeencreatedasperspecifications.Youhave
createdthedatabaseviewwithtwotablesKNA1andVBAKjoinedby
(innerjoin)thefieldsMANDTandKUNNRsetupaconditiontofilter
outrowshavingVBTYP=C.
Thedatabaseviewyoucreatedearlierhadverylittledatainits
participatingtables,soyouvisuallycheckeditforitsaccuracy(i.e.,the
numberofrowsintheresult).Inthepresentdatabaseview,the
participatingtableshavethousandsofrows,sovisualinspectionand
accuracydeterminationisnotfeasible.
ViewAudit
Thepresentdatabaseviewisonaparallelbasistothepreviousexercise.
Inthepreviousexercise,itwasstatedthatallthebillswillappearinthe
result,andthewaitershavingnobillswillbeomittedintheresult.Of
course,theconditionisthattherewillbenobillswithoutawaiter.
InthepresentexerciseitcanbestatedthatalltherowsoftableVBAK
withVBTYP=Cmustappearintheresult,customershavingnosales
documentwillnotappearintheresult.Soifthenumberofrowsinthe
tableVBAKwithVBTYP=Careappearingintheresult,youareassured
ofthecorrectnessofthedatabaseview.Ofcoursetheconditionhastobe
fulfilledthattherearenosalesdocumentswithoutacustomercode.In
fact,youareassuredofthiscondition.IntheSAPenvironment,you
cannotcreateasalesdocumentwithoutavalidcustomercodebeing
assigned.
Soyourtaskistodetermine:
1. ThenumberofrowsinthetableVBAKwithVBTYP=C.
2. Thenumberofrowsinyourdatabaseview.
Ifthesetwomatch,yourdatabaseviewiscorrect.Iftheydonotmatch,
youhavetotroubleshoot.Whenjoinconditionsarenotgeneratedbythe
systembutenteredmanually,thisisoneareapronetoerrors.
NowletthenumberofrowsinthedatabaseviewYCL_CH03_KNVKbe
determined.Clickonthe
buttonoftheDatabaseviewapplication
toolbar.ThescreenDataBrowser:TableYCL_CH03_KNVK:Selection
Screenwillappear.OnthisscreenthereisabuttonNumberofEntrieson
theapplicationtoolbar.Clickonthisbutton.Thesystemwilldisplaythe
numberofrowsinthedatabaseview.ThisisshowninFigure321.
Figure321.DatabaseViewSelectionScreen:Determine
numberofrows
Thenumberofrowsinthedatabaseviewis6504.
NowdeterminethenumberofrowsinthetableVBAKwithfieldVBTYP=
C.NavigatetothetransactioncodeSE16screenenterthetablenameas
VBAK.Clickonthetableofcontents
button.ThescreenData
Browser:TableVBAK:SelectionScreenwillappear.Youhavetofilterout
rowswithVBTYP=C.Forthis,clickonthemenubarSettings
Fields
forSelections.Adialogboxwillappearwiththefieldsoftablesandcheck
boxesasshowninFigure322.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
9/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure322.TableVBAKSelectionScreen:ChooseFieldsfor
Selection
EnsurethecheckboxforthefieldVBTYPisenabled,andclickonthe
button.
IntheDocumentcat.fieldenterC(justtheletterC)andclickonthe
applicationtoolbarbuttonNumberofEntries.Thesystemwilldisplaythe
numberofrowsinthetableVBAKwhereVBTYP=C.Thisisshownin
Figure323.
Figure323.TableVBAKSelectionScreenwithVBTYP=C:
NumberofRows/Entries
ThenumberofrowsinthetableVBAKwithVBTYP=Cis6504.Thisis
matchingwiththenumberofrowsinthedatabaseview.
TheSelectionScreen(whereyouenteredCinthefieldDocumentcat.
/VBTYPisasophisticatedfeature,whichwillbecoveredwhen
prerequisitesareinplace.Fornowyoucantakeitthatinitiallyifthis
fieldwasnotontheSelectionScreen,youmadeitappearonthe
SelectionScreenthroughSettings
FieldsforSelections,etc.Onceit
wasontheSelectionScreen,youenteredthevalueC(forsalesdocument
typesalesorder)thesystemfiltereddataasperthisvalue(i.e.,itfetched
andcountedrowswithVBTYP=C).
MakingtheDatabaseViewClientIndependent
InthedatabaseviewYCL_CH03_KNVK,thefirstfieldistheclientcode
fieldMANDTofDDICTYPECLNT.AsthefirstfieldisDDICTYPE
CLNT,yourviewisclientdependent.Letthepositionofthisfieldbe
changedanditsrepercussionsobserved.AsshowninFigure324,the
fieldMANDThasbeenshiftedtothesecondposition.Sincethefirstfield
isnolongerDDICTYPECLNT,yourviewnowwillbeclient
independentthatis,thedataofclientsotherthantheloggedinclientis
alsoretrieved.
Figure324.DatabaseViewYCL_CH03_KNVKShiftMANDT
toSecondPosition:TheViewBecomesClientIndependent
Aftermakingthischange,doanobjectconsistencycheck.Thesystemwill
highlighttwowarnings:(a)Viewaccessisreadonly,and(b)Viewis
clientindependent.
Activatetheobject.Clickonthecontents
button.Theselection
screenappears.InthefieldMaximumNo.ofHits(attheverybottom),
changethevalueto9999.Normally,asperdefaultsettings,thevalue
hereis200(i.e.,itlistsamaximumof200rows).Inyourpresent
situation,thenumberofrowsinyourviewis>6,500.Soyouhave
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
10/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
changedthevalueto9999(i.e.,displayamaximumof9999rows).Thisis
showninFigure325.PressfunctionkeyF8ortheexecute
button.
Figure325.DatabaseViewYCL_CH03_KNVKmadeClient
Independent:SelectionScreen
Thedatahasbeenfetchedforallclientsinsteadofjusttheloggedin
client.Thenumberofentriesorrowsisappearingonwindowtitleandin
yourcaseare6,639,whicharegreaterthanyourearliercountof6,504
rowsintheclientdependentview.Alistappearsdisplayingthefieldsof
yourview.NextpositionyourcursoronthelistcolumnheadingClientas
showninFigure326.Thenclickontheapplicationtoolbar
button.Thiswouldsortyourviewlistindescendingorderofclientcode:
thatishighvalueclientcodeappearsfirst,lowvalueclientnext,etc.The
listthatappearsisshowninFigure326.Youcanobservethatlistis
startingwithclient811clientsotherthan800,etc.,arevisible.
Figure326.DatabaseViewYCL_CH03_KNVKmadeClient
Independent:List
Thisisrarelydoneinapracticalworldthatis,makingaviewconsisting
ofafunctionalmoduletablesclientindependent.Ithasbeendonehere
tohighlightanddemonstratetheclientdependencyfeature.Restorethe
viewtoitsoriginalconfiguration.
Exercise:CreateDatabaseViewwithSAPdeliveredTables
KNA1,VBAK,VBAP
Extendthetwotabledatabaseviewtothreetabledatabaseviews:
KNA1CustomerPrimarytable
VBAKSalesDocumentheader
VBAPSalesDocumentitem
ThetwotablesKNA1&VBAKarerelatedbythefieldKUNNR,whichisthe
customercode.ThefieldKUNNRispartoftheprimarykeyintableKNA1
anditisaforeignkeyintableVBAK.
ThetwotablesVBAKandVBAParerelatedbythefieldVBELN,whichis
theDocumentNumber.ThefieldVBELNispartoftheprimarykeyin
tableVBAK,anditisaforeignkeyintableVBAPaswellaspartofthe
primarykey.CheckthisoutinSE11.
Thespecificationsfortheproposeddatabaseview:
ObjectSpecification
Databaseviewname:YCL_CH03_KNVKP
Tables:(1)KNA1(CustomerPrimary)(2)VBAK(SalesDocumentHeader)
(3)VBAP(SalesDocumentItem)
Relationshipfields(1)KNA1,VBAKMANDT,(ClientCode)KUNNR(CustomerCode)
(2)VBAK,VBAPMANDT(ClientCode)VBELN(DocumentNo.)
Hierarchy:KNA1
|
VBAK
|
VBAP
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
11/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
FieldsfromKNA1MANDTClientcode
KUNNRCustomerCode
NAME1CustomerName
STRASStreet
ORT01City
PSTLZPostalCode
FieldsfromVBAKVBELNDocumentNumber
AUDATDocumentDate
NETWRNetAmountinDocumentCurrency
WAERKDocumentCurrency
FieldsfromVBAPPOSNRSalesDocumentItem(SerialNo.)
MATNRMaterialNo
ZMENGTargetQuantity
ZIEMETargetUnitofMeasure
SelectionConditionVBTYP=C.FilteroutthedataofSalesOrder
(VBTYPisindicatorforSalesDocumentType)
TablesJoinConditions
VBAPKNA1MANDTVBAKMANDT
VBAKKNA1KUNNRVBAKKUNNR
KNA1VBAKMANDTVBAPMANDT
VBAKVBELNVBAPVBELN
FieldsTable
MANDTKNA1
KUNNRKNA1
VBELNVBAK
POSNRVBAP
NAME1KNA1
STRASKNA1
ORT01KNA1
PSTLZKNA1
AUDATVBAK
NETWRVBAK
WAERKVBAK
MATNRVBAP
ZMENGVBAP
ZIEMEVBAP
SelectionConditions
VBAKVBTYPEQC
Aftercreation,aperformconsistencycheckandactivatethedatabase
view.Testandascertainthatthenumberofrowsinthedatabaseviewis
aspertheinnerjoinsexpectations.
Thisconcludesthedatabaseviews.
ProjectionView
Aprojectionviewisusedtorestrictaccesstoonlycertainfieldsofa
table.
Aprojectionviewconsistsofexactlyonedatabasetable.
Aprojectionviewcanusepooled,clusteredtables.
SelectionConditionsarenotavailableforprojectionviews.
AprojectionviewcanbeusedwithanOpenSQLSELECT
statement.
AprojectionviewcanbereferredtodeclaredatainanABAP
program.
Tabledatacanbemaintainedthroughtheprojectionview(insert,
update,delete).
CreateProjectionViewwithSAPdeliveredTableKNA1
ObjectSpecification
Projectionviewname:YCL_CH03_KNA1_PJ
Table:KNA1(CustomerPrimary)
FieldsfromKNA1MANDTClientcode
KUNNRCustomerCode
NAME1CustomerName
STRASStreet
ORT01City
PSTLZPostalCode
ObjectCreation
IntheSE11openingscreen,selecttheradiobuttonView.Enterthename
oftheviewtobecrestedYCL_CH03_KNA1_PJ.ClickontheCreate
buttonorpressfunctionkeyF5.Thesystemwillpromptfortheviewtype
tobecreatedasshowninFigure327.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
12/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure327.CreateProjectionViewChooseViewType
SelecttheProjectionviewontheChooseViewTypescreenandclickon
the
button.Youwillbepromptedwithan
informationmessageliketheoneshowninFigure328.
Figure328.CreateProjectionViewInformationMessage
Informationmessageshavetheicon
.Theyarenotifying
messages.ThisoneremindsyoutoObserveconstraintsforuseinLogical
database.TheLogicaldatabaseisafeatureintheABAPWorkbench
somewhatobsoletenow(HRfunctionalmoduleusesit).TheLogical
databaseisnotcoveredinthisbook.Press<Enter>ontheinformation
message.YouareontheViewFieldstab.EnterShortdescription.Enter
thetablenameKNA1inthefieldBaseTable.ClickonthebuttonTable
fields.ThesystempopupstheFieldSelectionfromTableKNA1window
asshowninFigure329.
Figure329.CreateProjectionViewFieldSelectionfromTable
KNA1
Selectthefieldsaspertheobjectspecificationsandclickonthe
button.Thescreenshotwiththeselectedfieldsis
showninFigure330.
Figure330.CreateProjectionViewSelectedFields
Youarefinishedwiththefieldselection.ClickonthetabMaintenance
Status.ThisisshowninFigure331.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
13/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure331.CreateProjectionViewMaintenanceStatustab
YoushouldnotintendtooperateonthedataofKNA1(insert,update,
delete).OperatingonthedataofSAPdeliveredfunctionalmoduletables
isnotadvisable.ClickontheradiobuttonreadonlyintheAccessarea.
SelectDisplay/MaintenanceAllowedwithRestrictionsoptionfromthe
dropdownlistofthefieldDataBrowser/TableViewMaint.
Savetheprojectionview.Performtheconsistencycheck.Thisshould
producethescreenshowninFigure332.
Figure332.CreateProjectionViewConsistencyCheckMessage
FromtheLogdisplayscreen,pressfunctionkeyF3orthestandard
toolbar
button.ActivatetheProjectionview.Letthecontentsof
theprojectionviewbeexamined.Ononeoftheprojectionviewtabs,
clickonthe
button.Theselectionscreenwillappear.EnterA*in
thefieldNametoretrieveanddisplaycustomernamesstartingwithA,
andchangefieldMaximumNo.ofHitsfromdefault200to9999.Thisis
showninFigure333.
Figure333.ProjectionViewSelectionScreen
PressfunctionkeyF8orthe
button.Theprojectionviewcontents
areappearinginFigure334(onlycustomersnamesstartingwithA).
Figure334.ProjectionViewContents
YouarefinishedwiththeViewsfornow.Youwillproceedtothenext
DDICobject,SearchHelp.
DDICObjectsSearchHelps
TheDDICobjectsearchhelpenablesuserstomakeaselectionfroma
selectionlist(alsocalledthehitlist)toassignvaluetoascreenfield
insteadofmanuallyenteringthevalue,whichistediousanderrorprone.
Youhavealreadyseenthesearchhelpinoperationwhenyouassigned
domainstodataelementsinthesectionentitledCreateDataElements,
andassigneddataelementstotablefieldsinthesectionentitledCreate
TablesinChapter2.Theselectionlistsappearanceisgenerally
precededbyadialogboxcalledtherestrictiveorfilterdialogbox.Inthis
book,itisbeingreferredtoasarestrictivedialogbox.Therestrictive
dialogboxcontainsfields,andtheusercanentervaluesorpatternsin
thesefields.Thesearchhelpwillfilteroutthedataaspervalue/s,pattern
specificationintherestrictivedialogboxfields,sothattheresulting
selectionlistissmallandmanageable.Thisistrueofsituationswhere
theunrestrictedselectionlistscontainlargeamountsofdata.
Outofthehundredsofthousandsofdomains,youcouldfilteroutyour10
domainsintoaselectionlistoutofthehundredsofthousandsofdata
elements,youcouldfilteroutyour17dataelementsintoaselectionlist.
Searchhelpsareoftwotypes:(a)elementarysearchhelp,and(b)
collectivesearchhelp.Acollectivesearchhelpconsistsofmultiple
elementarysearchhelps.Thesearchhelpcanbeattachedtoaprimary
keytable,atablefield(usuallyaforeignkeyfield),adataelement,ora
screenfield,etc.
Youwillperformhandsonexercisestocreateelementaryaswellas
collectivesearchhelps.Searchhelpcreationwillbescenariobased.At
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
14/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
first,youwillcreatesearchhelpsusingyourcustomtables.Youwill
followthisupbycreatingsearchhelpsusingSAPdeliveredtables.
SearchHelpwithCustomTables
CreateSearchHelp:ScenarioofElementarySearchHelpwith
CustomTable
InyourtableYCL_CH02_BILLI,thefieldITEM_CODEisaforeignkey,
andthechecktableforthisfieldisYCL_CH02_ITEMM.
Whenyouareenteringdatainthistable(i.e.,YCL_CH02_BILLIinthe
DataBrowser,andSE16/SE11,etc.),whenyoupressthefunctionkeyF4
ontheforeignkeyfieldITEM_CODE,alistofprimarykeyfieldvalues
fromthechecktableYCL_CH02_ITEMMisdisplayed.Andwhenauser
makesaselectionbydoubleclicking,etc.,thevalueoftheprimarykeyis
assignedtothescreenfield.SeeFigure335.
Figure335.CreateDatainTableYCL_CH02_BILLI,PressF4
keyinFieldITEM_CODE
Thisisnotveryuserfriendly.First,youwantadescriptionoftheitem
andrate(fieldsITEM_DESC,RATE)tobedisplayedonthelistalong
withITEM_CODE.Next,youwouldlikethefieldRATEvaluetobe
assignedfromthelisttothescreenfieldRATEalongwiththefield
ITEM_CODE.
Toachievethis,youaregoingtocreateanelementarysearchhelp,attach
thissearchhelptotheforeignkeyfieldITEM_CODEinthetable
YCL_CH02_BILLI,andtesttheattachmentofthesearchhelp.
CreateElementarySearchHelpwithTableYCL_CH03_ITEMM
ObjectSpecification
SearchHelpname:YCL_CH03_ITEMS_SH
DatabaseTable:YCL_CH02_ITEMM(sourceofdata)
Attachment:TableYCL_CH02_BILLI
FieldITEM_CODE(ForeignKey)
SelectionListFields:ITEM_CODELPos=1.
ITEM_DESCLPos=2.
RATELPos=3.
RestrictiveDialogueBoxFieldsITEM_CODESpos=1.
ITEM_DESCSpos=2.
ExportFields:ITEM_CODEExport=X.
RATEExport=X
ImportFields:None
Youarecreatinganelementarysearchhelp
YCL_CH03_ITEMS_SH(maximumnamespace30characters).
ThissearchhelpssourceofdataisthetableYCL_CH02_ITEMM.
Thesourceofdatacaneitherbeatable,aprojectionview,a
databaseview,orahelpview.
Youwillattachthissearchhelptotheforeignkeyfield
ITEM_CODEoftableYCL_CH02_BILLI(BillsItems).
Thefieldsthatwillbedisplayedinthepopupselectionlistare
ITEM_CODE,ITEM_DESC,andRATELposvalues.
Thefieldsthatwillbedisplayedintherestrictivedialogboxare
ITEM_CODEandITEM_DESCSposvalues.
Thescreenfieldsthatwillbeassignedvaluesfromtheselectionlist
fieldsoftableYCL_CH02_ITEMMareITEM_CODEandRATE
checkboxExport.
Therearenoimportparameters.Theconceptofsearchhelpimport
parameterswillbeexplainedanddemonstratedwithreallifetype
scenarioinChapter14,entitledScreenProgramming.
Inthecontextofsearchhelp,exportparametersmeanswhatthesearch
helpselectionlistsendsvaluestothescreenfieldsonthescreenwhen
theuserhasmadeaselection.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
15/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Inthecontextofsearchhelp,importparametersmeanswhatthesearch
helprestrictivedialogboxfieldsreceivesfromthescreenfieldswhere
userpressesthefunctionkeyF4.
CreateElementarySearchHelpYCL_CH03_ITEMS_SHwith
TableYCL_CH02_ITEMM,tobeattachedtofieldITEM_CODE
oftableYCL_CH02_BILLI
IntheSE11openingscreen,selecttheradiobuttonforSearchhelp.Enter
thenameofthesearchhelptobecreated.Thenameasperyourobject
specificationisYCL_CH03_ITEMS_SH.ClickontheCreatebuttonor
pressfunctionkeyF5.Thesystemwillpromptforthesearchhelptypeto
becreatedasshowninFigure336.
Figure336.CreateSearchHelpSelectSearchHelpType
SelecttheElementarysearchhelp,whichisthedefaultpressthe
button.ThescreentocreateelementarysearchhelpasshowninFigure
337appears.
Figure337.CreateSearchHelpSelectionMethod
Intheselectionmethod,youhavetoindicatefirstwhetheryoursourceof
dataisatableoraview.(Database,projectionandhelpviewsare
acceptable.)Inyourcaseithappenstobeatable.Thetableis
YCL_CH02_ITEMM.Itisselectedfromaselectionlistasshownin
Figure338.
Figure338.CreateSearchHelpASelectionListonSelection
Method
Aftertheselectionmethodisentered,thenextfieldistheDialogtype.
Thiscontrolstheappearanceoftherestrictivedialogbox,whetherit
appearsimmediatelyontheuserpressingfunctionkeyF4ornot.There
isadropdownlistwiththreeoptions.Youwillselectthethirdoption:
Dialogwithvaluerestriction.Thisoptionpopsuptherestrictivedialog
boxfirst,andnexttheselectionlistmakesitsappearance.Youcantryout
theotheroptionsasanexercise.
TheSearchhelpexitisanadvancedfeaturebeyondthescopeofthisbook.
Nextistheparameterarea.Inthisareathereareninecolumnfields.For
eachSearchhelpparameterorfieldthesecolumnfieldshavetobe
enteredasperrequirements.Explanationforthesecolumnfields
follows:
1. Searchhelpparameter:Thisisafieldfromthesourceofdata.AF4
popup(searchhelp)facilityisavailable.Thefieldsfromthetable
orviewarelistedintheselectionlist.Withyoursourceofdata,the
tableYCL_CH02_ITEMMitsthreefieldsITEM_CODE,
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
16/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
ITEM_DESCandRATEappearintheselectionlistasshownin
Figure339.Oneofthesefieldsisenteredinthiscolumn.
Figure339.CreateSearchHelpSearchhelpparameter
SelectionList
Thefieldsparticipatinginthesearchhelpwouldbeentered,one
fieldineachrow.Aspertheobjectspecifications,allthethree
fieldsfromthetableareparticipatinginthesearchhelp.Howeach
fieldparticipatesisindicatedintherestofthecolumns(i.e.,export,
import,LPos,Spos,etc.).
2. Import:ThesecondfieldintheParameterareaisacheckboxfor
indicatingwhetheraSearchhelpparameterisanimport
parameter.Theexportorimportiswithreferencetothesearch
help.Theimportwillbeofvalue/sfromscreenfield/stooneor
moreoftherestrictivedialogboxfield/s.Ashasbeenstated
earlier,theimportparameterfeaturewillbedemonstratedin
Chapter14entitledScreenProgramming.
3. Export:ThethirdfieldintheParameterareaisacheckboxfor
indicatingwhetheraSearchhelpparameterisanexport
parameter.Theexportwillbetransferoffieldvaluesfromthe
selectionlisttoscreenfields.Aspertheobjectspecifications,you
areexportingtwofieldssuchasITEM_CODEandRATE.
4. LPos:Thisisthefourthfieldintheparameterarea.Itsvalue
controlsthephysicalpositionofSearchhelpparameterorfieldin
theselectionlist.Ifyouenteravalue1,thefieldwillappearinthe
firstpositionintheselectionlistandsoon.Ifyoudontenterany
value,thisfieldwillnotappearintheselectionlist.
5. SPos:Thisisthefifthfieldintheparameterarea.Itcontrolsthe
physicalpositionofSearchhelpparameterorfieldintherestrictive
dialogbox.Ifyouenteravalueof1,thefieldwillappearinthefirst
positionintherestrictivedialogboxandsoon.Ifyoudontenter
anyvalue,thisfieldwillnotappearintherestrictivedialogbox.As
pertheobjectspecification,thefieldRATEwillqualifyforthisyou
dontwantittoappearintherestrictivedialogbox.
6. SDis:Thesixthfield,theSDis,isacheckboxitgoeswiththecheck
boximportandsowillbecoveredalongwiththeimport.Referto
item2foradescription.
7. Dataelementname&Modifiedcheckbox:(seventhandeighth
fields).EverySearchhelpparameterorfieldbydefaultisassigned
adataelementthatwasassignedtoitinthesourceofdata(Tableor
View).Thisdataelementnameappearsindisplaymode.Iffor
somereason,youwanttoassignsomeotherdataelement,then
youenablethecheckboxModified.Whenyouenablethischeck
box,thedataelementcolumnswitchesfromdisplaytoeditmode
andyoucanassignanotherdataelementofyourchoice.Thedata
elementandcheckboxModifiedgotogether.
8. Defaultvalue:Thisgoeswiththecheckboximportandwillbe
coveredalongwiththeimport.
Aspertheobjectspecifications,threerowswiththeappropriatevalues
havebeenenteredintheparameterarea,andthisisshowninFigure3
40.
Figure340.CreateSearchHelpAllFieldsfilledupasperObject
Specification
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
17/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Performaconsistencycheck(
Activatethesearchhelp(
buttonorkeys<Ctrl>+<F2>).
buttonorkeys<Ctrl>+<F3>).
Oncethesearchhelpisactivated,itisreadyforattachmenttothefield
ITEM_CODEoftableYCL_CH02_BILLI.
AttachSearchHelpYCL_CH03_ITEMS_SHtoTable
YCL_CH02_BILLI,FieldITEM_CODE
Inattachingasearchhelptoatablefield,youwillbebasicallymodifying
aDDICtabledefinition.
Toattachasearchhelptoatable,intheSE11openingscreen,clickonthe
Databasetableradiobutton,enterthenameofthetable
YCL_CH02_BILLI.(Alternatively,youcanmakeaselectionfromthe
selectionlistbyenteringthepatternYCL_CH02_*andpressingF4,etc.)
ClickontheChangebuttonorpressthefunctionkeyF6.Youwillbe
presentedwiththetabledefinitionscreen.Onthisscreenpositionthe
cursoronthefieldtowhichyouwanttoattachsearchhelp:thatis,
ITEM_CODE(theforeignkeyfield),andclickontheSrchhelpbutton,
nexttotheforeignkeyrelationship
buttonjustabovethefields.A
dialogboxpromptingforthesearchhelpnamewillpopup.Enterthe
nameorselectthesearchhelpfromtheselectionlist.Thedialogboxwith
thesearchhelpnameisshowninFigure341.
Figure341.AttachSearchHelpInitialScreen
Clickonthe
buttonandawindowandthesearchhelpattachment
dialogboxasshowninFigure342appears.
Figure342.AttachSearchHelpFieldAssignment
Alltheimport,exportparametersarelistedhere.Yourtwoexport
parameterswillappearintheFieldassignmentarea.Ifthefieldsarenot
appearing,clickonGenerateProposalButtonatthetoprightcorner.
Clickonthe
buttontocopysearchhelp.
Savethetablechanges.Performaconsistencycheck:
keys<Ctrl>+<F2>.Activatethetable
buttonor
buttonorkeys<Ctrl>+
<F3>.ClickontheEntryhelp/checktabonthetablemaintenancescreen,
andyouwillseethesearchhelpentryundertheSrchHelpcolumnforthe
fieldITEM_CODEasshowninFigure343.
Figure343.AttachSearchHelpEntryinSrchHELP
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
18/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Youcandeleteanattachedsearchhelpifsodesiredbyusingthe
buttononthesearchhelpattachmentdialogbox.
TestAttachedSearchHelpYCL_CH03_ITEMS_SH
Youneedtotesttheworkingoftheattachedsearchhelp.Entertabledata
creationmode.IntheDictionary:MaintainTablescreenclickonthe
menuoption:Utilities
TableContents
Createentriesorinthe
SE16openingscreen,enterthetablename,clickontheapplication
toolbar
button.Thedatacreationscreenwillappear.Enteravalid
billno,serialnothenpressF4inthefieldITEM_CODE(LabelItem
Code).ThescreenappearsasinFigure344.
Figure344.TestSearchHelpRestrictiveDialogueBox
Youareviewingthesearchhelprestrictivedialogboxwiththetwofields
ITEM_CODEandITEM_DESC.SPosvaluesforthesetwofieldswere1
and2respectively,andtheyappearinthefirstandsecondpositioninthe
restrictivedialogbox.Youcanentersomevalue/sorpattern/sinthese
fieldsinthedialogboxanddatawillbefilteredasperthevalue/s,
pattern/sintheselectionlist.Ifyoudonotenteranyvalueandpress
<Enter>,alltherows(uptotheMaximumofHits)willappearinthe
selectionlist.Press<Enter>intherestrictivedialogbox.Theselection
listofthesearchhelpwillappearonthescreenasshowninFigure345.
Figure345.TestSearchHelpSelectionList
ThesearchhelpselectionlistisdisplayingITEM_CODEinthefirst
position,ITEM_DESCinthesecondposition,andRATEinthethird
positionaspertheobjectspecificationLPosvalueassignmentstothese
fieldsare1,2,and3.Selectanitemintheselectionlistbydouble
clickingonitorselectingtherowandclickingonthe
button(the
Buttonisusedforcancellationandexitofselectionlist).Select
ITEM_CODEvalue0015withRATEvalue320.00.Thesearchhelp
exportsthetwofieldsITEM_CODEandRATEvaluesfromtheselection
listfieldstotherespectivescreenfields.ThisisshowninFigure346.
Figure346.TestSearchHelpExportfromSelectionListto
ScreenFields
Youhavefullytestedthesearchhelpanditisoperatingaspertheobject
specifications.
SearchHelpswithSAPdeliveredTables
ScenarioofElementarySearchHelpwithSAPDeliveredTable
YouwillcreatesearchhelpsusingtheSAPcustomerprimarytableKNA1.
YouwillnotbeabletoattachthissearchhelptoaSAPtablefield(no
modificationofSAPdeliveredobjects)youwilltestthesearchthroughan
ABAPprogram.ABAPprogramwritingisbeingintroducedinapreview
manner.ItwillbeformallyintroducedintheChapter4.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
19/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Theobjectspecificationforthissearchhelpfollowsinthenextsection:
CreateElementarySearchHelpwithCustomerPrimaryTable
KNA1ObjectSpecification
SearchHelpname:YCL_CH03_KNA1_SH1
Table:KNA1(sourceofdata)
Test:ABAPProgram
SelectionListFields:KUNNRLPos=1.
NAME1LPos=2.
ORT01LPos=3.
LAND1Lpos=4.(CountryCode)
RestrictiveDialogueBoxFieldsKUNNRSPos=1.
NAME1SPos=2.
ORT01SPos=3.
LAND1SPos=4.(CountryCode)
ExportFields:KUNNRExport=X.
ImportFields:None
CreateElementarySearchHelpwithTableKNA1
YCL_CH03_KNA1_SH1
IntheSE11openingscreen,selecttheradiobuttonSearchhelp.Enterthe
nameofthesearchhelptobecreated.Thenameis
YCL_CH03_KNA1_SH1.ClickontheCreatebuttonorpressfunctionkey
F5.Thesystemwillpromptforthesearchhelptypetobecreated.Select
thedefaultElementarysearchhelpandpressthe
button.
Thescreentocreateelementarysearchhelpwillappear.Fillinthe
valuesaspertheobjectspecification.Afterfillinginthevalues,the
screenwillappearasshowninFigure347.
Figure347.CreateSearchHelpYCL_CH03_KNA1_SH1
Saveandperformaconsistencycheckandactivate.
TestElementarySearchHelpYCL_CH03_KNA1_SH1inits
environment
Thereisamodeoftestingasearchhelpwithinthesearchhelp
environment.SelectmenuoptionSearchHelp
Test.Awindow
appearsasshowninFigure348.
Figure348.TestSearchHelpYCL_CH03_KNA1_SH1in
SearchHelpScreen
ClickinthefieldReadyforinpandpressF4.Therestrictivedialogboxas
showninFigure349appears.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
20/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure349.TestSearchHelpYCL_CH03_KNA1_SH1
RestrictiveDialogueBox
EnterS*intheName1fieldandBerlininORT01field.Thatis,fetchall
customersofBerlinstartingwiththeletterS.Thisproducestheselection
listasshowninFigure350.
Figure350.TestSearchHelpYCL_CH03_KNA1_SH1Selection
List
Ifyouselectacustomer,thecustomercodefieldKUNNRvalueshouldbe
exportedfromtheselectionlisttothescreenfield.Selectthecustomer
code2999.Whenyoudoubleclickonthis,itisreturnedtothescreen
field.ThisisshowninFigure351.
Figure351.TestSearchHelpYCL_CH03_KNA1_SH1Export
Thissearchhelpisaspertheobjectspecification.Ithasfourfieldsinthe
restrictivedialogboxintheorderspecifiedbySPosvalues.Ithasthe
samefourfieldsintheselectionlistintheorderspecifiedbyLPosvalues.
ItisreturningthevalueofKUNNRfromtheselectionlisttothescreen
field.
TestElementarySearchHelpYCL_CH03_KNA1_SH1withan
ABAPProgram
CreateanABAPprogram.ThetransactioncodeforABAPprogram
maintenanceisSE38.TheSE38openingscreenisshowninFigure352.
Figure352.ABAPEditorOpeningScreen
AnABAPprogramisnotjustthesource.Ithasfivecomponents
representedbythefiveradiobuttonsshownonthescreenofFigure352.
Atpresent,youwillconcernyourselfwithjusttwocomponents:Source
codeandAttributes.
LikeanyotherABAPWorkbenchobject,youcreateanABAPprogramby
enteringthenameoftheobject,clickingtheCreatebuttonorpressing
functionkeyF5.Soentertheprogramnameas
YCL_CH03_TEST_SEARCH_HELPS.Themaximumnamespaceis30
characters.ThenamehastostartwithaYorZ.Therestofthecharacters
canbealphanumericwithembeddedunderscores(_).Theattributes
screenisshowninFigure353.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
21/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure353.ABAPEditorProgramAttributes
IntheAttributesscreen,entertheTitle(EquivalentofShortdescription
ofotherobjects).SelectprogramtypeorTypeasExecutableprogram
fromthedropdownlist.Clickonthe
button.The
systemwillpromptforthepackage.Assign$TMPorclickonthelocal
objectbutton.Thesystem,uponacceptingtheassignedpackageand
saving,presentsthescreenshowninFigure354.
Figure354.ABAPSourceTextEditor
TheABAPtexteditorhasallthefacilitiestocreateandmaintainsource
text.ItsfeatureswillbecoveredindetailwhenABAPisintroduced
formallyinChapter4.
Ifalinehasanasteriskor*inthefirstcolumn,theentirelineistreated
asacommentline.
Ifalinehasadoublequoteor,therestofthelinetotherightofdouble
quoteistreatedasacomment.
Whenyoucreateaprogram,thesystemgeneratessevenlinesof
comments,aswellastheREPORTstatementforanexecutableprogram
(theexecutableprogramistheprogramtypeassignedontheattribute
screen).TheREPORTisakeywordandisfollowedbythenameofa
programandisterminatedbyaperiod(.).Allstatementsexceptthe
chainedonesareterminatedbyaperiod.Chainedstatementsare
separatedbycommas(,)withthelaststatementinthechainagain
terminatedbyaperiod.
TheconventionistocreateABAPsourceinuppercase.
Thefollowinglineshavebeenenteredintheeditor.Thereiselaborate
commentatthebeginningofprogram.Readthiscommentcarefully.The
PARAMETERstatementissomewhatlikethescanfofC.Itcreatesa
screenprompt.Youareattachingthesearchhelptothepromptvariable
withthekeyphraseMATCHCODEOBJECT.Thepromptvariableis
referringtotheDDICfieldKUNNRoftableKNA1.Thepromptvariable
willderiveitsTYPE,length,etc.,fromtheTYPElengthoffieldKUNNR
inthetableKNA1.ThenotationKNA1KUNNRdenotesfieldKUNNRof
tableKNA1.
TheABAPProgram:
REPORTYCL_CH03_TEST_SEARCH_HELPS.
********************************************************
*PARAMETERSkeyword*****
******
*:forchaining(Avoidrepetitionof*****
*keywordPARAMETERS)*****
******
*CUST_CD1promptvariablename.*****
*Variablenamecan8char*****
*long,startingwithalpha*****
*restcanbealphanumeric*****
*withembeddedunderscores*****
******
*TYPEkeyword*****
******
*KNA1KUNNRTYPE,LENGTHofCUST_CD1*****
*sameasTYPE,LENGTHOF*****
*KNA1KUNNR*****
******
*MATCHCODEkeyphrasetoattach*****
*OBJECTsearchhelp*****
******
*YCL_CH03_KNA1_SH1nameofsearchhelp*****
********************************************************
PARAMETERS:
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
22/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
CUST_CD1TYPEKNA1KUNNRMATCHCODEOBJECTYCL_CH03_KNA1_SH1
Performaprogramsyntaxcheck(the
buttonorkeys<Ctrl>+
<F2>).
Activatetheprogram(the
buttonorkeys<Ctrl>+<F3>).
Executetheprogrambyclickingonthe
buttonorpressingthe
functionkeyF8.AscreenpromptwillappearasshowninFigure355.
Figure355.PARAMETERSVariablewithSearchHelpAttached
OnpressingthefunctionkeyF4onthispromptvariable,therestrictive
dialogboxasshowninFigure356popsup.
Figure356.PARAMETERSSearchHelpRestrictiveDialogueBox
EnteringtheS*patterninNamefieldandBerlinintheCityfieldwill
fetchallcustomersnamesstartingwithSofCityBerlin,andthesewill
appearinthesearchhelpselectionlistasshowninFigure357.
Figure357.PARAMETERSSearchHelpSelectionList
Ondoubleclickingonthecustomer1173,thisisreturnedorexportedto
thescreenpromptvariable.ThisisshowninFigure358.
Figure358.PARAMETERSSearchHelpReturn/Exportvalue
SoyouhaveobservedthattheelementarysearchhelpcreatedwithSAP
deliveredtable,attachedtoPARAMETERSvariableworksjustfine,as
pertheobjectspecifications.
CollectiveSearchHelpwithSAPdeliveredTable
CreateCollectiveSearchHelpwithTableKNA1Scenario,
ObjectSpecification
YouwillcreateacollectivesearchhelpwithSAPdeliveredwithtable
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
23/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
KNA1.Acollectivesearchhelpconsistsofacollectionofelementary
searchhelps.IntheelementarysearchhelpYCL_CH03_KNA1_SH1,the
firstfieldintheselectionlistisKUNNRforwhichLPos=1.Theselection
listbydefaultisproducedinascendingorderofthefirstfieldinthe
selectionlist(i.e.,thefieldforwhichLPos=1).
Lettwomoreelementarysearchhelpsbecreated:(a)
YCL_CH03_KNA1_SH2inwhichLPosforNAME1=1,and(b)
YCL_CH03_KNA1_SH3inwhichLPosforORT01=1.
Boththeseelementarysearchhelpswillhavethesameexportparameter
KUNNR.
Finallyyouwillhavethreeelementarysearchhelps:
YCL_CH03_KNA1_SH1fieldKUNNR,LPos=1.Theselection
listisproducedcustomercodewiseascending.Exportparameter
KUNNR.
YCL_CH03_KNA1_SH2fieldNAME1,LPos=1.Theselection
listisproducedcustomernamewiseascending.Exportparameter
KUNNR.
YCL_CH03_KNA1_SH3fieldORT01,LPos=1.Theselectionlist
isproducedcitywiseascending.ExportparameterKUNNR.
Youwillcreateacollectivesearchhelpinwhichyouwilllocatethese
elementarysearchhelps.Theideaisthatthesameinformationof
customersispresentedindifferentways(i.e.,codewise,namewise,city
wise).
CreateTwoElementarySearchHelpstobeincludedincollective
searchhelps
CreatetheelementarysearchhelpYCL_CH03_KNA1_SH2.Thefilledin
valuesofthesearchhelpscreenareshowninFigure359.
Figure359.SearchHelpYCL_CH03_KNA1_SH2,NAMELPos=
1
Performaconsistencycheckandactivate.
Testtheelementarysearchhelpinthesearchhelpenvironment.
CreatetheelementarysearchhelpYCL_CH03_KNA1_SH3.Thefilledin
valuesofthesearchhelpscreenareshowninFigure360.
Figure360.SearchHelpYCL_CH03_KNA1_SH3,ORT01LPos=
1
Performaconsistencycheckandactivate.
Testtheelementarysearchhelpinthesearchhelpenvironment.
Create,TestCollectiveSearchHelp
IntheSE11openingscreen,selecttheradiobuttonSearchhelp.Enterthe
nameofthesearchhelptobecrested:YCL_CH03_KNA1_CSH.Clickon
theCreatebuttonorpressthefunctionkeyF5.Thesystemwillpromptfor
thesearchhelptypetobecreated.Selectthistimethecollectivesearch
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
24/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
helpradiobutton,andpressthe
button.
ThescreentocreatecollectivesearchhelpappearsasshowninFigure3
61.
Figure361.CreateCollectiveSearchHelpDefinitiontab
ClickontheIncludedsearchhelpstab.Thesecondtabunderthefirst
columnSearchHelp,youhavetoincorporatetheelementarysearch
helps,oneineachrow.EnterthepatternYCL_CH03*andpressF4.A
selectionlisttochooseanelementarysearchhelpappearsasshownin
Figure362.
Figure362.CreateCollectiveSearchHelpIncludedsearchhelps
tab
Assigneachofthethreeelementarysearchhelps
YCL_CH03_KNA1_SH1,YCL_CH03_KNA1_SH2,and
YCL_CH03_KNA1_SH3.Thecheckboxtohideanelementarysearch
helpisinthecontextofenhancinganSAPdeliveredcollectivesearch
help.Thescreenwiththeassignedelementarysearchhelpsisshownin
Figure363.
Figure363.CreateCollectiveSearchHelpEnterelementary
searchhelps
ClicktheDefinitiontab.Now,onthistab,youhavetomanuallyenterall
theexportandimportparametersofalltheelementarysearchhelps
includedinthecollectivesearchhelp.Inyourscenario,youhaveonly
oneexportparameterKUNNRforallyourthreeelementarysearchhelps
andnoimportparameter.Enterthisexportparameterunderthecolumn
Searchhelpparameter,andenabletheexportcheckboxenterthedata
elementnameforKUNNR,whichisKUNNRitself.(VerifyfromtheKNA1
tabledefinition,thedataelementnameforthefieldKUNNR).After
enteringparameterKUNNR,enablingtheexportcheckbox,enteringthe
dataelementKUNNRthescreenisasshowninFigure364.
Figure364.CreateCollectiveSearchHelpEnterparametersin
Definitiontab)
ClickagainontheIncludedsearchhelpstab.Youhavetoassignexport
andimportparameterstoeachoftheincludedelementarysearchhelps.
Todothis,positionthecursoroneachoftheelementarysearchhelprows
inturns(YCL_CH03_KNA1_SH1andsoon)andclickonthebutton
Param.assignment.Amessagepromptappearsaskingwhetherthe
systemshouldproposeparameterassignment.ClickonthebuttonYes.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
25/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
ThisisshowninFigure365.
Figure365.CreateCollectiveSearchHelpparameters
assignmentmessageprompt
OnclickingthebuttonYes,theparameterassignmentsystemproposal
windowwillappearasshowninFigure366.
Figure366.CreateCollectiveSearchHelpparameters
assignmentSystemProposal
Clickonthe
button.Repeatthisprocedurefor
remainingtwoelementarysearcheshelps(i.e.,YCL_CH03_KNA1_SH2
andYCL_CH03_KNA1_SH3).
Performaconsistencycheck.Activatethecollectivesearchhelp.
Youarereadytotestthecollectivesearchhelp.LetitbedoneintheABAP
program.Modifyyourprogramthatyouusedtotesttheelementary
searchhelp.WriteastatementtohavethePARAMETERSvariableto
attachthecollectivesearchhelp.Atthesametime,totestthetwoother
elementarysearchhelpscreatedandincorporatedinthecollective
searchhelp,lettherebeaPARAMETERSvariablewithoutattachmentof
anyofyoursearchhelps.SoyouwillhavefivePARAMETERSvariables,
fourwithattachmenttoyoursearchhelpsandonewithoutattachmentto
anyofyoursearchhelps.Recallthatsearchhelpisattachedtoa
PARAMETERSvariablewiththephraseMATCHCODEOBJECT.
AttachmentofsearchhelptoaPARAMETERSvariableisoptional.Recall
thatinanABAPprogram,whateverfollowsadoublequote()istreated
asacomment.Theprogramlinesfollow:
REPORTYCL_CH03_TEST_SEARCH_HELPS.
PARAMETERS:
CUST_CD1TYPEKNA1KUNNRMATCHCODEOBJECTYCL_CH03_KNA1_SH1,
CUST_CD2TYPEKNA1KUNNRMATCHCODEOBJECTYCL_CH03_KNA1_SH2,
CUST_CD3TYPEKNA1KUNNRMATCHCODEOBJECTYCL_CH03_KNA1_SH3,
CUST_CD4TYPEKNA1KUNNRMATCHCODEOBJECTYCL_CH03_KNA1_CSH,
CUST_CD5TYPEKNA1KUNNR.noexplicitsearchhelpattached
Afterthemodificationshavebeencarriedout,performsyntaxcheck,
troubleshootsyntaxerrorsandfixthemifanyactivatetheprogram,and
executeit(F8/
).ThescreenwillbeasshowninFigure367.
Figure367.TestSearchHelpsinABAPProgramInitialPrompt
LettheelementarysearchhelpYCL_CH03_KNA1_SH2betestedfirst.
SoclickonthePARAMETERSvariableCUST_CD2andpressF4.The
restrictivedialogboxasshowninFigure368appears.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
26/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure368.TestSearchHelpsinABAPProgramCUST_CD2
RestrictiveDialogueBox
Press<Enter>.Theselectionlistappearswithcustomersnamesin
alphabeticascendingorder.ThisisshowninFigure369.
Figure369.TestSearchHelpsinABAPProgramCUST_CD2
SelectionList
Clickthecancel
buttonandreturntothe
PARAMETERSprompt.ClickonCUST_CD3andpressF4.The
restrictivedialogboxappears,whichisthesameasforCUST_CD2.Press
<Enter>.
Theselectionlistappearswithcustomerscitiesinalphabeticascending
order.ThisisshowninFigure370.
Figure370.TestSearchHelpsinABAPProgramCUST_CD3
SelectionList
Clickthecancel
buttonandreturntothePARAMETERSprompt.
ClickonCUST_CD4(thecollectivesearchattachedtothisvariable)and
pressF4.Therestrictivedialogboxappears(differentfromtheearlier
oneforCUST_CD1,CUST_CD2,andCUST_CD3,whichwereidentical)
withthreetabs,oneforeachelementarysearchhelpincorporated.Thisis
showninFigure371.
Figure371.TestCollectiveSearchHelpinABAPProgram
CUST_CD4RestrictiveDialogueBox
ThethreetabsforCustomerCodeWise,CustomerNameWise,and
CustomerCityWisecorrespondtoeachoftheelementarysearchhelps.
Forsimplicity,yourrestrictivedialogboxisthesameforallthe
elementarysearchhelps(i.e.,theSPosvaluesareidenticalforallthe
elementarysearchhelps).ThetextsCustomerCodeWise,etc.,arepicked
upfromtheshortdescriptionoftherespectiveelementarysearchhelps.
YouarenowontheCustomerCodeWisetab,andwhenyoupress
<Enter>,customercodewiseselectionlistappearsasshowninFigure3
72.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
27/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure372.TestCollectiveSearchHelpinABAPProgram
CUST_CD4SelectionList
IfyouclickontheCustomerNameWisetab,therestrictivedialogboxfor
itappears(identicaltotherestrictivedialogboxoftheCustomerCode
Wisetab)asshowninFigure373.
Figure373.TestCollectiveSearchHelpinABAPProgram
CUST_CD4RestrictiveDialogueBox
Whenyoupress<Enter>onthisrestrictivedialogbox,theCustomer
namewiseselectionlistappears.Similarly,youcanpressCustomerCity
Wisetab,press<Enter>andgetthecitywiseselectionlist.
Inthismanner,theendusercangetthesameinformationpresentedina
differentmanner.Itisarequirementwhenyourdataisverylarge.
Differentpeoplerelatetodifferentpresentationsindifferentsituations.
Inthecollectivesearchhelp,therestrictivedialogboxcanbedifferent
foreveryelementarysearchhelp.Theexportandimportparameterscan
bedifferentforeveryelementarysearchhelp.Thiswoulddependonthe
requirementandscenario.Inyourscenario,tokeepthingssimple,you
areusinganidenticalrestrictivedialogbox,withoneexportparameter
forallelementarysearchhelpslocatedinthecollectivesearchhelp.
LetthelastofthePARAMETERSpromptvariablesCUST_CD5betested
towhichyouhavenotattachedexplicitlyanysearchhelpthroughthe
phraseMATCHCODEOBJECT.Clickonthevariable,andpressF4.It
presentsthescreenshowninFigure374.
Figure374.TestSearchHelpsinABAPProgramCUST_CD5
RestrictiveDialogueBox
AcollectivesearchhelpisimplicitlyattachedtothePARAMETERS
variableCUST_CD5.Ifthenumberofelementarysearchhelpsisvery
many,likeinthepresentcaseof17elementarysearchhelps,allthetabs
correspondingtotheseelementarysearchhelpscannotappear
horizontally.Abuttonatthetoprightcorneroftherestrictivedialogbox
isprovidedasshownintheFigure375.Clickingonthistogglebutton,
youmaketheelementarysearchhelplistappearanddisappearandmake
selectionofaparticulartab,oryoucanhorizontallyscrollacrossthetabs.
Figure375.CollectiveSearchHelpDEBIattachedtofield
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
28/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
KUNNR
Thecollectivesearchhelpappearingbydefaultisbecauseyouhave
declaredallthePARAMETERSvariables(CUST_CD1,CUST_CD2,
CUST_CD3,CUST_CD4andCUST_CD5)withthephraseTYPEKNA1
KUNNR.ThesePARAMETERSfieldsarederivingtheirattributesor
characteristicsfromtheDDICtablefieldKUNNR.Acollectivesearchhelp
isattachedtothefieldKUNNRoftableKNA1.Thisisgettingderivedor
inherited.
IncaseofthePARAMETERSvariablesCUST_CD1,CUST_CD2,
CUST_CD3,CUST_CD4,thenthisderivedcollectivesearchhelpis
overriddenbythelocalattachmentofyoursearchhelps.
SoyouarewitnessingthepowerofDDIC.AreferencetoaDDICobjectin
anABAPprogramwillhavethelocaldataobjectinheritingallthe
characteristicsoftheDDICobjects.
ConfirmanattachmentofcollectivesearchhelptotheKUNNRfieldof
tableKNA1.OntheSE11openingscreen,selecttheDatabasetableradio
button,enterKNA1inthefield,andclickontheDisplaybuttonorF7.
Inthetablestructure,positionthecursoronthefieldKUNNR,andclick
onthebuttonSrchHelp.ThescreenappearsasinFigure375.
YoucanexploreandviewthiscollectivesearchhelpDEBIasanexercise.
Youcandosobydoubleclickingonthesearchhelpnameonthisscreen.
ThesystemwillnavigatetotheDEBIcollectivesearchhelpscreen.Inthe
ABAPWorkbenchenvironment,youhavethisfacility.Ifyoudoubleclick
onanassignedobject,thesystemwillnavigatetothatobjectscreen.
Like,forexample,ifyoudoubleclickonthedataelementassignedtoa
tablefield,itwillnavigatetothatdataelementscreenasifyouopened
thatobjectinchangeordisplaymode.Ifyoudoubleclickonthedomain
assignedtoadataelement,thesystemwillnavigatetothescreenofthat
domain.
Ifondoubleclickingonanassignedobject,iftheobjectexists,the
systemwillnavigatetotheobjectscreeniftheobjectdoesnotexist,the
systemmessagepromptswhetheryouwanttocreatetheobject.
SearchHelpAttachments
Thesearchhelpscanbeattachedtotablefields.Inthecoverageofsearch
help,youhavetwoinstancesofthis:(1)attachingelementarysearchhelp
tothefieldITEM_CODE(foreignkeyfield)ofyourcustomcreated
tableYCL_CH02_BILLI,and(2)thecollectivesearchhelpDEBIattached
toKUNNR(primarykeyfield)fieldoftableKNA1.
Youcanattachsearchhelpstoaprimarytable.Thishasbeendoneinthe
SAPfunctionalmoduletableLFA1,whichistheVendor/Supplierprimary
table.Lookthisupasanexercise.IntheLFA1tablestructuredefinition,
clickonthemenuExtras
SearchHelpforTable.Thecollectivesearch
helpisattachedtothetableasKRED.
Youcanattachasearchhelpstoadataelement.Youcandothisinthe
FurtherCharacteristicstab,SearchHelparea.Youcanattachasearch
helptoadataelement,providedthesearchhelphasoneexport
parameter,becausethereisaprovisionforoneparameteronlyinthe
SearchHelpareaofthedataelement.
Searchhelpscanbeattachedtoscreenfieldslikeyouhaveseeninthe
ABAPprogram.Moreofthissearchhelpsattachedtoscreenfields,and
youwillseethisinChapter14entitledScreenProgramming.
SearchHelpwithHelpView
Ahelpviewimplementsaleftouterjoin.Ifyoucreateahelpviewwith
thetablesKNA1andVBAK,youwillobtainintheresultalltherowsfrom
thetableVBAKaswellasthecustomershavingnocorrespondingrowsin
theVBAKtable.Youcantrythisoutasanexercise.Createahelpview
usingtablesKNA1andVBAK.Usingthishelpview,createasearchhelp.
Theresultofaleftouterjoinissometimesrequiredinbusiness
scenarios.
DDICTitBits
IntheDDICopeningscreen,thereisaprovisiontocopyobjects.Usethe
applicationtoolbarcopy
buttontodothis.Thecopiedobjectwill
notbeinanactivestate.Tousethecopiedobject,youneedtoactivateit.
YoucandeleteDDICobjects,providedtheyarenotinuse.Youcannot
deleteadomainthathasbeenassignedtoataelement/s.Youcannot
deleteanobjectreferredtoinanABAPprogram.Usetheapplication
toolbardelete
buttontodoso.
Youshouldalsobeawareofthewhereused
button.Usingthis
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
29/30
1/5/2016
Chapter3:ABAPDictionary/DataDictionary/DDIC2SAPABAP:HandsOnTestProjectswithBusinessScenarios
button,youcanderivetheinformationofwhereallDDICobjectsare
beingused.Adomainhasbeenassignedtowhatalldataelementsanda
dataelementhasbeenassignedtowhatalltablefieldsandreferredin
whatallABAPprograms,etc.Adataelementcanbereferredtoinan
ABAPprogramtodeclaredata.
Conclusion
Intheforthcomingchapters,youwillfindmultiplereferencestoDDIC
objectstodeclaredatainABAPprograms.Youwilllearnaboutbusiness
scenariosthatwarrantcreationofDDICobjects,notablydatabaseviews,
structures,tabletypes,typegroups,searchhelp,anddataelements.
DDICisubiquitousasregardstheABAPdevelopmentalplatform.
NEXT
PREV
Chapterwho
2: ABAPfinished
Dictionary/Data
1
People
thisDictionary/DDIC
also enjoyed:
BOOK SECTION
26 MINS
SAP
BOOK SECTION
Introducing Some
Functional Features
from: Functional Python
Programming by Steven Lott
Released: January 2015
5 MINS
Python
Recommended / Queue / Recent / Topics / Tutorials / Settings / Blog / Feedback / Sign Out
2016 Safari.
Terms of Service / Privacy Policy
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch03.xhtml
30/30