Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Recent
Topics
Tutorials
NEXT
PREV
Highlights
Appendix A: Description of the SAP-Delivered Tables
Used in th...
CHAPTER14
Settings
Feedback
ScreenProgramming
Sign Out
BasicsofScreenPainter
YouwereintroducedtotheverybasicsofscreenprogramminginChapter
12entitledALV(ABAPListViewerOutputsPart1).Screen
programmingisforinputofdata.Inputscouldinvolvemultiplescreens
andcomplexscreenelements(customcontrols,tabstripcontrols,table
controlsandsoonarecomplexscreenelements.Thischapterwill
Settings
10 days left in your trial. Subscribe.
Feedback
recapitulatecoverageofscreenprogrammingwecoveredearlierandadd
toit.
Sign Out
Thecoreofscreenprogrammingisthescreenpainter.(Transactioncode
SE51).Screensareattachedtoprogramsandareidentifiedbyfourdigit
numbers.Screensconsistof:
Attributes.(Likeanyotherworkbenchobjects).
FlowLogic.Ontriggeringofscreenevents,toexecutealimited
repertoireofABAPstatements,mostofthesestatementsare
permittedonlyintheflowlogicarea,notablythemoduleinvoking
statementMODULE<modulename>.Themoduleinvoking
statementsjumptotherespectivemodule(similartojumpingtoa
subroutinetoexecutenormalABAPcodeandreturn).Refertothe
ABA)forafulllistofflowlogicstatements.
TheElementList.Thisisanongraphicalrepresentationofthe
screenelementswiththeirattributes.
TheLayoutEditor.Youcandrag,drop,position,size,and
staticallyadjustattributesofscreenelementsinthelayouteditor.
ThescreenelementpaletteisshowninFigure141.
Figure141.LayoutEditorScreenElementPalette
ThoughitisshownhorizontallyinFigure141,itislaidoutverticallyin
thelayouteditor.
Mainevents.Twomaineventshavealreadybeendescribed,
includingPROCESSBEFOREOUTPUT,PBO,andPROCESS
AFTERINPUT(PAI).ThePBOeventistriggeredintwosituations:
(i)justbeforethescreenappearstotheuserforthefirsttime,and
(ii)ifitsucceedsthePAIevent.ThePAIeventisareactiontoauser
interactionsuchasauserpressingabutton,ausermakingamenu
selection,orauserpressingthe<Enter>key,etc.
BydefaultthePBOeventsucceedsthePAIevent.Butifanerror
condition(invalidinput)arisesduringaPAIevent,thePBOeventis
suspendeduntiltheerrorconditionisrectified.
Therearetwomoreevents:PROCESSONVALUEREQUEST(POV)and
PROCESSONHELPREQUEST(POH),analogoustotheSelection
ScreeneventsATSELECTIONSCREENONVALUEREQUESTandAT
SELECTIONSCREENONHELPREQUEST,respectively.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
1/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Datatransfer.Thereisacontinualexchangeortransferofdata
betweentheapplicationserversandthepresentationservers.The
ABAPprogramsgetexecutedontheapplicationserverthatis,all
thedataobjects/variablesdeclaredwithDATAandTABLES
statementsareallocatedmemoryontheapplicationservers.These
declaredvariables,allocatedmemoryontheapplicationserver,
willbecalledasABAPvariables.Whatevervariablesyoulocate
andpositiononthescreeninthescreenpaintergetdefinedonthe
presentationserverswhentheprogramexecutes.Thevariables
positionedonscreenwillbecalledasscreenvariables.Thereisa
transferofvaluesbetweenABAPvariablesandscreenvariables
duringthePBOandPAIeventsforidenticallynamedvariables.
DuringthePBOevent,dataorvaluesaretransferredfromtheABAP
variablestothescreenvariablesforidenticallynamedvariables.
DuringthePAIevent,itisthereverse(i.e.dataorvaluesaretransferred
fromthescreenvariablestotheABAPvariablesforidenticallynamed
variables).ThisisshowngraphicallyinFigure142.
Figure142.TransferofDataduringPBOandPAIEvents
ThescreenfieldnamesareKUNNRandKNA1NAME1.TheABAP
variablesnamesareKUNNRandNAME1.
Therefore,datawillgettransferredbetweenthescreenfieldKUNNR
andABAPvariableKUNNRonly.(ScreenfieldnameandABAPvariable
namebeingidentical).ThescreenfieldnameKNA1NAME1isnot
identicaltotheABAPvariablenameNAME1.
Asstatedearlier,thistransferoccursonlyforidenticallynamed
variables,asiftheMOVECORRESPONDING...statementisin
operation.
Bydefaulttheflowofdatawilloccurforallidenticallynamedvariables.
WiththeflowlogicstatementsFIELDandCHAIN...ENDCHAIN,the
flowcanberestrictedtospecificfieldorfields.Thiswillbedemonstrated
inthehandsonexercises.
HandsonExercise.OperateontheDataofaCopyofTable
T005T
DatatoBeOperatedUpon
YouwillcreateanABAPprogramandrelatedobjectstooperateonthe
dataofacopyoftheSAPdeliveredtexttableT005T.Thetexttable
T005Tstoresthecountryrelatedtexts.ThetableT005Thasthefields
showninTable141.
Table141.FieldsinTableT005T
FieldName
DDICType,
Description
Length
MANDT
CLNT/3
ClientCode
SPRAS
LANG/1
LanguageCode
LAND1
CHAR/3
CountryCode
LANDX
CAHR/15
CountryText
NATIO
CHAR/15
NationalityText
LANDX50
CHAR/50
CountryText,50
Characters
NATIO50
CHAR/50
NationalityText,50
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
2/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Characters
PRO_SPREGT
CHAR/50
SuperRegionText
ThroughanABAPprogram,youwillbeableto:
Displaythedataofaspecifiedlanguageandcountrycode.
Change/editthedataofaspecifiedlanguageandcountrycode.
Addanewrowinthetable.(Newlanguagecountrycodeswiththe
relatedtexts).
Deletearowofaspecifiedlanguageandcountrycode.
YouaremakingacopyofthetablestructureT005Tintothestructure
YCL_CH14_T005T.ThetableT005Tisatexttableanditsprimarytable
isT005.ThenewtableYCL_CH14_T005TwillalsoinheritT005asits
primarytable.ButyouwillmakethenewtableYCL_CH14_T005T
independentoftheprimarytableT005bydeletingtheforeignkey
relationshipofthefieldLAND1.Afterdeletingtheforeignkey
relationshipoffieldLAND1inthetablestructureYCL_CH14_T005T,
youwillactivatethenewtablestructure.Withtheforeignkey
relationshipforthefieldLAND1deleted,youwillbeabletoinsert/add
newcountriesinthenewtableYCL_CH14_T005Tasitisindependent
ofthetableT005.
YouwillcopyrowsfromthetableT005Tintothetable
YCL_CH14_T005Tforrowscorrespondingtotheloggedinlanguage.
(Anarbitrarydecision).ThecodeforcopyingdatafromT005Tinto
YCL_CH14_T005T.
TABLEST005T.
SELECT*FROMT005TWHERESPRAS=SYLANGU.
INSERTINTOYCL_CH14_T005TVALUEST005T.
ENDSELECT.
WRITE./5'RowsTransferred.',(4SYDBCNT.
Screens
Youwillhavetwoscreensforthisexercisetodemonstratethenavigation
betweenthescreens.Thefirstscreenwillhavejusttheprimarykeyfields
SPRASandLAND1tobeinput.Basedontheinputvaluesandoperation
tobeperformed,youwillnavigatetothesecondscreen,whichwillhave
alltheseventablefields.(ExcludingtheMANDTfield).Youwillprovide
fornavigationfromthesecondscreenbacktothefirstscreen.
Thefirstscreenmusthaveapplicationtoolbarbuttonstocarryout
operationsofdisplay,change,create,anddelete.Andtheapplication
toolbarmustcontainabuttontoexitorquittheprogram.
AroughlayoutofthefirstscreenisshowninFigure143.
Figure143.OperateDataofYCL_CH14_T005TFirstScreen
Youwilldesignatethefirstscreenasscreennumber500.
Onpressingtheexitbutton,itwillquittheprogram.
Thefollowingwillapplyforthedisplay,change,anddeletebuttons.
Ifinvalidvaluesareinputforthelanguagecodeandcountrycode,
anerrorconditioniscreatedandreported.Thisisthecasewhen
thelanguageandcountrycodecombinationinputdonotexistin
thetableYCL_CH14_T005T.ThePBOisnottriggeredbecauseof
theerrorcondition.
Thefollowingwillapplyforthecreatebutton:
Invalidinputvaluesforlanguageandcountrycodeswillcreatean
errorconditionthatisreported.Thisisthecasewhenlanguageand
countrycodecombinationinputforcreationalreadyexistinthe
table.ThePBOisnottriggeredbecauseoftheerrorcondition.
Theinputsoflanguageandcountrycodesarevalidatedtogetherasa
combination.ThisisimplementedwiththeFIELDandCHAIN...
ENDCHAINstatementsintheflowlogicareaofthescreennumber500.
ThiswillbeelaborateduponwhenyoucodethePAImoduleofthefirst
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
3/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
screenorscreennumber500.
Oncetheinputsoflanguageandcountrycodesarevalid,youare
navigatingtothesecondscreendesignatedasscreennumber550.You
arenavigatingtothesecondscreenforthethreeoperations:display,
change,andcreate.
Whenthedeletebuttonispressed,aconfirmationdialogboxwillappear.
Thedeleteoperationdoesnotinvolvenavigationtothesecondscreen.
Aroughlayoutofthesecondscreenorscreennumber550isshownin
Figure144.
Figure144.OperateDataofYCL_CH14_T005TSecondScreen
Thesecondscreen,screennumber550willhavethefollowingattributes
aspertheoperationsbeingcarriedout:
Ifthedisplaybuttonhadbeenpressedontheopeningscreen,all
thefieldsonthesecondscreenwillbeindisplaymode.The
applicationtoolbarwillcontainonlythebackbuttontonavigateto
thefirstscreen(i.e.,screennumber500).
Ifthechangebuttonhadbeenpressedontheopeningscreen,the
keyfieldslanguageandcountrycodeswillbeindisplaymode
andtherestofthefieldswillbeinchangemode.Theapplication
toolbarwillcontaintwobuttons.Thebackbuttontonavigateto
firstscreen(i.e.,screennumber500andthesavebuttontosave
thechangesinthetextfieldstothedatabasetable).
Ifthecreatebuttonhadbeenpressedontheopeningscreen,the
keyfieldslanguageandcountrycodeswillbeindisplaymode
andtherestofthefieldswillhaveinitialvaluesandwillbeready
forinput.Theapplicationtoolbarwillcontaintwobuttons:the
backbuttontonavigatetothefirstscreen/screennumber500and
thesavebuttontosavethecreationofnewlanguageandcountry
data.
Afternavigatingtothesecondscreen,beforethescreenappearstothe
user,youneedtochangethepropertiesoftheinputfieldsasper
operations.
Theapplicationtoolbaronthesecondscreenneedstobeadjustedasper
theoperations.Thesavebuttonmustnotappearwhenthedisplaybutton
ispressedonthefirstscreen.
Theprecedingdescriptionswouldmakeitamplyclearwhatyouare
settingouttodo.
ThefollowingareObjectCreationandTestTaskstobecarriedoutto
OperateontheDataofTableYCL_CH14_T005T.
1. CreateanABAPprogramthatwillbethemainprogram.
2. Createscreennumber500,itslayout,element,listandflowlogic
withthePBOmodule.
3. Createthestatusandtitlebarforscreennumber500.
4. Createthescreennumber500PAImodule.
5. CreateasearchhelptobeattachedtothefieldLAND1ofthetable
YCL_CH14_T005T.Theusercanmakeaselectionofalanguage
countrycodecombinationfromthislist.
6. Createscreennumber550:itslayout,elementlist,andflowlogic
withthePBOmodule.
7. Createthestatusandtitlebarforscreennumber550.
8. Createthescreennumber550PAImodule.
9. Testthedifferentoperationsprovidedintheprogram.
Youareusingtheobjectnavigator(i.e.transactioncodeSE80)to
performthetasksofobjectcreation.Withtheobjectnavigator,youcan
createallobjectsfromasingleexternalsession,insteadofmultiple
externalsessionsthatyouemployeduntilnowforcreationofvarious
objectssuchasprograms,screens,interfaces,andDDICobjectsetal.
TransactionCodeSE80ObjectNavigator
Untilnow,youwereusingseparateexternalsessionstocreatedifferent
workbenchobjects.Youhadanexternalsessionforscreenpainter,an
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
4/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
externalsessionformenupainter,anexternalsessionforDDICobjects,
anexternalsessionforABAPsourceprogram,andsoon.
WiththeobjectnavigatortransactioncodeSE80youcancreateand
maintainalltheworkbenchobjectsfromasinglesession.Youcanview
alltherelatedobjectsintheobjectnavigator.
Youwillcarryoutthedevelopmentaltasksofthecurrentexerciseinthe
objectnavigator.So,enter/NSE80inthecommandboxandnavigateto
theobjectnavigator.TheobjectnavigatorscreenwilllooklikeFigure14
5.
Figure145.ObjectNavigatorScreen
1. ABAPprogram.Asyouwanttostartoffbyfirstcreatinga
program,selecttheoptionProgramfromthedropdownlistas
showninFigure145.Rightunderthefieldwhereyouenteredthe
Programoption,enterthenameofthenewABAPprogram:
YCL_CH14_01_YCL_CH14_T005TDATA.Press<Enter>.The
followingpromptwillappear,indicatingthattheprogramdoesnot
existandasksifyouwanttocreatethenewprogram.
Figure146.ObjectNavigator.CreateNewProgram
Thesystemappearswithanotherpromptsothatyoucandecide
whethertocreateatopinclude.Atopincludeisanincludeprogram
containingglobaldatadeclarations,andaconventionSAPfollows
initsprograms.Youdonotwantatopinclude,soensurethecheck
boxfortopincludeisdisabled.ThescreenwilllooklikeFigure14
7.
Figure147.ObjectNavigator.CreateNewProgramTop
IncludeOption
Next,theprogramattributesscreenwillappearasshowninFigure
148.
Figure148.ObjectNavigator.CreateNewProgram
ProgramAttributes
TheABAPsourcewillappearlikeinFigure149.
Figure149.ObjectNavigator.CreateNewProgram
ProgramSource
Asindicated,thereisabuttontooperatewithafullscreenora
partialscreenfortheobjectnavigatorontheleft.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
5/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Youenterthefollowingcode.
TABLES.YCL_CH14_T005T.
DATA.OK_CODETYPESYUCOMM.
STARTOFSELECTION.
CALLSCREEN500.
MoresourcecodelineswillbeaddedwhenyoucreatePBOandPAImodules.
2. Screennumber500layout,elementlist,flowlogic,and
PBOmodule.Youwanttostartcreatingscreenpainterobjects.
Todothis,selectorclickontheprogramname,clickonthemouses
rightbutton,andthecontextmenushowninFigure1410will
appear.
Figure1410.ObjectNavigator.CreateScreen
SelectCreate
ScreenasshowninFigure1410.Afurther
promptforascreennumberwillappear.
Figure1411.ObjectNavigator.CreateScreenPromptfor
ScreenNumber
Enteringthescreennumberas500andpressingthecontinue
buttonwillbringuptheattributescreen.Entershorttextonthe
attributescreenandbringupthelayouteditorasshowninFigure
1412.
Figure1412.ObjectNavigator.CreateScreenLayout
Editor
YouwanttoplacethetwofieldsYCL_CH14_T005TSPRASand
YCL_CH14_T005TLAND1ofthetablestructure
YCL_CH14_T005Tonthescreenwiththerespectivefieldlabels.
Thepreferredwaytodoitistousefunctionalityofthethirdbutton
fromtherightoftheapplicationtollbarasshowninFigure1412.
ThisbuttonenablesyoutoplacefieldsofDDICstructuresor
programstructuresonthescreen.InthecaseofDDICstructure,it
willautomaticallyfetchandpositiontherelatedfieldlabelsfrom
theassigneddataelements.Inthecaseofprogramstructure,you
havetomanuallyenterthelabels.Thepreferredwayistogetthe
fieldsfromDDICstructures.Thisiswhatyouwilldointhepresent
context.Since,mostly,youwillbepositioningscreenfieldsby
fetchingthemfromtheDDICstructure,thenameofthescreen
fieldswillcarrythestructurename,hyphen,andthefieldname.If
youdesirethattheABAPprogramfieldshavetheidenticalfield
namesasthescreenfieldnames,theeasywaytodoitistodeclare
thestructureintheABAPprogramwiththekeywordTABLES.This
iswhathasbeendonehereandthisisaconvention.Thisensures
thatscreenfieldnamesareidenticaltoABAPprogramfieldnames
fortransferofdatabetweenscreenvariablesandABAPprogram
variablesduringthescreeneventsPBO,PAI,etc.Clickonthe
Dictionary/ProgramFieldsWindowbutton.Thiswillbringupthe
promptasshowninFigure1413.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
6/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure1413.ScreenPainterLayoutEditor.
Dictionary/ProgramFieldsWindow
YouhaveenteredthetablestructurenameYCL_CH14_T005Tand
pressedontheGetfromDictionarybutton.Allthefieldsoftable
structureYCL_CH14_T005Thavebeenfetched.Thereareradio
buttonstoselecttheShort/Medium/Long/Headerlabelsfromthe
dataelement.ThedefaultoptionistheMediumlabelthatyouare
accepting.Attheextremeleftthereisabuttonfor
selecting/deselectingfields.(Rowselectors).Sinceyouwantthe
twofieldsYCL_CH14_T005TSPRASandYCL_CH14_T005T
LAND1withtheirlabelstobeplacedonthescreen,youhave
selectedthesetwofields.Next,pressthecontinuebutton.The
screenwillappearlikeinFigure1414.
Figure1414.ScreenPainterLayoutEditor.Getting
DictionaryFieldsonScreen
Positionthefieldswiththeirlabelsatthedesiredpositionby
releasingtheleftmousebutton.Allthescreenelementswould
havebeenselected.Clickontheblankareaofthescreento
deselectthefieldsandlabels.Thescreenwilllookliketheonein
Figure1415.
Figure1415.ScreenPainterLayoutEditor.Placing
DictionaryFieldsonScreen
Saveandclosethescreen.Youwillbebackonthescreenpainter
screenwiththeAttribute,ElementList,andFlowLogictabs.Click
onthetabElementList,andentertheOK_CODEintheelement
list.Saveandnavigatebacktotheobjectnavigator.Youwillcreate
thePBOmodule,interface,andPAImodulefromtheobject
navigator.YouwillcreatethePBOmodulenow.Selecttheprogram
name,andclickonthemouserightbuttontogetthecontextmenu
asshowninFigure1416.
Figure1416.CreatethePBOModule
ThePBOintheflowLogicwillbe:MODULESTATUS_500.
CreatethePBOmoduleinthemainprogram
YCL_CH14_01_YCL_CH14_T005TDATA.ThePBOmodulewill
belikethefollowingone.
MODULESTATUS_0500OUTPUT.
SETPFSTATUS'STAT1'.
SETTITLEBAR'TITLE01'.
OK_CODE=''.
ENDMODULE.
Saveandnavigatebacktotheobjectnavigator.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
7/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
3. Screennumber500statusandtitlebar.Youhavetocreate
thestatusSTAT1.Soagain,selecttheprogramname,clickonthe
mouserightbutton,andmakethecontextmenuselectionasshown
inFigure1417.
Figure1417.CreateStatus
CreatethefivebuttonsinstatusSTAT1aspertheroughlayoutof
screennumber500inFigure143.ThestatusSTAT1application
toolbarwilllooksimilartoFigure1418.
Figure1418.StatusSTAT1.ApplicationToolBarofScreen
500
Intheapplicationtoolbar,fortheEXITbutton,youassigned
functiontypeE.Thesignificanceofthiswillbeexplainedduring
theelaborationonthePAImoduleofthescreennumber500.
Figure1419.StatusSTAT1.EXITButtonAssigning
FunctionTypeE
Figure1420.StatusSTAT1.EXITButtonAssigned
FunctionTypeE
Saveandreturntoobjectnavigator.
YouhavetocreatethetitlebarTITLE01.Selecttheprogram
name,clickonthemouserightbutton,andmakethecontextmenu
selectionasshowninFigure1421.
Figure1421.CreateTitleBar
CreateatitlebarasshowninFigure1422.
Figure1422.TitleBarCreatedScreen500
Activatetheinterfacebeforenavigatingbacktotheobject
navigator.
4. Screennumber500PAImodule.Nowthatthestatushasbeen
created,youwilltacklethePAIofscreennumber500.YourPAI
willbemoreinvolved.
YourPAIintheflowlogicis:
PROCESSAFTERINPUT.
MODULEOVER_AND_OUT_500ATEXITCOMMAND.
CHAIN.
FIELD.YCL_CH14_T005TSPRAS,YCL_CH14_T005TLAND1.
MODULEVALIDATE_INPUT_500.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
8/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
ENDCHAIN.
MODULEMAIN_PAI_500.
ThePAIwillbetriggeredbypressingoneofthebuttonsonthe
applicationtoolbar:EXIT,DISPLAY,CHANGE,CREATE,and
DELETE.(Referencetothebuttonsisbytheirfunctioncodes).The
discussionontheEXITbuttonisdeferredfornow.Whenany
buttonotherthantheEXITispressed,youwillhavetofirst
validatethecombinationofthefieldsYCL_CH14_T005TSPRAS
andYCL_CH14_T005TLAND1.Thevalidationiscarriedoutin
themoduleVALIDATE_INPUT_500.
ThestatementsCHAINandENDCHAINintheflowlogicareaof
thescreenpainterareequivalenttothedeclarationofablockin
theSelectionScreenenvironment.Whenexecutingthemodule
statementsforachain,thevaluesofonlythefieldinthechainare
transferredfromthescreentotheABAPvariables.Referto
documentABAPProgramming(BCABA)foradetaileddescription
oftheFIELD...,CHAIN,andENDCHAINstatements.
IftheCREATEbuttonispressed,youwillhavetocheckwhether
thevaluesoftheinputfieldsYCL_CH14_T005TSPRASand
YCL_CH14_T005TLAND1alreadyexistinthedatabasetable
YCL_CH14_T005TwithaSELECTSINGLE...statementinthe
PAImodule.Iftheinputvaluesexist,issueanerrormessage.
IfanyoftheDISPLAY/CHANGE/DELETEbuttonsarepressed,
youwillhavetocheckwhetherthevaluesoftheinputfields
YCL_CH14_T005TSPRASandYCL_CH14_T005TLAND1exist
inthedatabasetableYCL_CH14_T005TwithaSELECTSINGLE.
..statementinthePAImodule.Iftheinputvaluesdonotexist,
issueanerrormessage.
AnerrormessageinthePAIwillwithholdthetriggeringofaPBO
event.
IftheEXITbuttonispressed,thevalidationofinputvaluesoffields
YCL_CH14_T005TSPRASandYCL_CH14_T005TLAND1is
unnecessary.Ifyouwanttoquit,itdoesnotmakesensetoinsiston
validvaluestobeinput.Forthisreason,youcategorizedtheEXIT
buttonasfunctiontypeEinthemenupainter.Andyouare
executingthePAImoduleMODULEOVER_AND_OUT_500AT
EXITCOMMAND.Thoughyouareinvokingthismoduleinthe
flowlogicareaasthefirstmodule,itcanbeinvokedinanyorder,
butitwillbeexecutedfirstbeforeanychecksandvalidations.It
willtransferonlytheOK_CODEvaluefromthescreenvariableto
theABAPvariable.Thevaluesofothervariablesarenot
transferred.AmoduleendingwiththephraseATEXIT
COMMANDwillbeexecutedforbutton(s)assignedthefunction
typeEonly.
WhenthevaluesofinputfieldsYCL_CH14_T005TSPRASand
YCL_CH14_T005TLAND1arefoundvalidvisvisthe
operationalbuttonpressed,thevaluesshouldexistforthe
display/change/deleteoperations,andthevaluesshouldnotexist
forthecreateoperationwhenyouexecutethemodule
MAIN_PAI_500.
Inthismodule,youaresavingtheOK_CODEcontentsinto
anothervariableSAVE_OK_CODE,initializingtheexcludebutton
internaltable.Ifadisplay/change/createbuttonispressed,you
arenavigatingtoscreennumber550withthestatementLEAVE
TOSCREEN550.Inthecaseofthecreatebuttonbeingpressed,
youareinitializingthefivefields:YCL_CH14_T005TLANDX,
YCL_CH14_T005TNATIO,YCL_CH14_T005TLANDX50,
YCL_CH14_T005TNATIO50,andYCL_CH14_T005T
PRQ_SPREGT.Thesefieldsmustappearblankforinputwhen
creatinganewcountrytext.
Ifthedisplaybuttonispressed,youareappendingtheexclude
buttoninternaltablewiththefunctioncodeofthesavebutton.You
donotwantthesavebuttontoappearontheapplicationtoolbarof
screen550whenthescreen550isindisplaymode.
Ifthedeletebuttonispressed,youareissuingapopupdialogbox
forconfirmationtodeletecountrytextrow.Ifthedeletionis
confirmedinthepopupdialogbox,youaredeletingtherowand
confirmingthedeletionwithamessageelseissuingdeleteaborted
message.YouareusingtheopenSQLstatementDELETE
YCL_CH14_T005T(i.e.,DELETE<tablestructurename>).
5. SearchhelpforattachmenttofieldLAND1oftable
structureYCL_CH14_T005T.Youhavetocreateasearchhelp
andaDDICobject.Intheobjectnavigator,fromthedropdownlist
whereyouselectedProgram,selectnowLocalObjects.Select
Dictionary,andinvokethecontextmenubyclickingonthemouse
rightbuttonasshowninFigure1423.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
9/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure1423.ObjectNavigator.CreateDDICSearchHelp
Thesystemwillpromptforthenameofthesearchhelpandsearch
helptype(i.e.,elementaryorcollective).Acceptthedefaultsearch
helptype(elementary),andenterthenameofthesearchhelpas
YCL_CH14_OWN_CNTRY_TEXTS_SH,andpressthecontinue
button.Thesearchhelpwithenteredvalueswilllooksimilarto
Figure1424.
Figure1424.SearchHelp.
YCL_CH14_OWN_CNTRY_TEXTS_SH
Saveandactivatethesearchhelpandnavigatebacktotheobject
navigator.YouhavetoattachthissearchhelptothefieldLAND1of
tablestructureYCL_CH14_T005T.ExpandtheDictionarynode
andtheDatabaseTablessubnodeintheobjectnavigatorasshown
inFigure1425.
Figure1425.ObjectNavigator.DictionaryObjects
DatabaseTables
Scroll,andlocatethedatabasetableYCL_CH14_T005Tasshown
inFigure1426.
Figure1426.ObjectNavigator.DDICDatabaseTable
YCL_CH14_T006T
Whenyouhavethedatabasetablestructureinchangemode,
positionthecursoronthefieldLAND1andclickontheSrchHelp
button.Enterthesearchhelpname
YCL_CH14_OWN_CNTRY_TEXTS_SHinthedialogboxand
pressthecontinuekey.Thesearchhelpproposalwillappearas
showninFigure1427.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
10/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure1427.AttachSearchHelp.
YCL_CH14_OWN_CNTRY_TEXTS_SH
Clickonthecopybutton,save,andactivatethedatabasetable
YCL_CH14_T005Tandreturntotheobjectnavigator.
6. Screennumber550layout,elementlistandflowlogic
PBOmodule.Youhavetoswitchbacktotheprogram.Hence,
selectProgramfromthedropdownlist,andentertheprogram
nameasYCL_CH14_01_YCL_CH14_T005TDATAifitisnot
appearingasthedefault.Pressthe<Enter>keyaftertheentryof
theprogramname.Youhavethecreationofscreennumber550as
thenexttask.
Select/clickontheprogram,andinvokethecontextmenuasshown
inFigure1428.
Figure1428.ObjectNavigator.CreateScreen550
Enterthescreennumberas550inthedialogboxthatappears,and
clickcontinue.Maximizethescreenorclickonthefullscreen
button.Entershorttextontheattributescreen.Openthelayout
editor.ClickontheDictionary/ProgramFieldsWindowbuttonon
theapplicationtoolbarofthelayouteditor(thirdbuttonfromthe
right).EnterthetablestructurenameYCL_CH14_T005Tinthe
dialogboxfieldTable/FieldName,andclickontheGetfrom
Dictionarybutton.SelectallthefieldsexceptMANDTasshownin
Figure1429.
Figure1429.ScreenPainterLayoutEditor.
Dictionary/ProgramFieldsWindow
Theselectedfields,whendraggedontothescreenbeforereleasing
themousebutton,willlooklikeinFigure1430.
Figure1430.ScreenPainterLayoutEditor.SelectedFields
DraggedtotheScreen
Fetchthedialogboxforscreenelementattributesforeachofthe
inputfields,anddisabletheInputFieldcheckboxinthetab
Program.Alltheinputfieldsareindisplaymodetostartwith.The
screenwilllookliketheoneinFigure1431.
Figure1431.ScreenPainterLayoutEditor.SelectedFields
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
11/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Dragged,DroppedandSettoDisplay
Saveandclosethelayouteditorscreen.Selecttheelementlisttab,
andentertheOK_CODEfield.Saveandselecttheflowlogictab.
YouwillcreatethePBOmoduleforscreen550now.Invokethe
contextmenuasdescribedearlier.GetthetemplateofthePBO
moduleinthemainprogram
YCL_CH14_YCL_CH14_T005tDATA.InthisPBOmodule,setthe
statusandtitlebarforscreen550.Inthescreennumber550,the
propertiesofthefivefields
YCL_CH14_T005TLANDX
YCL_CH14_T005TNATIO
YCL_CH14_T005TLANDX50
YCL_CH14_T005TNATIO50
YCL_CH14_T005TPRQ_SPREGT
aretobeadjustedasperthebuttonpressedontheapplication
toolbarofscreen500.IfDISPLAYbuttonispressedonscreen
500,allthefieldsonscreen550havetoappearindisplaymode.If
thebuttonpressedonscreen500iseitherCHANGEorCREATE,
allthefivefieldsonscreen550havetoappearininputmode.The
twoprimarykeyfieldsYCL_CH14_T005TSPRASand
YCL_CH14_T005TLAND1onscreen550aretoappearin
displaymodeonlyforalloperations.Thepropertiesofthefive
listedfieldsonscreen550areadjustedasperthebuttonpressedon
screen500insideasubroutine,whichisbeinginvokedinthePBO
moduleofscreen550.Whilesettingstatusonscreen550,the
SAVEbuttonistobeexcludedwhentheoperationisDISPLAY.
Thisisbeingtakencareofbycheckingcontentsof
SAVE_OK_CODEvariable,etc.HereisthePBOmodulecode:
MODULESTATUS_0550OUTPUT.
SETPFSTATUS'STAT2'EXCLUDINGEXCLUD_FC_TAB[].
SETTITLEBAR'TITLE02'WITH'TableYCL_CH14_T005T'(001STRNG.
PERFORMCHANGE_SCR_550_PROP."adjustscreenproperties
ENDMODULE."STATUS_0550OUTPUT
7. Screennumber550statusandtitlebar.Createthestatus
andtitlebarforscreen550fromtheobjectnavigatorasdescribed
earlier.ThestatuswilllooklikeFigure1432.
Figure1432.StatusSTAT2.ApplicationToolbarofScreen
550
ThetitlebarwilllooklikeFigure1433.
Figure1433.TitleBarTITLE02.Screen550
8. Screennumber550PAImodule.YourPAIintheflowlogicis
thefollowing:
PROCESSAFTERINPUT.
CHAIN.
FIELD.YCL_CH14_T005TLANDX,YCL_CH14_T005TNATIO,
YCL_CH14_T005TLANDX50,YCL_CH14_T005TNATIO50,
YCL_CH14_T005TPRQ_SPREGT.
MODULESET_CHANGE_550ONCHAINREQUEST.
ENDCHAIN.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
12/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
MODULEUSER_COMMAND_0550.
ThemoduleSET_CHANGE_550isexecutedwhenthePAIistriggered
andonlyifanyofthefieldsincludedintheCHAIN...ENDCHAINhas
changedvalue.Inthismodule,youaresettingthevariable
DATA_CHG_550toX.RefertothedocumentABAPProgramming(BC
ABA)foradetaileddescriptionofthesestatements.
WhentheBACKbuttonispressed,youarecheckingthevalueofvariable
DATA_CHG_550.IfitsvalueisequaltoX,youareproducingapopup
dialogboxwithamessagetoconfirmwhethertoabortthechangeddata.
Youarenavigatingbacktothescreennumber500withtheLEAVETO
SCREEN500statement.
WhentheSAVEbuttonispressed,youareissuingtheopenSQL
statementMODIFYYCL_CH14_T005T.TheopenSQLstatement
MODIFY...isatwoinonestatement.Dependingonthecontext,it
operatesasanINSERTstatementoranUPDATEstatement.The
MODIFY...statementcheckswhethertheprimarykeyvaluesinthe
fieldsoftheABAPstructurevariablesexistinthedatabasetable.Ifthe
valuesexistinthedatabasetable,theMODIFY...statementoperatesas
anUPDATEstatement,updatinganexistingrow.Ifthevaluesdonot
existinthedatabasetable,theMODIFY...statementoperatesasan
INSERTstatement,insertinganewrowwithvaluesfromtheABAP
structure.
Soyouhavebeensavedtheefforttocodeforcheckingwhether
CHANGE/CREATEbuttonwaspressedonscreen500andissue
separateUPDATE/INSERTstatementsappropriately.
TherearevariationsoftheopenSQLstatementMODIFY....Youcan
refertotheonlinehelpforthis.
Thefullsourcecode:
REPORTYCL_CH14_01_YCL_CH14_T005TDATA.
**************************************
*CountryTextsCustomTableData**
**************************************
TABLES.YCL_CH14_T005T.
DATA.OK_CODETYPESYUCOMM,
SAVE_OK_CODETYPESYUCOMM,"saveOK_CODEtoprocessin
"screen550
STRNGTYPESTRING,
ANSWER(1TYPEC,"deleteconfirmation.1yes2no
EXCLUD_FC_TABTYPESTANDARDTABLEOFSYUCOMM"exclude
WITHHEADERLINE,"buttonstable
DATA_CHG_550(1TYPEC."datachangedindicator
*********************************
STARTOFSELECTION.
CALLSCREEN500.
*&*
*&ModuleSTATUS_0500OUTPUT
*&*
*text
**
*****PBOscreen500*****
MODULESTATUS_0500OUTPUT.
SETPFSTATUS'STAT1'.
SETTITLEBAR'TITLE01'.
OK_CODE=''.
ENDMODULE."STATUS_0500OUTPUT
*&*
*&ModuleVALIDATE_INPUT_500INPUT
*&*
*text
**
*****PAIfieldsvalidationscreen500*****
MODULEVALIDATE_INPUT_500INPUT.
SELECTSINGLE*FROMYCL_CH14_T005TWHERE
SPRAS=YCL_CH14_T005TSPRASAND
LAND1=YCL_CH14_T005TLAND1.
IFOK_CODE='CREATE'ANDSYSUBRC=0.
MESSAGEE041(YCL_CH07_MCLASS01WITH
YCL_CH14_T005TSPRASYCL_CH14_T005TLAND1.
"LanguageCode.&1CountryCode&2AlreadyExists
ELSEIFOK_CODE<>'CREATE'ANDSYSUBRC<>0.
MESSAGEE042(YCL_CH07_MCLASS01WITH
YCL_CH14_T005TSPRASYCL_CH14_T005TLAND1.
"LanguageCode.&1CountryCode&2DoNotExist
ENDIF.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
13/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
ENDMODULE."VALIDATE_INPUT_500INPUT
*&*
*&ModuleOVER_AND_OUT_500INPUT
*&*
*text
**
*****PAIONEXITscreen500*****
MODULEOVER_AND_OUT_500INPUT.
IFOK_CODE='EXIT'.
LEAVEPROGRAM.
ENDIF.
ENDMODULE."OVER_AND_OUT_500INPUT
*&*
*&ModuleMAIN_PAI_500INPUT
*&*
*text
**
*****PAI(mainscreen500*****
MODULEMAIN_PAI_500INPUT.
SAVE_OK_CODE=OK_CODE."saveOK_CODEforprocessinginscreen550
REFRESHEXCLUD_FC_TAB."initializeinternaltableforexcludebuttons
DATA_CHG_550=''."initializeindicatorforchangeddataonscreen550
***************************
CASEOK_CODE.
WHEN'DISPLAY'.
EXCLUD_FC_TAB='SAVE'."excludesavebuttonwhendisplay
APPENDEXCLUD_FC_TAB.
STRNG='Display'(002.
LEAVETOSCREEN550.
**************************
WHEN'CHANGE'.
STRNG='Change'(003.
LEAVETOSCREEN550.
**************************
WHEN'CREATE'.
CLEARYCL_CH14_T005TLANDX."initializefivefieldswhencreate
CLEARYCL_CH14_T005TNATIO.
CLEARYCL_CH14_T005TLANDX50.
CLEARYCL_CH14_T005TNATIO50.
CLEARYCL_CH14_T005TPRQ_SPREGT.
STRNG='Create'(004.
LEAVETOSCREEN550.
**************************
WHEN'DELETE'.
PERFORMDELETE_SRUSINGANSWERYCL_CH14_T005T."deleteconfirmation
IFANSWER=1.
DELETEYCL_CH14_T005T.
MESSAGES044(YCL_CH07_MCLASS01WITH
YCL_CH14_T005TSPRASYCL_CH14_T005TLAND1
DISPLAYLIKE'W'.
"LanguageCode.&1CountryCode&2Deleted!
ELSE.
MESSAGES045(YCL_CH07_MCLASS01.
"DeletionAborted
ENDIF.
**************************
ENDCASE.
ENDMODULE."MAIN_PAI_500INPUT
*&*
*&ModuleSTATUS_0550OUTPUT
*&*
*text
**
*****PBOscreen550*****
MODULESTATUS_0550OUTPUT.
SETPFSTATUS'STAT2'EXCLUDINGEXCLUD_FC_TAB[].
SETTITLEBAR'TITLE02'WITH'TableYCL_CH14_T005T'(001STRNG.
PERFORMCHANGE_SCR_550_PROP."adjustscreenproperties
ENDMODULE."STATUS_0550OUTPUT
*&*
*&ModuleUSER_COMMAND_0550INPUT
*&*
*text
**
*****PAIscreen550*****
MODULEUSER_COMMAND_0550INPUT.
CASEOK_CODE.
WHEN'BACK'.
IFDATA_CHG_550='X'.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
14/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
PERFORMABORT_SRUSINGANSWERYCL_CH14_T005T."savedatapopup
IFANSWER=1.
LEAVETOSCREEN500.
ENDIF.
ELSE.
LEAVETOSCREEN500.
ENDIF.
WHEN'SAVE'.
MODIFYYCL_CH14_T005T.
DATA_CHG_550=''.
MESSAGES043(YCL_CH07_MCLASS01WITH
YCL_CH14_T005TSPRASYCL_CH14_T005TLAND1.
"LanguageCode.&1CountryCode&2Saved!
ENDCASE.
ENDMODULE."USER_COMMAND_0550INPUT
*&*
*&ModuleSET_CHANGE_550INPUT
*&*
*text
**
*****PAI(changeindatascreen550*****
MODULESET_CHANGE_550INPUT.
DATA_CHG_550='X'.
ENDMODULE."SET_CHANGE_550INPUT
**************************************************************
*****subroutinetochangescreen550properties*****
FORMCHANGE_SCR_550_PROP.
LOOPATSCREEN.
CASESAVE_OK_CODE.
WHEN'CHANGE'.
IFSCREENGROUP1='DIS'.
SCREENINPUT=0.
ELSE.
SCREENINPUT=1.
ENDIF.
WHEN'DISPLAY'.
SCREENINPUT=0.
WHEN'CREATE'.
IFSCREENGROUP1='DIS'.
SCREENINPUT=0.
ELSE.
SCREENINPUT=1.
ENDIF.
ENDCASE.
MODIFYSCREEN.
ENDLOOP.
ENDFORM.
***********************
*****subroutinedeleteconfirmation*****
FORMDELETE_SRUSINGANSWRSTRUTYPEYCL_CH14_T005T.
DATA.TXTTYPESTRING.
CONCATENATE
'ConfirmDeletionofLanguageCode'(005STRUSPRAS
'CountryCode'(006STRULAND1
INTOTXTSEPARATEDBY''.
CALLFUNCTION'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR='ConfirmDeletion'(008
TEXT_QUESTION=TXT
TEXT_BUTTON_1='Yes,Delete'(009
TEXT_BUTTON_2='NoToDelete'(010
DEFAULT_BUTTON='2'
DISPLAY_CANCEL_BUTTON=''
START_COLUMN=40
START_ROW=2
IMPORTING
ANSWER=ANSWR
.
ENDFORM.
******************************************************************
*****subroutineabortchangesinscreen550confirmation*****
FORMABORT_SRUSINGANSWRSTRUTYPEYCL_CH14_T005T.
DATA.TXTTYPESTRING.
CONCATENATE
'AbortChangesofLanguageCode'(011STRUSPRAS
'CountryCode'(006STRULAND1
INTOTXTSEPARATEDBY''.
CALLFUNCTION'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR='AbortChanges'(012
TEXT_QUESTION=TXT
TEXT_BUTTON_1='Yes,Abort'(013
TEXT_BUTTON_2='DoNotAbort'(014
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
15/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
DEFAULT_BUTTON='2'
DISPLAY_CANCEL_BUTTON=''
START_COLUMN=60
START_ROW=2
IMPORTING
ANSWER=ANSWR
.
ENDFORM.
Theprogramwithitscomponents,etc.,willappearintheobject
navigatorlikeinFigure1434.
Figure1434.ProgramwithComponentsinObjectNavigator
IntheABAPprogram,thenotationofspecifyingaliteralwiththetext
symbolshasbeenused.[Display(002,etc].Thisnotationwas
introducedinChapter9.Youcancreatetextsymbolids:001,002,003,
004,005,006,008,009,010,011,012,013,and014(thereisnotext
symbolid007)bydoubleclickingonthetextsymbolids:001,002,etc.,
inthestatements.Youalsoneedtocreatemessagetextnumbers041,
042,043,044,and045:
041LanguageCode.&1CountryCode&2AlreadyExists
042LanguageCode.&1CountryCode&2DoNotExist
043LanguageCode.&1CountryCode&2Saved!
044LanguageCode.&1CountryCode&2Deleted!
045DeletionAborted
Thesemessagetextsaretobecreatedinmessageclass/id
YCL_CH07_MCLASS01.
Itnowremainsforustocarryoutthetestingofallproposedoperations
onthedataoftableYCL_CH14_T005T.
TestOperations
Selecttheprogram,andtoggletofullscreenintheobjectnavigator.
Executetheprogram.PressfunctionkeyF4onthefieldCountry.The
searchhelplistwillappearlikeinFigure1435.
Figure1435.ProgramYCL_CH14_YCL_CH14_T005TDATA.
SelectfromList
ThescreenafterselectionfromthelistwillappearlikeinFigure1436.
Figure1436.ProgramYCL_CH14_YCL_CH14_T005TDATA.
ScreenafterSelection
PresstheDisplaybuttontodisplaythevaluesofallthefieldsforthe
primarykeyvaluesENandIN.ThescreenasappearlikeinFigure14
37.
Figure1437.ProgramYCL_CH14_YCL_CH14_T005TDATA.
DisplayData
Youhaveenteredthesecondscreenindisplaymodeandthatiswhythe
Savebuttonontheapplicationtoolbarisexcluded.
Pressthebackbuttontoreturntothefirstscreen.Onthefirstscreen,
presstheChangebuttonforthesameprimarykeyfieldvalues:ENand
IN.EnteravalueinthefieldSuperregion,whichispresentlyblank,
andthescreenwilllooklikeFigure1438.
Figure1438.ProgramYCL_CH14_YCL_CH14_T005TDATA.
ChangeData
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
16/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Youhaveenteredthesecondscreeninchangemodethatiswhythe
Savebuttonontheapplicationtoolbarisappearing.Afterenteringthe
valueinthefieldSuperregion,presstheSavebutton.Thescreenafter
pressingtheSaveButtonwillappearlikeFigure1439.
Figure1439.ProgramYCL_CH14_YCL_CH14_T005TDATA.
DataChanged,Saved
PresstheBackbutton.Ontheopeningscreen,entervaluesEN,GBR
intheopeningscreenfields.PresstheCreatebutton.Thesecondscreen
willcontainblanksinalltheinputtextfieldswaitingforinput.The
screenwillappearlikeinFigure1440.
Figure1440.ProgramYCL_CH14_YCL_CH14_T005TDATA.
CreateData
ThescreenafterenteringvalueswillappearlikeinFigure1441.
Figure1441.ProgramYCL_CH14_YCL_CH14_T005TDATA.
DataCreated
PressontheSavebuttonandyouwillgetthemessageofdatasavedas
earlier.Pressthebackbuttontoreturntothefirstscreen.Pressfunction
keyF4onthefieldCountry.Scrolldownthelistuntilthenewlycreated
countrytextappearslikeinFigure1442.
Figure1442.ProgramYCL_CH14_YCL_CH14_T005TDATA.
ListafterNewData
Letthiscountrytextbedeleted.Selectfromlist/entervaluesENand
GBR.Pressthedeletebutton.Apopupdialogboxfordelete
confirmationwillappearlikeinFigure1443.
Figure1443.ProgramYCL_CH14_YCL_CH14_T005TDATA.
ConfirmDelete
Youcanconfirmorabortthedeletion.Confirmthedeletion.Thedeletion
alertmessagewillappearlikeinFigure1444.
Figure1444.ProgramYCL_CH14_YCL_CH14_T005TDATA.
RowDeleted
EntervaluesEN,USintheLanguageandCountryfields
respectively.Pressthechangebuttontonavigatetothesecondscreen.
Onthesecondscreen,entersomevalueinthefieldsay,Superregion.
Nowpressthebackbuttonwithoutsaving.Theabortchangespopupalert
willappearasshowninFigure1445.
Figure1445.ProgramYCL_CH14_YCL_CH14_T005TDATA.
ConfirmingAbortChanges
Youhavetestedallthespecificationsthattheprogramwassetoutto
fulfill.
Recapitulation.Arecapitulationofthehandsonexercise.
Thehandsonexerciseperformsalltheoperationsneededto
maintaindatainatable.
ThehandsonexercisehasthelookandfeelofaSAPdatacreation
ofcommonentities:customers,vendors,materialsetal.Accept
primarykeydataontheopeningscreenandfurtherdataon
subsequentscreens.
Youhavebeenintroducedtotheobjectnavigator,whichenables
themaintenanceofallworkbenchobjectsfromasinglepointina
singleexternalsession.
Inthelayouteditorofthescreenpainter,youwereintroducedto
theprocedureofplacingfieldsoftheDDICstructureonthescreen
withlabelsfromtheirrespectivedataelements.Thisisthe
frequentlyusedmodeofplacingfieldsonthescreen.
YouwereintroducedtotwoopenSQLstatements:DELETE...and
MODIFY....
Youwereintroducedtothevariationsofthemoduleinvoking
statementsintheflowlogicarea.Theconceptofconditional
executionofamodulehasbeenintroduced.Like:MODULE
SET_CHANGE_550ONCHAINREQUEST.Themodule
SET_CHANGE_550getsexecutedonlyifthescreenhasbeen
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
17/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
modified.
YouhaveusedthecombinationoftypeEbuttonwiththemodule
endingwiththephraseATEXITCOMMAND.Thiswasusedtoskip
inputvalidationwhenquittingaprogram.
Thisconcludesthehandsonexerciseofmaintainingadatabasetable
datawithascreenprogram.
HandsonExercise.DemonstrateSearchHelpImport
Parameters,ScreenEventPROCESSONVALUEREQUEST
POV,etc
ThefeatureofimportparametersinDDICobjectssearchhelpcanbe
betterdemonstratedinascreenprogrammingenvironment.
Therearebusinessscenarioswhereyouentervalue/sinfield/sonthe
screen.Asearchhelpattachedtosomeotherfieldwillfilteroutdata
basedonthevalue/senteredinearlierfields.Thesearchhelpthen
importsfieldvalue/sfromthescreen.
Scenario
Letaspecificscenariobeconsidered.Supposeyouhaveascreenwiththe
followingfields:
LIFNR
VendorCode
.....
BUKRS
CompanyCode
.....
EBELN
PurchasingDocument
YouattachasearchhelptothefieldEBELN.(Purchasingdocument).
WhenyoupressfunctionkeyF4ontheEBELNfield,youwouldlikethe
listofpurchasingdocumentstobefilteredonthebasisofvaluesinthe
twootherfieldsLIFNRandBUKRS(i.e.,purchasingdocuments
belongingtoaspecificcombinationofvaluesofvendorcodeand
companycode).Youwillimplementthiswithimportparametersofthe
searchhelp.ThesearchhelpattachedtothefieldEBELNshouldhavetwo
importingparameters:LIFNRandBUKRS.
Eachimportedparametercanbeindisplaymodethatis,theusercannot
changetheimportedvalueintherestrictivedialogboxandcanbeinedit
mode(i.e.,theusercanchangetheimportedvalueintherestrictive
dialogbox).Adefaultvaluecanalsobeassignedtotheimportparameter.
Allthiswillwork,providedalltheparticipatingfields(thefieldsofthe
presentscenario):LIFNR,BUKRS,andEBELNbelongtothesame
structureasoneentity.
ScenarioImplementation
Letthedescribedscenariobeimplementedwithanexerciseinvolving
screenprogramming.Youarenotperforminganyothertask(like
fetchingdatafromadatabasetable,etc.)otherthandemonstratingthe
importparameterfeatureofsearchhelp.
LettherebeaDDICstructurewiththefollowingfields:
LIFNR
VendorCode
NAME1
VendorName
STRAS
Street
ORT01
City
BUKRS
CompanyCode
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
18/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
EBELN
PurchasingDocument
BEDAT
PurchasingDocumentDate
WAERS
DocumentCurrency
Youhavesomeextrafieldsjusttomakeitfeellikeareallifescenario.
TheDDICstructureYCL_CH14_VENDOR_PD_STRUwilllooklike
Figure1446.
Figure1446.DDICStructure.YCL_CH14_VENDOR_PD_STRU
Thisstructurewillbeusedtopositionfieldsonthescreen.
AsindicatedinFigure1446,searchhelpsareattachedtothefields
LIFNRandEBELN.ThesearchhelpattachedtothefieldEBELN
(YCL_CH14_PURCH_DOC_SH)ismeantfordemonstration.Youhave
attachedyourownsearchhelptothefieldLIFNRtoenablethetransfer
ofnameandcitytothescreenfieldsNAME1andORT01uponselection
ofvendorfromtheselectionlistofthesearchhelp.Thissearchhelpis
YCL_CH14_VENDOR_SH.ThedefaultsearchhelpKREDwouldnot
haveperformedthis.
AscreenshotofsearchhelpYCL_CH14_VENDOR_SHisshownin
Figure1447.
Figure1447.DDICSearchHelp.YCL_CH14_VENDOR_SH
ScreenshotsofthedatabaseviewYCL_CH14_vendorusedbythesearch
helpYCL_CH14_VENDOR_SHisshowninFigures1448and1449.
Figure1448.DatabaseViewYCL_CH14_VENDORTables&
JoinConditions
Figure1449.DatabaseViewYCL_CH14_VENDORFields
AscreenshotofsearchhelpYCL_CH14_PURCH_DOC_SHisshownin
Figure1450.
Figure1450.DDICSearchHelp.YCL_CH14_PURCH_DOC_SH
ThesearchhelpYCL_CH14_PURCH_DOC_SHusesthedatabaseview
YCL_CH14_VN_PD.
ScreenshotsoftheviewYCL_CH14_VN_PDisshowninFigures1451
and1452.
Figure1451.DDICView.YCL_CH14_VN_PDTables&Join
Conditions
Figure1452.DDICView.YCL_CH14_VN_PDFields
CreateanABAPprogramYCL_CH14_02_DEMO_SH_IMPORT
PlacethefieldsofstructureYCL_CH14_VENDOR_PD_STRUonthe
screenasshowninFigure1453.
Figure1453.ProgramYCL_CH14_02_DEMO_SH_IMPORT
ScreenLayout
Theflowlogiccode:
PROCESSBEFOREOUTPUT.
MODULESTATUS_0200.
*
PROCESSAFTERINPUT.
MODULEUSER_COMMAND_0200.
PROCESSONVALUEREQUEST.
FIELDYCL_CH14_VENDOR_PD_STRULIFNRMODULEPOV_LIFNR.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
19/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Theprogramsourcecode:
REPORTYCL_CH14_02_DEMO_SH_IMPORT.
**********************************************
*DemonstrateSearchHelpImportParameters**
**********************************************
TABLES.YCL_CH14_VENDOR_PD_STRU.
DATA.OK_CODETYPESYUCOMM,
DYN_TAB1TYPESTANDARDTABLEOFDYNPREAD
WITHHEADERLINE,"tooutputLIFNRBUKRSNAME1ORT01
DYN_TAB2TYPESTANDARDTABLEOFDYNPREAD
WITHHEADERLINE."tooutputblankEBELNBEDATWAERS
DATA.RTABTYPESTANDARDTABLEOFDDSHRETVALWITHHEADERLINE,
PBUKRSTYPEBUKRS,
PLIFNRTYPELIFNR,
CBUKRSTYPEBUKRS,
CLIFNRTYPELIFNR.
******************************************************************
STARTOFSELECTION.
CLEARDYN_TAB2FIELDVALUE.
DYN_TAB2FIELDNAME='YCL_CH14_VENDOR_PD_STRUEBELN'.
APPENDDYN_TAB2.
DYN_TAB2FIELDNAME='YCL_CH14_VENDOR_PD_STRUBEDAT'.
APPENDDYN_TAB2.
DYN_TAB2FIELDNAME='YCL_CH14_VENDOR_PD_STRUWAERS'.
APPENDDYN_TAB2.
CALLSCREEN200.
*&*
*&ModuleSTATUS_0200OUTPUT
*&*
*text
**
MODULESTATUS_0200OUTPUT.
SETPFSTATUS'STAT1'.
ENDMODULE."STATUS_0200OUTPUT
*&*
*&ModuleUSER_COMMAND_0200INPUT
*&*
*text
**
MODULEUSER_COMMAND_0200INPUT.
IFOK_CODE='EXIT'.
LEAVEPROGRAM.
ENDIF.
ENDMODULE."USER_COMMAND_0200INPUT
*&*
*&ModulePOV_LIFNRINPUT
*&*
*text
**
MODULEPOV_LIFNRINPUT.
CALLFUNCTION'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME='YCL_CH14_VENDOR_PD_STRU'
FIELDNAME='LIFNR'
DYNPPROG='YCL_CH14_02_DEMO_SH_IMPORT'
DYNPNR='0200'
DYNPROFIELD='LIFNR'
TABLES
RETURN_TAB=RTAB.
REFRESHDYN_TAB1.
IFLINES(RTAB>0.
READTABLERTABWITHKEYFIELDNAME='BUKRS'.
CBUKRS=RTABFIELDVAL.
READTABLERTABWITHKEYFIELDNAME='LIFNR'.
CLIFNR=RTABFIELDVAL.
LOOPATRTAB.
CONCATENATE'YCL_CH14_VENDOR_PD_STRU'RTABFIELDNAME
INTODYN_TAB1FIELDNAME.
DYN_TAB1FIELDVALUE=RTABFIELDVAL.
APPENDDYN_TAB1.
ENDLOOP.
IFCBUKRS<>PBUKRSORCLIFNR<>PLIFNR.
APPENDLINESOFDYN_TAB2[]TODYN_TAB1.
ENDIF.
CALLFUNCTION'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME='YCL_CH14_02_DEMO_SH_IMPORT'
DYNUMB='0200'
TABLES
DYNPFIELDS=DYN_TAB1[]
.
PBUKRS=CBUKRS.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
20/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
PLIFNR=CLIFNR.
ENDIF.
ENDMODULE."POV_LIFNRINPUT
Thedetailedstepsofeachobjectcreationhavebeenskippedthesteps
havebeendescribedseveraltimes.
YouaretriggeringtheeventPROCESSONVALUEREQUEST(POVfor
short)forthefieldYCL_CH14_T005TLIFNR.(Seetheflowlogiccode
above).ThiseventisequivalenttotheSelectionScreeneventAT
SELECTIONSCREENONVALUEREQUEST.Theeventistriggered
whentheuserpressesthefunctionkeyF4onthefieldforwhichyouare
triggeringtheevent,andanABAPdevelopercanputcustomcodefora
filterdialogbox,selectionlist,etc.,insteadofusingsearchhelp.Inthe
presentcontext,youaretriggeringtheeventnotforacustomcoded
selectionlist,etc.,buttogetthecontrolandcustomcodeforsomeother
purposethanjustproducingtheselectionlist,etc.
Youwanttoinitializethebottomthreefields:EBELN,BEDAT,and
WAERSeverytimethereisachangeinthevaluesoftwooftheabove
fieldsLIFNRandBUKRS.Thismakessenseandproducesa
sophisticatedeffect.Theinvocationofthefunctionmodule
F4IF_FIELD_VALUE_REQUESTinvokesthesearchhelpattachedtothe
fieldprovidedasaparametertothisfunctionmodule.Soultimatelyyou
areusingthesearchhelp.Butyouaregettingthecontroltolocatethe
codethatservesyourpurposeofinitializingthebottomthreefieldson
changeofvalueofLIFNRandBUKRSfields.Andsimultaneously,the
POVeventisbeingdemonstratedpractically.
Theparametersprovidedinthisprogramtothefunctionmodule
F4IF_FIELD_VALUE_REQUESTareselfobviousexceptforthe
TABLESparameterRETURN_TAB.
Ifyoudonotprovidethisparameter,theprogramcodeintheevent
modulegetsexecutedfirst,regardlessofthepositionoftheprogramcode,
thenthesearchhelpdialogboxesappears.Afterselectionfromthesearch
helpselectionlist,thevaluesarereturnedtotherespectivescreenfields.
IfyouprovidethisparameterRETURN_TAB,theprogramcodelocated
aftertheCALLF4IF_FIELD_VALUE_REQUESTstatementintheevent
moduledoesnotgetexecutedfirst.Thesearchhelpdialogboxesappear
first.Afterselectionfromthesearchhelpselectionlist,thevaluesare
returnednottothescreenfieldsbutintheinternaltablespecifiedwith
formalTABLESparameterRETURN_TAB.Theprogramcodelocated
aftertheCALLF4IF_FIELD_VALUE_REQUESTgetsexecutednext.
Thereturnedvaluesfromthesearchhelpcanthenbecopiedtothescreen
fieldsusingthefunctionmoduleDYNP_VALUES_UPDATE.Thisiswhat
youaredoingyouwantedcontrolafterthereturnofvaluesfromsearch
help.
Lettheprogrambetested.Switchtofullscreenmodeintheobject
navigator.
Selecttheprogramandexecute.PressfunctionkeyF4onthevendor
field.EntervaluesintherestrictivedialogboxasshowninFigure1454.
Figure1454.ProgramYCL_CH14_02_DEMO_SH_IMPORT
F4onLIFNR
Onlythevendorcodesstartingwith39andcompanycodeequalto
3000willappearinthelistasshowninFigure1455.
Figure1455.ProgramYCL_CH14_02_DEMO_SH_IMPORT
F4ListonLIFNR
MakeaselectiononthelistasshowninFigure1456.
Figure1456.ProgramYCL_CH14_02_DEMO_SH_IMPORT
VendorSelection
NowpressfunctionkeyF4onthefieldEBELN.Therestrictivedialog
boxwillpopupwiththeimportparametersasshowninFigure1457.
Fordemonstrativepurposes,oneimportparameter(companycode)isin
displaymode,andtheotherimportparameter(vendorcode)isinedit
mode.Inareallifescenario,therequirementswilldecidethis.
Figure1457.ProgramYCL_CH14_02_DEMO_SH_IMPORT
F4onEBELN
Whenyoupress<Enter>,onlythepurchasingdocumentsofvendorcode
equalwith3902andcompanycodeequalto3000willappearinthe
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
21/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
list.TheselectionlistwillappearasinFigure1458.
Figure1458.ProgramYCL_CH14_02_DEMO_SH_IMPORT
F4ListonEBELN
Aftermakingaselectionofapurchasingdocumentfromthelist,the
screenwilllookliketheoneinFigure1459.
Figure1459.ProgramYCL_CH14_02_DEMO_SH_IMPORT
VendorCode,CompanyCode&PurchasingDoc.Selection
Trywiththevaluesvendorcodepattern90*andcompanycodeequalto
1000.ontherestrictivedialogbox.Selectthevendorcode90210from
thefilteredvendorlist,etc.
Youcanverifytheinitializationofthebottomthreefields:EBELN,
BEDAT,andWAERSonchangeofvaluesfieldsLIFNRand/or
BUKRS.
AQualification.TheprogramisnotcodedtotakecareofnormalPAI
triggeringapartfromtheEXITbutton.Iftheuserpressesthe<Enter>
key,youarenotprocessingitintermsofvalidatingthedata,etc.The
programassumesthatyouwillnotmanuallyentervaluesinthefieldsof
vendorandcompanycodeandthatvalueswillbefetchedthrougha
selectionfromthesearchhelpselectionlist.Theprogramisonlyto
demonstratetheimportparameterfeatureofsearchhelpandthePOV
event.
HandsonExercise.SimulateTabStripElementUsingSub
ScreenArea,SubScreensandApplicationToolBarButtons
TabStripElement/Control
Thetabstripelementortabstripcontrolisaverycommonelementin
anyGraphicUserInterface(GUI).Itenablesthesameareaofscreento
containrelatedinformationoroptions.Acommonplaceexampleoftab
stripisintheMSWordsoftwaredocumentmaintenancescreenasshown
inFigure1460.
Figure1460.ExampleofTabStripWordDocumentScreen
YouwillcreateanABAPScreenprogramandrelatedobjectstoillustrate
thesimulationofatabstripcontrol.
Scenario
Letatabstripcontrolbesimulatedwithtwobuttonsontheapplication
toolbarandthesamecanbeextendedtoanynumberofbuttons.Let
therebeascenario.Thecustomerinformationcanbecategorized.You
haveusedpartofonecategoryofcustomerinformation(i.e.,addressor
contact).Youwillconsiderthefollowingfieldsascustomercontact
information(table,field,fielddescriptions).
Youwillhaveonemorecategoryofcustomerinformation:
organizational.Acustomerisassociatedwithdifferentorganizational
units.Youhavealreadybeenexposedtooneprimeorganizationalunit:
thecompanycode.Youarebeingintroducedtothreemore
organizationalunitswithwhichacustomerisassociatedfromthe
perspectiveofthefunctionalmoduleSales&distribution.These
organizationalunitsare:
SalesOrganization
DistributionChannel
Division
Thethreetogetheriscalledasalesgroup.
Youwillconsiderthefollowingfieldsascustomerorganizational
information.
Table142.FieldsCustomerContactInfo
Table
Field
Description
KNA1
STRAS
Street
KNA1
ORT01
City
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
22/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
KNA1
PSTLZ
PostalCode
T005T
LANDX
CountryText
KNA1
TELF1
TelephoneNo.
KNA1
TELFX
TelefaxNo.
Table143.FieldsCustomerOrganizationalInfo
Table
Field
Description
KNB1
BUKRS
CompanyCode
T001
BUTXT
CompanyCodeText/Name
KNVV
VKORG
SalesOrganization
KNVV
VTWEG
DistributionChannel
KNVV
SPART
Division
TVKOT
VTEXT
SalesOrganizationText
TVTWT
VTEXT
DistributionChannelText
TSPAT
VTEXT
DivisionText
Thereareeightdatabasetablescontainingthecontactand
organizationalinformation(Tables142and143).
Youcangatheralltheinformationcontactandorganizationalinone
databaseviewusingtheeightdatabasetables:KNA1,KNB1,T001,
T005T,KNVV,TVKOT,TVTWT,andTSPAT.
Ifyoutrytoimplementthiswithasingledatabaseview,itrunsinto
problems.Onoursystem(theauthors),adatabaseviewwithmorethan
twentylinesofjoinconditionsishavingproblems.So,toreducethelines
ofjoinconditions,thedatabasetableT005Tisbeingexcludedfromthe
databaseview.Adatamodel/ERdiagramconstitutingtheremaining
sevendatabasetablesisshowninFigure1461.
Figure1461.ERdiagramforaDatabaseViewofContactand
OrganizationalInfo
DatafortheScenario
YouwillcreateadatabaseviewforthedatamodelinFigure1461.You
willaccessthedataindatabasetableT005Tseparately(outsidethe
view).
Itisagoodideatolookupthestructuresandrelationshipsofthedatabase
tables:KNB1,KNVV,TVKOT,TVTWT,andTSPAT.Pleasedosoasan
additionalexercise.
ThedatabaseviewisYCL_CH14_CUST_VW.Thedatabasetablesand
joinconditionsoftheviewarelisted.
Table144.ViewYCL_CH14_CUST_VWTables&Join
Conditions
ThelistoffieldsinthedatabaseviewYCL_CH14_CUST_VW.
Table145.ViewYCL_CH14_CUST_VWViewFields
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
23/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Acustomerisassociatedwithalanguage:alanguagewithwhichto
communicatewithacustomer.ItisrepresentedbythefieldSPRASof
DDICtypeLANGinthestructureofdatabasetableKNA1.Youare
retrievingthetextofthesalesorganization,(VKORG),distribution
channel,(VTWEG),anddivision,(SPART),inthelanguageofthe
customer.HencethejoinconditionsbetweenthedatabasetableKNA1
andthedatabasetexttables:TVKOT,TVTWT,andTSPAT.Thefield
nameforthetextsinthethreedatabasetexttablesTVKOT,TVTWT,and
TSPATisthesame(i.e.,VTEXT).Intheview,withthepurposeof
assigninguniquefieldnames,youhaveassignedthenamesVTEXT1
VTEXT2,andVTEXT3respectively.Similaristhecasewhen
incorporatingthefieldSPRASfromthesethreedatabasetexttablesinto
theview(SPRAS1,SPRAS2,andSPRAS3).
Acustomercanexistformorethanonecompanycodethatis,therecan
bemorethanonerowforavalueofKUNNRinthedatabasetableKNB1.
(TheprimarykeyofKNB1isKUNNRandBUKRS).Also,acustomercan
beassignedtomorethanonesalesgroup.(Combinationofsales
organization,distributionchannel,anddivision).Inotherwords,
multiplerowsofavalueofKUNNRcanexistinthedatabasetable
KNVV.(TheprimarykeyofdatabasetableKNVVisKUNNR,VKORG,
VTWEG,andSPART).Forthesereasons,thenumberofrowsgetting
generatedintheviewYCL_CH14_CUST_VWisoverfiftythousand.The
numberofrowsinthedatabasetableKNA1isoverseventhousand.
Havingexplicitlydefinedyourdatasource,letthescenariodescriptionof
simulatingatabstriptodisplayrelatedinformationonthesamescreen
areaberesumed.
Screen,SubScreensLayout
Inthescreenpainterlayouteditor,thereisascreenelementSubscreen
Areaintheelementpalette.ASubscreenAreaisareservedphysicalscreen
areaintowhichyoucanloadsubscreensatruntime.Thescreensthatyou
createdinallyourpreviousexerciseswerenormalscreens.Normal
screenscanbeloadedwiththeCALLSCREEN...statement.Youcan
createinscreenpaintersubscreensbychoosingtheSubscreenradio
buttoninthescreenattributesinsteadoftheNormalradiobutton,which
isthedefaultandwhatyouhavebeenusinguntilnow.
ThesubscreenscanbeloadedintotheSubscreenAreaatruntimethrough
thestatementCALLSUBSCREEN...intheflowlogicareaofthescreen
painter.WiththestatementCALLSUBSCREEN...,youspecifythe
programnameandthesubscreennumber.Subscreennumbersare
screenidentifiersjustlikethenormalscreenidentifiersa
fourdigit
number.
Soyouwillcreateanormalscreeninwhichyouwillplacetwofields:
customercodeandcustomername.YouwillplaceaSubscreenArea
elementunderthesetwofieldsonthisnormalscreen.
Youwillcreateafirstsubscreenonwhichyouwillplacethefieldsrelated
tothecustomerscontactinformation.\(STRAS,ORT01etal.).
Youwillcreateasecondsubscreenonwhichyouwillplacethefields
relatedtothecustomersorganizationalinformation(BUKRS,BUTXT,
VKORG,VTEXT1etal.).
Youwillpositiontwobuttons(inadditiontotheotherbuttons)onthe
applicationtoolbar.Youwilldesignatethefirstofthesetwobuttonsasthe
contactinfobuttonandthesecondofthesetwobuttonsasthe
organizationalinfobutton.
Onpressingthecontactinfobutton,youwillloadthesubscreen
containingthecustomercontactinfofieldsintotheSubscreenArea.On
pressingtheorganizationalinfobutton,youwillloadthesubscreen
containingthecustomerorganizationalinfofieldsintotheSubscreen
Area.
Inthismannerthesamescreenareaisbeingusedtodisplayeitherthe
customerscontactinfoorthecustomersorganizationalinfo.
Inthepresentexercise,youaresimulatingthetabstripoperationswith
buttonsontheapplicationtoolbartoinductyouintotheconceptsof
SubscreenAreaandsubscreens.Thetabstripcontrolisavailableasa
screenelement.Thetabstripcontrolelementisimplementedusingthe
SubscreenAreaandsubscreens.Inthenextexercise,youwillusethetab
stripcontrol.
Aroughscreenlayoutofthenormalscreenisshown.Thenormalscreen
willcontainthetwofieldsKUNNRandNAME1alongwiththe
SubscreenAreaintowhichyouloadsubscreensatruntime.Thisisshown
inFigure1462.
Figure1462.RoughLayout.MainScreenforCustomerInfowith
SubscreenArea
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
24/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Aroughlayoutofthesubscreencontainingthecustomercontactinfo
fieldsisshowninFigure1463.
Figure1463.RoughLayout.SubScreenforCustomerContact
Info
Aroughlayoutofthesubscreencontainingthecustomerorganizational
infofieldsisshowninFigure1464.
Figure1464.RoughLayout.SubScreenforCustomer
OrganizationalInfo
ProgramandOtherObjects
YouwillcreateanABAPprogram
YCL_CH14_03_SIMULATE_TABSTRIP.
Createanormalscreen(ScreenNumber100).Positionthetwofields
KUNNRandNAME1fromthedatabaseviewYCL_CH14_CUST_VWon
thescreen.PlacethescreenelementSubscreenAreaonthescreenand
nameitasSAREA.(TheelementSubscreenAreaintheelementpaletteis
fifthfromthebottom).ThescreenafterplacementofSubscreenAreawill
looklikethatinFigure1465.
Figure1465.ScreenNo.100.TwoFieldsandSubscreenArea
IntheElementlisttab,entertheOK_CODE.
Createasubscreen200.Onthissubscreenplacethefieldsrelatedto
customercontactinfofromthedatabaseviewYCL_CH14_CUST_VW.
Thescreenshotsoftheattributesscreenandlayouteditorwilllooklike
thatinFigures1466and1467.
Figure1466.SubScreenNo.200.Attributes
Figure1467.SubScreenNo.200.CustomerContactInfoFields
Createasubscreen300.Onthissubscreenplacethefieldsrelatedto
customerorganizationalinfofromthedatabaseview
YCL_CH14_CUST_VW.Thescreenshotsoftheattributesscreenand
layouteditorwilllooklikethatinFigures1468and1469.
Figure1468.SubScreenNo.300.Attributes
Figure1469.SubScreenNo.300.CustomerOrganizationalInfo
Fields
YouarenotbotheringtoenterOK_CODEintheElementlisttabforthe
subscreens.SinceyouarenothandlingoreditingdataintheSubscreen
Area,youarenottriggeringanyPAIandconsequentlyPBOeventsfor
thesubscreens.TherearenoPBOandPAImodulesforthesubscreens.
Setallthefieldsonthenormalscreenandsubscreensindisplaymode.
ThePAIandPBOeventswillbetriggeredforthemain,normalscreen
(ScreenNumber100).
Theflowlogicforthenormalscreennumber100:
PROCESSBEFOREOUTPUT.
MODULESTATUS_0100.
CALLSUBSCREENSAREAINCLUDINGPROGSCRN.
*
PROCESSAFTERINPUT.
MODULEUSER_COMMAND_0100.
ThestatementCALLSUBSCREENSAREAINCLUDINGPROGSCRN
willloadasubscreennumbercontainedinthevariableSCRNintothe
SubscreenAreaSAREA.Theprogramnamehastobesuppliedtothe
CALLSUBSCREEN...statement.Youaresupplyingthisthroughthe
variablePROG.Whenthecontactinfobuttonontheapplicationtoolbar
ispressed,inthePAImodule,youareassigningthesubscreennumber
200tothevariableSCRN.Andwhentheorganizationalinfobuttonis
pressed,inthePAImodule,youareassigningthesubscreennumber
300tothevariableSCRN.Aspertheseassignments,theappropriatesub
screennumberisloadedintotheSubscreenAreathroughthestatement
CALLSUBSCREEN...inthePBOflowlogicareaofthescreenpainter.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
25/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
IntheABAPprogram,youareloadingtwointernaltableswiththedata
fromthedatabaseviewYCL_CH14_CUST_VWandthedatabasetable
T005Trespectively.Youhaveasusualdeclaredstructuresusingthe
keywordTABLESlikeTABLES.YCL_CH14_CUST_VW,T005T.You
placedthescreenvariablesonthenormalscreenandsubscreensusing
thesamestructuresofthedatabaseviewanddatabasetable.
Whentheprogramisexecuted,youarefirstloadingthefirstinternal
table(MAIN_TAB,standard)fromthedatabaseview
YCL_CH14_CUST_VW.Youareloadingthesecondinternaltable
(T005T_TAB,sorted)fromthedatabasetableT005T.Youaresortingthe
firstinternaltableonKUNNR.Youarethenloadingthescreennumber
100withCALLSCREEN100.ThiswilltriggerthePBOeventandexecute
thePBOmodule.InPBOmodule,youaresettingstatus(STAT1)Youare
retrievingthefirstrowfrominternaltableMAIN_TABintothe
structureYCL_CH14_CUST_VW.Youarefetchingthecorresponding
LANDXfieldvaluefromtheinternaltableT005T_TAB.(Random
accessofsortedtable).Initiallywhendeclaringthedata,youare
assigningthesubscreennumber200(customercontactinfo)tothe
variableSCRN.Thevaluesfromthefieldsofstructure
YCL_CH14_CUST_VWandtheLANDXfieldfromthestructureT005T
willgettransferredtocorrespondingscreenvariables.Thecustomer
contactinfoofthefirstrowfromtheinternaltablesfetchedintothe
structuresYCL_CH14_CUST_VWandT005Twillbedisplayedonthe
screenonexecutionoftheprogram.
Thesettingofthestatusandfetchingofthefirstrowofinternaltableinto
thestructure,etc.,isrequiredtobedoneonlyoncewhentheprogramis
executedandneednotberepeatedsubsequentlyeverytimethePBOis
triggered.YouaremanagingthiswiththevariableONCE.
AscreenshotofthestatusSTAT1isshowninFigure1470.
Figure1470.StatusSTAT1
InadditiontotheEXIT,CONTACT,andORGANZbuttons,thereare
fouradditionalbuttons:FIRST,NEXT,PREVIOUS,andLAST.The
fourbuttonsarefordatanavigation.
WhentheFIRSTbuttonispressed,datafromthefirstrowof
MAIN_TABandthecorrespondingLANDXfromT005T_TABis
fetchedanddisplayed.WhentheNEXTbuttonispressed,datafromthe
nextrow,ifany,isfetchedanddisplayed.WhenthePREVIOUSbutton
ispressed,dataofthepreviousrow,ifany,isfetchedanddisplayed.
WhentheLASTbuttonispressed,dataofthelastrowisfetchedand
displayed.
FortheinternaltableMAIN_TAB,youaremaintainingthetotal
numberofrows.(NO_OF_ROWS).Youarealsomaintaining,forthis
table,thenumberofthecurrentrowbeingdisplayed(CURRENT_RW).
InthePAImodule,youarecarryingoutthetaskofnavigatingtothe
appropriaterowbyincrementinganddecrementingthecurrentrow,etc.
Thedatanavigationparthasbeenaddedthroughtheapplicationtoolbar
buttons,justtoputsomeadditionalmeaningfulfunctionalitytothetab
stripsimulationdemonstrativeprogram.
Thesourceprogram:
REPORTYCL_CH14_03_SIMULATE_TABSTRIP.
*******************************************************
*SimulateTabStripSubScreenArea&SubScreens**
*******************************************************
TABLES.YCL_CH14_CUST_VW,T005T.
DATA.OK_CODETYPESYUCOMM,
MAIN_TABTYPESTANDARDTABLEOFYCL_CH14_CUST_VW,
T005T_TABTYPESORTEDTABLEOFT005TWITH
UNIQUEKEYSPRASLAND1,
ONCE(1TYPEC,
CURRENT_RWTYPESYTABIX,
NO_OF_ROWSTYPESYTABIX,
PROGTYPESYREPIDVALUE'YCL_CH14_03_SIMULATE_TABSTRIP',
SCRNTYPESYDYNNRVALUE'0200'.
*****************************************************************
STARTOFSELECTION.
SELECT*FROMYCL_CH14_CUST_VWINTOTABLEMAIN_TAB.
NO_OF_ROWS=SYDBCNT.
SORTMAIN_TABBYKUNNR.
SELECT*FROMT005TINTOTABLET005T_TAB.
CALLSCREEN100.
*&*
*&ModuleSTATUS_0100OUTPUT
*&*
*text
**
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
26/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
MODULESTATUS_0100OUTPUT.
IFONCE=''.
ONCE='X'.
SETPFSTATUS'STAT1'.
CURRENT_RW=1.
PERFORMREAD_TABLE.
ENDIF.
ENDMODULE."STATUS_0100OUTPUT
*&*
*&ModuleUSER_COMMAND_0100INPUT
*&*
*text
**
MODULEUSER_COMMAND_0100INPUT.
CASEOK_CODE.
WHEN'EXIT'.
LEAVEPROGRAM.
WHEN'FIRST'.
CURRENT_RW=1.
PERFORMREAD_TABLE.
WHEN'NEXT'.
IFCURRENT_RW<NO_OF_ROWS.
CURRENT_RW=CURRENT_RW+1.
PERFORMREAD_TABLE.
ENDIF.
WHEN'PREVIOUS'.
IFCURRENT_RW>1.
CURRENT_RW=CURRENT_RW1.
PERFORMREAD_TABLE.
ENDIF.
WHEN'LAST'.
CURRENT_RW=NO_OF_ROWS.
PERFORMREAD_TABLE.
WHEN'CONTACT'.
SCRN='0200'.
WHEN'ORGANZ'.
SCRN='0300'.
ENDCASE.
ENDMODULE."USER_COMMAND_0100INPUT
********************************************************
FORMREAD_TABLE.
READTABLEMAIN_TABINTOYCL_CH14_CUST_VWINDEXCURRENT_RW.
READTABLET005T_TABINTOT005TWITHKEY
SPRAS=YCL_CH14_CUST_VWSPRAS2LAND1=YCL_CH14_CUST_VWLAND1.
ENDFORM.
ThesubroutineREAD_TABLEisreferringtoglobaldataobjects
(internaltablesandstructuresdirectly).Notgoodprogramming!Ithas
beendoneforexpediency.Inareallifedevelopmentenvironment,you
mustsupplytheparameterstopasstheinternaltablesandstructures.
Theprogram,whenexecuted,displayingscreensforcontactinfoand
organizationalinfo,willlooklikeFigures1471and1472.
Figure1471.ProgramYCL_CH14_03_SIMULATE_TABSTRIP.
ContactInfo
Figure1472.ProgramYCL_CH14_03_SIMULATE_TABSTRIP.
OrganizationalInfo
Todisplaytherowshownhere,navigatetothelastrowandclickonthe
Previousbuttonafewtimes.
Youshouldtryoutallthenavigationalbuttons.Thiswasasimulationof
thetabstripelementusingSubscreenArea,subscreens,andapplication
toolbarbuttons.
HandsonExercise.TabStripElement
Youwillperformthesameexerciseasthepreviousone,butwiththetab
stripscreenelement.Youwillomittheapplicationtoolbarbuttons
CONTACTandORGANZ.Thebuttonstochooseaparticulartabwill
appearaspartofthetabstripelement.
Youareusingthesamedatasources:databaseview
YCL_CH14_CUST_VWanddatabasetableT005T.Youareloadingdata
fromthesesourcesintointernaltablesandprocessingthemthesame
wayasinthepreviousexercise.
YoucreateanABAPprogramYCL_CH14_04_TABSTRIP.Copythe
appropriaterequiredlinesfromthepreviousprogram.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
27/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Inthescreenpainterenvironment,onthenormalscreen(screen
number500),positionthetwofieldsYCL_CH14_CUST_VWKUNNR
andYCL_CH14_CUST_VWNAME1.Thendraganddropthetabstrip
elementonthenormalscreenfromtheelementpalette.(Thetabstrip
elementistheseventhelementfromthetoportheeighthelementfrom
thebottomintheelementpalette).Assignanametothetabstripelement
(CUST_INFO)inserttabsintothetabstripelement(minimumor
defaultoftwo)andassigntexts,icons,andfunctioncodestoeachofthe
twotabs.Assignthefollowingtothefirsttab:
Name.CONTACT
Text.Contact
Icon.ICON_ADDRESS
Functioncode.CONTACT
Assignthefollowingtothesecondtab:
Name.ORGANZ
Text.Organizational
Icon.ICON_NEW_ORG_UNIT
Functioncode.ORGANZ
Selectallthetabs.(KeeptheCtrlkeypressedandclickontabs
successivelytoselectalltabs).Withallthetabsselected,draganddrop
theSubscreenAreaelementintothetabs.AssigntheSubscreenAreaa
nameofSAREA.
ThescreenshotsofFigures1473,1474,and1475showtheseelements
andtheirattributes.
Figure1473.Screennumber500.TabStripElement
Figure1474.Screennumber500.TabCONTACT
Figure1475.Screennumber500.TabORGANZ
InsteadofselectingalltabsandthendragginganddroppingSubscreen
Areaintothetabs,youcanassigntheSubscreenAreanametoeachofthe
tabsintheattributeRef.FieldasshowninFigure1474.
CreatetheOK_CODEintheElementlisttabofthenormalscreen500.
Theflowlogicofnormalscreennumber500issimilartothatofthe
previousprogram.
PROCESSBEFOREOUTPUT.
MODULESTATUS_0500.
CALLSUBSCREENSAREAINCLUDINGPROGSCRN.
*
PROCESSAFTERINPUT.
MODULEUSER_COMMAND_0500.
Youcancopythesubscreennumbers200and300oftheprevious
exerciseforthepresentprogramintoscreennumbers600and700
respectively.Onscreennumber600,youhavethecustomercontact
fieldsandonthescreennumber700,youhavethecustomer
organizationalfields.Thelayoutofsubscreennumbers600and700is
showninFigures1476and1477.
Figure1476.SubScreenNo.600.CustomerContactInfoFields
Figure1477.SubScreenNo.700.CustomerOrganizationalInfo
Fields
AscreenshotofthestatusSTAT1isshowninFigure1478.
Figure1478.StatusSTAT1
Thisisacopyofthestatusofthepreviousprogram,withthelasttwo
buttonsdeleted.
Thesourceprogramisthesameasinthepreviousexerciseexceptthat
youhavetoindicatetothesystemwhichofthetabsinthetabstrip
elementiscurrentlyactive.
Toindicatetothesystemwhichofthetabsinthetabstripelementis
currentlyactive,youdeclareastructurewiththekeywordCONTROLS:
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
28/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
CONTROLS.<nameoftabstripelement>TYPETABSTRIP.
Thisstatementdefinesastructureofthesamenameastabstripelement
name.(InthepresentcaseCUST_INFO).Youareconcernedwithonly
onefieldofthisstructure(i.e.,ACTIVETAB).Youhavetoassignthe
functioncodeofthetabtothisfieldtoindicatethetabyouwanttobe
active(Displayed).
IntheABAPprogram,youwillhaveadeclarationalongwithyourglobal
datadeclarationsandthestatement:
CONTROLS.CUST_INFOTYPETABSTRIP.
InthePAIcodesegment,whereyouareassigningthesubscreennumber
tothevariableSCRN,youshouldalsoassignthefunctioncodeofthetab
tothefieldCUST_INFOACTIVETABinthefollowingmanner:
..........
WHEN'CONTACT'.
SCRN=600.
CUST_INFOACTIVETAB='CONTACT'.
WHEN'ORGANZ'.
SCRN=700.
CUST_INFOACTIVETAB='ORGANZ'.
......
ThesourcecodeofprogramYCL_CH14_04_TABSTRIP:
REPORTYCL_CH14_04_TABSTRIP.
***************************
*DemoControlTabStrip**
***************************
CONTROLS.CUST_INFOTYPETABSTRIP.
TABLES.YCL_CH14_CUST_VW,T005T.
DATA.OK_CODETYPESYUCOMM,
MAIN_TABTYPESTANDARDTABLEOFYCL_CH14_CUST_VW,
T005T_TABTYPESORTEDTABLEOFT005TWITH
UNIQUEKEYSPRASLAND1,
ONCE(1TYPEC,
CURRENT_RWTYPESYTABIX,
NO_OF_ROWSTYPESYTABIX,
PROGTYPESYREPIDVALUE'YCL_CH14_04_TABSTRIP',
SCRNTYPESYDYNNRVALUE'0600'.
*****************************************************************
STARTOFSELECTION.
SELECT*FROMYCL_CH14_CUST_VWINTOTABLEMAIN_TAB.
NO_OF_ROWS=SYDBCNT.
SORTMAIN_TABBYKUNNR.
SELECT*FROMT005TINTOTABLET005T_TAB.
CALLSCREEN500.
*&*
*&ModuleSTATUS_0500OUTPUT
*&*
*text
**
MODULESTATUS_0500OUTPUT.
IFONCE=''.
ONCE='X'.
SETPFSTATUS'STAT1'.
CURRENT_RW=1.
PERFORMREAD_TABLE.
ENDIF.
ENDMODULE."STATUS_0500OUTPUT
*&*
*&ModuleUSER_COMMAND_0500INPUT
*&*
*text
**
MODULEUSER_COMMAND_0500INPUT.
CASEOK_CODE.
WHEN'EXIT'.
LEAVEPROGRAM.
WHEN'FIRST'.
CURRENT_RW=1.
PERFORMREAD_TABLE.
WHEN'NEXT'.
IFCURRENT_RW<NO_OF_ROWS.
CURRENT_RW=CURRENT_RW+1.
PERFORMREAD_TABLE.
ENDIF.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
29/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
WHEN'PREVIOUS'.
IFCURRENT_RW>1.
CURRENT_RW=CURRENT_RW1.
PERFORMREAD_TABLE.
ENDIF.
WHEN'LAST'.
CURRENT_RW=NO_OF_ROWS.
PERFORMREAD_TABLE.
WHEN'CONTACT'.
SCRN='0600'.
CUST_INFOACTIVETAB='CONTACT'.
WHEN'ORGANZ'.
SCRN='0700'.
CUST_INFOACTIVETAB='ORGANZ'.
ENDCASE.
ENDMODULE."USER_COMMAND_0100INPUT
********************************************************
FORMREAD_TABLE.
READTABLEMAIN_TABINTOYCL_CH14_CUST_VWINDEXCURRENT_RW.
READTABLET005T_TABINTOT005TWITHKEY
SPRAS=YCL_CH14_CUST_VWSPRAS2LAND1=YCL_CH14_CUST_VWLAND1.
ENDFORM.
Whentheprogramisexecuted,thescreenswilllooklikeFigures1479
and1480.
Figure1479.ProgramYCL_CH14_04_TABSTRIP.ContactInfo
Figure1480.ProgramYCL_CH14_04_TABSTRIP.
OrganizationalInfo
Youcantestthenavigationbuttons.Thisconcludesthehandsonexercise
ofthetabstrip.
Inthepresenthandsonexercise,inthelayouteditor,youhave
positionedthetabstripelementwithoutusingawizard.Intheelement
paletteofthescreenpainter,youhaveanoptiontopositionthetabstrip
elementwithoutusingawizard,andyoualsohavewithusingawizard.
Whenyoupositionatabstripusingawizard,youaresavedofwritingthe
coderelatedtothetabstripincludingthecodetoloadsubscreensinthe
flowlogic.Youcantry,asanadditionalhandsonexercise,the
following:placethetabstripelementusingthewizard.
HandsonExercise.UseTableElement
TableElement/Control
Thetableelementortablecontrolisusedtopresentmultiplerowsofdata
onthescreen.Youhaveencounteredaninstanceofmultiplerows
presentationonthescreen.Themessagemaintenancescreen
(transactioncodeSE91)iswheremultiplemessagenumberswiththe
correspondingmessagetextsbelongingtoamessageclassarepresented
onthescreen.Ithasbeenimplementedusingthetableelement.Figure
1481showsthemessagemaintenancescreen.
Figure1481.MessageMaintenance.MultipleRowDatawith
TableControl
Ifyouwanttopresent,atonetime,thedataofonebusinessdocument
(billingdocument,purchasingdocument,etc).havingaheaderanditem
informationonascreen,youwillhavetolocatethemultipleitem
informationrowsbelongingtoonebusinessdocumentinatable
element.Atableelement,likeotherscreenelements,willoccupya
physicalarea.Multiplerowsofdataareloadedintothetableelement.
Dependingontheheightofthetableelement,acertainnumberofrows
arevisibleatanytime.Ifthenumberofloadedrowsaregreaterthanthe
numberofrowsvisibleatatime,thescrolldownaswellasthescrollup
facilityisavailable.
ThetransferofdataofthefieldsofmultiplerowsfromthescreentoABAP
variablesandtheotherwayaroundarehandledthroughaspecialformof
LOOP...ENDLOOPstatementsintheflowlogicareaofthescreen
painter.
Scenario
Letthebillingdocumentdatabepresentedalongwiththerelateddata:
customername&addressandmaterialdescriptionsonthescreen.At
onetime,thedatarelatedtoonespecificbillingdocumentwillbe
presentedonthescreen.Youwillplacetheheader&relateddataonthe
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
30/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
normalareaofthescreenandplacetheitemandrelateddatainsidea
tableelement.AroughlayoutofthescreenisshowninFigure1482.
Figure1482.BillingDocument&RelatedData.RoughScreen
Layout
ScenarioImplementation
Data.LetthetablesretrievedataforthescreenlayoutofFigure1482.
Thefollowingtableswillhavetobeusedtoretrievethedata:
VBRK
Billingdocumentsheader
KNA1
Customerprimary
T005T
Countrytexts
VBRP
Billingdocumentsitems
MAKT
Materialdescriptiontexts
Createtwodatabaseviews:thefirstviewcontainingfieldsrelatedto
headerinformationandthesecondviewcontainingfieldsrelatedtoitem
information.
Theparticularsofdatabaseviewcontainingfieldsrelatedtoheader
YCL_CH14_KNVB.
ViewTablesandJoinconditions.
Table146.ViewYCL_CH14_KNVBTables&JoinConditions
ViewFields.
Table147.ViewYCL_CH14_KNVBViewFields
ViewSELECTCondition.
Theparticularsofthedatabaseviewcontainingfieldsrelatedtoitems
YCL_CH14_VBP_MKT.
ViewTablesandJoinconditions.
Table148.ViewYCL_CH14_VBP_MKTTables&Join
Conditions
ViewFields.
Table149.ViewYCL_CH14_VBP_MKTViewFields
ViewSELECTCondition.
YouarearbitrarilyfetchingthetextinlanguagecodeE(Englishfrom
thecountryandmaterialtexttables).
CreateanABAPprogramYCH_CH14_05_TABLE_CTRL.Inthis
program,declarestructuresforthetwoviewswiththeTABLES
statement.Alsodeclareinternaltablesforthesetwostructures.
Screens
Createanormalscreen,screennumber300.Onthelayouteditor,click
thethirdbuttonfromtherightoftheapplicationtoolbartoselectfields
fromtheDDICobject.Enterthedatabaseviewnameas
YCL_CH14_KNVBinthedialogbox,clickontheGetfromDictionary
button,andselectthefieldsVBELN,FKDAT,WAERK,KUNNR,
NAME1,ORT01,andLANDX.Clickonthecontinuebuttontoplaceon
thescreennumber300,thefieldsfromthedatabaseviewcontaining
fieldsrelatedtoheaderinformationaspertheroughscreenlayoutof
Figure1482.Thescreenafterplacementoftheheaderfieldswilllook
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
31/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
likeFigure1483.
Figure1483.ScreenNumber300.PlacementofFieldsrelatedto
Header
Draganddropthetableelement,thethirdelementfromthebottomin
theelementpalette.Youcandraganddropthefourthelementfromthe
bottominelementpalette.Thisalsocreatesatableelementusinga
wizard.Creatingatableelementwithawizardwillsavethewritingof
code.Fornow,youarecreatingatableelementwithoutusingawizard.
Intheattributesscreenofthetableelement,assignanameITEMSto
thetableelement.Enablethecheckboxesforhorizontalandvertical
dividers(i.e.,eachfieldwillappearasacellasinanExcelspreadsheet).
Youareretainingthedefaultoptionsofotherattributes:rowselection,
columnselectionandresizingbyanenduser,etc.Theattributesscreen
ofthetableelementITEMSisshowninFigure1484.
Figure1484.ScreenNumber300.PlacementofTableElement
Thenextstepistoplacefieldsinsidethetableelement.Again,openthe
dialogboxforfieldselection.(Thethirdbuttonfromtherightofthe
applicationtollbar,etc).EntertheviewnameasYCL_CH14_VBP_MKT
forfieldsrelatedtoiteminformation.SelectthefieldsVBELN,POSNR,
FKIMG,VRKME,NETWR(sourcedfromdatabasetableVBRP),and
MAKTX,sourcedfromdatabasetableMAKT.Thescreenafterthefield
selectionswilllooklikeFigure1485.
Figure1485.ScreenNumber300.SelectionofFieldsRelatedto
Items
YoudonotneedthefieldVBELNasperthelayout.Youincludeditjustto
demonstratethatfieldsandlabelscanbedeletedaftertheirplacementin
thetableelement.Thescreenafterthefieldsareplacedinthetable
elementwilllooklikeFigure1486.
Figure1486.ScreenNumber300.InitialPlacementofFields
RelatedtoItems
Thefieldlabelsappearascolumnheadingsinthetableelement.After
placingthefields,allthefieldswouldhavebeenselected.Unselectby
clickingonascreenareadifferentfromthetableelement.Deletethe
fieldVBELN.Thefieldshavetobeorderedasperthelayout.
Topositionfields,simplydraganddropthefieldinthedesiredposition.
Orderandresizethefields,andchangetheattributestodisplay.Twoof
thefieldsFKIMG(BilledQuantity)andNETWR(NetValueofitem)
sourcedfromdatabasetableVBRParenumericfieldsthatmustappear
asrightalignedorrightjustified.Bydefault,allfieldsonthescreen
appearleftalignedorleftjustified.Tomakeafieldappearrightjustified,
opentheattributedialogboxofthefield,selectthetabProgram,and
enablethecheckboxRightjustified.Thescreenaftertheseoperations
willlooklikeFigure1487.
Figure1487.ScreenNumber300.FinalPlacementofFields
RelatedtoItems
Lastly,youhavetoplacethefieldsNETWR(sourcedfromthedatabase
tableVBRK,netvalueofbillingdocument)atthebottomofthescreen.
Placingthisfieldandthescreenafterfieldplacementwilllooklike
Figure1488.
Figure1488.ScreenNumber300.FinalPlacementofAllFields
Savethescreen,andclosethelayouteditor.Intheelementlist,enterthe
OK_CODEfield.Intheflowlogicarea,decommentthemodule
statements.CreatethePBOandPAImodulesalongthenowfamiliar
pattern.Forthetableelement,youenterthefollowingcodeintheflow
logicarea:
PROCESSBEFOREOUTPUT.
MODULESTATUS_0300.
LOOPATBILLSI_TABINTOYCL_CH14_VBP_MKTWITHCONTROLITEMS.
ENDLOOP.
*
PROCESSAFTERINPUT.
MODULEUSER_COMMAND_0300.
LOOPATBILLSI_TAB.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
32/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
ENDLOOP.
TheLOOP...ENDLOOPstatementsinthePBOevent,inthepresent
context,transferthedatafromtheinternaltabletotheworkarea(ABAP
variables)intothescreenvariablesinthetableelement.
TheLOOP...ENDLOOPstatementsinthePAIevent,inthepresent
context,transferthedatafromthescreenvariablesinthetableelement
intotheinternaltable(ABAPvariables).
ThesyntaxoftheLOOP...ENDLOOPstatementinthePBOeventis
differentfromthatinthePAIevent.
Thesteploopingprocess(LOOP...ENDLOOPinflowlogicarea)canbe
perusedinthedocumentABAPProgramming(BCABA).
Interface
CreateastatusSTAT1intheinterfaceYCL_CH14_05_TABLE_CTRLas
showninFigure1489.
Figure1489.Interface.YCL_CH14_05_TABLE_CTRLStatus
STAT1
Program.TheSourceProgram
REPORTYCH_CH14_05_TABLE_CTRL.
*******************************
*DemonstrateTableControl**
*******************************
CONTROLS.ITEMSTYPETABLEVIEWUSINGSCREEN300.
TABLES.YCL_CH14_KNVB,YCL_CH14_VBP_MKT.
DATA.BILLSH_TABTYPESTANDARDTABLEOFYCL_CH14_KNVB,
BILLSI_TABTYPESTANDARDTABLEOFYCL_CH14_VBP_MKT,
OK_CODETYPESYUCOMM,
NO_ROWSTYPESYTABIX,
CUR_ROWTYPESYTABIX,
ONCE(1TYPEC.
**************************************************
STARTOFSELECTION.
CALLSCREEN300.
*&*
*&ModuleSTATUS_0300OUTPUT
*&*
*text
**
MODULESTATUS_0300OUTPUT.
IFONCE=''.
ONCE='X'.
SETPFSTATUS'STAT1'.
SELECT*FROMYCL_CH14_KNVBINTOTABLEBILLSH_TABUPTO100ROWS
WHEREVBELN>='0090023219'.
NO_ROWS=SYDBCNT.
SORTBILLSH_TABBYVBELN.
CUR_ROW=1.
PERFORMREAD_ITEMS.
ENDIF.
OK_CODE=''.
ENDMODULE."STATUS_0300OUTPUT
*&*
*&ModuleUSER_COMMAND_0300INPUT
*&*
*text
**
MODULEUSER_COMMAND_0300INPUT.
CASEOK_CODE.
WHEN'EXIT'.
LEAVEPROGRAM.
WHEN'FIRST'.
CUR_ROW=1.
PERFORMREAD_ITEMS.
WHEN'NEXT'.
IFCUR_ROW<NO_ROWS.
CUR_ROW=CUR_ROW+1.
PERFORMREAD_ITEMS.
ENDIF.
WHEN'PREV'.
IFCUR_ROW>1.
CUR_ROW=CUR_ROW1.
PERFORMREAD_ITEMS.
ENDIF.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
33/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
WHEN'LAST'.
IFCUR_ROW<NO_ROWS.
CUR_ROW=NO_ROWS.
PERFORMREAD_ITEMS.
ENDIF.
ENDCASE.
ENDMODULE."USER_COMMAND_0300INPUT
***********************************************
FORMREAD_ITEMS.
READTABLEBILLSH_TABINTOYCL_CH14_KNVBINDEXCUR_ROW.
SELECT*FROMYCL_CH14_VBP_MKTINTOTABLEBILLSI_TABWHERE
VBELN=YCL_CH14_KNVBVBELN.
ITEMSLINES=SYDBCNT.
ENDFORM.
ThescreenonprogramexecutionwilllookliketheoneinFigure1490.
Figure1490.ProgramYCL_CH14_05_TABLE_CTRL.
Execution
Deliberately,thefirstrowfetchedandloadedintotheinternaltable
BILLH_TABcorrespondstobillingdocumentnumber0090023219.
(WHEREVBELN>=0090023219).Thisbillingdocumenthasthe
maximumnumberofitemsofallthebillingdocumentsinthetableVBRK
(fiftythree).Itservesthepurposeofprovidingthescopefor
demonstratingtheverticalscrollinginthetablecontrol.
Thiswasademonstrationoftablecontrol.Itenablespresentationof
multiplerowsofdata.Datanavigationfacilityisprovidedasinthe
handsonexercisesonthetabstripcontrol.Allthedataonthescreenfor
thishandsonexercisewasindisplaymode.Ifyouwanttooperateonthe
tablecontroldataorinsert,delete,andchangerows,itinvolves
complexscreenprogrammingbeyondthescopeofthisbook.
Miscellanea
CreateCustomTransactionCode
Youcancreatecustomtransactioncodes.TheABAPprogramscreatedby
developersofanimplementationteamarenotexecutedbytheendusers
peoplewhooperatetheSAPsoftwarethewayyouhavebeentesting
andexecutingthembynavigatingtotransactionSE38,enteringthe
programname,andclickingtheexecutionbutton.Instead,youwill
createcustomtransactioncodesandassigntheABAPprogramstothese
customtransactioncodes.Theenduserswillemploythesecustom
transactioncodestoexecutetheABAPprogramsdeliveredbythe
implementationteamdevelopers.
Tocreateacustomtransactioncode,usethetransactioncodeSE93to
navigatetothescreenformaintainingcustomtransactioncodes.
Letacustomtransactioncodebecreatedwiththeprogramyoucreatedfor
demonstratingthetablecontrol(i.e.,YCL_CH14_05_TABLE_CTRL).So
onthecustomtransactioncodemaintenancescreen,enterthe
transactioncodeYCL_CH14_TC01.ThescreenwilllooklikeFigure14
91.
Figure1491.TransactionMaintenanceSE93Screen
AcustomtransactioncodemuststartwithY/Zandcancontain
alphanumericcharacterswithembeddedunderscores(_,amaximum
namespaceoftwentycharacters).Clickonthecreatebutton.The
transactionattributedialogwillappearliketheoneinFigure1492.
Figure1492.CreateTransactionTransactionAttributes
Enterashortbitoftext.Thefiveradiobuttonsspecifythestartobject.
Thefirstthreeareselfexplanatory.
ForTransactionwithvariant,youcancreateavariation(akindof
versionofanexistingtransactioncodeincludingtheSAPdelivered
transactioncodes).Inthesevariants,youcansetattributesofscreen
fields(likehidingpresetvaluesofscreenfieldsandevenhideentire
screens).
ForTransactionwithparameter,youcanpreassignvaluestothefields
ontheopeningscreen.
Inthepresentcontext,youarecreatingatransactioncodefora
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
34/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
screen/dialogprogram.Hencethefirstorthedefaultradiobuttonistobe
enabled.Clickonthecontinuebutton.ThescreenwillappearlikeFigure
1493.
Figure1493.CreateTransactionYCL_CH14_TC01
EnterthenameoftheprogramasYCL_CH14_05_TABLE_CTRL.
Enteringthescreennumberisnotmandatoryinyourpresentcontextas
yourprogramstartsexecutionwiththeCALLSCREEN300statement.
SelectthedefaultClassificationoption.ProfessionalUserTransaction.
BydefaultitsupportstheSAPGUIforWindows.Youcanenableother
checkboxesundertheGUIsupportifsodesired.Save.Assignthe$TMP
packagewhenprompted.
ThecustomtransactioncodeYCL_CH14_TC01isreadytobeused.Enter
itinthecommandboxlikeinFigure1494.
Figure1494.ExecuteCustomTransactionCode.
YCL_CH14_TC01
ThescreenofFigure1490willappear.Thisconcludesthecreationof
customtransactioncode.
ABriefOverviewofDDICLockObjects
YouhavebeenexposedtoafewoftheSAPfunctionalmoduledatabase
tablesofthefunctionalmoduleSalesandDistributionSD.For
instance,thecustomerentitydataislocatedinmorethanonedatabase
table:KNA1,KNB1...,andtheKNseriesoftables.Thebillingdocument
dataislocatedintwotables:VBRKandVBRP.Similarly,databasetables
ofthefunctionalmodulearelocatedinMaterialManagementMM.
Thevendorentitydataislocatedinmorethanonedatabasetable:LFA1,
LFB1...,andtheLFseries.Thepurchasingdocumentdataislocatedin
twotables:EKKOandEKPO.
MostoftheSAPfunctionalmoduledataislocatedinmultipletables.
Whenanenduseriseditingthedataofaspecificcustomerforexample,
customercodeequaltoX001therow/softhiscustomercodeX001in
allthecustomerdatabasetablesneedtobelockedtoallotherendusers
otherthantheenduserwhoiseditingthedata.Thisistoensuredata
integrity.
Alldatabasesoftwareprovideslockingmechanismsformaintainingdata
integrity.Butthedatabasesoftwarelockingmechanismsoperateona
singledatabasetableandcannotservethatpurposeinaSAP
environmentwheremostentitydataislocatedinmultipletables.
Totakecareofthisrequirementofsimultaneouslylockingrowsin
multipletables,SAPoffersitsownlockingmechanismthroughtheDDIC
lockobjects.Alllockobjectnames,includingcustomlockobjectnames,
muststartwiththeletterE.
AscreenshotoftheTablestaboftheSAPlockobjectEXKNA1usedfor
customerdataisshowninFigure1495.
Figure1495.DDICLockObjectEXKNA1TablesTab
Alockobjectconsistsofaprimarytable.ThelockobjectEXKNA1has
KNA1astheprimarytable.Youcanexplicitlyassignsecondarytablesto
thelockobject.(AtthebottomofthescreenoftheTablestab).Ifthe
secondarytablesarenotexplicitlyassigned,thereisimplicitassignment
throughforeignkeyrelationshipsoftheprimarytablewithothertables.
Theimplicitassignmentofsecondarytablesthroughforeignkey
relationshipsiswithrestrictions.Togivearoughexample,ifanenduser
iseditingspecificcustomerdata,therowcorrespondingtothiscustomer
mustbelockedinallthetablescontainingcustomerdatanotanyother
tableslikesalesordersorbillingdocumentdata.Thesalesordersand
billingdocumentsalsohaveaforeignkeyrelationshipwithcustomer
data.
Oneprimeruleofimplicitassignmentofsecondarytablesisthatthe
foreignkeyfieldsinthesecondarytablesmustalsobeprimarykeyfields
inthesecondarytables.
ConsiderthetablesKNA1andKNB1.Theyarerelatedthroughthefield
KUNNR.ThefieldKUNNRisaprimarykeyfieldintheprimarytable
KNA1.ItisaforeignkeyfieldinthetableKNB1aswellasaprimarykey
field.HencethetableKNB1qualifiesasanimplicitsecondarytableinthe
lockobjectEXKNA.
ConsiderthetablesKNA1andVBRK.Theyarerelatedthroughthefield
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
35/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
KUNNRandKUNAG.ThefieldKUNNRisaprimarykeyfieldinthe
primarytableKNA1.ThefieldKUNAGisaforeignkeyfieldinthetable
VBRKandnotaprimarykeyfield.HencethetableVBRKdoesnot
qualifyasanimplicitsecondarytableinthelockobjectEXKNA.
YoucanassignlockmodeasExclusive,Shared,orExclusivebut
cumulative.
AscreenshotofLockparametertabofthesameSAPlockobjectEXKNA1
usedforcustomerdataisshowninFigure1496.
Figure1496.DDICLockObjectEXKNA1LockParameterTab
Inthistab,youassignthelockparameter(i.e.,theprimarykeyfieldsof
theprimarytable).
WhenyouactivateaDDIClockobject,twofunctionmodulesare
generated.Thesearethenamesofthesefunctionmodules:
ENQUEUE_<lockobjectname>
DEQUEUE_<lockobjectname>
ABAPupdateprogramswillusethesefunctionmodules.Thefunction
moduleENQUEUE_<lockobjectname>isusedtosetalock.The
functionmoduleDEQUEUE_<lockobjectname>isusedtoreleasea
lock.
YoucanrefertothedocumentABAPDictionary(BCDWBDIC)foran
elaboratedescriptionoflockobjects.
TabStriponaSELECTIONSCREEN
Youcanplacetabstriponselectionscreens.Thelocationoftabstripon
selectionscreeninvolvesdeclarationof
1. SubscreenswithBEGINOFSCREEN...ENDOFSCREEN
statements.
2. TabbedBlockwithBEGINOFTABBED...ENDOFBLOCK...
Thefollowingsourceprogramwiththecommentswillmakethisclearer.
REPORTYCL_CH14_06_TABSTRIP_SL_SCREEN.
**********************************
*TabStripinSELECTIONSCREEN**
**********************************
*********************************************
*SELECTIONSCREENSUBSCREENSdeclarations**
*********************************************
SELECTIONSCREENBEGINOFSCREEN100ASSUBSCREEN
NOINTERVALS.
PARAMETERS.KUNNRTYPEKUNNR,
VKORGTYPEVKORG,
VTEXTTYPEVTEXT.
SELECTIONSCREENENDOFSCREEN100.
SELECTIONSCREENBEGINOFSCREEN200ASSUBSCREEN
NOINTERVALS.
PARAMETERS.LIFNRTYPELIFNR,
EKORGTYPEEKORG,
EKOTXTYPEEKOTX.
SELECTIONSCREENENDOFSCREEN200.
**************************************************************
SELECTIONSCREEN.BEGINOFBLOCKBLOCK1WITHFRAMETITLETL01
NOINTERVALS,
SKIP,
**************************************************************
*TABBEDBLOCKspecialtypeofSELECTIONSCREENBLOCK**
*TABBEDBLOCKSacceptonlySELECTIONSCREENTABstatements**
*insidethemtocreatetabstriptabs**
**************************************************************
BEGINOFTABBEDBLOCKPART_TABFOR3LINES
NOINTERVALS,
TAB(18CUST_BTUSERCOMMANDCUSTOMER
DEFAULTSCREEN100,
TAB(18VEND_BTUSERCOMMANDVENDOR
DEFAULTSCREEN200,
ENDOFBLOCKPART_TAB,
ENDOFBLOCKBLOCK1.
**************************************************************
INITIALIZATION.
TL01='BusinessPartner'(001.
CUST_BT='@A0@Customer'(002.
VEND_BT='@AD@Vendor'(003.
Selectiontextsarecreatedfetchingthelabelsfromthedataelements.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
36/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Whentheprogramisexecuted,thescreenwilllooklikeFigure1497.
Figure1497.TabStripinSELECTIONSCREEN
MaintenanceViewsandTableMaintenanceDialogs
Overview.MaintenanceViews,TableMaintenanceGenerator,and
TableMaintenanceDialogs
MaintenanceViews.YouhavebeenexposedtothreeDDICtypesof
views:databaseviews,projectionviews,andhelpviews.Youcancreate
onemoretypeofviewinDDIC:themaintenanceview.Maintenance
viewcanonlybeusedintablemaintenancedialogs.Tablemaintenance
dialogsaremostlytobeusedformaintainingdataincustomoruser
defineddatabasetables.Maintainingdataincustomoruserdefined
databasetablesmeanscreation,change,deletion,anddisplayofdatain
thesedatabasetables.
Youcancreateamaintenancevieweitherwithoneormultipledatabase
tables.Incaseofamaintenanceviewconsistingofmultipledatabase
tables,thesetablesmustbelinkedwithforeignkeyrelationships.When
youcreateamaintenanceviewwithmultipledatabases,thesystem
automaticallyentersthetablejoinconditions.Youcannotmodifyor
manuallyenterthejoinconditionslikeyouweredoingwhencreating
databaseviews.Therowsinthemaintenanceviewusingmultiple
databasetablesisbasedoninnerjoinlikeitiswithdatabaseviews.
Tobeabletoinsert,edit,anddeletedataintheunderlyingtablesofa
maintenanceview,thefollowingprerequisitesshouldbefulfilled:
1. Ineachoftheparticipatingdatabasetablesofthemaintenance
view,inthetabDeliveryandMaintenance,intheitemData
Browser/TableViewMaint.,theoptionDisplay/Maintenance
Allowedshouldhavebeenassigned.
2. Inthemaintenanceview,inthetabMaint.Status,theradio
buttonread,change,deleteandinsert(default)shouldhavebeen
selected.
Thereareconstraintsofcardinalitywhencreatingamaintenanceview
withmultipledatabasetables.Youcancreateamaintenanceviewwith
multipledatabasetablesonlywhenthecardinalitybetweenthesetables
iseitherN.1orN.C.(RefertoChapter2forcardinality).Thisconstraintis
operativewhenyouusethemaintenanceviewinatablemaintenance
dialogtocreate/edit/deleteentriesinallunderlyingtablesofthe
maintenanceview.Ifyouemployatablemaintenancedialogusinga
maintenanceviewwithmultipledatabasetablestocreate/edit/delete
entriesonlyinasingleunderlyingdatabasetableatthebottomofthe
hierarchyofthemaintenanceview,youneednotbeboundbythis
cardinalityconstraint.
TableMaintenanceDialogsUsingMaintenanceViewsandTable
MaintenanceGenerator
WhenyoucreatedandactivatedcustomdatabasetablesinChapter2,a
defaulttablemaintenancedialogwascreatedenablingyoutoinsert,edit,
delete,anddisplaydatainthedatabasetable:thatis,performdata
operationsonthedatabasetables.YouusedtransactioncodeSE11or
SE16toperformdataoperationsonthedatabasetables.
Theprocessthatgeneratesthetablemaintenancedialogusingthe
maintenanceviewsiscalledthetablemaintenancegenerator.
Tablemaintenancedialogsusingmaintenanceviewsofferssome
advantagesandadditionalfeaturesoverthedefaulttablemaintenance
dialogsgeneratedwhendatabasetablesareactivated.
Theadditionaladvantagesandfeaturesoftablemaintenancedialog
usingmaintenanceviewoverthedefaultmaintenancedialogareas
follows.
Themaintenancedialogusingmaintenanceviewcanbefor
multipledatabasetablessubjecttothecardinalityconstraints.
Themaintenancedialogusingmaintenanceviewcanbeassigned
anauthorizationgroupenablingaccessbyspecificusergroup:that
is,anextrasecurityfacility.Withtheauthorizationgroupand
authorizationobject,accesscanberestrictedtothelevelofany
workbenchobject.Theauthorizationgroupandauthorization
objectisnotinthescopeofthisbook.
Withthemaintenancedialogboxassignedanauthorizationgroupandan
authorizationobject,itwilloperateinthefollowingmanner.
Anenduserenvisagedtooperateonthedataofunderlyingtable/sofa
maintenanceviewwillnothaveaccesstothetransactionscodesSE11and
SE16.TheywillbegivenaccesstotransactioncodeSM30.Inthe
transactioncodeSM30,youcanaccessandoperateonlytablesforwhich
tablemaintenancedialogexists.WithtransactioncodeSM30,anend
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
37/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
usercanonlyaccessandoperatedataofspecificdatabasetablesforwhich
tablemaintenancedialogexistsandhasbeenauthorizedaccesstothese
throughtheauthorizationgroupandauthorizationobject.
Themaintenancedialogusingmaintenanceviewcanbemodified
andcustomized.
Onceamaintenanceviewiscreated,atablemaintenancedialogcanbe
generatedusingthismaintenanceviewscreenorthetransactioncode
SE54bythetablemaintenancegenerator.
Thetablemaintenancegeneratorautomaticallygeneratesafunction
group,functionmodule/s,interfaces,andscreensofatablemaintenance
dialog.Thisgeneratedtablemaintenancedialogcanthenbeusedto
maintaindatainthedatabasetable/softhemaintenanceview.
Atablemaintenancedialoggeneratedusingamaintenanceviewhas
optiontooperatethemaintenancedialogwitheitheronescreenorwith
twoscreens.
Whenyouchoosetheoptionofamaintenancedialogwithtwoscreens,
thefirstscreenpresentsanoverviewofexistingmaintenanceviewdata
(multiplerowdisplaydisplayingdataofthefirstfourfields).Thisiscalled
theoverviewscreen.Tooperateonexistingrows,therowstobe
operateduponhavetobeselectedthroughtherowselectorsinthe
overviewscreenandcontrolthenshiftstoasecondscreen.Tocreate
newrows,youclickonthecreatebuttonontheapplicationtoolbarand
thecontrolshiftstothesecondscreen.
Thesecondscreenistoinsert/edit/delete/displayindividualrows.This
screeniscalledthesinglescreenandpresentsonerowatatimeofthe
maintenanceview.Togetafeeloftwoscreenstablemaintenancedialog,
seethecontentsofSAPdeliveredmaintenanceviewV_T001using
transactioncodeSE16orSM30.
Inatablemaintenancedialogwithasinglescreen,datafromthe
maintenanceviewispresentedinmultiplerowformwithfieldheadings
andcanbeoperatedupononthesamescreen.Togetafeelofsingle
screentablemaintenancedialog,seethecontentsofSAPdelivered
maintenanceviewV_KNA1_COREusingtransactioncodeSE16or
SM30.
Whengeneratingthetablemaintenancedialog,thetablemaintenance
generatorpromptsforthefunctiongroup.Itisagoodpracticetoinputa
nonexistentfunctiongroupname.Whenyouinputanonexistent
functiongroupname,thetablemaintenancegeneratorcreatesa
functiongroupwiththatnameandalsogeneratesfunctionmodules.All
programmingincludingscreenrelatedprogramming(PBOandPAI
modules,etc.),arelocatedinthecodeofthefunctiongroupandthe
functionmodules.YoucanincorporateandexecuteyourcustomPBOand
PAImodulesandsubroutines.ThecustomPBOandPAImoduleswillbe
invokedfromtheflowlogicareaofthescreens.Thesubroutinesare
codedforevents.Therearemorethanthirtyeventssupportedinthe
maintenancedialog.Thescreenlayoutscanbechangedintermsof
repositioning,resizing,andchangingthepropertiesofscreenelements.
Nowthatanoverviewhasbeenprovidedoftablemaintenanceviewsand
tablemaintenancedialog,youcanproceedtohandsonexercises.
HandsonExercise.CreateandOperateTableMaintenanceDialogfor
theCustomDatabaseTableYCL_CH02_BILLI
Scenario
Usingatablemaintenancedialog,youwanttobeabletoinsert,edit,
delete,anddisplaydataforthedatabasetableYCL_CH02_BILLI.This
tablewascreatedinChapter2aspartofyourhandsonexerciseon
domains,dataelements,andtables.Youoperatedthedataofthistable
usingthedefaulttablemaintenancedialoginChapter2.Thistable
consistsofitemsofbills.Torecapitulate,thetableconsistsofthe
followingfields:
BILL_NO
BillNumber
SRL_NO
SerialNumber
ITEM_CODE
ItemCode
QNTY
Quantity
RATE
Rate(SellingPrice)
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
38/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
AMOUNT
AmountfortheItem
YouhadattachedasearchhelptothefieldITEM_CODEofthistablein
Chapter3.ThesearchhelphadthetableYCL_CH02_ITEMMasits
sourceofdata.Theattachedsearchhelpenabledaselectionlisttoappear
onpressingfunctionkeyF4inthisfieldwhenenteringdatathroughthe
defaulttablemaintenancedialog.Theselectionlistdisplayedthe
followingfields:ITEM_CODE,ITEM_DESC(ItemDescription),and
RATE.Onmakingaselectionintheselectionlist,thevaluesoffields
ITEM_CODEandRATEwerereturnedtothescreenfields.
YouwillcreateamaintenanceviewwiththetablesYCL_CH02_BILLI
andYCL_CH02_ITEMMrelatedthroughthefieldITEM_CODE.These
twotablesdonothaveN.1cardinality.Sinceyouwilloperate
(insert/edit/delete)dataofonetableonly(i.e.,YCL_CH02_BILLI),this
doesnotmatter.Theobjectiveofincludingthetable
YCL_CH02_ITEMMistodisplaytheITEM_DESC(itemdescription)
fieldalongsidetheitemcode(ITEM_CODE)fieldwhenarowis
presented.Youwillgenerateatablemaintenancedialogusingthe
maintenanceview.
Theparticipatingfieldswiththeiroriginatingtablesinthemaintenance
viewareshowninTable1410.
Table1410.
FieldName
TableName
Description
BILL_NO
YCL_CH02_BILLI
BillNumber
SRL_NO
YCL_CH02_BILLI
SerialNumber
ITEM_CODE
YCL_CH02_BILLI
ItemCode
ITEM_DESC
YCL_CH02_ITEMM
ItemDescription
QNTY
YCL_CH02_BILLI
Quantity
RATE
YCL_CH02_BILLI
Rate(SellingPrice)
AMOUNT
YCL_CH02_BILLI
Amountforthe
Item
Withthisspecificationofmaintenanceview,youproceedtocreatethe
maintenanceview.
CreateMaintenanceView
OntheopeningscreenoftransactioncodeSE11,clickontheViewradio
button.Enterthenameofthemaintenanceviewtobecreatedas
YCL_CH14_BIIT_MV.ClicktheCreatebuttonorpressthefunctionkey
F5.Thesystemwillpromptforthetypeofviewtobecreated.Selectthe
Maintenanceviewradiobutton.
Themaintenanceviewcreationscreenappears.Enterappropriateshort
text.UnderthecolumnTables,entereithernameofthesecondarytable
YCL_CH02_BILLIorselectthistablefromthefiltered(YCL_CH02*)
selectionlist.Toselecttheprimarytable,clickontheRelationships
button.SelectthetablerelationshipofYCL_CH02_ITEMM&
YCL_CH02_BILLIfromthelist.Thescreenafterselectionoftable
relationshipisasshowninFigure1498.
Figure1498.CreateMaintenanceViewYCL_CH14_BIIT_MV,
TabTable/JoinConditions
ClickontheViewFldstab.Selectallthefieldsofthetable
YCL_CH02_BILLI.SelectthefieldITEM_DESCfromthetable
YCL_CH02_ITEMM.Thescreenafterorderingthefieldsasperthe
specificationswilllooklikethoseinFigure1499.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
39/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure1499.CreateMaintenanceViewYCL_CH14_BIIT_MV,
TabViewFields
Save,performaconsistencycheck,andactivatethemaintenanceview.
Nowyouneedtocreatethetablemaintenancedialog.Togeneratethe
tablemaintenancedialog,makethefollowingmenuselectioninthe
maintenanceviewscreen:Utilities(M
TableMaintenance
Generator).ThisisshowninFigure14100.
Figure14100.MaintenanceViewYCL_CH14_BIIT_MVScreen
NavigatetoTableMaintenanceGenerator
GenerateTableMaintenanceDialog
ThegeneratetablemaintenancedialogscreenwillappearlikeinFigure
14101.
Figure14101.MaintenanceViewYCL_CH14_BIIT_MVScreen
GenerateTableMaintenanceDialogScreen
EntertheAuthorizationGroupas&NC&(noauthorization)fromthe
selectionlist.Authorizationobjectisautomaticallyassignedas
S_TABU_DIS.
EntertheFunctiongroupvalueasYCL_CH14_MV_FG.Thisfunction
groupshouldnotexist.Thetablemaintenancegeneratorwill
automaticallycreatethisfunctiongroupandrelatedfunctionmodules.
SelecttheMaintenanceTypeasatwostep.Withthisoption,therewill
beanoverviewscreendisplayingmultiplerows.Therewillbeasingle
screeninwhichallthefieldsofaselectedrowfromtheoverviewscreen
willappear.Incaseyouselectonestep,onasinglescreen,multiple
rowswillappear.EnterOverviewscreenvalueas100andSingle
screenvalueas200.
Formultiplemaintenanceviewscreatedwiththesamesetoftable/s,
thesescreennumbersshouldbeunique.
Afterthevalueshavebeenentered,clickonthecreatebuttononthe
applicationtoolbar.
Thescreenwiththeenteredvaluesandthetablemaintenancegenerated
willappearasinFigure14102.
Figure14102.GenerateTableMaintenanceDialogScreen
ValuesFilled&TableMaintenanceDialogGenerated
Nowthatatablemaintenancedialoghasbeencreated,youwilluseitto
operatethedataoftableYCL_CH02_BILLI.
OperateTableYCL_CH02_BILLIDataUsingMaintenanceView
TableMaintenanceDialog
Withthetablemaintenancedialoggenerated,gobacktothemaintenance
viewscreen.Clickonthecontentsbuttonoftheapplicationtoolbar.The
overviewscreenofthetablemaintenancedialogappears.Itdisplaysthe
firstfourfieldsofthemaintenanceview.Thisdatawascreatedin
Chapter2.Ifyouclickonthetogglebuttonchangeontheapplicationtool
baroftheoverviewscreenofthetablemaintenancedialog,an
informationalertappearsasyourtableiscrossclient(Client
independent).ThisisshowninFigure14103.
Figure14103.TableMaintenanceDialogOverviewScreenAlert
forCrossClient
Withtheselectallbuttonontheapplicationtoolbar,selectalltherows.
Theoverviewscreeninterfacewithalltherowsselectedisshownin
Figure14104.
Figure14104.TableMaintenanceDialogOverviewScreen&Its
Interface
IfyouclickontheDetailsbutton,thescreenwillpresenteachrows
contentsasshowninFigure14105.
Figure14105.TableMaintenanceDialogSingleScreenwith
Data
Therearebuttonstocreatenewrowsandnavigatetootherrows
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
40/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
(previous,next,etc.).
Asanexercise,usethetablemaintenancedialogtocreatenewrows,edit
existingrows,anddeleterows.
Torecapitulate,youfirstdefinedascenarioforamaintenanceview
usingtablesYCL_CH02_BILLIandYCL_CH02_ITEMM.Thescenario
envisagedusageofthemaintenanceviewfordataoperationofthetable
YCL_CH02_BILLI.Youcreatedamaintenanceviewasperthescenario.
Youusedthemaintenanceviewtogenerateatablemaintenancedialog.
Youdeployedthetablemaintenancedialogtooperateonthedataofthe
tableYCL_CH02_BILLI.
Inthenexthandsonexercise,youwillcarryoutmodificationstothe
tablemaintenancedialog.
HandsonExercise.ModifyGeneratedTableMaintenanceDialog
Scenario
Inthishandsonexercise,youwillperformmodificationstotheobjectsof
precedinghandsonexerciseinwhichyoucreatedthetablemaintenance
viewwiththetablesYCL_CH02_BILLIandYCL_CH02_ITEMMand
generateatablemaintenancedialogtooperatethedataofthetable
YCL_CH02_BILLI.Theobjectiveofincludingthesecondtable
YCL_CH02_ITEMMwastohavetheitemdescriptionfield
ITEM_DESCfromthesecondtableappearalongsidethefield
ITEM_CODEofthefirsttableYCL_CH02_BILLI.Youarenot
operatingonthedataofthesecondtableYCL_CH02_ITEMM.Soyoudo
notwantthefieldITEM_DESCtoappearineditorchangemode.This
fieldmustappearindisplaymode.ThefieldAMOUNTisaderivedfield
ofratemultipliedbyquantity.ThefieldAMOUNTshouldbesetto
displaymode.Itshouldbederivedbymultiplyingtherateandquantityin
aPAImodule:thatis,whenyouclickonthesavebuttonorpressthe
<Enter>key,(triggeringaPAIevent)onthetablemaintenancedialog,
thefieldAMOUNTshouldbederivedbyexecutingaPAImodule.
Tosumup,inthepresenthandsonexercise,youwillperformthe
following:
SetthefieldITEM_DESCindisplaymodeinbothscreensofthe
tablemaintenancedialog:theoverviewscreen(screenno.100)as
wellasthesinglescreen(screenno.200).
SettheAMOUNTfieldtodisplaymodeinthesinglescreen
(screenno.200)andderivethefieldAMOUNbymultiplying
RATEandQNTYinaPAImodule.
ModificationsasperScenario
Tocarryouttheselistedmodificationsinthetablemaintenancedialog,
navigatetothegeneratetablemaintenancedialogscreenofthe
maintenanceviewYCL_CH14_BIIT_MV(Figure14102)Doubleclickon
screen200.(Singlescreen),andthesystemwillnavigatetothescreen
painter.Clickonthelayouteditorbuttonontheapplicationtoolbar.In
thelayouteditorofscreen200,doubleclickonthescreenelement
YCL_CH14_BIIT_MVITEM_DESCtobringupthepropertiesdialog
boxofthisscreenelement.Onthepropertydialogbox,clickonthe
Programtab,anddisabletheInputFieldcheckbox.Thisisshownin
Figure14106.
Figure14106.TableMaintenanceDialog.SingleScreenChange
Properties
Carryoutasimilarprocedureforthescreenelement
YCL_CH14_BIIT_MVAMOUNT.Save,activatescreenno.200,and
exitthelayouteditor.Returntothegeneratetablemaintenancedialog
screen.ThiswillensurethatthefieldsITEM_DESCandAMOUNTon
thesinglescreenorscreenno.200willappearindisplaymodewhen
operatingthetablemaintenancedialog.
ToensurethatthefieldITEM_DESContheoverviewscreenorscreen
no.100appearsindisplaymode,youhavetoexecuteaPBOmodule
(dynamicsettingofpropertiesfromtheflowlogicareaofscreenno.
100).Thisissobecausethetablemaintenancedialogismanipulatingthe
propertiesofthisscreenelementinitsPBOmodule.Ifyouwanttosetthe
propertiesofthisscreenelement,itshouldoverridethesettingbyPBO
moduleofthetablemaintenancedialog.SoyourPBOmoduleinvocation
shouldfollowthetablemaintenancedialoginvocationofPBOmodules.
Onthegeneratetablemaintenancedialogscreen,doubleclickonscreen
100.Thesystemwillnavigatetotheflowlogicareaofscreenno.100.
InsertamoduleinvokingastatementlikeMODULEOWN_PBO100.
ThisstatementisjustprecedingtheENDLOOPstatementinthePBO
area.Performsyntaxandactivatethescreen.Theflowlogicareawith
invocationofyourPBOmoduleafteractivationisshowninFigure14
107.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
41/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure14107.TableMaintenanceDialog.OverviewScreenPBO
Module
Thenextstepistoincorporatethecodefortheinvokedmodule
OWN_PBO100.Toincorporatethecodeforinvokedmodule,selectthe
followingmenuoptiononthegeneratetablemaintenancedialogscreen.
Environment
Modification
SourceCode.Whenyoumakethis
menuselection,thescreenasinFigure14108appears.
Figure14108.TableMaintenanceDialog.OverviewScreen
IncorporateSource
InFigure14108,atthebottomarecommentedINCLUDEsourcelines.
TheyareaprovisiontocreateyourownPBOandPAImodules.Thereis
provisiontocreateyourownsubroutinesorsubprograms.The
subroutinesgetexecutedforevents.Thereareoverthirtyevents
availableinthetablemaintenancedialog.Alistoftheseeventscanbe
foundinSAPdocumentationonmaintenanceviewsandtable
maintenancedialog.
Inthepresentscenario,youhavetocodeaPBOmodulethatwillsetthe
propertyofthescreenelementYCL_CH14_BIIT_MVITEM_DESCto
displaymode:thatis,SCREENINPUT=0.So,decommenttheline
*INCLUDELYCL_CH14_MV_FGO...
asINCLUDELYCL_CH14_MV_FGO01.
Saveandthendoubleclickontheincludeprogramname
LYCL_CH14_MV_FGO01.Thesystemwillalertthattheprogramdoes
notexist,shouldtheprogrambecreated?Thisalertappearsonthestatus
barandnotasapopup.Pressthe<Enter>key.Thenenterthefollowing
lines:
MODULEOWN_PBO100OUTPUT.
LOOPATSCREEN.
IFSCREENNAME='YCL_CH14_BIIT_MVITEM_DESC'."nameofthescreenelement
SCREENINPUT=0.
MODIFYSCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
Save,performasyntaxcheck,andactivatetheincludeprogram.
Navigatetothepreviousscreeninwhichtheincludeprogramisbeing
invoked.Activatethismainprogram.Navigatebacktothegeneratetable
maintenancedialogscreen.
Youhavecarriedouttherequiredmodificationstomakethefield
ITEM_DESCappearindisplaymodeinboththeoverviewscreenand
thesinglescreen.Next,youwillincorporateaPAImoduleforthesingle
screen(screenno.200),whichwillcalculatethefield
YCL_CH14_BIIT_MVAMOUNT=YCL_CH14_BIIT_MVQNTY*
YCL_CH14_BIIT_MVRATE.
ToinvokeitsownPAImoduleandcreatecodeforitsownPAImodulefor
thesinglescreen(screenno.200),followthesameprocedureyou
followedforinvokingandcreatingitsownPBOmodule.
Inthegeneratetablemaintenancedialogscreen,doubleclickonthe
singlescreen(screenno.200).Thesystemwillnavigatetotheflowlogic
areaofscreenno.200.ScrolldownthePAIarea.Thescreenwilllook
likeFigure14109.
Figure14109.TableMaintenanceDialog.SingleScreenPAI
Module
AttheendoftheexistingPAIstatements(afterthestatementendchain),
incorporatethePAImoduleinvokingstatement.
FIELDYCL_CH14_BIIT_MVAMOUNTMODULECALC_AMT.
Save,performasyntaxcheck,andactivatethescreen.Returntothe
generatetablemaintenancedialogscreen.Youhavetocreatethecodeof
invokedPAImoduleCALC_AMT.Toincorporatethecodeforinvoked
PAImodule,selectthefollowingmenuoptiononthegeneratetable
maintenancedialogscreen:Environment
Modification
Source
Code.Whenyoumakethismenuselection,thescreenasinFigure14110
appears.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
42/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
Figure14110.TableMaintenanceDialog.SingleScreen
IncorporatePAIModuleSource
YouhavetocodeaPAImodulethatwillcalculatethefieldAMOUNT.So,
decommenttheline:
*INCLUDELYCL_CH14_MV_FGI...
asINCLUDELYCL_CH14_MV_FGI01.
Saveandthendoubleclickontheincludeprogramname
LYCL_CH14_MV_FGI01.Thesystemwillalertthattheprogramdoes
notexist,shouldtheprogrambecreated?Thisalertappearsonthestatus
barandnotasapopup.Pressthe<Enter>key.Thenenterthefollowing
lines:
MODULECALC_AMTINPUT.
YCL_CH14_BIIT_MVAMOUNT=YCL_CH14_BIIT_MVQNTY*YCL_CH14_BIIT_MVRATE.
ENDMODULE.
Save,performasyntaxcheck,andactivatetheincludeprogram.
Navigatetothepreviousscreeninwhichtheincludeprogramisbeing
invoked.Activatethis(main)program.Navigatebacktothegenerate
tablemaintenancedialogscreen.
Onthegeneratetablemaintenancedialogscreen,ensurethatthefield
CompareFlagisassignedthevalueAutomaticallyAdjustable.Pressthe
savebutton.YouarenowreadytooperatethetableYCL_CH02_BILLI
throughthetablemaintenancedialogwiththeproposedchanges
incorporatedinthetablemaintenancedialogwiththeproposedchanges.
ThefieldITEM_DESCwillappearindisplaymodebothin
overviewscreenandsinglescreen.
ThefieldAMOUNTwillappearindisplaymodeinthesingle
screen.
ThefieldAMOUNTisderivedbymultiplyingthefieldsRATEand
QNTY.
Youwillproceedtotestthesemodificationstotheoriginaltable
maintenancedialog.
OperateTableYCL_CH02_BILLIafterModifications
LettheoperationonthetableYCL_CH02_BILLIwiththemodifiedtable
maintenancedialogbetestedintransactioncodeSE16.Onthescreenof
transactioncodeSE16,enterthenameofthemaintenanceviewas
YCL_CH14_BIIT_MV.Clickonthetablecontentsbuttononthe
applicationtoolbar.Switchtochangethemodeofthescreen.The
overviewscreenwillappearasshowninFigure14111.
Figure14111.TableMaintenanceDialog.OverviewScreenWith
Modifications
Asperthemodifications,thefieldITEM_DESCappearsindisplaymode
ontheoverviewscreen.Selectoneormorerowsontheoverviewscreen
andnavigatetothesinglescreenasshowninFigure14112.
Figure14112.TableMaintenanceDialog.SingleScreenWith
Modifications
YoucanobservethatthefieldsITEM_DESCandAMOUNTappearin
displaymodeonthesinglescreen.
TotestwhetherthefieldAMOUNTisderivedbymultiplyingthefields
RATEandQNTY,youcaneitherassignanothervaluetothefield
ITEM_CODEand/orchangethecontentsofthefieldQNTYofan
existingrow.Oryoucancreateanewrowandtestthederivationofthe
fieldAMOUNT.
Inthefollowingscreen,thetestingofderivationofAMOUNTis
demonstratedbycreatinganewrow.Youcancreateanewrowby
clickingtheNewEntriesbuttoneitherontheoverviewscreenorthe
singlescreen.WhenyouclickontheNewEntriesbutton,ablanksingle
screenappears.ClickonthefieldITEM_CODE.PressfunctionkeyF4
andmakeaselectionfromtheselectionlist.Enteravalueinthefield
QNTY.Pressthe<Enter>key.ThiswilltriggerthePAIevent,anda
singlescreenwillappearlikeinFigure14113.
Figure14113.TableMaintenanceDialog.SingleScreenField
AMOUNTDerived
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
43/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
YoucanobservethatthevalueofthefieldITEM_DESCisfetchedand
appearsindisplaymode.ThefieldAMOUNTisderivedbymultiplying
thefieldsRATEandQNTY.ThefieldAMOUNTappearsindisplay
mode.
Alltheproposedchangestothetablemaintenancedialogasperthe
describedscenariohavebeencarriedoutandtested.
MaintenanceView,TableMaintenanceDialog,Miscellanea
Thefollowingshouldbeborneinmindwhenmodifyingthetable
maintenancedialog.
Thedifferentcomponentsofthetablemaintenancedialogcanbe
accessedfromthegeneratetablemaintenancedialogscreenwith
themenuoptions.
Environment
Modification
MaintenanceScreens
Environment
Modification
UserInterface
Environment
Modification
Events
Environment
Modification
SourceCode
Thenameofthemainprogramoftheautomaticallygenerated
functiongroupisasusual:SAPL<functiongroupname>.Inthe
functiongroup,youcandeclareyourglobaldataifrequired
preferablythroughanincludeprogram.
Inthemainprogram,donotmodifyanythingexcepttheUser
DefinedIncludefilesarea.RefertoFigure14110.
Ifyouwanttomakemodificationstothefunctiongroupin
transactioncodeSE37,ensurethatyouarenotonthegeneratetable
maintenancedialogscreen.Aftercarryingoutmodificationto
functiongroupintransactioncodeSE37,activateallprogram
componentsofthefunctiongroupbeforeexiting.Ifthefunction
groupisnotactive,youcannotaccessitfromgeneratetable
maintenancedialogscreenformodification.
Youcanmodifythetablemaintenancedialogscreensintermsof
layout,changingscreenelementproperties,andinserting
statementsintheflowlogicarea.
Ifthingsgowrong,deletetheentire(allcomponents)table
maintenancedialog.Recreatethetablemaintenancedialogagain.
Thisconcludesmaintenanceviewsandtablemaintenancedialog.
Conclusion
Thechapterbeganwitharecapitulationofthescreenpainterbasicsthat
youwereintroducedtoinChapter12.Thiswasfollowedbythehandson
exercisethathandlesadatabasetabledata(i.e.,display,change,create,
anddeletearowmakinguseofmultiplescreenswithscreennavigations.
Whileperformingthehandsonexercise,youwereintroducedtothe
objectnavigatortransactioncodeSE80.Intheobjectnavigator,you
cancreateallworkbenchobjectsfromasinglepoint.Withtheobject
navigator,youcanviewalltheworkbenchobjectsusedintheABAP
programinahierarchicaltreelikestructure.
Thesecondhandsonexercisedemonstratedtheimportparametersofa
DDICsearchhelp.Whiledemonstratingtheuseofimportparametersofa
DDICsearchhelp,youusedthefunctionmodules:
F4IF_FIELD_VALUE_REQUESTandDYNP_VALUES_UPDATE.
ThethirdhandsonexerciseinvolvedthescreenelementsSubscreenArea
andSubScreenstosimulateatabstripelement.
HavingbeenexposedtothescreenelementsSubscreenAreaandSub
Screens,youusedatabstripelementinthefourthhandsonexercise.The
tabstripisimplementedusingthescreenelementsSubscreenAreaand
SubScreens.
Thescreenpresentationofdataofmostbusinessdocumentsrequires
multiplerowstobedisplayed.Thetablescreenelementisusedfor
presentingmultiplerowsdataonthescreen.Thefifthhandsonexercise
usesthetablescreenelementtopresentthebillingdocumentdataonthe
screen.
Somemiscellaneaarecovered:creatingcustomtransactioncodes,abrief
overviewoftheDDIClockobjects,andplacingatabstriponaselection
screen.
Thechapterconcludeswithabriefonmaintenanceviewsandtable
maintenancedialog.
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
44/45
1/5/2016
Chapter14:ScreenProgrammingSAPABAP:HandsOnTestProjectswithBusinessScenarios
PREV
NEXT
Recommended
/ Queue
RecentOutputPart
/ Topics / Tutorials
/ Settings / Blog / Feedback
Appendix
/ Sign
A: Out
Description of the SAP-Delivered Tables Used in th...
Chapter 13: ABAP
List /Viewer
2
2016 Safari.
Terms of Service / Privacy Policy
https://www.safaribooksonline.com/library/view/sapabaphandson/9781430248040/9781430248033_Ch14.xhtml
45/45