Вы находитесь на странице: 1из 119

SAP R/3 Implementation

ABAP Programming Standards

Version: 3

TABLE OF CONTENTS
3.3.5.2.1 Menu Standards............................................................................................................................26 3.3.5.2.2 Tabstrips in SAP Release 4.X......................................................................................................2 6.5.1.!.1 Inner "oin......................................................................................................................................!2 6.5.1.!.2 #e$t %uter "oin..............................................................................................................................!3

1!64522& .do' Pa+e


i

(ersion) 3 &4 Mar'* 2&&3

1. Document Revision History Date Versi Re uester on # 1 (ineet -*atia (ineet -*atia (ineet -*atia C!an"e Descri#tion Initial (ersion /*an+e to /TS 0amin+ Standards Pre$i1 Addition o$ Standards $or Report 2eader and .ooter

2! "anuar, 2&&3 &5 .ebruar, 2 2&&3 &4 Mar'* 2&&3 3

$. %ntro&uction T*is do'ument is a 'ompilation o$ possible A-AP pro+rammin+ and e$$i'ien', standards and 3ill pro4ide +uidan'e in 'reatin+ readable5 maintainable 'ode. It is intended $or all de4elopers in t*e SAP R/3 Implementation Pro6e't 7iamond at 0o4artis5 8SA. T*e A-AP lan+ua+e is an 9e4ent dri4en:5 9top;do3n: pro+rammin+ lan+ua+e. T*e A-AP pro'essor 'ontrols t*e e1e'ution o$ an e4ent. .or e1ample5 t*e e4ent AT S<#</TI%0; S/R<<0 is e1e'uted 3*en t*e user presses enter on t*e sele'tion s'reen and t*e e4ent START;%.;S<#</TI%0 is e1e'uted 3*en t*e user e1e'utes t*e pro+ram. As t*e A-AP lan+ua+e in'orporates man, 9e4ent: =e,3ords5 it is ne'essar, to implement in;*ouse A-AP 'odin+ standards to 'reate 'onsistent and e$$i'ient maintainable 'ode. As a standard5 T*e %b6e't -ro3ser s*ould be used $or all de4elopment in t*e SAP s,stem. A Sour'e /ode /*an+e Pro'ess s*ould be in pla'e and ad*ered to prior to ma=in+ '*an+es to produ'tion A-AP pro+rams and SAP sour'e 'ode. T*e reader is also re$erred to t*e se'tion dealin+ 3it* t*e 0amin+ standards re>uired b, t*is pro6e't 3*en dealin+ 3it* t*e

1!64522& .do' Pa+e


1

(ersion) 3 &4 Mar'* 2&&3

CTS ?/orre'tion and Transport S,stem@5 t*is is 'ontained 3it*in t*e Appendi1 o$ t*is do'ument.

1!64522& .do' Pa+e


2

(ersion) 3 &4 Mar'* 2&&3

'. '.1

(enera) *ro"rammin" Stan&ar&s Namin" Conventions o+ ABA* Deve)o#ments All 'ustom A-AP pro+ram names s*ould $ollo3 t*e namin+ standards stated belo3. <a'* A-AP pro+ram s*ould ad*ere to t*e A-AP internal namin+ 'on4entions set $ort* in t*is do'ument. Standard namin+ 'on4entions are in pla'e and s*ould be used at all times as detailed belo3 $or bot* tables5 stru'tures and A-AP et'); *roc Re Num 1n&erscore Brie+ Desc 1 -$/ -1/ -$'/ -$/

, -1/ Ty#e -1/

, -c!aracter num.er 1/) /ustom A-AP pro+rams need to be+in 3it* ABC. Ty#es -c!aracter num.er $/) T*is 3ill be used to mention t*e t,pe o$ A-AP pro+ram. Possible 4alues are as $ollo3s) 0 ) In'lude T ) Table S ) Stru'ture R ) Report / ) /on4ersions $or le+a', data upload I ) Inter$a'e M ) Module Pool $or 7ialo+s # ) #a,out Set/.orm *roc1 -c!aracters ' an& 0/)
1!64522& .do' Pa+e
3

(ersion) 3 &4 Mar'* 2&&3

T*is 3ill be used to mention t*e main SAP module. .I ) .inan'ial A''ountin+ /%) /ontrollin+ MM ) Materials Mana+ement S7 ) Sales and 7istribution PP) Produ'tion Plannin+ PM) Plant Maintenan'e PS) Pro6e't S,stems /S) /ustomer Ser4i'e D0 ) Deneral T*is 3ill be deri4ed $rom '*ara'ter 3 and 4 o$ t*e .un'tional spe'i$i'ation. Re uirement Num -c!aracter 23 4/5 T*e ARe>uirement 0umberC 3ill be t*e runnin+ serial number 3it*in a SAP Module. T*e SAP Module and t*e re>uirement number to+et*er 3ill *elp as an inde1 in 'ollation all de4elopment ob6e'ts su'* as .un'tional spe'i$i'ation5 Te'*ni'al spe'i$i'ation5 8nit test Plan5 A-AP de4elopment ob6e'ts E pro+ram/tables/et'. 1n&erscore ?'*ara'ter F@) T*e AGC s,mbol 3ill be de$ined as separator. Brie+ Descri#tion ?'*ara'ters ; 3&@)

/*ara'ters E 3& 'an be used to brie$l, des'ribe t*e $un'tionalit,. T*is 'an also be used to distin+uis* se4eral ob6e'ts o$ t*e same t,pe $or a 'ommon 3or= list item5 su'* as multiple stru'tures used $or t*e same dialo+ module. E6am#)es) B/MM1!Gmaterial upload E /on4ersion pro+ram $or uploadin+ material masters in materials mana+ement module. BSMM23G&1GPurG*istor,5 BSMM23G&2GPurG*istor, E 2 number stru'tures de4eloped $or de$inition o$ $ield 'atalo+s $or A#( report pro+ram to s*o3 pur'*asin+ *istor,. T*ese stru'tures are 'reated $or re>uirement number 23 3it*in t*e main SAP Module in t*e main A-AP de4elopment 3or= list.
1!64522& .do' Pa+e
4

(ersion) 3 &4 Mar'* 2&&3

*ro7ect *o)icy on Stan&ar& SA* c!an"es To be determined5 and in'luded in t*is do'ument later in t*e ne1t 4ersion. '.1.1 %nterna) &ata &ec)aration58 ?see se'tion 4@ '.1.$ Deve)o#ment C)asses 7e4elopment 'lasses +roup to+et*er de4elopment ob6e'ts ?e.+. pro+rams5 tables5 $un'tion modules@ 3*i'* 'an be 'orre'ted and mi+rated to+et*er a'ross instan'es. A de4elopment 'lass 'an5 $or e1ample5 'onsist o$ a transa'tion or a +roup o$ related transa'tions alon+ 3it* pro+rams5 77I/ ob6e'ts5 menu painters5 s'reen painters5 lo'= ob6e'ts5 messa+e 'lasses5 mat'* 'odes5 et'. All 'ustom de4elopment s*ould be assi+ned to a 'ustom de4elopment 'lass. Temporar, ob6e'ts ma, be assi+ned to 'lass AHTMPC. %b6e'ts de$ined under t*e HTMP de4elopment 'lass 3ill not be mi+rated. 7e4elopment 'lasses $ollo3 t*e namin+ 'on4ention) Deve)o#ment C)ass B7M/ B0/A B0// B0/7 B0/< B0/. B0/K B0/# B0/M Descri#tion <1tension o$ Aut*oriIation .ields 0o4artis /onsumer 2ealt* ; AM ; Assets A''ountin+ 0o4artis /onsumer 2ealt* ; PP/ ; Produ'tion Plannin+ J /ontr 0o4artis /onsumer 2ealt* ; 7ASS 0o4artis /onsumer 2ealt* ; RI(A 0o4artis /onsumer 2ealt* ; .I ; .inan'ial A''ountin+ 0o4artis /onsumer 2ealt* ; /ost A''ountin+ 0o4artis /onsumer 2ealt* ; In4entor, Mana+ement 0o4artis /onsumer 2ealt* ; MM ; Materials Mana+ement
(ersion) 3 &4 Mar'* 2&&3
5

1!64522& .do' Pa+e

Deve)o#ment C)ass B0/% B0/P B0/M B0/S B0/T B0/( B0/X B0/B '.1.'

Descri#tion 0o4artis /onsumer 2ealt* ; Lor=$lo3 0o4artis /onsumer 2ealt* ; 2uman Resour'es 0o4artis /onsumer 2ealt* ; MSS ; Mualit, Assuran'e 0o4artis /onsumer 2ealt* ; -asis 0o4artis /onsumer 2ealt* ; Temp. 7e4. ?/on4ersion pro+rams@ 0o4artis /onsumer 2ealt* ; Sales J 7istribution 0o4artis /onsumer 2ealt* ; Material Master 7ata Mana+ement 0o4artis /onsumer 2ealt* ; /ross appli'ation

Function (rou#s .un'tion +roups allo3 $or +roupin+ related $un'tion modules and t*eir 'omponents into a 'ommon area. Also5 'ommon 4ariables ma, be s*ared b, all $un'tion modules 3it*in a $un'tion +roup. .un'tion +roups s*ould ad*ere to t*e $ollo3in+ namin+ 'on4ention) ,9CCa666666666666666666666 // E /ountr, /ode a ; Appli'ation I7 1 ; %pen

'.1.0

Functions :o&u)es T*e SAP $un'tion modules are pro+rams 3ritten in A-AP t*at $orm lo+i'al units in $un'tion +roups. T*e, 'an be s*ared b, multiple A-AP pro+rams and b, ot*er $un'tion modules. T*e, are mana+ed 'entrall, in t*e $un'tion librar,. .un'tion modules are +rouped to+et*er usin+ t*e $un'tion +roups. .un'tion modules ma, be de$ined to one and onl, one $un'tion +roup.

1!64522& .do' Pa+e


6

(ersion) 3 &4 Mar'* 2&&3

SAP;supplied $un'tion +roups s*ould ne4er be used to de$ine ne3 $un'tion modules. .un'tion modules are similar to pro+rams5 t*e primar, di$$eren'e is t*e, 'an be 'alled usin+ remote $un'tion 'alls $rom t*e operatin+ s,stem5 'an be 'alled 4ariabl, 3it*in and a'ross pro+rams5 and are not t,pi'all, built $or reportin+ usin+ sele'tion 'riteria. .un'tion module names 'an be a ma1imum o$ 3& '*ara'ters. T*e $ollo3in+ namin+ 'on4ention s*ould be used) ,9CCa9666666666666666666666666 // E /ountr, /ode a ; Appli'ation I7 1 ; %pen ?separate 3ords 3it* unders'ores@ Remarks: All $un'tion modules s*ould $ollo3 pro+rammin+ standards outlined in t*is do'ument. T*ere is no di$$eren'e bet3een pro+rams and $un'tion modules 3*en 'onsiderin+ lo+i' $lo3s5 s,nta15 unit testin+5 and 4ariable namin+. '.1.2 Functions :o&u)es Ta.)es Dec)aration Tables must be de'lared in D#%-A# 7ATA '.1.4 Layout Sets SAP s'ript is a tool in R/3 $or $ormattin+ te1t do'uments. T*e $ormattin+ rules are stored in R/3 ob6e'ts 'alled a #a,out set. #a,out sets 'an be used to $ormat R/3 standards te1t or to $ormat t*e output o$ A-AP reports. In parti'ular5 SAP s'ript 'an be used to $ormat R/3 $orms ?Pur'*ase %rder/ DR0 / In4oi'e / et'@ 3*en t*e, are displa,ed on t*e s'reen or printed on a printer. A ma1imum o$ 16 '*ara'ters 'an be used to name #a,out Sets. T*e $ollo3in+ namin+ 'on4ention s*ould be used) ,CCa666666666666 // E /ountr, /ode
1!64522& .do' Pa+e
F

(ersion) 3 &4 Mar'* 2&&3

a ; Appli'ation I7 1 ; %pen ?use unders'ores to separate 3ords and ma=e as meanin+$ul as possible@. '.1.; Stan&ar& Te6t T*ese are standard pie'es o$ te1t t*at 'an be slotted into a la,out set and 'an 'ontain pie'es o$ standard te1t t*at 'an be 'alled b, an, la,out set. An e1ample 3*ere standard te1t 3ould be used 3ould be to *old an address $or an in4oi'e appro4al slip. T*e address is 'ontained 3it*in t*e standard te1t and 'an be 'alled in t*e la,out set to displa, t*e address 3*en re>uired. I$ t*e address '*an+es5 onl, t*e standard te1t needs to be modi$ied $or t*e '*an+es to be e$$e'ti4e immediatel, 3*ere it is 'alled. T*e menu pat* $or standard te1t is Tools/Lord Pro'essin+/Standard Te1t or transa'tion S%1&. T*e transport pro'edure is sli+*tl, di$$erent a+ain in t*at ,ou *a4e to 'reate a blan= 'orre'tion or repair5 and atta'* t*e standard te1t to it. T*e 'orre'tion/repair 'an t*en be released in t*e normal 3a,. '.1.< :essa"es T*e abilit, to displa, messa+es s*ould also $ollo3 t*e prin'iples o$ maintainabilit, and be stored as indi4idual messa+es. Messa+e 'lasses e1ist 3it* messa+es alread, in t*em. T*ere are alread, an e1tensi4e number o$ messa+es in ea'* o$ t*e 'lasses t*ere$ore5 more t*an li=el,5 ,ou 3ill $ind t*e messa+e ,ou re>uire. Nou 'an also 'reate a ne3 messa+e and store it in an appropriate 'lass. :essa"e C)asses5 Messa+e /lasses s*ould ad*ere to t*e $ollo3in+ namin+ 'on4ention) ,CCa6666666666666666 // E /ountr, /ode a ; Appli'ation I7 1 ; %pen %ND%V%D1AL :ESSA(ES5
1!64522& .do' Pa+e (ersion) 3 &4 Mar'* 2&&3

<a'* messa+e is +i4en a se>uential number and 'alled b, t*at number $rom t*e pro+ram5 3it* t*e se4erit, o$ t*e 3arnin+ bein+ de'ided ea'* time t*e messa+e is 'alled.

'.1.1=Loc> O.7ect L*en 'reatin+ a #o'= %b6e't5 t*e $ile name must be+in 3it* E, and 'an be a ma1imum o$ 14 '*ara'ters lon+. E,CCa9tttttttttttt // E /ountr, /ode A E Appli'ation I7 t ; primar, table name ?3*ere multiple #o'= %b6e'ts are re>uired $or t*e same primar, table5 assi+n a uni>ue di+it to t*e $inal position@.

'.1.11

Transaction Co&es <a'* SAP transa'tion is identi$ied b, a uni>ue transa'tion 'ode 3*i'* is listed in t3o SAP tables. Table TST/ 'ontains t*e attributes o$ t*e transa'tion5 3*ile table TST/T 'ontains t*e s*ort te1t asso'iated 3it* t*e transa'tion. Transa'tion 'odes s*ould ad*ere to t*e $ollo3in+ namin+ 'on4ention) ZCCaxx // E /ountr, /ode a E Appli'ation I7 1 E %pen All reports s*ould be e1e'uted $rom an area menu or $rom t*e reportin+ tree.

'.1.1$

1sin" Lo"ica) Fi)e Names 1. 8se T'ode E A.I#<C to 'reate lo+i'al $ile names. .or 'on4ersions t*e #o+i'al .ile pat* is BI7T.

1!64522& .do' Pa+e


!

(ersion) 3 &4 Mar'* 2&&3

1!64522& .do' Pa+e


1&

(ersion) 3 &4 Mar'* 2&&3

2. /*oose #o+i'al $ile name de$inition5 'ross;'lient

1!64522& .do' Pa+e


11

(ersion) 3 &4 Mar'* 2&&3

3. /reate ne3 entr, $or ,our pro+ram as $ollo3in+ E #o+i'al $ile ) Opro+ram namePG.I#<1 0ame ) Os*ort des'riptionP P*,si'al $ile O$ile namePO7AT<P 7ata $ormat AS/ Appli'ation area .I #o+i'al pat* BI7T

1!64522& .do' Pa+e


12

(ersion) 3 &4 Mar'* 2&&3

4. 8se t*e $ollo3in+ .un'.Module in ,our pro+ram to +et t*e p*,si'al $ile name. /A## .80/TI%0 Q.I#<GD<TG0AM<Q <XP%RTI0D R /#I<0T S SN;MA07T #%DI/A#G.I#<0AM< S Opro+ramGnamePG.I#<1 R %P<RATI0DGSNST<M S SN;%PSNS R PARAM<T<RG1 SQQ R PARAM<T<RG2 SQQ R PARAM<T<RG3 SQQ R 8S<GPR<S<0TATI%0GS<R(<R S Q Q R LIT2G.I#<G<XT<0SI%0 S Q Q R 8S<G-8..<R SQQ IMP%RTI0D R <M<RD<0/NG.#AD S R .I#<G.%RMAT S .I#<G0AM< S load$ile <X/<PTI%0S .I#<G0%TG.%807 S1 %T2<RS S 2. I. SN;S8-R/ OP &. R M<SSAD< I7 SN;MSDI7 TNP< SN;MSDTN 08M-<R SN;MSD0% R LIT2 SN;MSD(1 SN;MSD(2 SN;MSD(3 SN;MSD(4. <07I.. ) ) ) ) ) START;%.;S<#</TI%0. open dataset load$ile $or output in te1t mode messa+e 3sGmessa+e.

'.$ '.$.1

*ro"ram Attri.utes Tit)e

1!64522& .do' Pa+e


13

(ersion) 3 &4 Mar'* 2&&3

Pro+ram attributes are set $rom t*e 9Attributes: option on t*e initial A-AP editor s'reen. All pro+ram attributes $or an A-AP are to be set as $ollo3s) Title T*e title s*ould be a s*ort 'on'ise des'ription. T*is is t*e title 3*i'* appears in t*e *eader se'tion o$ a report 3*en it is e1e'uted. E6am#)e) Create BDC Session +or Transaction ::=1 8 Create :ateria) :aster '.$.$ Ty#e T*e $ollo3in+ t,pes are a4ailable) <1e'utable pro+ram $or reports/inter$a'es In'lude pro+rams. T*ese are not dire'tl, e1e'utable and are in'luded in ot*er e1e'utable or non;e1e'utable pro+rams. Module pool pro'essin+ t*e $lo3 lo+i' o$ a d,npro. .un'tion +roup. Subroutine Pools. Inter$a'e pools /lass pools -lan= '.$.' Status SAP standard produ'tion pro+ram. /ustomer produ'tion pro+ram. S,stem Pro+ram. Test Pro+ram.
1!64522& .do' Pa+e
14

(ersion) 3 &4 Mar'* 2&&3

In SAP implementation5 all pro+rams are de4eloped as A/ustomer Produ'tion Pro+rams.C '.$.0 A##)ication T*e A-AP Appli'ation s*ould be set as mentioned in t*e $un'tional spe'i$i'ation name. '.$.2 Aut!ori?ation (rou# 8sed to restri't a''ess to users 3it*out a mat'*in+ aut*oriIation +roup in t*eir pro$ile. /*e'=s are per$ormed be$ore report e1e'ution5 and be$ore a''ess to utilit, $un'tions5 report attributes5 and t*e A-AP editor. '.$.4 Lo"ica) Data.ase Assi+ns t*e lo+i'al database to be e4aluated b, t*e pro+ram. T*e 3or=ben'* pro4ides a''ess to all lo+i'al database pro+rams deli4ered b, SAP. '.$.; From A##)ication 8sed in 'on6un'tion 3it* t*e lo+i'al database $ield. T*e tables retrie4ed to a''ess t*e parti'ular lo+i'al database depend upon t*is entr,. '.$.< Screen T*is is $or report pro+rams onl,. I$ a S'reen is not spe'i$ied t*e s,stem 3ill 'reate a sele'tion s'reen based on t*e lo+i'al database ?i$ spe'i$ied@5 t*e pro+ram parameters and sele't;options. To use an e1istin+ sele'tion s'reen5 enter t*e 4ersion in t*is $ield. (ersions are 'onne'ted to t*e pro+rammin+ o$ lo+i'al databases. 8se t*e 3or=ben'* to anal,Ie lo+i'al database s'reen 4ersions. '.$.@ E&itor Loc> To be set 3*ile a pro+ram is bein+ 'reated or modi$ied. It allo3s onl, t*e user I7 to set t*e $la+ to modi$, t*e pro+ram. T*is is to pre4ent alteration o$ a pro+ram 3*ile a pro+rammer ma=es modi$i'ations to it. T*e <ditor #o'= s*ould not be $la++ed on.
1!64522& .do' Pa+e
15

(ersion) 3 &4 Mar'* 2&&3

'.$.1=

Fi6e& *oint Arit!metic I$ $la++ed5 all 'al'ulations in t*e pro+ram are done usin+ $i1ed point arit*meti'. I$ t*e $ield is not '*e'=ed5 de'imal pla'es are onl, ta=en into 'onsideration $or output5 not $or 'al'ulations. All pro+rams s*ould *a4e t*is $la+ '*e'=ed.

'.$.11

Start via Variant I$ '*e'=ed5 t*e pro+ram 'an onl, be e1e'uted 4ia a 4ariant.

'.' '.'.1

1#&ate #ro"rams3 Comments3 Formattin"3 Structure 1#&ate #ro"rams All transa'tion update pro+rams are to o$$er t*e user t*e option o$ runnin+ t*e A-AP eit*er in -7/ Session or /all Transa'tion mode5 unless a spe'i$i' mode or a 'ombination o$ t*em li=e /all Transa'tion $or all re'ords and -7/ Session $or $ailed re'ords is spe'i$ied in t*e Te'*ni'al Re>uirement Spe'i$i'ation. <nsure t*at a dupli'ate re'ord e1isten'e '*e'= must be made in e4er, data upload pro+ram

'.'.$

Comments Internal 'ommentin+ o$ an A-AP Pro+ram is essential $or pro+ram maintenan'e and must be done $or all pro+rams. In$ormati4e 'omments s*ould pre'ede ea'* part o$ sour'e 'ode and supplement 3*at 'an be read $rom t*e 'ode itsel$. T*is A-AP do'umentation must 'ontain re$eren'es to t*e initial spe'i$i'ation and '*an+es made subse>uentl,. A-AP 'ode is $airl, sel$;do'umentin+. 2o3e4er5 it is prudent to pro4ide $uture pro+rammers 3it* do'umentation o$ purpose5 '*an+es5 en*an'ements5 additions5 and deletions. <1plain t*e purpose5 desi+n5 stru'ture and an, testin+ *ints at t*e top o$ t*e pro+ram. In'lude an, =e, de'isions and assumptions made. Maintain a '*ronolo+i'al *istor, o$ modi$i'ation notesT 3it* t*e latest '*an+e bein+ t*e last entr, in t*e modi$i'ation lo+. T*e do'umentation blo'= s*ould be pla'ed at t*e top o$ t*e main pro+ram. An o4erall des'ription

1!64522& .do' Pa+e


16

(ersion) 3 &4 Mar'* 2&&3

o$ t*e pro+ram s*ould be +i4en at t*e top o$ t*e pro+ram and s*ould *a4e t*e $ollo3in+ $ormat) <1ample) R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRR R /on$idential and Proprietar, R /op,ri+*t A#ST%M5 Australia R All Ri+*ts Reser4ed RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRR R Pro+ram 0ame) B1111111

R /reated b,) GGGGGGGG R /reated on) mm/dd/,,,,. R (ersion) n.n R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; R Modi$i'ation #o+) R 7ate Aut*or /orre'tion 7es'ription R2!/&5/&1 S*i4apri,a 7<(1!&&&1 AddedUU R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; I$ a modi$i'ation is made to a tested A-AP pro+ram5 an entr, s*ould be made in t*e modi$i'ation lo+ 3it* t*e date5 pro+rammerCs initials5 'orre'tion number5 and brie$ des'ription. Also5 in t*e pro+ram 'ode5 a 'omment s*ould be added to t*e e$$e'ted lines indi'atin+ t*e 'orre'tion number. <1ample) %F SA8S1BRC NE =. E6it. END%F. Or Be"in o+ DevC@====02 BDevC@====02 BDevC@====02 BDevC@====02

1!64522& .do' Pa+e


1F

(ersion) 3 &4 Mar'* 2&&3

%F SA8S1BRC NE =. ED%T. END%F. En& o+ DevC@====02 A-AP 'ode s*ould be 3ritten modular rat*er t*an in line para+rap* or $orm st,le. /omple1 and lar+e 'odin+ stru'tures s*ould be 'ommented b, usin+ a blo'=ed o$$ 'omment se'tion pre'edin+ t*e stru'ture. <1ample) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE E T!is +unction mo&u)e +ormats an& #osts E transaction :B=1 8 *ost (oo&s Recei#t E via CALL transaction EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE CALL F1NCT%ON F*OST9(OODS9RECE%*TG ED*ORT%N( TCODE H I9TCODE %:*ORT%N( DAN*ROTAB H %9BDC. '.'.' '.'.'.1 Formattin" Forms A lar+e and 'omple1 strin+ o$ 'odin+ statements s*ould be bro=en up and pla'ed in .%RMs to pro4ide eas, readabilit, and maintainabilit,. .%RMs are subroutines5 3*i'* allo3 a pro+rammer to de$ine a pro'ess on'e in a pro+ram and 'all t*at routine $rom di$$erent pla'es 3it*in t*e pro+ram. I$ a blo'= o$ 'ode is e1e'uted more t*an on'e5 it s*ould be pla'ed in a subroutine. T*is ma=es t*e 'ode more readable5 re>uires less indentation5 and is easier to debu+ sin'e t*e debu++er 'an 6ump t*rou+* an entire subroutine 4ia a P. =e,.

1!64522& .do' Pa+e


1

(ersion) 3 &4 Mar'* 2&&3

<a'* .%RM s*ould ser4e onl, one $un'tion. .%RMs s*ould be pla'ed at t*e end o$ t*e A-AP. All .%RM para+rap*s s*ould +enerall, be positioned in t*e order t*e, are 'alled. T*e $un'tion o$ t*e $orm s*ould be des'ribed in t*e 'omment se'tion. In t*e 'ase o$ .%RMs t*at use parameters5 t*e parameters s*ould also be des'ribed. .%RM names s*ould be+in 3it* F9. T*is 3ill displa, all t*e pro+ram ob6e'ts to+et*er 3*en usin+ Lor=ben'*. T*e rest o$ t*e .%RM name s*ould des'ribe 3*at t*e .%RM is doin+. 8se t*e SAP de$ault .%RM 'omment bo1. To use t*is $eature5 'ode t*e P<R.%RM statement and t*en double 'li'= on t*e ne3 $orm name. T*e .%RM and <07.%RM statements and a de$ault 'omment bo1 3ill be +enerated at t*e end o$ t*e A-AP. I$ an, parameters are passed in t*e P<R.%RM5 'omment lines allo3in+ indi4idual des'ription o$ t*ese parameters 3ill be +enerated as 3ell. Lit* 3.&5 t*e $ormat parameters must be t,ped usin+ TNP< or #IK< =e,3ords. T*is is a ne3 per$orman'e $eature in 3.& and also allo3s 'orre'tin+ t,pin+ errors be$ore runtime. Pass input parameters as usin+ parameters and output parameters as /2A0DI0D parameters. T*e $ormal parameter does not o''up, a memor, o$ its o3n. I$ in doubt5 pass t*e parameters b, 4alue. To a4oid s*ado3in+ problems5 al3a,s name ,our $ormal parameters di$$erent t*an t*e a'tual parameters. I$ Subroutines de$ined b, .%RM use/re>uire +lobal 4ariables t*en de$ine lo'al $ields $or use lo'all, 3it*in a subroutine and not use +lobal $ields <1ample) E8888888888888888888888888888888888888888E E FOR: F9xxxxxxxxxxxxxx *-8888888888888888888888888888888888888888E
1!64522& .do' Pa+e
1!

(ersion) 3 &4 Mar'* 2&&3

E %nsert a &escri#tive te6t !ere E8888888888888888888888888888888888888888E FOR: F9xxxxxxxxxxxxxx In'ludes s*ould be used to brea= do3n lar+e pro+rams into se'tions t*at 'an be maintained more easil, and to 'reate pro+ram se'tions t*at 'an be s*ared b, se4eral pro+rams. I0/#87< statements s*ould be 'ommented indi4iduall, b, usin+ t*e 'omment indi'ation ARC. /ode 'ontained 3it*in t*e I0/#87< statement s*ould ad*ere to pro+rammin+ standards and namin+ 'on4entions. <1ample) E %nsert a &escri#tive te6t to &escri.e t!e %NCL1DE E %NCL1DE 66666666. .or o4erall le+ibilit,5 an A-AP Pro+ram s*ould be neatl, indented. T*e PR<TTN PRI0T<R 'ommand ?PP t,ped in t*e 'ommand line@ 'an be used to indent ea'* nested 'ommand stru'ture b, 2 positions 3it* t*e settin+s indent and 'on4ert to 8pper'ase. Statements 3it* multiple ob6e'ts s*ould be indented and ali+ned $or 'larit,. '.'.'.$ Te6t E)ements <a'* A-AP pro+ram s*ould *a4e asso'iated te1t elements and 'onstants $rom t*e sour'e 'ode pla'ed 3it*in t*e Te1t <lements se'tion o$ t*e A-AP <ditor) Tit)es an& Hea&in"s 8 T*e *eadin+ s*ould al3a,s be 'ompleted in as mu'* detail as possible. 8se 90o Standard Pa+e 2eadin+: p*rase and 'ode a 'ustom *eader. Se)ection Te6ts 8 All s,stem S<#</T;%PTI%0S and PARAM<T<RS are limited to < '*ara'ters and as a 'onse>uen'e s*ould al3a,s *a4e sele'tion te1ts set to impro4e user understandin+. All Sele'tion Te1ts s*ould be in lo3er;'ase 3it* t*e $irst 3ord startin+ 3it* a 'apital letter.

1!64522& .do' Pa+e


2&

(ersion) 3 &4 Mar'* 2&&3

Te6t8Sym.o)s 8 All te1t s,mbols used $or *eaders s*ould *a4e numbers 2&15 2&25 2&3U.et'. As $ar as possible5 use one te1t $or one report *eader line. All Te1t S,mbols used $or messa+es s*ould *a4e numbers M&15 M&25 M&3Uet'. <1ample) IR%TE5 J TEDT8==1. T*e ad4anta+e o$ t*is met*od is ease o$ maintainabilit, i$ T<XT;&&1 is 'oded se4eral times in t*e pro+ram and needs to be '*an+ed. Formattin" Comman&s <1ample) Correct IR%TE5 J =1 666666613 1= 6666666$3 12 6666666'. %ncorrect IR%TE5 J =1 666666613 1= 6666666$3 12 6666666'. 8se one line per ob6e't 3*en de$inin+ multiple ob6e'ts o$ t*e same entit,. 7es'ribe t*ose ob6e'ts on t*at same line. <1ample) Correct TABLES5 T13 B&escri#tion T$3 B&escri#tion T'. B&escri#tion %ncorrect TABLES5 T13 T$3 T'. <a'* A-AP 'ommand 'onsists o$ a senten'e endin+ 3it* a period. SAP allo3s multiple 'ommands to be on one lineT *o3e4er5 as a standard start ea'* ne3 'ommand on a ne3 line. T*is 3ill allo3 $or easier deletin+5 'ommentin+5 and debu++in+.

1!64522& .do' Pa+e


21

(ersion) 3 &4 Mar'* 2&&3

<1ample) Correct %F I9D H ' AND I9A H $ AND I9, H 1. *ERFOR:K. END%F. %ncorrect %F I9D H ' AND I9A H$ AND I9, H 1 *ERFOR:K. END%F. '.'.0 ABA* Co&in" Structure Data De+inition 7ata elements must be +rouped in lo+i'al +roups. .or e1ample5 'onstants de'lared to+et*er5 4ariables +rouped to+et*er5 'ounters +rouped to+et*er. .or lar+e +roupin+s5 put items in alp*abeti'al order $or supportabilit,. L*ere 'lari$i'ation is needed5 4ariable names must *a4e in;line 'omments. <a'* 4ariable must be de'lared on a separate line. .or readabilit,5 di$$erent 'omponents o$ t*e names must be separated b, unders'ores. 8se 9#i=e: 3*en de$inin+ data elements 3*ene4er possible. T*is 3ill ensure $ield 3idt* and ot*er domain attributes are 'orre't $ollo3in+ up+rades. Co&in" Structure T*e standard stru'ture $or A-AP Report 'odin+ is) R<P%RT 2eader do'umentation TNP<S %R TNP<;P%%#S TA-#<S PARAM<T<RS S<#</T;%PTI%0S
1!64522& .do' Pa+e
22

(ersion) 3 &4 Mar'* 2&&3

/%0STA0TS 7ATA RA0D<S .I<#7;DR%8PS .I<#7S .I<#7;SNM-%#S R <4ent elements I0ITIA#IBATI%0 AT S<#</TI%0;S/R<<0 %0 PARAM<T<RS AT S<#</TI%0;S/R<<0 %0 -#%/K AT S<#</TI%0;S/R<<0 START;%.;S<#</TI%0 D<T <07;%.;S<#</TI%0 T%P;%.;PAD< <07;%.;PAD< /ontrol elements T%P;%.;PAD< 78RI0D #I0<;S<#</TI%0 AT #I0<;S<#</TI%0 AT P.nn AT 8S<R;/%MMA07 Subroutines .%RM / <07.%RM '.'.2 :o&u)e *ro"ram Structure Module pro+rams s*ould onl, 'ontain In'lude statements and an, ne'essar, 'omments. T*e module pool is also a means o$ lin=in+ all t*e asso'iated s'reens5 menus and $un'tion =e,s o$ t*e inter$a'e as a transa'tion. '.'.2.1 Screen F)oL Lo"ic Pla'e t*e AT <XIT;/%MMA07 at t*e be+innin+ o$ t*e $lo3 lo+i' in t*e PAI. <1ample)
1!64522& .do' Pa+e
23

(ersion) 3 &4 Mar'* 2&&3

*ROCESS AFTER %N*1T. :OD1LE ED%T911;= AT ED%T8CO::AND. :OD1LE *A%911;=. 8se .I<#7 and /2AI0 statements to =eep $ields in error open $or 'orre'tion. <1ample) *ROCESS AFTER %N*1T. :OD1LE ED%T911;= AT ED%T8CO::AND. CHA%N. F%ELD BTCH11;=8MOBNA:E. F%ELD BTCH11;=81SERNA:E. F%ELD BTCH11;=8FRO:9DATE. F%ELD BTCH11;=8FRO:9T%:E. :OD1LE *A%911;=. ENDCHA%N. L*en usin+ t*e AT /8RS%R S<#</TI%05 'ode it a$ter t*e AT <XIT;/%MMA07. '.'.2.$ Screens an& Screen Sty)e Stan&ar&s L*en desi+nin+ S/R<<0S5 pla'e $ields on t*e s'reen in t*e se>uen'e in 3*i'* t*e, are most $re>uentl, used. Ali+n all labels and $ields 3it* nei+*borin+ lines and -%X an, related s'reen $ields to+et*er. Position t*e 'ursor to t*e most $re>uentl, used $ield on t*e initial s'reen displa,. .or s'reen $ields t*at re>uire te1t input5 pla'e literal labels on t*e le$t and t*e data entr, $ields on t*e ri+*t o$ t*e label. .or s'reen $ields t*at use +rap*i'al elements5 pla'e t*e literal label to t*e ri+*t o$ t*e +rap*i' element. Apart $or t*e +eneral +uidelines +i4en abo4e5 t*e $ollo3in+ list des'ribes t*e 'ommon st,le and $un'tionalit, t*at must be in'orporated into ea'* online transa'tion s'reen. T*is
1!64522& .do' Pa+e
24

(ersion) 3 &4 Mar'* 2&&3

in$ormation supplements t*e SAP R/3 Mini St,le Duide in SAP %n;line do'umentation5 3*i'* s*ould also be ad*ered to. Screen )itera)s L*ilst all s'reens are bein+ 'onstru'ted in <n+lis*5 it is 4ital t*at t*e s'reens be produ'ed usin+ t*e $ield te1t asso'iated 3it* t*e data elements to ease translation to ot*er lan+ua+es. *arameters Ma1imum $ields t*at *a4e parameters de$ined s*ould use t*e D<T I7 and S<T I7 $la+s in s'reen painter to allo3 t*e stora+e and retrie4al o$ t*e parameter 4alues. Cey.oar& s!ortcuts All $un'tions must be a''essible usin+ a =e,board s*ort'ut5 b, usin+ t*e tab =e, to s=ip bet3een $ields5 assi+nin+ a $un'tion =e, ?or 'trl and a =e,@ to 'ommon tas=s5 or b, allo3in+ a''ess t*rou+* t*e menus5 3*i'* 'an be a''essed usin+ alt;O=e, lettter P ?normal menu na4i+ation @. See also t*e $ollo3in+ se'tion on menu de$inition@ Ta. stri#s Tab strips 'an be used e$$e'ti4el, to s*o3 t*e user t*e di$$erent $a'ets o$ an ob6e't. 2o3e4er5 t*e, s*ould not be used to maintain di$$erent ob6e'ts 3it*in t*e same s'reen5 and spe'i$i'all, must not be used to s3it'* bet3een ob6e'ts at di$$erent le4els 3it*in a lo+i'al *ierar'*,. Too).ar .uttons L*ere s'reens *a4e a sele'tion o$ $ilter $ields5 t*e <1e'ute -utton ?. @ s*ould be used to produ'e t*e list. *us! .uttons <1'ept in e1'eptional 'ir'umstan'es5 -uttons s*ould be positioned on t*e appli'ation toolbar and identi$ied b, a suitable i'on. .loatin+ Tool tip te1t s*ould be de$ined $or all buttons to ease identi$i'ation. FHy#er)in>sG L*ere $ields s*o3n on a s'reen *a4e a sensible lin= to anot*er transa'tion ?$or e1ample t*e maintenan'e transa'tion $or t*e Ser4i'e 'ode $ield@5 t*en allo3 t*e user to double 'li'= on t*e $ield to in4o=e t*e asso'iated transa'tion5 passin+ t*e 'ontents o$
1!64522& .do' Pa+e
25

(ersion) 3 &4 Mar'* 2&&3

t*e $ield to t*e ne3 transa'tion. 9-a'=: 3ill return to t*e ori+inal transa'tion 3it* all $ields populated as t*e, 3ere be$ore lea4in+ it. Variants All s'reens 'ontainin+ lists s*ould be 'apable o$ sa4in+ displa, 4ariants t*at ma, be retrie4ed b, t*e user in t*e normal 3a, and be 'apable o$ allo3in+ t*e user to de$ine a de$ault 4ariant. All report sele'tion must be 'apable o$ 'reatin+ and retrie4in+ report sele'tion 4ariants. Layout Transa'tions t*at 3ill be used e1tensi4el, must be >ui'= and eas, to use 3it* a minimum o$ s'reen '*an+es5 button 'li'=s or =e,stro=es. S'reens s*ould be laid out to present a 'lear5 un'luttered 4ie3 3it* data presented in lo+i'al +roups 3it*in separate $rames.

'.'.2.$.1

:enu Stan&ar&s A menu must be de$ined $or ea'* s'reen t*at $ollo3s t*e standard SAP st,le o$ menus in'ludin+ all o$ t*e appropriate menu elements.

Oob6e'tP

E&it

Environment (ot o See belo 3 ;;;;;; ;;;;;; -a' = E6tr Environm Vie as ent L See See belo3 See belo belo 3 3 Settin "s See belo3 1ti)iti es See belo3

System He)#

No.7ect O %t*er Sele't Oob6e't all P /reate 7esele 't all /*an+e Sele't blo'= 7ispla, /*oos e
1!64522& .do'

/reate session s <nd session

Appli 'ation 2elp SAP #ibrar , 8ser Dloss pro$ile ar, Ser4i'e ;;;;;;; s ;;;;;;;
(ersion) 3 &4 Mar'* 2&&3

Pa+e

26

/op,

;;;;;;;; ;;;;;;;

;;;;;;;;; /ut ;;;;;; Sa4e /op,

;;;;;;;;; ;;;;;;;; ;;;;;; ;;;;;;; Print Paste

;;;;;;;;; ;;;;;;;; ;;;;;; ;;;;;;; 7elete <1it Insert line 7elete line Sort... ;;;;;;;; ;;;;;;; /an'el

; 8tilitie Relea s se notes #ist ;;;;;;; ;;;;;;; ; Lor=$l SAP o3 0et #in=s ;;;;;;; ;;;;;;; ; Pri4ate .eedb notes a'= %3n ;;;;;;; spool ;;;;;;; re>uest ; s %3n Settin 6obs +s S*ort messa+ e Status #o+ o$$

(oto is a mandator, element and s*ould be used to in4o=e $eatures 3it*in t*e 'urrent transa'tion t*at are mandator, ?or are almost 'ertainl, used@ to enter all t*e re>uired data $or t*e ob6e't bein+ pro'essed T*e E6tras menu is not al3a,s re>uired5 but 3*ere appropriate is used $or ot*er $eatures or a'tions related to t*e ob6e't bein+ pro'essed t*at are used less $re>uentl, $or additional ?non; mandator,@ in$ormation.

1!64522& .do' Pa+e


2F

(ersion) 3 &4 Mar'* 2&&3

T*e Environment menu is not al3a,s re>uired5 but 3*ere appropriate is used $or lin=in+ to ot*er appropriate $un'tions 3it*in t*e 'urrent appli'ation area. T*e VieL menu is not al3a,s re>uired5 but 3*ere appropriate is used to allo3 t*e user to s3it'* bet3een di$$erent 4ie3s t*at are a4ailable $or t*e 'urrent ob6e't ?e.+ sin+le or multiline displa,s5 or +rap*i'al or te1t@ T*e Settin"s menu is not al3a,s re>uired5 but 3*ere appropriate is used to allo3 t*e user to set user;de$ined transa'tion parameters ?e.+. t*e number o$ se'onds bet3een automati' s'reen re$res*es@ T*e 1ti)ities menu is not al3a,s re>uired5 but 3*ere appropriate 'ontains $un'tions t*at allo3 not onl, t*e pro'essin+ o$ t*e 'urrent ob6e't5 but also 'ross;ob6e't pro'essin+ su'* as 'op,in+ in$ormation $rom one ob6e't to anot*er. '.'.2.$.$ Ta.stri#s in SA* Re)ease 0.D Tabstrips are ne3 ob6e'ts in SAP 4.X t*at pro4ide an eas, 3a, to de$ine di$$erent appli'ation 'omponents on t*e same s'reen and s3it'* bet3een t*em. T*eir intuiti4e desi+n also ma=es t*em easier $or end users. TabStrips enable t*e pro+rammer to ma=e it easier $or users to na4i+ate bet3een 'omponents o$ 'ompli'ated appli'ations. Moreo4er5 not onl, are TabStrips bat'* input 'ompatible5 but t*e, 'an also be used 3*ene4er 'omponents or lo+i'al 4ie3s o$ a sin+le ob6e't o''ur on di$$erent s'reens. 2o3e4er5 Tabstrips s*ould not be used to represent di$$erent ob6e'ts. '.'.2.' Loc>in" an& 1n)oc>in" in Dia)o"J%nter+ace *ro"rams Loc> O.7ect Creation
1!64522& .do' Pa+e
2

(ersion) 3 &4 Mar'* 2&&3

Related tables 'an be in'orporated in a lo'= ob6e't instead o$ *a4in+ lo'= ob6e'ts per table. A##)yin" t!e Loc> /all t*e <0M8<8< $un'tion be$ore t*e S<#</T Statement $or t*e transa'tional data to be '*an+ed/deleted. <1ample /all .un'tion <0M8<8<G<Olo'=Gob6e'tGnameP <XP%RTI0D GS/%P< S2 M%7< S A<C O=e,G$ield1P S O4alue1P . . . <X/<PTI%0S .%R<ID0G#%/K S 1 SNST<MG.AI#8R< S2 . I$ SN;S8-R/ S 1. #o'= <rror 2andlin+ pro'edure. 0ote; S,stem .ield SN;MSD(1 3ill *a4e t*e user name b, 3*om t*e table re'ord is lo'=ed. <07I.. S<#</T statement S,stem (ariable SN;S8-R/ is bein+ '*e'=ed $or trappin+ e1'eptions. %nl, ?E@ <1'lusi4e lo'=s to be used until ot*er3ise stated spe'i$i'all,. 8se t*e standard settin+ _SCOPE = 2 $or <0M8<8< $un'tion module

Loc>in" Sta"es

1!64522& .do' Pa+e


2!

(ersion) 3 &4 Mar'* 2&&3

Num.erin" J Cey <1ternal Internal <1ternal / Internal <1ternal / Internal

*rocess /reate /reate /*an+e / 7elete Sele't and delete in a multi;re'ords / multi; purpose transa'tion

Loc> J (et No5 Start o$ 8nit <nd o$ 8nit Start o$ 8nit A$ter re'ord is sele'ted and delete button is pressed

8se t*e .un'tion Module 7<M8<8<G<Olo'=Gob6e'tGnameP to unlo'= t*e re'ords lo'=ed as abo4e be$ore lea4in+ t*e pro+ram. 0ote) /all .un'tion 7<M8<8<GA## is not re>uired as /%MMIT L%RK releases all t*e lo'=s in t*e #8L ?re$eren'e readin+ re'ommended on #8L@. T*e $ollo3in+ points s*ould be 'onsidered 3*ile lo'=in+ and unlo'=in+. #o'=in+ s*ould pre$erabl, be done at t*e re'ord le4el $or t*e re>uired set o$ $ields onl,. #o'=in+ s*ould ideall, be done outside a loop statement at a *i+*er le4el $or 'ases 3*ere t*ere is a possibilit, o$ t*e no. o$ re'ords bein+ *i+*5 as it ma, lead to t*e problem o$ o4er$lo3 in t*e lo'= table. T*e 7e>ueue pro'essin+ s*ould ta=e pla'e onl, a$ter t*e /ommit Lor= Statement. Re'ords en>ueued s*ould also be de>ueued 3*en t*e pro+ram is terminated t*rou+* <1it//an'el et'. 2o3e4er t*is s*ould not *appen 3*en ,ou 'all anot*er pro+ram be'ause t*e 'all 3ill 'ome ba'= to t*e 'allin+ pro+ram. T*ere is no need to output a messa+e 3*en a lo'= is released. <0M8<8<GR<A7 $un'tion 'an be used to '*e'= 3*et*er a lo'= *as been obtained5 *o3e4er it s*ould be a4oided.

1!64522& .do' Pa+e


3&

(ersion) 3 &4 Mar'* 2&&3

'.'.2.0

Data.ase 1#&ate Tec!ni ues

T*e main update te'*ni>ue $or bundlin+ database '*an+es in a sin+le database #8L is to use /A## .80/TI%0... I0 8P7AT< TASK. L*en t*e pro+ram en'ounters t*e /%MMIT L%RK statement5 3or= pro'ess t*at is pro'essin+ t*e 'urrent dialo+ step starts an as,n'*ronous update 3or= pro'ess. Inside t*e update tas=5 no messa+e *andlin+ re>uired as SAP automati'all, does R%##-A/K in 'ase o$ errors and sends an <1press 7o'ument in t*e user SAP o$$i'e mailbo1. L*ere more t*an one update is 'arried out durin+ ASa4eC t*e updates s*ould all be 'arried out in a sin+le 8P7AT< $un'tion 'all 3it*in sa4e pro'essin+ $or better 'ode or+aniIation. A su''ess messa+e must be +i4en 6ust a$ter all t*e 4alidations be$ore appl,in+ t*e re'ords to t*e database are su''ess$ull, 'ompleted. T*e pro+ram $lo3 3ill be as $ollo3s ) /ode $or (alidations UUUUU. Messa+e t,pe ASC A7o'ument su''ess$ull, postedC. /all .un'tion O.un'tion moduleP in 8P7AT< TASK

/%MMIT L%RK '.'.2.2 (1% Status .or ea'* D8I5 use SAP de$aults proposed b, Menu Painter 3it*in Lor=ben'* $or Menu. /reate a title bar $or ea'* s'reen 3it*in a transa'tion t*at identi$ies 3*at $un'tion and area t*e s'reen is to be used $or. T*e standard set o$ P. Ke,s s*ould use t*e SAP de$aults proposed b, Menu Painter $rom Lor=ben'*.
1!64522& .do' Pa+e
31

(ersion) 3 &4 Mar'* 2&&3

%n all initial entr, s'reens5 be sure t*e -A/K5 /A0/<#5 and <XIT $un'tions are a'ti4ated. T*e $ollo3in+ $un'tions s*ould *a4e a standard $un'tion 'ode asso'iated to t*em) Function A77 /2A0D< 7<#<T< 7ISP#AN SA(< -A/K /A0/<# <XIT /2%%S< .IRST PAD< PR<(I%8S PAD< 0<XT PAD< #AST PAD< PRI0T '.'.2.4 Function Co&e A77 /20D 7<#T 7ISP SA(< -A/K /A0/ <XIT /2S< P;; P; PV PVV PR0T < < Function Ty#e

Bac>3 E6it an& Cance) Navi"ation .or understandin+ o$ t*e abo4e5 allo'ate logical numbering o$ t*e s'reen be$ore *and.

1!64522& .do' Pa+e


32

(ersion) 3 &4 Mar'* 2&&3

Bac> E++ect <1its ob6e't 'omponent Returns pre4ious le4el

E6it

Cance)

<1its tas= <1its ?appli'ation@ pro'essin + to S'reen 'allin+ t*e S'reen tas= 'allin+ t*e tas= Nes 0o

Mum# tar"et

Nes Save o#tion-&ia )o"ue Lin&oL/ C!ec>s Se uence o+ saveJc!ec > E6am#)e tit)e o+ &ia)o"ue Lin&oL Dia"nosis te6t in &ia)o"ue Lin&oL Nes

Nes

0o

/*e'=s $irst5 sa4e Sa4e option ;;; option later $irst5'*e'=s later

-a'=

<1it D/# do'ument /an'el editin+

0o dia+nosis te1t

0o dia+nosis te1t

8nsa4ed data 3ill be lost ?e.+.@

1!64522& .do' Pa+e


33

(ersion) 3 &4 Mar'* 2&&3

Bac> E6am#)e te6t in &ia)o"ue Lin&oL 7o ,ou 3ant to post t*e *eld do'umentW Or 7o ,ou 3ant to post t*e *eld do'ument 4F12W

E6it 7o ,ou 3ant to post t*e *eld do'umentW Or 7o ,ou 3ant to post t*e *eld do'ument 4F12W

Cance) 8nsa4ed data 3ill be lost. ;;; blan= line ;;; 7o ,ou 3ant to 'an'el t*e editin+W ?1st line is dia+nosis te1t@ Nes5 0o

*us!.utto Nes5 0o5 /an'el ns in &ia)o"ue Lin&oL -&e+au)t ansLer un&er)ine &/ Function mo&u)e popupGtoG'on$irm Gstep

Nes5 0o5 /an'el

popupGtoG'on$irm Gstep

popupGto G'on$irm GlossGo$ G data Edit .12 ?(12@

Action menu F8>ey

Goto .3 ?(3@

<object> .15 ?(15@

1!64522& .do' Pa+e


34

(ersion) 3 &4 Mar'* 2&&3

'.'.2.;

:essa"es Messa+es 'an be used to 'ommuni'ate 3it* users. T*e, are mostl, used $or error *andlin+ durin+ pro'essin+ o$ ot*er user dialo+s Nou send messa+es usin+ t*e A-AP statement M<SSAD<. T*e statement spe'i$ies t*e messa+e 'lass5 number5 and t,pe o$ t*e messa+e. All Messa+e statements supplemented in 'ode 3it* 'omment t*at des'ribes t*e te1t o$ t*e messa+e. T*e messa+e 'lass and number are used to identi$, t*e messa+e in table T1&&. T*e messa+e t,pe is one o$ A5 <5 I5 S5 L5 or X5 . Messa+e pro'essin+ depends on t*e messa+e t,pe spe'i$ied in t*e M<SSAD< statement5 and t*e pro+ram 'onte1t in 3*i'* t*e statement o''urs. Messa+e T,pes A Termination T*e messa+e appears in a dialo+ bo15 and t*e pro+ram terminates. L*en t*e user *as 'on$irmed t*e messa+e5 'ontrol returns to t*e ne1t;*i+*est area menu. 7ependin+ on t*e pro+ram 'onte1t5 an error dialo+ appears or t*e pro+ram terminates. T*e messa+e appears in a dialo+ bo1. %n'e t*e user *as 'on$irmed t*e messa+e5 t*e pro+ram 'ontinues immediatel, a$ter t*e M<SSAD< statement. T*e pro+ram 'ontinues normall, a$ter t*e M<SSAD< statement5 and t*e messa+e is displa,ed in t*e status bar o$ t*e ne1t s'reen. 7ependin+ on t*e pro+ram 'onte1t5 an error dialo+ appears or t*e pro+ram terminates. 0o messa+e is displa,ed5 and t*e pro+ram terminates 3it* a s*ort dump. Pro+ram
(ersion) 3 &4 Mar'* 2&&3
35

< I

<rror In$ormation

Status

L X

Larnin+ <1it

1!64522& .do' Pa+e

terminations 3it* a s*ort dump normall, onl, o''ur 3*en a runtime error o''urs. Messa+e t,pe X allo3s ,ou to $or'e a pro+ram termination. T*e s*ort dump 'ontains t*e messa+e I7. (ui&e)ines +or :essa"e !an&)in" -A/K / <XIT Tit)e 8 E6it *rocessin" Messa+e te1t ; 7o ,ou 3is* to sa4e ,our data $irstW

DELETE Title E 7elete Pro'essin+ Messa+e te1t ; 7o ,ou 3ant to delete t*e re'ordsW TABLE LOCC Transa'tion aborted. 8nable to #o'= t*e 7atabase Tables ?used $or Abort messa+e@ %b6e't re>uired is lo'=ed b, anot*er user ?used $or <rror messa+e@ DATABASE 1*DAT%ON J Re'ord?s@ su''ess$ull, J ?<+. 1 Re'ord su''ess$ull, 'reated@ J Re'ord?s@ su''ess$ull, 'reated J Re'ord?s@ su''ess$ull, updated J Re'ord?s@ su''ess$ull, deleted J Re'ord *as alread, been deleted J Re'ord?s@ not deleted ?<+. Reason 'ode is used in ot*er tables. Re'ord?s@ not deleted@ 0o '*an+es made

1!64522& .do' Pa+e


36

(ersion) 3 &4 Mar'* 2&&3

DATABASE SELECT%ON 0o re'ord?s@ $ound mat'*in+ t*e sele'tion 'riteria TABLE CONTROL L%NE SELECT%ON Position t*e 'ursor on a 4alid entr, Sele't a re'ord $rom t*e list Sele't a J re'ord $rom t*e list J ?<+. Sele't a "ourne, re'ord $rom t*e list to allo'ate@ Multiple sele'tions not allo3ed :ANDATORA F%ELDS SAP messa+e s*ould 'ome i$ a $ield is de$ined Mandator, ?<+. Ma=e an entr, in all re>uired $ields@ *ro"ram s#eci+ic Please enter J ?e+. Please enter Ser4i'e Droup@ Va)i&ation C!ec>s SAP messa+e s*ould 'ome 3*ere4er $orei+n =e, is de$ined t*rou+* '*e'= table.

*ro"ram s#eci+ic I$ SAP $orei+n =e, is disabled/does not e1ist t*en *andle pro+rammati'all, e+. Reason 'ode does not e1ist Reason /ode does not e1ist $or Reason 'ode t,pe *ro"ram C!ec>s J e1ists $or t*e J J J ?e+. Ser4i'e Droup e1ists $or t*e Plant5 Reason /ode e1ists $or t*e Reason 'ode t,pe@ Start time is later t*an end time .rom date is later t*an to date .rom date is in past
1!64522& .do' Pa+e
3F

(ersion) 3 &4 Mar'* 2&&3

.rom date is in $uture *ro"ram s#eci+ic <1ample <$$e'ti4e $rom date is o4erlappin+ $or plant and dail, s'*edule <$$e'ti4e $rom date $or 7ail, s'*edule and Rota set to 7ate $rom

'.'.2.<

Va)i&ations an& Data Vo)umes in Dia)o" *ro"rams A4oid redundant 'ode $or 4alidation o$ s'reen inputs 3*en t*e data di'tionar, is alread, *andlin+ it t*rou+* '*e'= tables. Attention s*ould be paid in terms o$ 3*i'* all user;'ommands and transa'tions ?7ispla, et'.@ do not re>uire 4alidations. In a dialo+ 6ob it is ne'essar, to distribute t*e 4alidations a'ross s'reens instead o$ 'umulatin+ at one pla'e li=e SA(< et'. T*e pro+rammer s*ould be a3are o$ t*e 4olume o$ data to be *andled in t*e dialo+ pro+ram and its +ro3t* rate durin+ t*e Te'*ni'al spe'i$i'ation sta+e. T*e al+orit*m in t*e Te'*ni'al spe' s*ould be re4ie3ed 3it* t*e $un'tional 'onsultant and a peer.

'.'.2.@

*ro"ram ca)) t!rou"! a Function :o&u)e 0ormall, Set/Det parameters are used to pass data bet3een 'allin+ J 'alled pro+ram. -ut i$ a pro+ram is 'alled b, a number o$ pro+rams5 it be'omes easier i$ t*e 'alled pro+ram is 'oded as a $un'tion module. Parameter passin+ 'an t*en be done t*rou+* t*e e1port/import inter$a'e o$ $un'tion module. T*e $ollo3in+ are t*e steps to a'*ie4e t*e abo4e ) /reate a .un'tion +roup $or t*e $un'tion module.

1!64522& .do' Pa+e


3

(ersion) 3 &4 Mar'* 2&&3

Do to t*e %b6e't <ditor ?S< &@ and 3it*in t*e 'reated $un'tion +roup 'reate t*e s'reens5 in'ludes5 D8I status J title as re>uired b, t*e 'alled pro+ram. T*e top in'lude 3ill be automati'all, 'reated $or t*e $un'tion +roup. Do t*e main pro+ram o$ t*e $un'tion +roup and add t*e in'lude statements $or in'ludes li=e I&15 %&15 .&15 et'. Lrite t*e pro'essin+ lo+i' $or t*e s'reens 6ust li=e an, ot*er dialo+ pro+ram. .inall, 3it*in t*e .un'tion +roup 'reate t*e $un'tion module. /all to t*e initial s'reen o$ t*e transa'tion 3ill be made b, t*e $un'tion module. T*e P-% lo+i' o$ t*e initial s'reen 3ill be 3ritten in t*e $un'tion module be$ore t*e 'all. T*e parameters 3*i'* need to be passed to or returned b, t*e 'allin+ pro+ram 3ill be de$ined in t*e import/e1port parameters o$ t*e $un'tion 'all.

'.0

ALV Re#orts /aution ) A#( reports 'an not be run in ba'=+round. In A#( reports use D8I TIT#< $or settin+ t*e title o$ t*e report and D8I STAT8S $or t*e menu bar. Al3a,s use data elements $or A#( /olumn *eadin+s and Sele'tion S'reen blo'= *eadin+ to a4oid *ard 'odin+. .or A#( Reports5 al3a,s $ollo3 t*e $ollo3in+ instru'tion $or $ield 'atalo+) A in&icates #resence o+ te6t in res#ective +ie)& )a.e)

1!64522& .do' Pa+e


3!

(ersion) 3 &4 Mar'* 2&&3

Out#ut in :e&ium ALV Re#ort *rint S!ort te6t te6t o+ Lon" te6t +or +ie)& *revieL o+ Data Data o+ Data Hea&in cata)o" +ie)& o+ ALV E)ement E)ement E)ement " co)&&ict6t re#ort N #on+ Te1t #on+ Te1t As set ?#5 M5 N N N S@ S*ort Set R ; N N N N 2eadin+ 2eadin+ As set ?#5 M5 N N S@ Medium Al3a,s use di'tionar, stru'ture?s@ as per output re>uirement o$ A#( report. T*is 3ill pro4ide a 'lean 'ode. Stru'ture des'ription s*ould sa, Ato be used onl, $or t*e spe'i$ied pro+ram.C %nl, a ma1imum o$ ! 'olumns 'an be sorted in an A#( Report. /olumn *eadin+ o$ A#( report 'omes $rom t*e $ield label o$ data element. T*e $ollo3in+ are $our t,pes o$ $ield labels asso'iated 3it* a data element S*ort5 Medium5 #on+ and 2eadin+ T*e $ollo3in+ rules appl, $or determinin+ 3*i'* te1t 3ill be sele'ted as $ield label. I$ 2eadin+ e1ists t*en de$ault 'olumn *eadin+ 3ill be 92eadin+: te1t o$ t*e $ield label. I$ 2eadin+ doesnCt e1ist t*en de$ault 'olumn *eadin+ 3ill be 9S*ort: te1t o$ t*e $ield label .

1!64522& .do' Pa+e


4&

(ersion) 3 &4 Mar'* 2&&3

I$ 92eadin+: and 9s*ort: bot* do not e1ist t*en de$ault 'olumn *eadin+ 3ill be 9Medium: te1t o$ $ield label . I$ not*in+ else e1ists 9#on+: 3ill be used. '.2 Core :o&i+ications Prior to ma=in+ SAP sour'e 'ode modi$i'ations5 a Sour'e /ode /*an+e Pro'ess must be in pla'e and re>uirements s*ould be appro4ed. As a standard5 onl, SAP aut*oriIed repairs s*ould be allo3ed to t*e SAP 'ode. L*en ma=in+ modi$i'ations to SAP 'ore pro+rams5 it is 4er, important to do'ument t*e '*an+es made 3it*in t*e pro+ram. Lit*in t*e 'omments se'tion at t*e be+innin+ o$ t*e pro+ram5 in'lude t*e $ollo3in+ as part o$ a modi$i'ation lo+) Repair number o$ t*e modi$i'ation ?s,stem assi+ned@ 0ame/initials o$ person ma=in+ t*e modi$i'ation 7ate 7es'ription o$ t*e modi$i'ation <1ample) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEE *ro"ram 66666666 EDescri#tion5 KKKK E88888888888888888888888888888888888888888888888888E ERe#air No. Date Aut!or Descri#tion EKKKKKK ..J..J.. KKKKKK KKKKKKKKKKK EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EE Lit*in t*e bod, o$ t*e pro+ram5 'omment e4er, addition o$ 'ode or '*an+e in 'ode. In'lude in t*e 'omments t*e repair
1!64522& .do' Pa+e
41

(ersion) 3 &4 Mar'* 2&&3

number5 initials5 date5 and des'ription o$ add/'*an+e. 0o 'ode s*ould be deleted $rom an, SAP 'ore pro+ram. #ines o$ 'ode t*at are no lon+er used s*ould be 'ommented out. <1ample) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEE ERe#air num.er5 :S1C@===<< E Descri#tion5 A&& co&e to KKK EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EE SELECT S%N(LE E FRO: LFA1 IHERE C1NNR EP %9TAB8C1NNR. BDEVC@===<< %F SA8S1BRC NE =. E6it. BDEVC@===<< BDEVC@===<< END%F. BDEVC@===<< Or Be"in o+ DEVC@===<< SELECT S%N(LE E FRO: LFA1 IHERE C1NNR EP %9TAB8C1NNR. %F SA8S1BRC NE =. E6it. En& o+ DEVC@===<< '.4 Creation o+ a&&itiona) ta.s in SA* Stan&ar& *ro"rams Lit! Ta.8 stri#s T*e steps $or 'reatin+ additional tabs in SAP Standard Pro+rams 3it* tab;strips are as $ollo3s <1e'ute Transa'tion 'ode (.-S /reate $un'tion 'odes Spe'i$, t*e pro+ram name ?S<3 @ and t*e subroutine name.

END%F.

1!64522& .do' Pa+e


42

(ersion) 3 &4 Mar'* 2&&3

/all a $un'tion module in t*e subroutine. /all a s'reen in t*e $un'tion module. /reate t*e s'reen and 'ode in t*e $un'tion +roup o$ t*is $un'tion module.

3.7

Smart Forms T*e SAP Smart .orms is used $or 'reatin+ and maintainin+ $orms $or mass printin+. T*e, repla'e t*e SAP s'ript $orms5 *o3e4er SAP s'ript $orms 3ill also be supported b, SAP in $uture. SAP Smart .orms allo3 ,ou to e1e'ute simple modi$i'ations to t*e $orm and in t*e $orm lo+i' b, usin+ simple +rap*i'al tools. T*e $ollo3in+ points s*ould be 'onsidered 3*en 'reatin+ or maintainin+ Smart .orms ) A ba'=up o$ t*e la,out prepared t*rou+* Smart .orm s*ould be =ept in t*e s,stem 3it* t*e name ,O$ormnamePGb=OnnP ?nn bein+ t*e se>uen'e no. o$ t*e ba'=up@. T*is is important as 4ersion mana+ement is not supported $or t*ese $orms. T*e 'urren', $ield to be printed usin+ Smart .orms s*ould be de$ined as a $ield o$ t*e same t,pe in t*e +lobal de$initions. 0o *ard 'odin+ s*ould be done in in'lude te1t and address 3indo3 in Smart .orms.

1!64522& .do' Pa+e


43

(ersion) 3 &4 Mar'* 2&&3

4. 0.1

ABAP Internal Names Data Ty#es All data t,pes used b, a pro+ram s*ould be $irst de$ined to t*e A-AP 7i'tionar, as a TNP<;DR%8P. %ne or more TNP<; DR%8PS 'an be used b, t*e TNP<;P%%#S statement. Lit* release 3.& t*ere is a 'lear distin'tion bet3een t*e data t,pe and t*e data ob6e't) 7ata t,pes are de'lared usin+ t*e =e,3ord TNP<. 7ata t,pes are pure t,pe des'riptions. T*e, do not re>uire an, stora+e spa'e. A data t,pe '*ara'teriIes t*e te'*ni'al properties o$ all data ob6e'ts5 3*i'* *a4e t*is t,pe. 7ata ob6e'ts are 'on'rete instan'es o$ data t,pes. <a'* data ob6e't *as a parti'ular t,pe and re>uires all appropriate stora+e spa'e. 8ser de$ined data t,pes 'an be 'reated usin+ TNP<S statement. T*e, 'an be eit*er elementar, or stru'tured. 8ser de$ined data t,pes allo3 ,ou to 'reate all appli'ation spe'i$i' t,pe uni4ersall,. T*is stru'ture 'an be de$ined 'entrall, and t*us made =no3n to t*e A-AP pro+rammin+ en4ironment.

0.$

Data Fie)&s SA* RJ' Re uirements)

1!64522& .do' Pa+e


44

(ersion) 3 &4 Mar'* 2&&3

A-AP 4ariable names 'an be a ma1imum o$ 3& '*ara'ters lon+ $or 7ATA $ields S<#</T;%PTI%0S and PARAM<T<RS 'an be a ma1imum o$ < '*ara'ters lon+. Stan&ar&s) All 4ariables s*ould be de$ined usin+ t*e t,pe de'lared in t*e TNP< pool. L*en 'ustom 4ariables *a4e a 'orrespondin+ SAP 4ariable5 use t*e name t*at re$le'ts t*at parti'ular SAP data element or $ield name. 7o not use 4ariable names 'ontainin+ A;A. as t*e, 'an be 'on$used 3it* table $ields. 8nders'ores s*ould be used to separate 3ords 'ontained in 4ariable/'onstant names. In addition5 ma=e t*e names des'ripti4e. .or pro+ram readabilit, and maintainabilit,5 remo4e de$ined $ields5 3*i'* are ne4er re$eren'ed5 and 'ode5 3*i'* 'an ne4er be lo+i'all, e1e'uted. L*ene4er possible5 t*e #IK< parameter s*ould be used to de$ine 3or= $ields. *osition Descri#tion Va)ues 1;2 (ariable /G 7es'ription PG SG R-G /-G P-G (G TG #G XG LAG <G /#G /%G
1!64522& .do' Pa+e
45

:eanin" .or /onstants .or Parameters .or Sele't;%ptions .or Radio buttons .or /*e'=bo1 .or pus*buttons .or Dlobal (ariables .or Internal Tables .or #o'al (ariable .or T,pes/ Stru'tures .or Lor= Areas $or Internal Tables ?Also $or #a,outs in A#(@ .or <4ents .or /lasses .or /ontainer
(ersion) 3 &4 Mar'* 2&&3

DRG /IG RG .ldG /ntG .l+ 3V .reel, 7e$inable

.or Drid .or /lass Instan'e .or Ran+e .or .ield .or /ounters .or .la+s use abbre4iations $or 'lear and 'on'ise names.

0.'

A..reviations L*en de$inin+ 7ata .ields5 use 'lear and understandable names. In 'ases 3*ere abbre4iations are used5 utiliIe an a+reed upon set o$ standard abbre4iations. It is important t*at abbre4iations are used 'onsistentl, in all names. To determine an abbre4iation $or 3ords not listed belo35 strip out all 4o3els and insi+ni$i'ant '*ara'ters. 0ames5 3*i'* be+in 3it* a 4o3el5 retain t*e 4o3el in t*e abbre4iation. Add 4o3els ba'= in 3*en abbre4iations $or t3o di$$erent names are ali=e. Abbre4iations 3ill be based on <n+lis* names. Name /ustomer /ost 0ame (endor #ast .irst Middle <mplo,ee Identi$i'ation Muantit, /ounter A..reviation /us /st 0m (nd #st .rst mdl <mp Id Mt, /nt

0.0

Stan&ar& Hea&er an& Footer

1!64522& .do' Pa+e


46

(ersion) 3 &4 Mar'* 2&&3

All pro+rams t*at produ'e reports ?ie/ Reports5 Inter$a'es5 /on4ersions@ s*ould use a Standard 2eader and .ooter. T*e Standard 2eader s*ould be as $ollo3s) Co)or5 'olG*eadin+ intensi$ied on Com#any Name5 S*ould be in upper 'ase ; /entered Re#ort Descri#tion5 <a'* 3ord in Senten'e /ase ; 'entered and ali+ned 3it* /ompan, name. A line at t*e end o$ t*e 2eader. .ooter s*ould 'omprise o$ a line at t*e end o$ t*e pa+e.

pic00235.pcx

1!64522& .do' Pa+e


4F

(ersion) 3 &4 Mar'* 2&&3

2.

ABA* D%CT%ONARA L*en 'reatin+ a 'ustom table5 'are$ull, plan its desi+n and stru'ture. 7e$ine t*e table $ields appropriatel,. Al3a,s pla'e t*e =e, $ields startin+ 3it* MA07T ?'lient@ $ield at t*e $ront o$ t*e re'ord la,out. 8se t*e SAP database administrator to *elp desi+n t*e table and its attributes5 inde15 and bu$$er settin+s.

2.1

Ta.)es L*en de$inin+ 'ustom tables al3a,s pla'e t*e =e, $ields at t*e $ront o$ t*e re'ord stru'ture.

2.1.1

Trans#arent Ta.)es L*en 'reatin+ 'ustom tables5 Transparent Tables s*ould be used in most 'ases. A Transparent table is a table 3it* s,stem stru'ture5 3*i'* +i4es an identi'al stru'ture inside SAP as outside. T*ere$ore t*e table 'an be a''essed b, bot* internal and e1ternal appli'ations. All updates to SAP Tables s*ould be per$ormed 3it*in SAP.

2.1.$

VieLs .or reportin+ purposes5 use (I<L tables to e$$e'ti4el, 6oin related tables t*at are ta=in+ lar+e amounts o$ time $or data retrie4al. A database (ie3 is not p*,si'all, stored5 but it is a table deri4ed $rom multiple tables. 7atabase (ie3s allo3 $ields $rom se4eral tables to be a''essed in one 4ie3. Denerall,5 a''essin+ a database 4ie3 is $aster t*en sele'tin+ tables indi4iduall,. Lit* Release 4.X 4ie3s 'an be bu$$ered in t*e same manner as tables.

2.1.'

%n&e6 T*e purpose o$ an Inde1 is to >ui'=en t*e s'annin+ pro'ess 3*en sear'*in+ $or spe'i$i' re'ords in a table. An Inde1 is a 'op, o$ a table redu'ed to parti'ular sorted $ields to enable $aster a''ess to needed data.

1!64522& .do' Pa+e


4

(ersion) 3 &4 Mar'* 2&&3

Inde1es ma, be de4eloped 3*en t*e re>uired a''ess to a database table is based on $ields ot*er t*an t*e primar, =e, o$ t*e table. %nl, in'lude $ields in an inde1 i$ t*e, redu'e t*e sele'ted data si+ni$i'antl,. As inde1es are ad6usted ea'* time table 'ontents are '*an+ed5 'reate se'ondar, inde1es dis'ernin+l, to minimiIe t*e impa't on t*e s,stem. L*en S<#</Tin+ data $rom a table5 loo= at t*e stru'ture o$ all o$ t*e a4ailable inde1es and tailor t*e L2<R< 'lause to ta=e ad4anta+e o$ t*e most sele'ti4e inde1. 8se all $ields in t*e L2<R< 'lause in t*e same order $or an inde15 as s=ippin+ one $ield disables t*e inde1. Pla'e t*e most 9'ommon: 'olumns at t*e be+innin+ o$ an inde1. T*e most 9'ommon: 'olumns are t*ose 3*ere reports are sele'tin+ 'olumns 3it* no ran+es ; t*e L2<R< 'lause $or t*ese 'olumns is an 9e>ual to: e1pression. Rearran+e 'olumns o$ an inde1 to mat'* t*e sele'tion 'riteria. .or e1ample5 i$ a S<#</T statement is 3ritten to in'lude 'olumns 1 and 2 3it* 9e>ual to: e1pressions in t*e 3*ere 'lause and 'olumn 3 and 4 are sele'ted 3it* 4alue ran+es5 t*en t*e inde1 s*ould be 'reated 3it* 'olumns in t*e se>uen'e o$ 15 25 35 4. Pla'e /olumns to3ard t*e end o$ t*e inde1 i$ t*e, are eit*er in$re>uentl, used in S<#</TS or are part o$ reportin+ S<#</TS t*at in4ol4e ran+es o$ 4alues. -e sure to order t*e 'olumns in t*e L2<R< 'lause o$ a S<#</T in t*e same order as an inde1 table. Inde1es s*ould be small ?$e3 $ields@. Some optimiIers are able to 'ombine t3o or more inde1es to e1e'ute a >uer,. T*is is not possible 3it* 3ide inde1es.

1!64522& .do' Pa+e


4!

(ersion) 3 &4 Mar'* 2&&3

Multiple inde1es o$ one table s*ould be dis6oint ?*a4e $e3 'ommon $ields@5 in order not to 'on$use t*e optimiIer 3*i'* inde1 to use. <a'* inde1 slo3s t*e inserts into t*e table do3n. 8pdates are onl, slo3ed do3n i$ inde1ed $ields are updated. %n t*e ot*er *and5 t*e inde1es in'rease t*e e$$i'ien', o$ reads. T*ese tradeo$$s must be 3ei+*ed a+ainst one anot*er. In +eneral5 $re>uentl, updated tables s*ould *a4e onl, $e3 inde1es 3*ile $re>uentl, sele'ted tables mi+*t *a4e more. Remo4e unused inde1es or ones t*at '*an+e due to report desi+n '*an+es. /aution) T*e 'reation o$ an inde1 'an a$$e't per$orman'e ad4ersel,. T*e most suitable inde1 $or t*e sele't 'riteria mi+*t not be t*e inde1 '*osen $or use b, t*e database optimiIer. /reatin+ Inde1es s*ould be done 'are$ull, and 6ointl, 3it* t*e SAP 7atabase Administrator. (alidate t*e use o$ table inde1es b, per$ormin+ a SM# Tra'e. 1.$ Structures Identi$, t*e $ields t*at are used in 'onstru'tin+ a s'reen in 7ialo+ pro+ram /reate Stru'tures in t*e 7ata 7i'tionar,. Add t*e $ields t*at are re>uired in t*e stru'ture. Nou 'an 'op, t*e $ields 'ontained in a di'tionar, stru'tures5 table or 4ie3s 3it* Edit / Include / Insert / /op, 'omponents Maintain t*e $orei+n Ke,s o$ t*e Stru'ture

T*e re$eren'e $ield and re$eren'e table must be spe'i$ied $or 'omponents o$ t,pe /8RR ?'urren',@ and M8A0 ?>uantit,@.

Atta'* a Sear'* 2elp to a stru'ture $ield t*at 'an be used b, all s'reen $ields t*at re$er to t*e stru'ture $ield

1!64522& .do' Pa+e


5&

(ersion) 3 &4 Mar'* 2&&3

In A-AP pro+rams ,ou 'an a''ess t*e $ields dire'tl, 3it* <Structure name>-<Field name> All s'reen and A#( Reports ?$or meetin+ t*e re>uirement o$ .ield /atalo+@ s*ould use 7i'tionar, stru'tures $or s'reen $ields instead o$ usin+ table de$initions or pro+ram 4ariables 2.' Data E)ements A data element de$ines t*e des'ription $or t*e $ield. T*e semanti' in$ormation ?des'ription and $ield labels@ is assi+ned to t*e data element alon+ 3it* an, on;line do'umentation. I$ possible5 use t*e standard SAP 7ata <lements su'* as -8KRS5 -<#0R et'. T*e data element is t*e $un'tional name asso'iated 3it* a domainT e.+.5 one o$ t*e data elements asso'iated 3it* domain /2AR3& ma, be A77R<SS. L*ene4er A77R<SS is entered as a data element5 t*e '*ara'teristi's o$ t*e domain /2AR3& appear. 2.0 Domains A domain des'ribes t*e p*,si'al $ormat o$ t*e data su'* as t*e t,pe and len+t* o$ t*e data. .ields re$errin+ to a domain ?4ia t*e data elements assi+ned to t*em@ assumed t*e data $ormat de$ined b, t*e domain.

2.2

Searc! He)#s Q SA* Re)ease 0.D -re#)aces matc!co&es/ S<AR/2 2<#PS are a ne3 $eature in 4.X. T*e, are more po3er$ul t*an input *elp 'reated usin+ mat'*'odes and *elp 4ie3s. A S<AR/2 2<#P is an ob6e't t*at des'ribes t*e pro'edure $or possible 4alues *elp. T*e 4.X up+rade 3ill automati'all,

1!64522& .do' Pa+e


51

(ersion) 3 &4 Mar'* 2&&3

'on4ert mat'*'odes and *elp 4ie3s to sear'* *elps. ?T*e e1istin+ mat'*'odes and *elp 4ie3s 3ill 0%T be deleted.@ A S<AR/2 2<#P is an impro4ed met*od o$ displa,in+ allo3able 4alues $or an input $ield 3*i'* 'an return multiple 4alues to t*e underl,in+ s'reen. A sear'* *elp e1it is a $un'tion module 3it* a standard inter$a'e 'alled $rom ea'* step in t*e *elp pro'ess. T*ese s*ould onl, be used in e1'eptional 'ases5 as t*e, ma=e input *elp *arder to maintain. 0otes) .or more in$ormation5 t*ere is a sear'* *elp 'on4ersion pro+ram 'alled R8T2(MID. 2.4 Ta.)e Bu++erin" 7atabase tables 'an be stored lo'all, on ea'* appli'ation ser4er. Per$orman'e time ma, be impro4ed be'ause readin+ $rom t*e bu$$er a4oids dire'tl, a''essin+ t*e database. Lit*in SAP5 onl, P%%#<7 and TRA0SPAR<0T tables allo3 bu$$erin+. T*e de'ision to bu$$er a table s*ould be made b, t*e SAP 7atabase Administrator. /onsiderations) %nl, bu$$er a table t*at *as read;onl, a''esses made a+ainst it and is re$eren'ed $re>uentl,. %nl, bu$$er t*ose tables t*at 'ontain t*e business and ot*er transa'tion pro'essin+ rules5 t*at are setup durin+ t*e implementation o$ t*e SAP R/3 s,stem and are '*an+ed 4er, in$re>uentl,. Tables t*at 'ontain master and transa'tion data s*ould not be bu$$ered. %nl, bu$$er tables t*at are modi$iable5 i$ 3rite a''ess o''urs in$re>uentl,. /*an+es to bu$$ered tables +et automati'all, lo++ed in t*e database and are trans$erred to t*e appli'ation ser4ers at re+ular inter4als. I$ bu$$ered tables are modi$ied $re>uentl,5 t*e additional pro'essin+ needed ma, 'an'el an, per$orman'e +ains attained b, bu$$erin+.

1!64522& .do' Pa+e


52

(ersion) 3 &4 Mar'* 2&&3

0ati4e SM#. T*ese 'ommands al3a,s b,pass t*e bu$$er and a''ess t*e database dire'tl,. I$ nati4e SM# 3as to update a bu$$ered table dire'tl,5 t*e bu$$er status is not '*an+edT t*is 'ould result in in'onsisten'ies bet3een data in t*e bu$$er and t*e database. 2.; Data Ty#e Conversion 8nderstandin+ and usin+ data t,pe 'omparisons and 'on4ersions is 4er, important in A-AP. .ollo3in+ is a list $rom SAP R/3 s,stem t*at lists *o3 e1ternal data t,pes are mapped to t*e A-AP data t,pes usin+ standard domains. E6terna) ABA* Data Ty#e Descri#tion Data Ty#e A//P 0?6@ Postin+ period NNNNMM /2AR n /#0T /8KN /?n@ /?3@ /?5@ /*ara'ter strin+s /lient /urren', =e,5 re$eren'ed b, /8RR $ields /urren', $ield5 stored as 7</ /ounter or amount $ield 3/ 'omma J si+n 7ate $ield ?NNNNMM77@ stored as '*ar? @ .loatin+ point number5 a''urate to b,tes 1;b,te inte+er 2;b,te inte+er 4;b,te inte+er #an+ua+e =e, 8ninterpreted se>uen'e o$ b,tes #on+ '*ara'ter strin+5 re>uires
(ersion) 3 &4 Mar'* 2&&3
53

/8RR n5 P??nV2@/2@ m5 s 7</IMA# m 7</ n5 m5 s 7ATS .#TP I0T1 I0T2 I0T4 #A0D #RAL #/2R
1!64522& .do' Pa+e

P??nV2@/2@ 7</IMA# m 7? @ .? @ I I I /?2@ X?n@ /?n@

E6terna) ABA* Data Ty#e Data Ty#e 08M/ n 0?n@ M8A0 n m5 s RAL n TIMS 80IT (AR/ n n) no. o$ pla'es P??nV2@/2@ 7</IMA# m X?n@ T?6@ /?n@ /?n@ m) number o$ de'imal pla'es.

Descri#tion

pre'edin+ I0T2 $ield /*ara'ter $ield 3it* onl, di+its Muantit, $ield5 points to a unit $ield 3it* $ormat 80IT #on+ b,te strin+ needs pre'edin+ I0T2 $ield Time $ield ?**mmss@5 stored as '*ar?6@ 8nit =e, $or M8A0 $ields #on+ '*ara'ter strin+5 not supported $rom Release 3.& s) si+n $la+

/onsiderations) L*en non;standard 'on4ersions are needed to displa, di$$erentl, t*an SAPCs internal $ormat or 4i'e;4ersa5 'reate a /on4ersion <1it $or t*e 7omain. T*is s*ould be done b, 'reatin+ t3o $un'tion modules in t*e same $un'tion +roup. one module to 'on4ert $rom displa, $ormat to internal $ormat. t*e ot*er to 'on4ert $rom internal $ormat to t*e e1ternal $ormat. 7ata t,pes o$ P and I are treated t*e same on all SAP supported plat$orms. 0ote t*at $loatin+ points *a4e an a''ura', up to 15 de'imal pla'es on all plat$orms5 and t*at t*e roundin+ be*a4ior ma, '*an+e. SAP ad4ises t*at 3*en t3o $loatin+;point numbers
1!64522& .do' Pa+e
54

(ersion) 3 &4 Mar'* 2&&3

need to be tested $or e>ualit,5 t*at t*e di$$eren'e is 4er, small. Reports *a4e been made t*at errors o''ur 3*en a $ield *a4in+ de'imal pla'es is 'ompared to A&C be'ause SAP interprets an, number less t*an &.5 as e>ual to &. As a standard5 'reate a 'onstant) /GB<R% 3it* t*e 'orre't number o$ de'imal pla'es and use it $or 'omparisons instead o$ *ard 'odin+ t*e 'onstant in t*e pro'essin+ lo+i'. <1ample) DATA5 C9,ERO =.== TA*E * DEC%:ALS $ VAL1E

/reatin+ 'onstants 3ill also *elp 3it* debu++in+ and testin+ 'onditions. T*e debu++er 3ill allo3 t*e /GB<R% 4alue to be '*an+ed to test 4arious 'onditions easil,. 8se pro+ram RSA0A#&& to e1e'ute 'on4ersions b, an A-AP.

1!64522& .do' Pa+e


55

(ersion) 3 &4 Mar'* 2&&3

4. 4.1

ABA* COD%N( TECHN%P1ES %NTERNAL TABLES An Internal Table is a +roup o$ re'ords 'reated at runtime. It is re'ommended to de$ine all internal tables usin+ user;de$ined data t,pes and 3it*out a *eader line. <1ample) TNP<S) -e+in o$ TGde$inition 7ri4er li=e dri4erdut,;dri4er5 <nd o$ TGde$inition 7ATA) IGtable TNP< STA07AR7 table o$ TGde$inition. /onsiderations) T*e initial siIe addition is similar to t*e %//8RS parameter in 4ersion 3.X. L*en t*e initial siIe is not =no3n5 it ma=es more sense to lea4e it to SAP to determine b, spe'i$,in+ initial siIe &.

4.1.1

Fi))in" an %nterna) Ta.)e In$ormation re+ardin+ usin+ sele't statements) sele't sin+le s*ould onl, be used i$ t*e entire =e, is =no3n 2@ sele't ?$ields@ s*ould be used i$ ,ou are e1tra'tin+ less t*an 1/3 o$ t*e database $ields or a ma1imum o$ 16 $ields

4.1.1.1

Se)ect %nto L*en an Internal Table needs to be 'reated dire'tl, $rom one database table5 use t*e S<#</T I0T% to $ill t*e Internal Table. T*e 'ontents o$ IGT&&1 3ill be repla'ed b, t*e sele'ted data so a R<.R<S2 is not needed. <1ample) SELECT E FRO: T==1 %NTO TABLE %9T==1.

1!64522& .do' Pa+e


56

(ersion) 3 &4 Mar'* 2&&3

I$ an Internal Table is to be 'reated dire'tl, $rom database tables and t*e 'ontents 'urrentl, in t*e Internal Table need to be =ept5 add t*e APP<07I0D TA-#< parameter. <1ample) SELECT S%N(LE E FRO: T==1I A**END%N( TABLE %9:ARA IHERE IERCS H I9 IERCS. Consi&erations) T*is is onl, rele4ant $or Internal Tables t*at are as 3ide or 3ider t*an t*e database table bein+ S<#</Ted. It is al3a,s $aster to use t*e I0T% TA-#< 4ersion o$ a S<#</T statement t*an to use APP<07 statements. 4.1.1.$ A##en& Append adds a ne3 entr, to an Internal Table. T*e s,stem does not '*e'= i$ a re'ord 3it* t*e same =e, e1ists. /onsiderations) As APP<07 adds ne3 entries to an Internal Table5 dupli'ate entries ma, o''ur. I$ t*e internal table alread, 'ontains t*e number o$ entries allo'ated b, t*e s,stem ?Initial siIe & addition@5 t*e additional entries are rolled to t*e pa+in+ area5 resultin+ in lon+er runtimes. L*en usin+ Internal Tables 3it* a *eader line5 a4oid unne'essar, assi+nments to t*e *eader line. 8se statements5 3*i'* *a4e an e1pli'it 3or= area. <1ample) :ore E++icient A**END I9TAB TO %9TAB. Less E++icient %9TAB H I9TAB. A**END %9TAB
1!64522& .do' Pa+e
5F

(ersion) 3 &4 Mar'* 2&&3

8se t*e /#<AR 'ommand a$ter t*e APP<07 'ommand to 'lear t*e 'ontents o$ t*e internal tableQs *eader re'ord. As o$ Release 3.&/5 t*e addition #I0<S %. 'an be added to t*e APP<07 statement. T*e statement is used to add a blo'= o$ lines to an Internal Table. L*en appropriate5 use APP<07 3it* t*e blo'= 'ommand instead o$ APP<07I0D sin+le lines durin+ a #%%P. T*e blo'= 'ommand is $aster and easier to read. <1ample) :ore E++icient A**END L%NES OF %9TAB1 TO %9TAB$. Less E++icient LOO* AT %9TAB1. A**END %9TAB1 TO %9TAB$ ENDLOO*. 4.1.1.' %nsert 8se I0S<RT to add sin+le ro3s or blo'=s o$ ro3s to an Internal Table as a spe'i$i' position. <1ample) %NSERT %9TAB %NDED 4. Consi&erations) L*en a blo'= o$ lines is to be inserted at a spe'i$i' position5 use t*e #I0<S %. parameter o$ t*e I0S<RT statement. I0S<RTin+ a blo'= o$ lines is $aster t*an I0S<RTin+ one ro3 at a time durin+ a #%%P. T*is e1ample 3ill insert ro3s 3 t*rou+* F $rom IGTA-1 into IGTA-2 as ro3s 45 55 65 and line 4 $rom IGTA-2 3ill be'ome line F a$ter t*e I0S<RT. <1ample) %NSERT L%NES OF %9TAB1 FRO: ' TO 2 %NTO %9TAB$ %NDED 0.
1!64522& .do' Pa+e
5

(ersion) 3 &4 Mar'* 2&&3

4.1.$ 4.1.$.1

Retrievin" +rom an %nterna) Ta.)e Rea& Ta.)e R<A7 TA-#< is used to read a sin+le ro3 $rom an Internal Table. R<A7 TA-#< IGTA- is used to read a Internal Table usin+ t*e Internal TableCs *eader line as t*e output area. R<A7 TA-#< IGTA- I0T% LA is used to read an Internal Table and use t*e 3or= area as t*e output area. /onsiderations) L*en readin+ a sin+le re'ord in an Internal Table5 t*e R<A7 TA-#< LIT2 K<N.. is not a dire't R<A7. T*ere$ore5 S%RT t*e table on t*e =e, ?to be used $or e>ualit,@ in ACSEND%N( ORDER be$ore*and and use R<A7 TA-#< LIT2 K<N.. -I0ARN S<AR/2. T*e binar, sear'* 3ill $ail in 'ase t*e table ?=e,@ is sorted in a 7<S/<07I0D order. L*en t*e -I0ARN S<AR/2 is used5 t*e s,stem starts t*e sear'* in t*e middle o$ t*e table. It t*en '*e'=s t*e $irst *al$ or se'ond *al$ dependin+ i$ t*e =e, $ields are bi++er or smaller t*an t*e middle entr,.

4.1.$.$

LOO* #%%P U L2<R< is $aster t*an #%%P//2</K be'ause #%%P U L2<R< e4aluates t*e spe'i$ied 'ondition internall,. <1ample) :ore E++icient ECey access Lit! LOO* IHERE LOO* AT TAB IHERE C H CVAL. R ... ENDLOO*. Less E++icient

1!64522& .do' Pa+e


5!

(ersion) 3 &4 Mar'* 2&&3

:ore E++icient ECey access Lit! LOO*JCHECC LOO* AT TAB. CHECC TAB8C H CVAL. R ... ENDLOO*. Ma=e t*e 'omparison operators s*are a 'ommon t,peT as 3it* an, lo+i'al e1pression5 t*e per$orman'e is better i$ t*e operands o$ a 'omparison s*are a 'ommon t,pe. Per$orman'e 'an be $urt*er en*an'ed i$ t*e #%%P L2<R< is 'ombined 3it* .R%M i1 and/or T% i2. 4.1.$.' Neste& Loo#s Per$orman'e in readin+ t*e internal tables 'an be en*an'ed b, usin+ t*e 'ombination o$ 9Read table: and 9#oop: statements. 9Read table: 3ill lo'ate t*e inde1 o$ t*e re'ord and 9loop: statement 'an be used 3it* t*e addition 9.rom:. /aution) T*e nested loop table s*ould be sorted on t*e basis o$ 3*ere 'lause $ields. It *as to be ensured t*at sortin+ a table on a parti'ular $ield s*ould not a$$e't t*e pro+ram $lo3 at a subse>uent lo'ation in t*e pro+ram $lo3 3*ere a di$$erent sort is e1pe'ted. T*ere$ore5 in su'* 'ases t*e internal table must be resorted as per $ields e1pe'ted. <1ample) :ore E++icient

1!64522& .do' Pa+e


6&

(ersion) 3 &4 Mar'* 2&&3

Sort %9ta. .y +1. Rea& ta.)e %9ta. Lit! >ey +1 H L9+1. %+ sy8su.rc H =. L9in&e6 H sy8ta.i6. En&i+. LOO* AT %9ta. +rom L9in&e6. %+ L9+1 NO %9ta.8+1. E6it. En&i+. KKKK*rocessin" Lit!in )oo# KKKK ENDLOO*.

4.1.$.0

Events insi&e t!e LOO* L*ile usin+ e4ents li=e 9At start o$:5 9At end o$:5 9At $irst:5 9At #ast:5 9%n '*an+e o$: in side t*e loop5 al3a,s trans$er t*e *eader re'ord into a 3or= area. -e'ause 3*en 'ontrol 'omes to 9At end o$: or 9At start o$: 5 all t*e '*ara'ter $ield o$ *eader line be'omes star?R@. <1ample Correct :et!o& Loo# at ita. L!ere K. Ia9ita. H ita.. At en& o+ #)ant. En&at. En&)oo#.

1!64522& .do' Pa+e


61

(ersion) 3 &4 Mar'* 2&&3

4.1.' 4.1.'.1

:o&i+yin" an %nterna) Ta.)e Co))ect T*e /%##</T statement s'ans t*e Internal Table $or an entr, 3*ere t*e de$ault =e, mat'*es t*at o$ t*e entr, in t*e Lor= area / Internal TableCs *eader re'ord. I$ a mat'* is $ound5 t*e s,stem sums an, $ield o$ t,pe .5 P5 I5 0 in t*at re'ordT i$ no re'ord e1ists t*e *eader re'ord is inserted into t*e Internal Table. L*en addin+ data to SAP tables ?as opposed to totalin+ numbers@5 use t*e APP<07 statement instead o$ t*e /%##</T statement. T*is impro4es speed and a4oids 'omparisons to e1istin+ data /onsiderations) L*en 3or=in+ 3it* Internal Tables5 re'all t*at t*e /%##</T statement is 4er, /P8 intensi4e. L*en /%##</Tin+ on an Internal Table 3it* +reater t*an 5& entries5 use t*e $ollo3in+ alternati4e 'ode) K.. READ TABLE %9TAB I%TH CEA .. B%NARA SEARCH. CASE SA8S1BRC. IHEN =. %9TAB8A:T H %9TAB8A:T S I9NEI9A:T. :OD%FA %9TAB %NDED SA8TAB%D. IHEN 0. %NSERT %TAB %NDED SA8TAB%D. IHEN <. A**END %9TAB. ENDCASE K.. E .or Internal Tables 3it* less t*an 5& entries t*e /%##</T is a''eptable.

1!64522& .do' Pa+e


62

(ersion) 3 &4 Mar'* 2&&3

A$ter t*e /%##</T statement *as been e1e'uted5 t*e inde1 o$ t*e modi$ied or ne3 entr, is 3ritten to t*e s,stem $ield SN;TA-IX. L*en ,ou $ill an internal table5 do not use /%##</T in 'ombination 3it* an, ot*er table;$illin+ statements ?APP<075 I0S<RT5 and/or M%7I.N@. I$ ,ou mi1 /%##</T 3it* t*e ot*er statements5 /%##</T 'annot use its *as* al+orit*m. In t*is 'ase /%##</T resorts to a normal linear sear'*5 3*i'* is dramati'all, slo3er. 4.1.'.$ :o&i+y 8se t*e M%7I.N 'ommand to '*an+e a line 3it*in an Internal Table <1ample) LOO* AT %9TAB. :OVE C9%N%T%AL%,E TO %9TAB8%N%T%AL%,E. :OD%FA %9TAB. ENDLOO*. 4.1.'.' De)ete 8se t*e 7<#<T< 'ommand to delete a ro3 or +roup o$ ro3s $rom an Internal Table. L*en 7<#<T<in+ a +roup o$ ro3s $rom an Internal Table5 delete t*em usin+ a 7<#<T< L2<R< 'lause instead o$ a sin+le ro3 at a time durin+ a #%%P5 unless ot*er a'ti4it, ta=es pla'e durin+ t*e #%%P. <1ample) DELETE %9TAB IHERE IERCS EP C9==1=. I$ possible5 L2<R< s*ould be used to+et*er 3it* .R%M...and/or T% ... to en*an'e per$orman'e e4en more. <1ample) DELETE %9TAB TFRO:KU TTOKU IHEREK.

1!64522& .do' Pa+e


63

(ersion) 3 &4 Mar'* 2&&3

/onsiderations) To delete all ro3s in an Internal Table5 use t*e R<.R<S2 statement. L*en 3or=in+ 3it* Internal Tables5 use t*e .R<< 'ommand to release t*e memor, a$ter t*e Internal Table *as ser4ed its purpose and 3ill not be used a+ain. <1ample5 I$ Table IGTA- is 1&M-5 use FREE %9TAB. I$ an Internal Table is de$ined lo'all, in a subroutine5 t*e allo'ated memor, is released upon 'ompletion o$ t*e subroutine5 so t*e R<.R<S2 statement is not needed. 4.1.0 Sortin" %nterna) Ta.)es Muali$, all S%RT statements 3it* t*e -N option and limit t*e sortin+ o$ data to $ields t*at must be used to satis$, t*e re>uirements. S%RTs5 in +eneral5 are e1pensi4e. /onsiderations) -e a3are o$ t*e e$$e't on '*ara'ter se>uen'e usin+ S%RT. 8pper 'ase '*ara'ters 'an be sorted be$ore lo3er 'ase letters or5 lo3er 'ase 'an be sorted be$ore upper 'ase. T*e sort mi+*t pla'e letters be$ore numbers or 4i'e 4ersa. S%RT<7 Internal Tables L*en S%RTin+ Internal Tables5 spe'i$, t*e $ields to be S%RTed. <1ample) :ore E++icient SORT %TAB BA FLD1 FLD$ Less E++icient SORT %TAB.
1!64522& .do' Pa+e
64

(ersion) 3 &4 Mar'* 2&&3

-uildin+ S%RT<7 Tables I$ t*e amount o$ data is less t*an 2& entries5 or i$ read a''ess to t*e Internal Table is needed 3*ile t*e ITA- is bein+ $illed5 use a one;step approa'* usin+ R<A7/I0S<RT. I$ t*e data amount is lar+er and read;a''ess is onl, needed to t*e 'ompletel, $illed table5 use t*e t3o;step pro'ess. <1ample) One8ste# A##roac!5 READJ%NSERT E %9DEST is +i))e& Lit! 1=== entries REFRESH %9DEST. LOO* AT TAB9SRC %NTO IA9SRC. READ TABLE %9DEST I%TH CEA C H TAB9SRC8C B%NARA SEARCH. %NSERT IA9SRC %NTO %9DEST %NDED SA8 TAB%D. ENDLOO*. R8se on small tables ?OS 2& ro3s@ TLo8ste# A##roac!5 A**END3 SORT E %9DEST is +i))e& Lit! 1=== entries REFRESH %9DEST. LOO* AT TAB9SRC %NTO IA9SRC. A**END IA9SRC TO %9DEST. ENDLOO*. SORT TAB9DEST BA C. R8se on lar+e tables 4.1.2 4.1.2.1 (enera) %nterna) Ta.)e Tec!ni ues DESCR%BE 7<S/RI-< determines t*e number o$ entries in an Internal Table. <1ample) :ore E++icient DESCR%BE TABLE %9TAB L%NES I9LNE9CNTR Less E++icient
1!64522& .do' Pa+e
65

(ersion) 3 &4 Mar'* 2&&3

LOO* AT %9TAB. I9LNE9CNTR H I9LNE9CNT S 1. ENDLOO* 4.1.2.$ RAN(ES T*e RA0D<S statement 'reates Internal Tables t*at *a4e t*e stru'ture o$ a S<#</T;%PTI%0 table5 but t*e RA0D<S do not *a4e t*e same $un'tionalit,. T*e stru'ture 'reated b, t*e RA0D<S statement is) <1ample) -<DI0 %. RGtab5 SID0?1@5 %PTI%0?2@5 #%L #IK< U..5 2ID2 #IK< U..5 <07 %. RGtab.

As a standard5 3*en usin+ t*e I0 operator in 'ombination 3it* S8-MIT5 S<#</T5 /2</K5 L2I#<5 or I.5 al3a,s de$ine t*e asso'iated Internal Table usin+ S<#</T;%PTI%0S or RA0D<S 0e4er de$ine t*e sele'tion 'riteria in an Internal Table dire'tl,. 8sin+ RA0D<S 3ill ma=e $or easier maintainabilit,5 readabilit,5 and 'on$orms to SAP re'ommendations. As a standard5 3*en an Internal Table is to be used as abo4e5 use t*e RA0D<S de$inition to de$ine t*e ran+e. <1ample) Stan&ar& RAN(ES R9ta. +or )+.18Bu>rs Non8Stan&ar&

1!64522& .do' Pa+e


66

(ersion) 3 &4 Mar'* 2&&3

7ATA)

-<DI0 %. IGTA-5 %//8RS nn5 SID0?1@5 %PTI%0?2@5 #%L #IK< U..5 2ID2 #IK< U..5

<07 %. IGTA-5. Consi&erations 3*en usin+ RA0D<S) RA0D<S are not sele'tion s'reen $ields. RA0D<S are not passed to t*e lo+i'al database pro+rams. RA0D<S do not support t*e s*ort $orm o$ lo+i'al e1pressions5 RA0D<S are to be used in t*e L2<R< 'lause o$ %P<0 SM# statements in e1pressions 3it* t*e I0 parameter. 4.1.2.' :isce))aneous :ore E++icient A**END IA9 TO %TAB. Less E++icient :OVE IA9 TO %TAB. A**END %TAB. :ore E++icient %NSERT IA9 %NTO %TAB. Less E++icient :OVE IA9 TO %TAB. %NSERT %TAB.

1!64522& .do' Pa+e


6F

(ersion) 3 &4 Mar'* 2&&3

:ore E++icient COLLECT IA9 %NTO %TAB. Less E++icient :OVE IA9 TO %TAB. COLLECT %TAB. 8se t*e .R<< statement to release t*e memor, allo'ated to Internal Tables. T*e .R<< statement s*ould $ollo3 t*e last statement used to pro'ess t*e data in t*e table. 8se t*e .R<< statement 3*ere ,ou no lon+er need t*e internal table in ,our pro+ram. As noted abo4e in APP<075 3*en usin+ Internal Tables 3it* a *eader line5 a4oid unne'essar, assi+nments to t*e *eader line. 8se statements t*at *a4e an e1pli'it 3or= area) <1amples) L*en per$ormin+ 'ontrol brea= lo+i' on Internal Tables and .I<#7;DR%8PS5 ma=e use o$ t*e AT 0<L5 AT <07 %.5 %0 /2A0D< %.5 and S8M 'ommands. T*e use o$ A-APCs 'ontrol brea= 'ommands 3ill pro4ide easier readabilit, and maintainabilit, 4ersus 'odin+ t*e brea= lo+i' 3it*out t*e bene$it o$ t*e 'ommands. L*en usin+ t*e 'ontrol brea= lo+i' statements5 one must ne'essaril, use t*e 3or= area instead o$ internal table *eader. 4.1.4 F%ELD (RO1*S SAP R/3 Re>uirements) .I<#7;DR%8PS 'ombines se4eral e1istin+ $ields to+et*er under one name. 8sed in 'on6un'tion 3it* I0S<RT5 <XTRA/T5 and #%%P. /on'eptuall,5 it is similar to pro'essin+ Internal Tables. /onsiderations) .I<#7;DR%8P are used to build internal tables t*at *a4e a 'ommon =e, stru'ture but di$$erent ar+uments. T*e, are
1!64522& .do' Pa+e
6

(ersion) 3 &4 Mar'* 2&&3

supported b, 3.& and more e$$i'ient t*an internal tables be'ause o$ 'ompression. .I<#7;DR%8P s*ould be used to pro'ess lar+e amounts o$ data. Smaller amounts o$ data s*ould be stored in Internal Tables. As soon as t*e $irst dataset $or a .I<#7;DR%8P *as been e1tra'ted 3it* <XTRA/T5 t*e .I<#7;DR%8P 'an no lon+er be e1tended 3it* I0S<RT. .I<#7;DR%8PS 'an onl, *a4e re'ords added to t*em be$ore a sort or loop 'ommand is per$ormed. 4.1.; (eneration o+ Error Lo" +rom a Dia)o" *ro"ram I$ a list is re>uired ?e.+ an <rror or /on$irmation #o+@ $rom dialo+ pro'essin+5 use t*e statement A#<A(< T% #IST; PR%/<SSI0DC. Its e$$e't is to start t*e list pro'essor and displa, t*e basi' list a$ter t*e PAI pro'essin+ o$ t*e 'urrent s'reen. T*en its possible to use all t*e usual list la,out 'ommands li=e LRIT<5 SKIP5 et'. All list pro+rammin+ options are possible5 e.+ line sele'tion5 $un'tion =e,s5 3indo3s. #ist pro'essin+ 'an be e1ited b, usin+ t*e -A/K/<XIT//A0/<# o$ t*e D8I status de$ined $or t*e list usin+ AS<T P.GSTAT8S U..C. -, de$ault5 t*e dialo+ pro'essor returns to t*e P-% o$ t*e s'reen $rom 3*ere t*e list 3as 'alled.

<1ample

1!64522& .do' Pa+e


6!

(ersion) 3 &4 Mar'* 2&&3

Sam#)e Co&e set #+8status W$0B:9ERRW. )eave to )ist8#rocessin". Lrite te6t8==0. )oo# at i9return L!ere ty#e H WEW. E Data to .e &is#)aye& Lrite at J i9return8messa"e en&)oo#.

4.1.<

Dis#)ay o+ Tra++ic Li"!ts Tra$$i' li+*ts ?Red5 Nello3 and Dreen@ mi+*t *a4e to be displa,ed $or di$$erent error situations i.e. Red $or <rror5 Nello3 $or Larnin+ and Dreen in 'ase t*ere is no error or 3arnin+. T*e $ollo3in+ pie'e o$ 'ode demonstrates t*e met*od) Sam#)e Co&e E Ty#e &e+ine& +or mo&u)e )eve) va)i&ations ty#es5.e"in o+ t9mo&u)e3 E T!e +ie)& -BstatusiconV/ re#resents t!e icon +or tra++ic )i"!ts statusicon ty#e icons8te6t3 R +or status icon inc)u&e structure ?cramo&!&. ty#es5 en& o+ t9mo&u)e. Data L9icon9stat ty#e icons8te6t. Data %9mo&u)e ty#e stan&ar& ta.)e o+ t9mo&u)e Lit! !ea&er )ine. E Creatin" t!e tra++ic )i"!ts in t!e status +ie)& &e#en&in" on t!e corrstat -Error Status +ie)&/ o+ t!e recor& in t!e ta.)e ?cramo&!& c)ear5 L9stat3 L9icon9stat. L9stat H i9mo&u)e8corrstat.

1!64522& .do' Pa+e


F&

(ersion) 3 &4 Mar'* 2&&3

#er+orm +9"et9)i"!ts usin" L9stat c!an"in" L9icon9stat. i9mo&u)e8statusicon H L9icon9stat. +orm +9"et9)i"!ts usin" #9L9stat c!an"in" #9L9icon9stat. &ata5 )9stat )i>e ?cramo&!&8corrstat3 )9icon9stat ty#e icons8te6t3 )9icon9name-4=/ ty#e c. )9stat H #9L9stat. )9icon9stat H #9L9icon9stat. i+ )9stat H c9e. )9icon9name H c9re&. e)sei+ )9stat H c9L. )9icon9name H c9ye))oL. e)sei+ )9stat H s#ace. )9icon9name H c9"reen. en&i+. E T!is +unction mo&u)e Li)) return t!e icon -)9icon9stat/ ca)) +unction W%CON9CREATEW e6#ortin" name H )9icon9name im#ortin" resu)t H )9icon9stat e6ce#tions KK i+ sy8su.rc NO =. E Status )i"!t not create&. Error :essa"e en&i+. #9L9stat H )9stat. #9L9icon9stat H )9icon9stat. en&+orm. R F9(ET9L%(HTS

1!64522& .do' Pa+e


F1

(ersion) 3 &4 Mar'* 2&&3

4.1.@

(eneration o+ Se uence Num.ers 7ependin+ on t*e business re>uirements t*e +eneration o$ se>uen'e numbers 'an ta=e pla'e in t*e $ollo3in+ 3a,s) I$ t*e number to be +enerated is independent o$ an, ot*er entit,5 t*e number 'an obtained b, usin+ a standard or user;de$ined $un'tion module 3*i'* +ets t*e ne1t a4ailable number $or t*e domain. E6am#)e E For e6terna) num.er ran"e "et t!e ne6t num.er avai)a.)e ca)) +unction W(ET9NEDT9N1:BERW e6#ortin" &omname H c9&omn9name9i& im#ortin" n6tnum H L9rci& e6ce#tions inva)i&9num.er9ran"e H 1 inva)i&9#arameter9ty#e H $ ot!ers H '.

L*en usin+ t*e standard or user de$ined $un'tion modules to +enerate t*e ne1t se>uen'e number5 t*ere 'an be a number loss in 'ase o$ an error. T*is loss o$ number is not a''eptable in statutor, transa'tions li=e DR5 IR5et'. 3*ere one s*ould tr, to 'on$irm t*e 4alidations in test mode be$ore +eneratin+ t*e number. To =eep t*e loss to a minimum5 t*e number s*ould be +enerated a$ter all 4alidations and 6ust be$ore t*e en>ueue $un'tion $or lo+i'al lo'=in+ i$ t*e number $ield is part o$ t*e lo'= =e, else 6ust be$ore t*e update statement. I$ t*e number is to be internall, +enerated 3it*out a number ran+e 3e +et t*e last used number $rom t*e database table5 in'rement it b, one to +et t*e ne1t number5 and lo'= it immediatel,.

1!64522& .do' Pa+e


F2

(ersion) 3 &4 Mar'* 2&&3

E6am#)e E (et t!e )ast use& va)ue o+ #)ant reci& +or #)ant an& &ate se)ect ma6- #)ntreci& / into L9#)anti& +rom Js)ssvJc#)ntrec L!ere #)ant H #9#)ant an& )&&ate H #9&ate. L9#)anti& H L9#)anti& S 1. %mme&iate)y en ueue L9#)anti&.

4.1.1=

1se o+ *ac>e& Num.ers 8se 'aution 3*en per$ormin+ arit*meti' 3it* pa'=ed numbers. -e a3are t*at i$ t*e numbers are de$ined 3it* a di$$erent number o$ de'imal pla'es ,ou ma, +et une1pe'ted results. A-AP per$orms t*e arit*meti' i+norin+ t*e de'imal pla'es and inserts t*e de'imal on t*e ans3er. /are$ul testin+ is essential. All Pa'=ed $ields are treated as 3*ole numbers. /al'ulations in4ol4in+ de'imal pla'es re>uire additional pro+rammin+ to in'lude multipli'ation or di4ision b, 1&5 1&&5 1&&&5 et'.. T*e 7</IMA#S spe'i$i'ation 3it* t*e 7ATA de'laration is e$$e'ti4e onl, $or output 3it* t*e LRIT< statement. I$5 *o3e4er5 $i1ed point arit*meti' ?pro+ram attributes@ is a'ti4e5 t*e 7</IMA#S spe'i$i'ation is also ta=en into a''ount. In t*is 'ase5 intermediate results are 'al'ulated 3it* ma1imum a''ura', ?31 de'imal pla'es@. T*is applies parti'ularl, to di4ision. .or t*is reason5 ,ou s*ould al3a,s set t*e pro+ram attribute X.i1ed point arit*meti'X5 unless t*ere are te'*ni'al re>uirements needin+ $loatin+;point.

4.1.11

A&&in" Lea&in" ,eros To displa, a numeri' 4alue in a la,out or a report 3it* all leadin+ Ieros5 instead o$ usin+ ,our o3n 'ode use t*e $un'tion module

1!64522& .do' Pa+e


F3

(ersion) 3 &4 Mar'* 2&&3

A/%0(<RSI%0G<XITGA#P2AGI0P8TC. T*is $un'tion 'on4erts a padded 4alue to a 4alue 3it* leadin+ Ieros. e.+. I$ ,ou +i4e t*e input as A123C J t*e $ield len+t* is 1& t*en t*is module 3ill +i4e t*e output as A&&&&&&&123C. 4.1.1$ Han&)in" Dates in BDC Session 7ate 4alues in a -7/ session s*ould al3a,s be 'on4erted to a 4alue as per t*e user master so as to maintain 'onsisten',. To a'*ie4e t*e abo4e5 ma=e use o$ t*e $un'tion module A7AT<GSTRI0DG/%0(<RTC. In t*e input parameters o$ t*is $un'tion 3e spe'i$, t*e $ormat o$ t*e e1istin+ date and its 4alue. T*e output o$ t*e $un'tion module is t*e date as per t*e 8ser Master. e.+. .%RM ab'. data) 3sGdate li=e s,;datum. ) ) R;;; .i1 date. /A## .80/TI%0 Q7AT<GSTRI0DG/%0(<RTQ <XP%RTI0D 7AT<G.%RMAT S Q4Q X4 S NNNN.MM.77 7AT<GSTRI0D S dateG4alue R STARTG7AT< S SN;7AT8M IMP%RTI0D R<S8#TG7AT< S 3sGdate. 3rite 3sGdate <07.%RM. to U... X ab'

2ere 3sGdate 'ontains dateG4alue as t*e $ormat in t*e 8ser Master. 4.1.1' %F Com#arison -e$ore doin+ I. 'omparisons on elements o$ di$$erent t,pes ?i.e.5 numeri' to '*ara'ter@5 mo4e one element to a 4ariable o$ t*e same t,pe as t*e ot*er element so t*at ,ou 3ill not e1perien'e une1pe'ted results. L*ile A-AP 3ill automati'all, 'on4ert
1!64522& .do' Pa+e
F4

(ersion) 3 &4 Mar'* 2&&3

elements o$ unli=e t,pes $or ,ou5 t*e end result ma, not be 3*at t*e pro+rammer e1pe'ts. L*en 'omparin+ >uantit, $ields5 ma=e sure t*e >uantities are in t*e same unit o$ measure. 0ote t*at t*is is normall, done b, loo=in+ at 3*i'* $ield is used 0%T b, 'odin+ in a unit 'on4ersion or 4alidation. 4.$ %nterna) Ta.)es 8 SA* Re)ease 0.6 7ata) OitabP TNP< Oitab=indP o$ Ot,peP Y3it* Y80IM8<Z/0%0 80IM8<Z O=e,de$P YI0ITIA# SIB< OnPZ5 O3or= areaP TNP< Ot,peP.

Ta.)e Dec)aration an& :emory A))ocation T,pes) -<DI0 %. Ot,peP5 O$ieldnamesP 5 <07 %. Ot,peP.

E6am#)es Stan&ar& 8 0on;8ni>ue Ke,5 a''essed b, =e, or inde1in+ ?predominantl, b, inde1in+5 also =no3n as Inde1 Tables@. L*en t*e =e, is used5 t*e time in'reases linearl, 3it* t*e number o$ table entries. TNP<S) -<DI0 %. TGMAT5 7ATA) IGMAT TNP< STA07AR7 L<RKS #IK< MS<D; TA-#< %. TGMAT L<RKS5 LIT2 K<N 0%0;80IM8< MAT0R #IK< MS<D; MAT0R MAT0R5 I0ITIA# SIB< &5 <07 %. TGMAT. LAGMAT TNP< TGMAT. Sorte& 8 Ke, is eit*er 8ni>ue or 0on;8ni>ue5 a''essed primar, b, =e, or inde1in+ ?predominantl, b, Ke,@. L*en t*e =e, is used5 t*e time is lo+arit*mi' in relation to t*e number o$ table entries. TNP<S) -<DI0 %. TGMAT5 7ATA) IGMAT TNP< S%RT<7 TA-#< L<RKS #IK< MS<D; %. TGMAT L<RKS5 LIT2 80IM8< K<N MAT0R #IK< MS<D; L<RKS MAT0R5 I0ITIA# SIB< 1&&&&5 <07 %. TGMAT. LAGMAT TNP< TGMAT. Has!e& 8 8ni>ue Ke,5 a''essed onl, b, Ke,. Response time is 'onstant and does not depend on t*e number o$ entries.
1!64522& .do' Pa+e
F5

(ersion) 3 &4 Mar'* 2&&3

TNP<S) -<DI0 %. TGMAT5 L<RKS #IK< MS<D; L<RKS5 MAT0R #IK< MS<D; MAT0R5 <07 %. TGMAT.

7ATA) IGMAT TNP< 2AS2<7 TA-#< %. TGMAT LIT2 K<N L<RKS I0ITIA# SIB< 1&&&&5 LAGMAT TNP< TGMAT.

T*e table t,pe de$ines *o3 A-AP a''esses indi4idual table entries. T*ere are no3 t*ree di$$erent t,pes o$ internal tables in SAP Release 4.1) standard5 sorted and *as*ed. In a stan&ar& ta.)e5 re'ords 'an be a''essed usin+ eit*er t*e table inde1 or t*e =e,. I$ a =e, is used5 t*e response time is in linear relation to t*e number o$ table entries. T*e =e, o$ a standard table is al3a,s 0%0;80IM8<. Standard tables are +eneri'all, =no3n as in&e6 ta.)es. In a sorte& ta.)e5 t*e entries are al3a,s sa4ed sorted a''ordin+ to t*e =e,. It is possible to a''ess t*e table usin+ eit*er t*e table inde1 or t*e =e,. L*en t*e =e, is used5 t*e response time is in lo+arit*mi' relation to t*e number o$ table entries5 sin'e t*e s,stem uses a binar, sear'*. T*e =e, or a sorted table 'an be eit*er 80IM8< or 0%0;80IM8<. Sorted tables are +eneri'all, =no3n as in&e6 ta.)es. Has!e& ta.)es 'an onl, be a''essed usin+ t*eir =e,. T*e response time is 'onstant5 and does not depend on t*e number o$ table entries5 sin'e t*e s,stem uses a *as* al+orit*m to a''ess entries. T*e =e, o$ a *as*ed table must al3a,s be uni>ue. Sorted or *as*ed tables usin+ inde1 operations ?I0S<RT U 5 I07<X5 APP<07@ 'annot be $illed. Also it is not possible to S%RT a sorted table. T*ere are t3o t,pes o$ =e,s $or internal tables. Stan&ar& >ey 'onsists o$ all o$ t*e non;numeri' $ields $rom t*e internal table t*at are not internal tables. 1ser8&e+ine& >ey 'an 'onsist o$ an, $ields $rom t*e internal table t*at are not internal tables. T*e additions 80IM8< and 0%0;80IM8< determine 3*et*er t*e table 3it* t,pe Oitabt,peP ma, 'ontain entries 3it* dupli'ate =e,s.
1!64522& .do' Pa+e
F6

(ersion) 3 &4 Mar'* 2&&3

4.$.1

:emory A))ocation +or %nterna) Ta.)es in SA* 0.6 7ue to all o$ t*e internal table nestin+ t*at o''urs5 SAP *as needed to ta=e better 'ontrol o$ t*e memor, allo'ation pro'ess $or internal tables. In Release 3.X5 t*e memor, $or internal tables 3as allo'ated in K- blo'=s. In Release 4.X t*ere 3ill be a ne3 al+orit*m to allo'ate memor,. <ssentiall,5 internal tables 3ill no3 be e1pe'ted to de'lare t*eir table t,pe 3it* an) O initial siIeP R Oro3 len+t*P S initial allo'ation. I$ t*at initial allo'ation is e1'eeded5 t*e abo4e e>uation 3ill be repeated up to 3 times. A$ter t*at initial allo'ation *as been e1'eeded 3 times5 memor, is simpl, allo'ated in 12K- blo'=s. #i=e3ise5 i$ no initial siIe is spe'i$ied5 SAP 9+uesses: ?i.e. uses an undis'losed al+orit*m@.

4.'

Co&e to a&& Function Cey to Re#orts 8se t*e $ollo3in+ 'ode to add .un'tion =e,s to Reports. T*e 'ode *elps in 'reatin+ $un'tion buttons in a report 3it*out t*e use o$ P.;STAT8S. R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;; Rtable $or $un'tion button tables) ss'r$ields5 d&1&&. ) ) RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRRRRR R S<#</TI%0 S/R<<0 RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRRRRR Rbutton to '*e'= sm35 sele'tion;s'reen $un'tion =e, 1. Rbutton to '*e'= sm35 R$or more buttons use =e, 2 and =e, 3 and =e, 4.

1!64522& .do' Pa+e


FF

(ersion) 3 &4 Mar'* 2&&3

) ) I0ITIA#IBATI%0. R prepare SM35 button ss'r$ields;$un't1tG&1 S Q(ie3 SM35Q. X$or =e, 1 ) ) at sele'tion;s'reen. i$ ss'r$ields;u'omm S Q./&1Q. 7&1&&;MAP0 S PAGDR%8P. S<T PARAM<T<R I7 QMP0Q .I<#7 7&1&&;MAP0. /A## TRA0SA/TI%0 QSM35Q A07 SKIP .IRST S/R<<0. endi$. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;; T*e limitation to t*e abo4e 'ode is t*at ma1 4?$our@ $un'tion =e,s 'an be added to t*e sele'tion s'reen.

4.0

Lo"ica) Data.ase In most 'ases5 it is li=el, t*at 'odin+ database retrie4als 3it* S<#</T statements 3ill pro4e more e$$i'ient t*an usin+ a #o+i'al 7atabase ?#7-@ pro+ram. A #7- pro+ram reads tables 3it* nested S<#</T loops. T*e dept* o$ t*e S<#</T into t*e #7- *ierar'*, depends on t*e D<T statement in t*e A-AP 'orrespondin+ to t*e tables lo'ated at t*e lo3est le4el o$ t*e #7- *ierar'*,. I$ a pro+ram does not need in$ormation $rom a superior table in t*e *ierar'*,5 unne'essar, reads 3ill o''ur. -e$ore usin+ a #7-5 be sure t*e lo+i' 'annot be 'oded more e$$i'ientl, usin+ S<#</T. T*e #o+i'al 7atabase allo3s readin+ o$ *ierar'*i'all, related tables usin+ D<T statements. T*e ad4anta+es o$ t*e lo+i'al databases are) <ase o$ pro+rammin+

1!64522& .do' Pa+e


F

(ersion) 3 &4 Mar'* 2&&3

Sele'tion s'reen and $ilterin+ o$ t*e data Aut*oriIation '*e'=in+ I$ a #7- is '*osen5 t*e most e$$i'ient lo+i'al database possible s*ould be used. Stud, t*e sele'tion 'riteria and 3*i'* se'ondar, inde1es are used $or t*at 4ie3. Pro4ide t*e appropriate sele'tion 'riteria to limit t*e number o$ database reads. .or'e users to pro4ide sele'tion 'riteria b, e4aluatin+ t*e sele'tion 'riteria entered on t*e sele'tion s'reen durin+ AT S<#</TI%0; S/R<<0 e4ent. 8se Mat'*'odes $or sele'tion and report sortin+. Consi&erations) A''ess to database in$ormation 4ia D<T pro4ides automati' se'urit, '*e'=in+ and '*e'=in+ on =e, $ields $rom t*e sele'tion s'reen. T*e S<#</T statement 3ill re>uire bot* o$ t*ese operations to be 'oded. L*en +ettin+ in$ormation $rom a *ierar'*, database 4ia a lo+i'al database 4ie35 t*e order in 3*i'* ,ou '*e'= statements is important. Attempt to eliminate an, data 3*i'* is not re>uired at t*e earliest sta+e possible. An A-AP report 'an 3or= 3it* onl, one lo+i'al database5 but e4er, lo+i'al database 'an be s*ared b, se4eral reports. L*en usin+ a lo+i'al database5 t*e sele'tion s'reen o$ t*e report is 'alled automati'all, b, t*e lo+i'al database pro+ram. L*en usin+ t*e S<#</T statements t*e sele'tion s'reen must be pro+rammed. <4en i$ a lo+i'al database 3ill not be atta'*ed to ,our A-AP Report5 transa'tion S<36 is use$ul to learn. ; espe'iall, t*e se'ondar, inde1 tables and relations*ips bet3een tables. #o+i'al 7atabase Pro+rams 'annot be atta'*ed to .un'tion Modules. L*en usin+ #o+i'al 7atabases5 ,ou must ta=e into 'onsideration t*e $ollo3in+)
1!64522& .do' Pa+e
F!

(ersion) 3 &4 Mar'* 2&&3

7etermine i$ some o$ t*e sele'tion s'reen $ields 'an be re>uired $ields. T*is 3ould $or'e t*e users to put in a 4alue into t*ese $ields limitin+ t*e number o$ ro3s retrie4ed 3it*in t*e lo+i'al database pro+ram. T*e sele'tion s'reen 'an be d,nami'all, modi$ied b, t*e pro+ram usin+ t*e lo+i'al database and usin+ AT S<#</TI%0;S/R<<0 output e4ent. 8se t*e D<T dbtab O$ieldsPU option to retrie4e onl, t*e $ields needed b, ,our pro+ram. T*is option re>uires t*e initialiIation e4ent to populate all internal tables 3it* t*e table name and t*e $ield name. 8se *elp on D<T $or additional in$ormation. 4.0 Su.routines T*e t*ree subroutine alternati4es are) .%RM routines In'lude pro+rams /all $un'tions /allin+ A-AP subroutines 'an 'reate 'on$li'ts bet3een t*e +oals o$ transparen',5 maintainabilit, and per$orman'e. In ea'* indi4idual 'ase5 'onsider t*e $ollo3in+) 2o3 o$ten is t*e $orm 'alledW 2o3 mu'* time is re>uired b, t*e respe'ti4e module 'allW T*e +uideline 4alues $or resour'e 'onsumption) Su.routine Ty#e Internal P<R.%RM <1ternal P<R.%RM /A## .80/TI%0 /A## 7IA#%D :icrosecon&s 3 2&;5& 2&;1&& 1&5&&&;15&5&&&

1!64522& .do' Pa+e


&

(ersion) 3 &4 Mar'* 2&&3

4.0.1

Forms .%RMS are subroutines t*at allo3 a pro+rammer to de$ine a pro'ess on'e in a pro+ram and 'all t*at routine $rom di$$erent pla'es 3it*in t*e pro+ram or $rom ot*er pro+rams. A .%RM s*ould be used $or lar+e 'odin+ blo'=s. /ommon se'tions o$ 'ode a''essed $rom se4eral points in an A-AP s*ould also be put into .%RMS. I$ a blo'= o$ 'ode is e1e'uted more t*an on'e5 it s*ould be pla'ed in a subroutine at t*e bottom o$ t*e 'ode. T*is ma=es t*e 'ode more readable5 re>uires less indentation5 and is easier to debu+ sin'e t*e debu++er 'an 6ump t*rou+* an entire subroutine 4ia a P. =e,. .or +ood modulariIation5 t*e de'ision o$ 3*et*er or not to P<R.%RM a subroutine s*ould be made be$ore t*e subroutine is 'alled. <1ample) :ore E++icient %F +1 NE =. *ERFOR: su.1. END%F. FOR: su.1. KK. ENDFOR:. Less E++icient *ERFOR: su.1. FOR: su.1. %F +1 NE =. ED%T. END%F. ENDFOR:.. Consi&erations) 7onCt use P<R.%RMO$orm nameP?Opro+ram nameP@ unne'essaril,. %4erall runtime 3ill be in'reased be'ause t*e

1!64522& .do' Pa+e


1

(ersion) 3 &4 Mar'* 2&&3

entire pro+ram 'ontainin+ t*e a'tual per$orm must be loaded into memor,. .or mana+eabilit,5 subroutines s*ould be 'reated 3it* t*e 'on'ept o$ a 9bla'= bo1: in mind. T*e routine 3ill *a4e 'ertain input and output parameters5 and =no3led+e o$ t*e parameters s*ould be su$$i'ient to use t*e routine. Subroutines s*ould not5 as a rule5 re$eren'e +lobal data. Alterations made to +lobal data 3it*in t*e bla'= bo1 produ'e less mana+eable 'ode. /allin+ a subroutine 3it*out parameters re>uires minimal e1tra /P8 time. T*e more parameters passed5 t*e more /P8 time a subroutine 'all re>uires. Passin+ b, re$eren'e re>uires less /P8 time t*an passin+ b, 4alue. T*e amount o$ /P8 time re>uired to pass a sin+le parameter b, 4alue is dependent on t*e siIe ?$ield len+t*@ o$ t*e parameter. .ormal parameters must be $ull, t,ped. 4.0.$ %nc)u&es An I0/#87< is a se'tion o$ 'ode 3*i'* *as been separated due to pro+ram siIe or it is in 'ommon use b, se4eral pro+rams. <$$e'ti4e use o$ in'ludes 'an redu'e de4elopment and maintenan'e time. /onsideration) A pro+ram t*at uses in'lude in'orporates it at +eneration time5 so i$ t*e in'lude is altered all t*e pro+rams t*at use it must be re; +enerated. SAP *as to re+enerate i$ t*e last update date and t*e re+eneration date o$ t*e pro+ram are not t*e same. 4.0.' Function :o&u)es .or speed5 internal routines are t*e $astest. .un'tions s*ould be used $or +eneral routines so maintenan'e 'an be per$ormed 'olle'ti4el,. T*e routines are loaded into a bu$$er so t*eir $irst a''ess is 4er, slo3. T*e most $re>uentl, a''essed $un'tions are *eld se>uentiall, in memor,5 and as ne3 routines are used t*e least $re>uent routines are dropped.
1!64522& .do' Pa+e
2

(ersion) 3 &4 Mar'* 2&&3

.or speed internal routines are >ui'=er t*an .un'tions. /reate $un'tion 'alls dis'ernin+l,. Per$orm does not re>uire t*e AloadC o$ in'ludes5 et'. t*at 'all $un'tions do. T*ere$ore5 'reate $un'tion 'alls 3*en 'ode is used b, multiple pro+rams5 ot*er3ise use per$orm. Consi&eration) A .un'tion module and t*e 'allin+ pro+ram *a4e separate 3or= areas. T*e separated 3or= area means t*ere is no data inter$a'e bet3een t*e $un'tion module and t*e 'allin+ pro+ram. T*e, are limited to t*e passin+ o$ import and e1port parameters. T*is impro4es abstra'tion and mana+eabilit, at t*e 'ost o$ e$$i'ien',. A /A## to a .un'tion Module 'auses t*e loadin+ o$ t*e entire .un'tion Droup. T*ere$ore5 al3a,s limit t*e number o$ $un'tion modules 3it*in a +roup to less t*an $i4e. Error !an&)in" in Function :o&u)es I$ t*e <1'eptions are 'ommented t*en t*e .un'tion module 3ill displa, t*e error i$ t*e messa+e 'ommand is 3ritten in it ot*er3ise t*e displa, o$ t*e messa+e 3ill be t*e responsibilit, o$ t*e 'allin+ pro+ram. It is re'ommended t*at t*e <1'eptions s*ould not be 'ommented and rat*er t*e, s*ould be *andled in t*e 'allin+ pro+ram b, '*e'=in+ t*e 4alue o$ s,;subr'. <1ample Ca)) +unction K. E6#ortin" KK %m#ortin" KK Ta.)es KK E6ce#tions KK i+ sy8su.rc NO =. messa"e i& sy8ms"i& ty#e sy8ms"ty num.er sy8ms"no
1!64522& .do' Pa+e
3

(ersion) 3 &4 Mar'* 2&&3

Lit! sy8ms"v1 sy8ms"v$ sy8ms"v' sy8ms"v0. en&i+. T*e s,stem 4ariables in t*e messa+e in t*e e1ample abo4e are populated in t*e $un'tion module. It 'an *o3e4er 3it* substituted 3it* a pro+ram spe'i$i' messa+e. 4.0.0 Su.mit3 Ca))3 Leave To T*e 'ommands S8-MIT and S8-MIT A07 R<T8R0 'an be used to start anot*er report and /A## and #<A(< T% 'an be used to start anot*er transa'tion. T*ese 'ommands 'an be 4er, use$ul to build inte+rated $un'tions. Consi&erations) /ommands 3*i'* 9+o ba'=: a$ter e1e'ution use additional R%## area5 t*ere$ore5 to prote't s,stem per$orman'eT 'omplete one S8-MITU. A07 R<T8R0 prior to initiatin+ anot*er. #<A(< T% 'annot be used in a transa'tion usin+ -7/ pro'essin+. 4.2 4.2.1 SPL ABA* O#en SPL T*e SAP pro+rammin+ lan+ua+e A-AP *as its o3n diale't o$ SM#. T*is is a rudimentar, SM# lan+ua+e desi+ned $or database 'ompatibilit, and independen'e. T*e desi+n p*ilosop*, 3as to redu'e SM# $un'tionalit, to su'* a le4el t*at 'ode 3ritten usin+ A-AP %P<0 SM# 3as suitable $or e1e'ution a+ainst all o$ t*e ma6or databases used b, SAP5 t*us impro4in+ portabilit,. L*en usin+ t*e S<#</T statement5 stud, t*e =e, and al3a,s pro4ide as mu'* o$ t*e le$t;most part o$ t*e =e, as possible. I$ t*e entire =e, 'an be >uali$ied5 'ode a S<#</T SI0D#< not 6ust a S<#</T

1!64522& .do' Pa+e


4

(ersion) 3 &4 Mar'* 2&&3

%rder t*e 'olumns in t*e L2<R< 'lause in t*e same order as t*e =e,. A4oid t*e use o$ #IK< 3it* a pattern in an A-AP %P<0 SM# statement 3*en a''essin+ a lar+e table .It is less e$$i'ient and 'an 'ause s'annin+ o$ t*e table. .ields t*at are 'ompared in S<#</T statements s*ould *a4e similar attributes. I$ t*e, donCt t*e s,stem 3ill *a4e to 'on4ert t*e data e4er, time a 'omparison is made. L*en t*e data $ields 'anCt be mat'*ed 4ia table de$initions5 mo4e t*e data to a temporar, $ield in t*e pro+ram be$ore doin+ t*e 'ompare ?i$ ,ou 3ill be usin+ t*e same $ield $or se4eral 'omparisons@ .amiliariIe ,oursel$ 3it* t*e data bein+ pro'essed be$ore usin+ t*e S<#</T statement. Table t,pes +reatl, in$luen'e *o3 t*e A-AP pro+ram s*ould pro'ess t*e data. L*en usin+ A-AP %P<0 SM#5 t*e user is restri'ted to data pertainin+ to t*e 'lient t*e, are 'urrentl, lo++ed into unless t*e table is 'lient independent or 9'lient;spe'i$ied: is used. L*en S<#</Tin+ data $rom a table5 loo= at t*e stru'ture o$ all o$ t*e a4ailable inde1es and tailor t*e L2<R< 'lause to ta=e ad4anta+e o$ t*e most sele'ti4e inde1. As o$ Release 3.&5 spe'i$i' $ields 'an be sele'ted instead o$ usin+ t*e S<#</T R statement. Spe'i$,in+ $ields in t*e S<#</T statement redu'es t*e amount o$ data to be retrie4ed $rom t*e database. T*ere$ore to impro4e per$orman'e sele't onl, t*e $ields t*at are re>uired. 4.2.1.1 Data Se)ection +rom Trans#arent an& *oo) Ta.)es L*en sele'tin+ $rom a Transparent or Pool Table5 al3a,s >uali$, t*e S<#</T statement as $ull, as possible 3it* t*e L2<R< option. T*is in'ludes data $ields t*at ma, not be part o$ t*e =e,. T*is allo3s t*e database to e4aluate t*e re'ords and return onl, t*e re'ords mat'*in+ t*e sele'tion 'riteria. <1ample)
1!64522& .do' Pa+e
5

(ersion) 3 &4 Mar'* 2&&3

R :ore e++icient +or Trans#arent X *oo) ta.)es SELECT E FRO: ,,LT$ IHERE RLDNR H I9LD(R AND RRCTA H F=G AND RVERS H F==1G AND RAEAR H I9AR AND B1CRS H I9C:*NA AND RACCT H I9ACCT AND RCNTR H I9CNTR. KK. ENDSELECT Ii)) Lor>3 .ut re uires more memory X .u++ers SELECT E FRO: ,,LT$ IHERE RLDNR H I9LD(R AND RRCTA H F=G AND RVERS H F==1G AND RAEAR H I9AR. CHECC I9C:*NA. CHECC I9ACCT. CHECC I9CNTR. KKK ENDSELECT.

4.2.1.$

Data Se)ection +rom C)uster Ta.)es L*en 3or=in+ 3it* /luster tables5 onl, >uali$, t*e S<#</T statements 3it* $ields t*at are part o$ t*e =e,. I$ t*e table is a 'luster table5 use t*e /2</K 'ommand to eliminate re'ords a$ter t*e sele'tion *as been narro3ed 4ia t*e L2<R< 'lause $or =e, $ields. /luster tables 'annot be pro'essed b, t*e database dire'tl,5 'ompared to transparent tables. In most 'ases $or'in+ t*e database to unpa'= and '*e'= $ields ?as 3it* S<#</T statements 'ontainin+ non;=e, $ields in L2<R< 'lauses@ is less e$$i'ient t*en >uali$,in+ onl, 3it* =e, $ields and lettin+ A-AP '*e'= non;=e, $ields a$ter t*e data is returned.

1!64522& .do' Pa+e


6

(ersion) 3 &4 Mar'* 2&&3

<1ample) .or 'luster table -S<D 3it* =e,s MA07T5 -8KRS5 -<#0R5 D"A2R5 and -8B<I) R 1se t!e C!ec> statement to eva)uate non >ey +ie)&s L!en se)ectin" +rom C)uster ta.)es SELECT E FRO: BSE( IHERE B1CRS H BS%C8B1CRS AND REB,( H BS%C8BELNR. CHECC BS%C8L%FNR H BSE(8L%FNR. CHECC BSE(8SHC,( H FSG. CHECC BSE(8COART H FCG. KK.. ENDSELECT. RLor=s more e$$i'ientl, $or 'luster tables5 espe'iall, in multiple appli'ation ser4er en4ironments. E Iit! C)uster ta.)es &onGt s#eci+y non8>ey +ie)&s in t!e IHERE c)ause SELECT E FRO: BSE( IHERE BELNR H BS%C8BELNR AND B1CRS H BS%C8B1CRS AND L%FNR H BS%C8L%FNR AND SHC,( H FSG AND COART H FCG. KK.. ENDSELECT. RLill 3or=5 but re>uires a lot o$ a4ailable memor,5 bu$$er spa'e and database time to unpa'= non;=e,ed data $or 4eri$i'ation/in'lusion. T*is 3or= ta=es pla'e at t*e database le4el and 'an be 'ostl,. /an o4erload sin+le 7- ser4ers and slo3 per$orman'e $or all user.

1!64522& .do' Pa+e


F

(ersion) 3 &4 Mar'* 2&&3

4.2.1.'

SELECT A""re"ates L*en ,ou need to $ind t*e ma1imum5 minimum5 sum5 and a4era+e 4alue or t*e 'ount o$ a database 'olumn5 use a sele't list 3it* a++re+ate $un'tions instead o$ 'omputin+ t*e a++re+ates ,oursel$. T*e net3or= load is 'onsiderabl, less. <1ample) Se)ect usin" an a""re"ate +unction SELECT :AD-:S(NR/ FRO: T1== %NTO C0A IHERE S*RSL H FDG AND ARB(B H F==G. RMore <$$i'ient Se)ectK. I!ere S C!ec> C0A H F===G. SELECT E FRO: T1== IHERE S*RSL H FDG. CHECC T1==8:S(NR O C0A. C0A H T1==8:S(NR. ENDSELECT. RLill 3or=5 but not %ptimall,

1!64522& .do' Pa+e

(ersion) 3 &4 Mar'* 2&&3

4.2.1.0

SELECT Lit! B1FFER su##ort. I$ bu$$erin+ is allo3ed $or a table in t*e A-AP 7i'tionar,5 t*e S<#</T statement al3a,s reads t*e data $rom t*e bu$$er in t*e database inter$a'e o$ t*e 'urrent appli'ation ser4er. 2o3e4er5 as a rule5 onl, data t*at does not '*an+e $re>uentl, s*ould be bu$$ered5 and usin+ t*e bu$$er 3*ere appropriate impro4es per$orman'e. T*is option s*ould be used 3*ere reall, ne'essar,. Sele'tin+ $rom bu$$ered tables is intended $or tables t*at are $re>uentl, used and read;onl,. Addin+ t*e -NPASSI0D -8..<R parameter to t*e S<#</T statement is less e$$i'ient. <1ample) Se)ect Lit!out .u++er su##ort SELECT E FRO: T1== BA*ASS%N( B1FFER IHERE S*RSL H FDG AND ARB(B H F==G AND :S(NR H F@@@G. R453!5 mi'rose' Se)ect Lit! .u++er su##ort SELECT E FRO: T1== IHERE S*RSL H FDG AND ARB(B H F==G AND :S(NR H F@@@G. R242 mi'rose'

4.2.1.2

(rou# Leve) Data Access In +eneral5 e1ternal table I/% ?table reads5 inserts5 updates@ are mu'* more e$$i'ient 3*en done at a +roup le4el. Droup;le4el table a''esses are less e1pensi4e in terms o$ dis= I/% and /P8 ','les5 and t*e, are usuall, 'leaner and easier to read. <1ample 1) Se)ect into Ta.)e REFRESH %9T==4. SELECT E FRO: T==4 %NTO TABLE %9T==4. R.aster

1!64522& .do' Pa+e


!

(ersion) 3 &4 Mar'* 2&&3

Se)ect an& t!e a##en& statement REFRESH %9T==4. SELECT E FRO: T==4 %NTO %9T==4. A**END %9T==4. ENDSELECT. RLill 3or=5 but i$ possible5 use I0T% TA-#< <1ample 2) T*e +roup update 3ill $ind all mat'*in+ ro3s in t*e e1ternal table and update t*em 3it* t*e ro3s in t*e internal table. (rou# 1#&ate usin" Ta.)e 1*DATE TAD%R 1S%N( TABLE %9OBMECTS. R More <$$i'ient Non8"rou# u#&ate LOO* AT %9OBMECTS. SELECT E FRO: TAD%R IHERE *(:%D H %9OBMECTS8*(:%D AND OBMECT H %9OBMECTS8OBMECT AND OMB9NA:E H %9OBMECTS8 OBM9NA:E. TAD%R H %NT9OBMECTS. 1*DATE TAD%R. ENDSELECT. ENDLOO*. R #ess <$$i'ient

4.2.1.4

Co)umn 1#&ate L*en possible5 use 'olumn updates instead o$ sin+le;ro3 updates to update database tables <1ample) Co)umn u#&ate 1*DATE VER%9CLNT SET F1NCT%NT H F1NCT%NT S 1 R More <$$i'ient

1!64522& .do' Pa+e


!&

(ersion) 3 &4 Mar'* 2&&3

Sin")e )ine u#&ate SELECT E FRO: VER%9CLNT. VER%9CLNT8F1NCT%NT H VER%9CLNT8 F1NCT%NT S 1. 1*DATE VER%9CLNT. ENDSELECT. R Lill 3or=5 but #ess <$$i'ient

4.2.1.;

Fi))in" %nterna) Ta.)es It is al3a,s $aster to use t*e I0T% TA-#< 4ersion o$ a S<#</T statement t*an to use APP<07 statements <1ample 1) Se)ect %nto Ta.)e SELECT E FRO: T==4 %NTO TABLE %9T==4. R More <$$i'ient Se)ect S A##en& Statement REFRESH D==4. SELECT E FRO: T==4 %NTO %9T==4. A**END %9T==4. ENDSELECT. R More <$$i'ient As a +eneral rule5 use database 4ie3s or t*e I0T% TA-#< 4ersion o$ a S<#</T statement 3it* t*e addition .%R A## <0TRI<S I0 TA-#< ITA- rat*er t*an usin+ nested S<#</T statements. T*e latter ?$or all entries@ is less e$$i'ient t*an usin+ database 4ie3s but is more e$$i'ient t*an nested sele'ts. L*en usin+ A.or All <ntries in Table ITA-C5 it must be ensured t*at ITA- is not initial.

1!64522& .do' Pa+e


!1

(ersion) 3 &4 Mar'* 2&&3

4.2.1.<

1* TO nn ROIS T*e A-AP 98P T% nn: 'onstru't 'auses as man, .<T/2s to be e1e'uted until su$$i'ient ro3s *a4e been returned to satis$, t*e nn re>uirement. L*en 'odin+ a 'onstru't o$ t*is t,pe5 use SM# Tra'e to e1amine t*e output to see *o3 man, re'ords 'an be retrie4ed 3it* a sin+le .<T/2 and ad6ust ,our Initial SiIe and 8P T% 4alues appropriatel,. L*en e1aminin+ t*e tra'e s'reen5 loo= $or t*e 9.<T/2 11 Arra,) nnn: statement. T*is +i4es t*e optimum 4alue $or t*e siIe o$ t*e 8P T% and Initial SiIe in t*e pro+ram

4.2.1.@ 4.2.1.@.1

ABA* O#en SPL En!ancements Q SA* Re)ease 0.6 %nner Moin Inner "oin E Pro4ides t*e 'apabilit, to produ'e a set o$ results $rom multiple tables 4ia one S<#</T statement. S<#</T .1[/ARRI7 .1[/%00I7 .1[.#7AT< .2[/8ST%MI7 I0T% ?S.#ID2T;/ARRI75 S.#ID2T;/%00I75 S.#ID2T; .#7AT<5 S-%%K;/8ST%MI7@ .R%M S.#ID2T AS .1 I00<R "%I0 S-%%K AS .2 %0 .1[/ARRI7 S .2[/ARRI7 A07 .1[/%00I7 S .2[/%00I7 A07 .1[.#7AT< S .2[.#7AT<. T*e I00<R "%I0 pro4ides t*e 'apabilit, to produ'e a set o$ results $rom multiple tables 4ia one S<#</T statement ?as opposed to nested sele'ts@. (ie3s 'reated in t*e data di'tionar, 'an be 'onsidered as inner 6oins. Sin'e 4ie3s are bu$$ered5 t*ere 3ill be instan'es 3*en a 4ie3 3ill be used o4er an inner 6oin dependin+ on t*e tables. .urt*er in4esti+ation per situation s*ould be done usin+ t*e Runtime Anal,sis Tool in S<3&. I$ $ield names are used in t*e $ield list t*at o''ur in bot* tables o$ t*e inner 6oin5 t*e, must be made uni>ue b, eit*er pre$i1in+ t*em 3it* an alias name and a tilde %R t*e table name and a tilde. %4erall5 t*e result o$ an inner 6oin is t*e same5 re+ardless o$ 3*et*er t*e 'ondition is e1pressed in t*e %0 or L2<R< 'lause.

1!64522& .do' Pa+e


!2

(ersion) 3 &4 Mar'* 2&&3

8sin+ a 6oin *as t*e added ad4anta+e t*at onl, one statement is e1e'uted in t*e database. 2o3e4er5 it *as t*e disad4anta+e t*at redundant data $rom t*e outer table appears in t*e result i$ t*ere is a 1)0 relations*ip bet3een t*e outer and inner tables. .or t*is reason5 3*en a 6oin is used5 onl, ne'essar, $ields s*ould be spe'i$ied. #i=e3ise5 t*e per$orman'e o$ a 6oin depends *ea4il, on t*e per$orman'e o$ t*e database optimiIer t*at is used5 espe'iall, i$ t*ere are more t*an 2 tables in t*e 6oin. 4.2.1.@.$ Le+t Outer Moin Outer Moin E Similar to an Inner "oin5 e1'ept t*e result o$ a #<.T %8T<R "%I0 depends on 3*et*er t*e 'ondition is spe'i$ied in t*e %0 or t*e L2<R< 'lause. S<#</T .1[/ARRI7 .1[/%00I7 .1[.#7AT< .2[/8ST%MI7 I0T% ?S.#ID2T;/ARRI75 S.#ID2T;/%00I75 S.#ID2T; .#7AT<5 S-%%K;/8ST%MI7@ .R%M S.#ID2T AS .1 #<.T %8T<R "%I0 S-%%K AS .2 %0 .1[/ARRI7 S .2[/ARRI7 A07 .1[/%00I7 S .2[/%00I7 A07 .1[.#7AT< S .2[.#7AT< %R7<R -N .1[/ARRI7 .1[/%00I7 .1[.#7AT<. 8nli=e an I00<R "%I05 t*e result o$ a #<.T %8T<R "%I0 depends on 3*et*er t*e 'ondition is spe'i$ied in t*e %0 or t*e L2<R< 'lause. Lit*out a L2<R< 'lause t*e resultin+ table 3ill al3a,s 'ontain all t*e lines o$ t*e le$t table5 3*ereas 3it* a L2<R< 'lause5 re'ords $rom t*e le$t table 'an be ta=en out. Table entries appear in t*e 6oin result e4en i$ t*ere is no 'orrespondin+ re'ord in t*e ri+*t;*and table. T*is is t*e e>ui4alent o$ t*e nested S<#</T statement in t*e result set. T*ere are restri'tions on t*e #<.T %8T<R "%I0. .or e1ample5 t*e onl, lo+i'al e1pressions allo3ed 3it* t*e %0 'lause are ASA J A07. Also5 t*e %0 'lause must 'ontain $ields $rom t*e ri+*t; *and table and t*e %0 'lause must 'ontain at least one $ield 'omparison o$ t*e $orm tab1[$ield1 S tab2[$ield1. In addition5 t*e L2<R< 'lause 'an onl, 'ontain $ields $rom t*e le$t;*and table.
1!64522& .do' Pa+e
!3

(ersion) 3 &4 Mar'* 2&&3

4.2.1.1=

Catc! J En&catc! Catc!JEn&catc! ; T*e /AT/2 and <07/AT/2 statements allo3 $or t*e implementation o$ +lobal e1'eption *andlin+. /AT/2 SNST<M;<X/<PTI%0S /%0(TG0%G08M-<R S 1 -/7GB<R%7I(I7< S 2 %T2<RS S 3. <07/AT/2. /AS< SN;S8-R/. L2<0 1. LRIT<) / Q0umeri' 'on4ersion error.Q. L2<0 2. LRIT<) / Q7i4ide b, Iero error.Q. L2<0 3. LRIT<) / Q8n=no3n run time error *as o''urred.Q. <07/AS<. T*e /AT/2 and <07/AT/2 statements allo3 $or t*e implementation o$ +lobal e1'eption *andlin+. T*e, $orm a pro'essin+ blo'= to allo3 t*e trappin+ o$ A-AP runtime errors ?and errors $rom $un'tion modules and met*ods 3it* 4.&/@. T*e /AT/2U<07/AT/2 statements 'an be nested to an, dept*. I$ t*e rele4ant runtime error o''urs in t*e /AT/2 pro'essin+ blo'=5 t*e s,stem 6umps $rom t*e A-AP statement 3*ere t*e error o''urred dire'tl, to t*e <07/AT/2 statement re+ardless *o3 man, 'ontrol stru'ture le4els e1ist ?e.+.5 I.5 7%5 S<#</T5 /AT/2U@. In addition5 t*e return 4alue Or'nP assi+ned to t*e s,stem e1'eption Oe1'ptnP is pla'ed in t*e s,stem $ield SN; S8-R/. I$ t*ere is more t*an one e1pression Oe1'eptnP S Or'nP5 t*e Or'nP t*e $irst e1pression is returned. T*is is parti'ularl, important i$ t3o di$$erent <RR%R 'lasses 'ontain t*e same runtime error.

4.2.$

Native SPL T*e use o$ nati4e SM# pro4ides t*e pro+rammer 3it* +reater $le1ibilit, but in'reases t*e responsibilit, to produ'e e$$i'ient 'ode. In addition5 nati4e SM# 'an impro4e per$orman'e but in'reases responsibilit,. Personnel need to be multis=illed as maintenan'e be'omes more di$$i'ult.

1!64522& .do' Pa+e


!4

(ersion) 3 &4 Mar'* 2&&3

Consi&erations) T*e bu$$erin+ o$ tables 3ill not be bene$i'ial i$ 0ati4e SM# is used. 8nli=e A-AP %P<0 SM#5 t*e pro+rammer needs to be 'on'erned 3it* t*e MA07T $ield. In A-AP %P<0 SM#5 L2<R< MA07T S is added to t*e S<#</T statementT 3it* nati4e SM#5 t*e pro+rammer needs to 'ode L2<R< MA07T S )SN;MA07T. T*e use o$ nati4e SM# $or I0S<RT5 8P7AT<5 and 7<#<T< operations is not re'ommended $or standard SAP tables. As nati4e SM# dire'tl, a''esses t*e underl,in+ database and b,passes t*e bu$$er $or SAP bu$$ered tables5 nati4e SM# s*ould onl, be used $or read;onl, tables. Lit* t*e use o$ SM#5 t*ere is a potential loss o$ portabilit,. 4.4 4.4.1 Strin" :ani#u)ation CONCATENATE 8se t*e /%0/AT<0AT< statement instead o$ pro+rammin+ a strin+ 'on'atenation. <1ample) 1se o+ t!e CONCATENATE statement

1!64522& .do' Pa+e


!5

(ersion) 3 &4 Mar'* 2&&3

:OVE FManeG TO I9:A. :OVE F:i))erG TO I9:B. :OVE FNeL Aor> CityG TO L9:C. CONCATENATE F:rs.G L9:A L9:B F+romG L9:C %NTO CHA SE*ARATED BA S*ACE. B:rs. Mane :i))er +rom NeL Aor> CityV is t!e +ina) va)ue o+ CHA R More <$$i'ient :ovin" Lit! O++set :OVE FManeG TO L9:A. :OVE F:i))erG TO L9:C. %1 H STRLEN- L9:A /. %$ H STRLEN- L9:B / :OVE F:rs.G TO I9CHA. :OVE L9:A TO CHAS2. %1 H %1 S 4. :OVE L9:B TO CHAS11. 1 H %1 S 1$ S 1. :OVE F+rom FTO CHAS%1.%1 H %1 S 2. :OVE L9:C TO CHAS11. B:rs. Mane :i))er +rom NeL Aor> CityV is t!e +ina) va)ue o+ CHA R #ess <$$i'ient Some strin+ manipulation $un'tions *a4e be'ome obsolete in Release 3.& and 'an be repla'ed b, an A-AP statement or $un'tions) STR%N(9CONCATENATE CONCATENATE STR%N(9S*L%T S*L%T STR%N(9LEN(TH STRLEN-/ STR%N(9CENTERED IR%TE K TO K CENTERED STR%N(9:OVE9R%(HT IR%TE K TO K R%(HT8M1ST%F%ED <1ample)
1!64522& .do' Pa+e
!6

(ersion) 3 &4 Mar'* 2&&3

1se o+ t!e CONCATENATE Statement CONCATENATE T1==8ARB(B T1==8:S(NR T1==8TEDT %NTO L9CLA. R Standard in Release 3.& 1se o+ a CONCATENATE +unction mo&u)e CALL F1NCT%ON FSTR%N(9CONCATENATE9'G ED*ORT%N( STR%N(1 H T1==8ARB(B STR%N($ H T1==8:S(NR STR%N(' H T1==8TEDT %:*ORT%N( STR%N( H L9CLA EDCE*T%ONS TOO9S:ALL H =1. R %bsolete in Release 3.& 4.4.$ Removin" Lea&in" S#aces I$ leadin+ spa'es in a strin+ are to be deleted5 use t*e A-AP statement SH%FT K LEFT DELET%N( LEAD%N(

A4oid usin+ S2I.T inside a L2I#< loop. <1ample) 1sin" SH%FT K LEFT DELET%N( LEAD%N( B I9CLA contains t!e stin" BF E&itor )ine nG. SH%FT I9CLA LEFT DELET%N( LEAD%N( S*ACE. R More <$$i'ient S!i+tin" .y SA8FD*OS #)aces

1!64522& .do' Pa+e


!F

(ersion) 3 &4 Mar'* 2&&3

B I9CLA contains t!e stin" BF E&itor )ine nG. %F I9CLA CN S*ACE. END%F. SH%FT I9CLA BA SA8FD*OS *LACES LEFT. R #ess <$$i'ient

4.4.'

S*L%T 8se t*e SP#IT statement instead o$ pro+rammin+ a strin+ split. <1ample) 1se o+ t!e S*L%T statement E I9C:A contains W-01=/8021;0844'20'1$W an& s!a)) .e s#)it into E I9AREA9CD3 I9TEL9NBR13 TEL9NBR$ S*L%T I9C:A AT W8W %NTO I9AREA9CODE I9TEL9NBR1 I9TEL9NBR$. R More <$$i'ient 1se o+ SEARCH an& :OVE Lit! o++set EI9C:A contains W-01=/8021;0844'20'1$W an& s!a)) .e s#)it into EAREA9CD3 TEL9NBR13 TEL9NBR$. SEARCH I9C:A FOR W8W. :OVE I9C:A-SA8FD*OS/ TO I9AREA9CD. %1 H SA8FD*OS S $. SEARCH I9C:A FOR W8W START%N( AT %1. %1 H %1 8 1. :OVE I9C:AS%1-SA8FD*OS/ TO TEL9NBR1. %1 H %1 S SA8FD*OS S 1. :OVE I9C:AS%1 TO TEL9NBR$. R #ess <$$i'ient

1!64522& .do' Pa+e


!

(ersion) 3 &4 Mar'* 2&&3

4.4.0

STRLEN T*e A-AP $un'tion STR#<0 returns t*e len+t* o$ a strin+ up to t*e last '*ara'ter t*at is not a spa'e. <1ample E Dis#)ay t!e )en"t! o+ t!e varia.)es L9Lor&13 L9Lor&$ an& L9Lor&' DATA5 I9%NT TA*E %3 I9IORD1-$=/ VAL1E WABCDEW. I9IORD$-$=/. I9IORD'-$=/ VAL1E W 0 W. I9%NT H STRLEN- I9IORD1 /. IR%TE I9%NT. I9%NT H STRLEN- I9IORD$ /. IR%TE J I9%NT. I9%NT H STRLEN- I9IORD' /. IR%TE J I9%NT. T!e resu)ts are 2 3 =3 an& 1 res#ective)y.

4.;

F%ELD8SA:BOLS 8se t*e ASSID0 and .I<#7;SNM-%#S statements to pro4ide t*e po3er$ul $un'tionalit, o$ !ointers. .I<#7;SNM-%#S are pla'e *olders $or $ields. A .I<#7;SNM-%# does not o''up, memor,5 but !oints to a position t*at *as been ASSID0ed to t*e .I<#7;SNM-%# at runtime. A$ter t*e .I<#7;SNM-%# *as been ASSID0ed to an ob6e't5 it 'an be 3or=ed 3it* t*e same 3a, as t*e ob6e't itsel$. <1ample) A data strin+ 'ontains t3o t,pes o$ $ields. .ield 1 'ontains t*e len+t* o$ .ield 2T .ield 3 'ontains t*e len+t* o$ .ield 4. T*is o''urs until t*e len+t* $ield 'ontains & or t*e total len+t* is o4er 3&&&. *ARA:ETERS5 *9FL9%N-;=/.

1!64522& .do' Pa+e


!!

(ersion) 3 &4 Mar'* 2&&3

DATA5 %N*T9RCRD-'===/3 *OS%T%ON TA*E %3 LEN(TH TA*E N. SA:BOLS NENTRAO.

F%ELD8

DO. READ DATASET *9FL9%N %NTO %N*T9RCRD. %F SA8S1BRC NE =. ED%T. END%F. LEN(TH H %N*T9RCRDS*OS%T%ON-'/. %F LEN(TH H =. ED%T. END%F. ADD ' TO *OS%T%ON. ASS%(N %N*T9RCRDS*OS%T%ON-LEN(TH/ TO NENTRAO. IR%TE NENTRAO. %F *OS%T%ON OH '===. ED%T. END%F. ENDDO. Consi&erations) As .I<#7;SNM-%# re$eren'es are onl, establis*ed at runtime5 t*e s,nta1 does not al3a,s dete't errors su'* as t,pe 'on$li'ts. T*is 'ould 'ause runtime errors or in'orre't data assi+nments. As o$ Release 3.&5 to a4oid t*e possibilit, o$ a t,pe 'on$li't5 ,ou 'an de'lare .I<#7;SNM-%#S 3it* a TNP<.

4.<

(enera) Statements #o+i'al e1pressions are e4aluated $rom le$t to ri+*t. T*e e4aluation is ended 3*en t*e $inal result *as been establis*ed ?elimination or 'omplete in'lusion@. T*ere$ore5 3*en usin+ A07 or %R operator ?in I.5 L2<R<5 et'.@5 t*e most li=el,

1!64522& .do' Pa+e


1&&

(ersion) 3 &4 Mar'* 2&&3

elimination 'riterion s*ould be spe'i$ied $irst. T*e opposite 3ill be true $or ne+ati4e 'omparisons and some %R 'onditions. <1ample) T*e $ollo3in+ table is to be read 3it* printin+ o$ emplo,ees $rom A-/ 'ompan, in Deor+ia) E:*LOAE E &&1 &&2 &&3 &&4 &&5 &&6 &&F && &&! &1& NA:E 7oe5 " 7oe5 M "ones5 A. "ones5 -. "ones5 /. "ones5 7. "ones5 <. Smit*5 A. Smit*5 -. Smit*5 /. CO:*AN A A-/ A-/ XNB A-/ A-/ XNB A-/ A-/ A-/ A-/ STATE TX %K TX DA TX DA TX DA TX %K

Less E++icient %F CO:*ANA H FABCG AND STATE H F(AG. IR%TE K END%F. Lill 3or=5 but 3ill need to e4aluate bot* t*e 'ompan, and state $ields $or ei+*t o$ ten re'ords. :ore E++icient %F STATE H F(AG AND CO:*ANA H FABCG. IR%TE K END%F. Lill need more time to pro'ess5 sin'e it 'an eliminate all re'ords 3it*out STAT< S ADAC and t*ere$ore 3ill need to e4aluate bot* 'ompan, and state $or onl, 3 re'ords.

1!64522& .do' Pa+e


1&1

(ersion) 3 &4 Mar'* 2&&3

8se spe'ial operators /% ?/ontains %nl,@5 /A ?/ontains An,@5 /S ?/ontains Strin+@ instead o$ pro+rammin+ t*e operations ,oursel$. I$ A-AP statements are e1e'uted per '*ara'ter on lon+ strin+s5 /P8 'onsumption 'an rise substantiall,. <1ample) Do8Loo# Lit! Fie)&8Sym.o)s ASS%(N CHA-1/ TO NCO. DO $== T%:ES. %F NCO H F-F OR NCO H F/G. BK.. any actions ED%T. END%F. ASS%(N NCOS1 TO NCO. ENDDO. 1263 mi'rose' 1sin" t!e CA O#erator %F CHA-$==/ CA F-/G. BK any actions. END%F. 443 mi'rose' L*en testin+ $ields 9e>ual to: somet*in+5 use eit*er t*e nested I. or t*e /AS< statement. /AS< is better $or t3o reasons. It is easier to read and a$ter about $i4e nested I.s t*e per$orman'e o$ t*e /AS< is more e$$i'ient. L*en re'ords a and b *a4e t*e e1a't same stru'ture5 it is more e$$i'ient to M%(< a to b t*an to M%(<; /%RR<SP%07I0D a to b5 i$ re'ords a and b *a4e t*e e1a't same stru'ture. <1ample) :ore E++icient :OVE BSE( TO EBSE( Less E++icient :OVE8CORRES*OND%N( BSE( TO EBSE(
1!64522& .do' Pa+e
1&2

(ersion) 3 &4 Mar'* 2&&3

4.@

SA* Re)ease 0.=D O.7ect Oriente& *ro"rammin" E6am#)e5 R<P%RT .li+*tdemo. TNP<S) tpassen+er?2&@. /#ASS 'G$li+*t 7<.I0ITI%0. P8-#I/ S</TI%0. 7ATA) 'arrid li=e sp$li;'arrid5 'onnid li=e sp$li;'onnid5 $ldate li=e sp$li;$ldate. M<T2%7S) boo= IMP%RTI0D passen+er TNP< tpassen+er. PRI(AT< S</TI%0. 7ATA) passen+erlist t,pe tpassen+er o''urs 1&. <07/#ASS.s /#ASS 'G$li+*t IMP#<M<0TATI%0. M<T2%7 boo=. APP<07 passen+er to passen+erlist. <07M<T2%7. <07/#ASS. START;%.;S<#</TI%0. 7ATA) $li+*t TNP< R<. to 'G$li+*t. /R<AT< %-"</T $li+*t. .li+*t;P'arrid S A#2C. .li+*t;P'onnid S A&56FC. .li+*t;P$ldate S A1!!F&!& C. /A## M<T2%7 $li+*t;Pboo= <XP%RTI0D passen+er S APeter MillerC. %b6e't %rientated Pro+rammin+ ?%%P@ re;de$ines modulariIation and 'an produ'e so$t3are more tolerant o$ '*an+e. C)asses E 7e$ine %b6e'ts Sections

1!64522& .do' Pa+e


1&3

(ersion) 3 &4 Mar'* 2&&3

Publi' E 'omponents are 4isible outside t*e 'lass Prote'ted E 'omponents are 4isible to sub'lasses o$ t*at 'lass Pri4ate E 'omponents are onl, 4isible 3it*in t*e 'lass itsel$. Attri.utes an& :et!o&s E Assi+ned to a se'tion Attri.utes E de$ine t*e internal state o$ an ob6e't5 de$ined usin+ a 7ATA statement. Store an ob6e'ts properties Re$eren'e ot*er ob6e'ts (irtual5 'ontrolled b, set/+et met*ods and Read %nl, :et!o&s E %perations t*at are applied to ob6e'ts. Inter$a'e is similar to $un'tion modules. Import and e1port parameters Pass a return 4alue and 'an raise e1'eptions. O.7ects E Instan'es o$ /lasses %b6e'ts belon+ to 'lasses and *a4e t*e same attributes and respond to t*e same met*ods as ot*er ob6e'ts in t*at 'lass. %b6e'ts *a4e) State5 as des'ribed b, its attributes5 be*a4ior5 des'ribed b, its met*ods5 and an identit,. %b6e'ts ma, intera't) b, a''essin+ publi' attributes5 b, 'allin+ met*ods5 or b, raisin+ and *andlin+ e4ents.

1!64522& .do' Pa+e


1&4

(ersion) 3 &4 Mar'* 2&&3

;.

Hints an& Ti#s Nou 'an use t*e E&it and *attern Statement to set up statements5 $or e1ample LRIT< or /AS<. Nou 3ill +et t*e s*ell o$ ,our statement alread, set up and ,ou 6ust *a4e to enter ,our 4ariables. I$ problems o''ur 3it* data in ,our internal tables5 '*e'= t*at t*e $ields are de'lared in t*e data de'laration se'tion in t*e same order t*at t*e, o''ur in t*e ori+inal table. Also5 '*e'= to see t*at 3*en ,ou are +rabbin+ t*e 4alues $or t*e internal table t*at t*e $ields are in t*e same order as in t*e de'lared table statement. 8se t*e Prett, Printer to line up ,our 'ode so t*at statements su'* as i$;endi$ are eas, to read. Sele't Prett, Printer 3it* t*e settin+s indent and 'on4ert to #o3er'ase. /op, and paste 3or=in+ 'ode $rom ot*er reports as mu'* as possible to sa4e time and a4oid errors. Put all 3ords and names t*at appear on ,our reports into te1t elements so t*at t*e, 'an be maintained easil,. L*en inputtin+ %SS notes5 i$ ,ou *a4e to input lar+e se'tions o$ 'ode5 'op, t*e %SS note to .t1t $ormat and t*en usin+ t*e Too)s and 1#)oa& $un'tionalit,5 upload t*e 'ode dire'tl, into ,our pro+ram t*ere$ore redu'in+ t*e '*an'e o$ an, spellin+ errors or mista=es. -e$ore a pie'e o$ 'ode +oes li4e5 it is al3a,s a +ood idea to as= anot*er pro+rammer to do a 'ode re4ie3 $or ,ou. T*e, 'an eit*er loo= at t*e pro+ram in t*eir o3n time or ,ou 'an +o t*rou+* t*e pro+ram 3it* t*em. T*e '*e'=er ma,be able to see an, problems or possible per$orman'e en*an'ements o$ ,our 'ode and ma, be able to o$$er ad4i'e. 7o not de'lare t*e initial siIe o$ an internal table. #ea4e t*is as & o$ 3*i'* t*e s,stem 3ill d,nami'all, allo'ate memor, to *o3e4er man, are re>uired. It is more e$$i'ient t*an

1!64522& .do' Pa+e


1&5

(ersion) 3 &4 Mar'* 2&&3

de'larin+ o''urren'e o$ 1&&& and t*e s,stem allo'ates memor, $or 1&&& but ,ou onl, use a $e3. L*en de'larin+ a $ield5 tr, to use t*e #IK< statement to +i4e ,our 4ariable t*e same '*ara'teristi's o$ an alread, de$ined 4ariable. Al3a,s '*e'= A-AP statements return 4alue SN;S8-R/5 3*et*er an operation 3as su''ess$ul. /an be used in AR<A7C5 AI0S<RTC5 AM%7I.NC5 A7<#<T<C5 AS<#</TC5 A/A## .80/TI%0C et'. .or more details re$er to t*e A-AP 'ode re4ie3 '*e'=list 3*i'* is +i4en in t*e Appendi1 belo3. 8se APer$ormC instead o$ a ne3 print pro+ram $or la,out 6obs. Remo4e redundant 'ode $rom t*e pro+ram in t*e $inal deli4er,. L*en S<#</Tin+ data $rom te1t table ensure t*at t*e lan+ua+e is in'luded in t*e 3*ere 'lause usin+ SN;#A0D8.

1!64522& .do' Pa+e


1&6

(ersion) 3 &4 Mar'* 2&&3

A##en&i6 1J Conversion *rocess T*e purpose o$ t*is Appendi1 is to pro4ide 'lear +uidelines $or buildin+ /on4ersion Pro+rams and /on4ersion Reportin+. 1. Bui)&in" Conversion *ro"rams SAP pro4ides a number o$ Standard 8pload /on4ersion pro+rams. I$ no Standard /on4ersion pro+ram e1ists a /ustom A-AP pro+ram 3ill be built. L*ere a Standard /on4ersion pro+ram does e1ist5 t*e pro+ram re>uires t*e input data in a spe'i$ied stru'ture/$ormat. /onse>uentl,5 a 'ustom A-AP pro+ram must be built to manipulate and map t*e data. T*ere$ore t*e standard pro'ess 3ill be t*e de4elopment o$ a /ustom A-AP pro+ram to produ'e a $ile t*at meets t*e SAP Standard 8pload pro+ramCs re>uirements. T*e ne3 $ile 3ill be passed into t*e Standard A-AP. A list o$ standard SAP pro+rams $or data upload is pro4ided later. 1.1 Fi)e 1#)oa& In inter$a'e pro+rams5 3*en ,ou upload t*e data $rom $ile to internal table t*en all t*e $ields s*ould be '*ara'ter t,pe onl, ot*er3ise it ma, 'ause a s*ort dump. %n'e t*e data is t*ere in t*e '*ara'ter $ields it is t*en 4alidated $or 'ontainin+ 4alues as per its re>uired $ield t,pe. In'orre't re'ords are re6e'ted as errors and 'orre't re'ords are passed a*ead $or $urt*er pro'essin+. T*is pre4ents an, s*ort dumps. Also5 translate to upper 'ase all '*ara'ter $ields ?e1'lude des'ripti4e te1t $ields@ o$ inbound $iles $irst5 and t*en use t*em in 4alidations a+ainst SAP tables. 1.$ Fi)e Trans+er

1!64522& .do' Pa+e


i

(ersion) 3 &4 Mar'* 2&&3

L*en a trans$er o$ t*e $ile $rom 3or=station to appli'ation ser4er is re>uired t*en trans$er mode s*ould al3a,s be AS/II onl,. L*en t*e $ile is opened $or readin+ t*e data $rom appli'ation ser4er t*en use 9in te1t mode:. <+. open dataset pGi$ile $or input in te1t mode. L*ere pGi$ile is $ile name 3it* pat*.

I0 T<XT M%7< <$$e't) I$ t*is addition is used5 t*e 'ontents o$ t*e $ile are stru'tured in lines. <a'* time t*e R<A7 7ATAS<T or TRA0S.<R statement are used5 t*e s,stem reads or 3rites a sin+le line. I0 -I0ARN M%7< <$$e't) T*e 'ontents o$ t*e $ile are not stru'tured in lines in t*e R<A7 7ATAS<T or TRA0S.<R operations. Instead5 t*e, are input or output as a stream. T*ere is no need to spe'i$, t*e I0 -I0ARN M%7< addition e1pli'itl,. Note %nl, one o$ t*e additions I0 T<XT M%7< and I0 -I0ARN M%7< 'an be used in a sin+le statement. :o&e o+ u#)oa& :o&e o+ o#enin" Resu)t t!e &ata t!e +i)e -inar, -inar, mode A\C appears as '*ara'ter in re'ord -inar, Te1t mode A\C appears as '*ara'ter in re'ord AS/II -inar, mode A\C appears as '*ara'ter in re'ord AS/II Te1t mode Lit*out A\C.
1!64522& .do' Pa+e
ii

a last ea'* a last ea'* a last ea'*

(ersion) 3 &4 Mar'* 2&&3

1.'

Te6t +i)e +or .CSV Fi)e L*ile uploadin+ t*e $ile ?R./S(5 /omma separated $ile@ in inter$a'e 6ob5 i$ 'ontents o$ an, o$ t*e te1t $ield in t*e input $ile 'ontains 'omma :5: it must be separatel, ta=en 'are o$ ?automati'all, ta=en 'are in MS <1'el@ and t*e te1t s*ould *a4e identi$ier 9 9 to si+ni$, t*e start and end o$ te1t $ield data. <+. ) Plant5 S'*edule /ode5 S'*edule 7es'ription5 7ate 7ata Re'ord no. 1 ) P1&&57#N1&&57ail, S'*edule5&1&12&&1 7ata Re'ord no. 2 ) P1&&57#N2&&5:Monda,5 Tuesda,5S'*edule:5&1&12&&1 7ata Re'ord no. 3 ) P1&&57#N2&&5Monda,5 Tuesda,5S'*edule5&1&12&&1 0ote) Recor& no. $ in t*e $ield s'*edule des'ription 'ontains A 9 A as an identi$ier5 >uotes si+ni$, t*e start and end o$ t*e s'*edule des'ription and 'omma inside t*e >uotes is data itsel$ and not a $ield separator. 0ote) Recor& no. ' doesnCt 'ontain >uotes $or s'*edule des'ription. As a result s,stem 3ill 'onsider 9Monda,: as Sc!e&u)e Descri#tion and 9Tuesda, 9 as Date.

$.

Conversion Re#ortin" <a'* /on4ersion pro+ram s*ould +enerate t*e $ollo3in+ reports) 1/ /on4ersion Statisti's Report) T*is is a brea=do3n o$ 'on4ersion statisti's ?ie/ Total number o$ re'ords in t*e input $ileT total number o$ re'ords pro'essedT total number o$ re'ords 'ontainin+ errors@. 2/ Ma6or <rror Report) T*is is a list o$ all t*e re'ords5 3*i'* 'ontained ma6or errors ?ie/ 0o 4alue $or a mandator, $ieldT in'orre't/non SAP Standard 4alue $or a mandator, $ieldT in'orre't/non SAP standard 4alue $or an, $ield 3it* a '*e'= table@. It s*ould also detail re'ords 3*i'* *a4e $ailed be'ause

1!64522& .do' Pa+e


iii

(ersion) 3 &4 Mar'* 2&&3

Sele't statements *a4e not been able to return an SAP 4alue ?e+/ Pur'*ase %rder /on4ersion 3ill ta=e a le+a', s,stem (endor number and use it to tr, to $ind t*e SAP (endor 0umber@. A pa+e brea= s*ould e1ist bet3een t*ese reports. <a'* o$ t*e 'on4ersion pro+rams s*ould use t*e same Report $ormat. '. BDC Sessions vs. Ca)) Transactions I$ t*e re>uirements deem t*at -7/ sessions are not needed in a $inis*ed state ?$or user re4ie3/'om$ort@5 use /A## TRA0SA/TI%0 and 'reate a -7/ session $or error transa'tions 3it* errors. 0. Conversion Testin" All /ustom /on4ersion A-APs s*ould be unit tested prior to bein+ si+ned o$$ as 'ompleted. It is assumed t*at in 'ases 3*ere t*e /on4ersion pro'ess 'omprises a SAP Standard and a /ustom A-AP A-AP5 bot* 3ill be unit tested. T*e te1t $ile 3ill be passed t*rou+* t*e SAP Standard A-AP5 all t*e 3a, to e1e'utin+ t*e -7/ Session. Test s'ripts and data s*ould be pro4ided to t*e /on4ersion $un'tional and te'*ni'al 7esi+ners.

1!64522& .do' Pa+e


i4

(ersion) 3 &4 Mar'* 2&&3

$J ED% :o&i+ications L*en modi$,in+ SAP supplied <7I $un'tion modules5 t*e $ollo3in+ steps s*ould be $ollo3ed) 1. Co#y SA* stan&ar& +unction mo&u)e An e1a't 'op, o$ SAPCs standard <7I $un'tion modules 3ill be made $or t*ose transa'tions t*at 0o4artis 3ill be usin+. T*ese 'opies 3ill =eep t*e same name as t*e ori+inal5 but 3ill be pre$i1ed 3it* ABG//aC ? // S /ountr, /ode5 a S appli'ation I7@. T*e name o$ t*e $un'tion module 3ill ser4e as t*e Alin=C ba'= to t*e SAP ori+inal 4ersion. $. :o&i+ications an& commentin" Modi$i'ations are made dire'tl, in t*e 'ode o$ t*e 'ustomer $un'tion module. T*e modi$i'ation s*ould be 'ommented in su'* a 3a, as to allo3 eas, readabilit, and tra'=in+ o$ updates. Modi$i'ations s*ould onl, in'lude addin+ lines o$ 'ode and 'ommentin+ out o$ SAP 'ode5 i$ ne'essar,. SAP standard 'ode s*ould ne4er be deleted or '*an+ed. T*e modi$i'ations s*ould be 'ommented and mar=ed 3it* a sear'* strin+ as des'ribed in Se'tion 4 abo4e. '. OSS notes s!ou)& .e a##)ie& simu)taneous)y to SA* stan&ar& an& custom +unction mo&u)es T*is 3ill ensure t*at bot* $un'tion modules are =ept in s,n'. It also ensures t*at t*e onl, di$$eren'es in t*e t3o $un'tion modules are t*e 'ommented modi$i'ations made as a result o$ as DAP. T*is 3ill ma=e it easier in t*e $uture to identi$, SAP bu+s independentl, $rom t*e modi$i'ations made at 0o4artis. T*e ad4anta+es and disad4anta+es to t*is met*od are outlined in t*e $ollo3in+ table) A&vanta"es <ase o$ 'ode maintenan'e and modi$i'ation
1!64522& .do' Pa+e
4

Disadvantages SAP la'= o$ support $or 'ustomer $un'tion modules


(ersion) 3 &4 Mar'* 2&&3

Minimal up+rade impa't. /ustomer $un'tion modules 3ill remain un'*an+ed. ; no '*an'e o$ o4er3rite. Per$orman'e 'an be $ine;tuned more easil, b, remo4in+ unne'essar, +eneri' loo=ups ?depends on 'ustomer;spe'i$i' needs@.

Mi+ration o$ up+raded en*an'ements in SAP standard $un'tion modules to 'ustomer $un'tion modules.

'J Correction an& Trans#ort System -CTS/ Namin" Stan&ar&s 1. %ntro&uction T*e purpose o$ t*is do'ument is to outline t*e namin+ 'on4ention t*at s*ould be $ollo3ed $or t*e 'reation o$ Transports $or A-AP de4elopment 6obs in t*e de4elopment en4ironment. A ri+orous namin+ 'on4ention is t*e 'ornerstone o$ e$$e'ti4e 4ersion mana+ement and '*an+e 'ontrol in an SAP lands'ape. T*e Transport des'ription 3ill allo3 t*e te'*ni'al team to audit / tra'= / +roup '*an+es in t*e s,stem. It 3ill also allo3 t*e te'*ni'al team to identi$, and 'orre't errors 3*en t*e, o''ur. In s*ort a +ood namin+ standard 3ill allo3 t*e te'*ni'al team and t*e -asis en+ineers to better support t*e pro6e't. It s*ould be noted t*at t*e basis team 3ill be instru'ted not to mo4e an, transports $rom 7e4elopment 3*i'* do not 'ompl, 3it* t*e namin+ standard outlined belo3. $. Stan&ar& Out)ine T*is se'tion 3ill re4ie3 some o$ t*e main $ields o$ rele4an'e in t*e transport5 and 3*i'* are re+ularl, used as a basis $or reportin+. Transport 0o. T*e transport no is automati'all, assi+ned b, t*e SAP s,stem to ea'* /TS.
1!64522& .do' Pa+e
4i

(ersion) 3 &4 Mar'* 2&&3

Sample Transport 0o)

7%3K&&342

T*e $irst 3 letters re$er to t*e Instan'e 3*ere t*e transport is bein+ 'reated5 ?transport noCs are 'lient independent@. K 7elimiter. .inall, a se>uential 6 di+it number t*at identi$ies t*e transport. .or in$o. SAP supplied transports e.+. $or Ser4i'e Pa'=s/ 2ot Pa'=ets $ollo3 t*e SAP namin+ 'on4ention i.e. T*ese are not pre$i1ed 3it* our s,stem Id S!ort Descri#tion T*is $ield is t*e main $o'us o$ t*is do'ument. T*e s*ort des'ription is a 6& '*ara'ter $ree te1t $ield 3*i'* is 'ompleted b, t*e 'reator o$ t*e transport re>uest. T*is is one o$ t*e primar, $ields used b, t*e te'*ni'al team $or reportin+. %utlined belo3 is t*e stru'ture 3*i'* must be $ollo3ed 3*en 'reatin+ a Transport re>uest. Position 1;3 4 5.6 name@ F ;11 Te1t (alid 3;'*ara'ter pre$i1 e.+. 0// 7as* A;A SAP module name ?Pi'= $rom .un'tional spe'

7as* A;A T,pe o$ pro+ram ?Pi'= $rom .un'tional spe' name e.+. /%05 R<P5 et'.@ $ollo3ed b, a spa'e 12 7as* A;A 13.16 (alid se>uen'e number ?Pre$i1 & to t*e 3 di+it number obtained $rom .un'tional spe' name@ 1F.24 (alid date in NNNNMM77 $ormat 25V (alid R/3 user id5 $ollo3ed b, spa'e5 $ollo3ed b, $ree $orm te1t. <1ample) NCC8F%8CON Q===$$=='=1$1RO1TRAB1 C!art o+ Accounts Conversion

1!64522& .do' Pa+e


4ii

(ersion) 3 &4 Mar'* 2&&3

T*e 3;'*ara'ter pre$i1 $or t*e transport des'ription s*ould be '*osen $rom t*e $ollo3in+ table) *re+i6 CAT DMC DNT DVC GUE NCC OSS USC UUE Descri#tion CATT SCRIPTS DEDUCTION MANAGEMENT DO NOT TRANSPORT! DEVELOPMENT CLASSES GLOBAL USER EXIT NOVARTIS CONSUMER CORE OSS NOTES US SECURITY AND CONTROLS US USER EXIT

Note5 L*en 'reatin+ Transport Re>uests $or an, 8ser <1it 6obs5 please use t*e pre$i1 A(1EG. T*e $ollo3in+ aspe'ts related to or+aniIation o$ /TS s*ould be ad*ered to) %b6e'ts o$ t*e same pro+ram in one transport re>uest. %b6e'ts $or +lobal use in separate re>uest one $or ea'* A-AP ob6e't. /reate related +roup o$ +lobal ob6e'ts in one re>uest.

1!64522& .do' Pa+e


4iii

(ersion) 3 &4 Mar'* 2&&3

0J SA* Stan&ar& Conversion *ro"rams Business O.7ect Financia) Accountin" .inan'ial A''ountin+ .inan'ial A''ountin+ .inan'ial A''ountin+ .inan'ial A''ountin+ F%8Ban> Data A''ountin+ do'uments Assets D/# a''ount master /ustomer master (endor master Trans$er o$ -an= 7ata ?Austrian@ Trans$er o$ -an= 7ata ?/anada@ Trans$er o$ -an= 7ata ?Derman,@ Trans$er o$ -an= 7ata ?Dreat -ritain@ Trans$er o$ -an= 7ata ?Italian@ Trans$er o$ -an= 7ata ?Spanis*@ Trans$er o$ -an= 7ata ?S3iss@ Master data ?%r+aniIational 8nits@ Pa,roll a''ount Personnel plannin+ data /reate '*ara'teristi's /reate 'lasses *ro"ramJTransaction Co&e R.-I-#&& RAA#T7&1 ?-at'* Input@ RAA#T711 ?7ire't Input@ R.-ISA&& R.-I7<&& R.-IKR&& R.-(ATG& R.-(/AG& R.-(7G G2 R.-(D-G& R.-(ITG& R.-(<SG& R.-(/2G& RP8ST7&& RP8#KT&& R2A#T7&& R//T-I&1 R//#-I&1
(ersion) 3 &4 Mar'* 2&&3
4i

.I;Deneral #ed+er .I;Deneral #ed+er .I;Deneral #ed+er Human Resources 2uman Resour'es 2uman Resour'es :ateria)s :ana"ement Materials Mana+ement
1!64522& .do'

Pa+e

Business O.7ect Materials Mana+ement Materials Mana+ement Materials Mana+ement Materials Mana+ement Materials Mana+ement /reate 'lassi$i'ation /*an+e 'lassi$i'ation Material master Pur'*ase in$ormation re'ords Pur'*ase re>uisitions %pen pur'*ase order

*ro"ramJTransaction Co&e

Materials Mana+ement Materials Mana+ement Materials Mana+ement :ateria)s :ana"ement -EHXS/

R//#-I&2 R//#RI&3 RM7ATI07 RM&6I-I& RM&6--I& RM&6<<I& Pur'*ase %rder RM&6<<I1 %rder 7e4elopment RSTX#IT. #on+ Te1ts Reser4ations RM&FRR<S Sto'=s ?In4entor, Mana+ement@ RM&FMM-# (endor master R.-IKR&& P*rases /D31 Sour'es Substan'es /D32 /D33 RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP RII-IP&&/I-IP
(ersion) 3 &4 Mar'* 2&&3
4ii

*)ant :aintenance Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e Plant Maintenan'e
1!64522& .do'

Measurin+ point Measurement do'ument 0oti$i'ations ; +eneral .un'tional lo'ation %b6e't lin= <>uipment Maintenan'e plan S'*edulin+ maintenan'e plan %rder 'on$irmation <>uipment tas= list Deneral maintenan'e tas= list

Pa+e

Business O.7ect Plant Maintenan'e *ro&uction :aster Data Produ'tion Master 7ata Produ'tion Master 7ata Produ'tion Master 7ata Produ'tion Master 7ata *ro&uction *)annin" SA*8E%S Sa)es an& Distri.ution Sales and 7istribution Sa)es an& Distri.ution on .un'tional lo'ation tas= list /reate bill o$ material /*an+e bill o$ material /reate 4ariant bill o$ material /reate bill o$ material 3it* lon+ te1ts Routin+s/tas= lists 7o'umentation in$o re'ord 7emand mana+ement Se4eral re'ords $or SAP;<IS /ondition re'ords ?pri'in+@ /ustomer master %pen sales orders In4oi'in+ e1ternal transa'tions Iare!ouse :ana"ement Stora+e bins Sto'=s on Stora+e -ins

*ro"ramJTransaction Co&e RII-IP&&/I-IP R/S-I&1& R/S-I&2& R/S-I&3& R/S-I&4& R/PTRA&1 R/(-I&1& RMMM6&-I ?-at'* Input@ RM6&I0&& ?7ire't Input@ RK/.I#<& R(14-T/I R.-I7<&& R(I0(-&& R(A.SS&& R#P#AT&& R#-<ST&&

1!64522& .do' Pa+e


4iii

(ersion) 3 &4 Mar'* 2&&3

Вам также может понравиться