abap standard coding rule (7th edition)

49
ABAP Standard Coding Rule ERP Common System  B P Standard Coding Rule 7th Edition Creation Date 2014/01/14 2014/0 /14 Date Last odi!ied

Upload: trang-hoang-anh

Post on 05-Jul-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 1/49

ABAP Standard Coding Rule

ERP Common System

 B P Standard Coding Rule

7th Edition

Creation Date2014/01/14 2014/01/14

Date Lastodi!ied

Page 2: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 2/49

ABAP Standard Coding Rule

Page 3: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 3/49

0"/02/201" 0#$2%$&4  #/4'

Change Log

Change Log

(er E!!e)ti*e Date Pu+lisher Changed Contents

1,0 2014/01/14 -S.1,B.% e)hni)al eam e Do)ument

Page 4: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 4/49

0"/02/201" 0#$2%$&4  4/4'

Change Log

Change Log

(er E!!e)ti*e Date Pu+lisher Changed Contents

Page 5: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 5/49

0"/02/201" 0#$2%$&4  &/4'

Change Log

ABAP Standard Coding Rule

Re*ised Sheet ame Change anagement o,

Page 6: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 6/49

0"/02/201" 0#$2%$&4  "/4'

Change Log

ABAP Standard Coding Rule

Re*ised Sheet ame Change anagement o,

Page 7: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 7/49

0"/02/201" 0#$2%$&4  7/4'

FPT Software Contents

Contents

ABAP Sta

3 3

3 33 3

3 3

3 3

3 3

3

3

3

3

3 3

3 3

3 3

3

3

3

33 3

3 3

3 3

3 3

3

3

3

3

3 3

3 3

3 3

3 3

3 3

3

3

De!ault Line Length !or Editor S)reen tem De!inition

Set Pretty Printer -ield ame 5Column itle6thers Amount/8uantity tem

Standard em9late aming

Program :eader Layout De!inition

De)laration :eader nternal Pro)edure

E*ent :eader

Su+routine :eader 5 odule :eader 6

E*ent ;eyord Com9osition

Su+routine Segmentation

ndent Su+routine 5-R6 ame

Comment <hat=s Stru)turation Desig

Literal Standardi>ation o! Program

S9e)i!y ty9e

Prohi+ition tem

essage

aming 5(aria+le / Constant6Print -ormat DB A))ess

E?tended Program Che)@ nternal a+le

aming odi!i)atgion log

. Status odi!i)ation Coment

S)reen tem De!inition

ethod o! .sing ; Code

E?e)ution Point o! .ser Command

Sa*e Pro)edure

Sort Pro)edure o! a+le Control Data S)reen De!inition

S)reen ransition 5Pattern as Return6 .9data Addon a+le

Con!irmation Po9u9 y9e o! n9utout9ut -ile

the P Stru)ture o! Dyn9ro E?9ression !rom Sele)tion S)reen Authority Che)@

the ethod o! ut9utting List !rom Dyn9ro ransa)tion

Des)ri9tion ethod

aming 5Parameter6

nitial Settinginitial settinginitial settinginitial settingnitial Setting

:eader Comment

Coding

Dyn9ro

Smart-orms

AL(

Per!orman)e

Stru)turation

Basi) Design

odi!i)atgion log

-un)tion odule

Page 8: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 8/49

0"/02/201" 0#$2%$&4  %/4'

FPT Software Contents

Contents

ABAP Sta

3 a+le y9e Parameter

Page 9: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 9/49

0"/02/201" 0#$2%$&4  '/4'

FPT Software Contents

  ndard Coding Rule

Stru)turation

Page 10: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 10/49

0"/02/201" 0#$2%$&4  10/4'

FPT Software Contents

  ndard Coding Rule

Page 11: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 11/49

0"/02/201" 0#$2%$&4  11/4'

FPT Software nitial Setting

nitial Setting

ABAP Standard Coding Rule

3

3

ot )he)@ =Con*ert u99er/loer)ase=

3

De!ault Line Length !or Editor

Set ma?imum digit num+er as 72 as +elo,

.serS9e)i!i) SettingsABAP Editor 5SE#%/SE%06

enu:.tilities > Setting

Che)@ =De!ault Line Length=

Set Pretty Printer

Set )hara)ter ty9e o! sour)e )ode as =.99er)ase= or =;eyord .99er)ase= as +elo,

5De!ault:.99er)ase6

r

Che)@ =Con*ert u99er/loer)ase=

Che)@ =.99er)ase= or =@eyord .99er)ase=

thers

Page 12: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 12/49

0"/02/201" 0#$2%$&4  12/4'

FPT Software nitial Setting

nitial Setting

ABAP Standard Coding Rule

Set other setting items as de!ault,

Page 13: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 13/49

0"/02/201" 0#$2%$&4  1#/4'

FPT Software :eader Comment

:ead Comment

ABAP Standard Coding Rule

3

<hen )reating a 9rogram it is ne)essary to )o9y the ea)h

:eader Comment !rom the atta)hed !ile at the right,

3

Enter registered Program D in u99er)ase,

Com9oser

De*elo9ment (ersion

R/# EERPRSE

A*aila+le Condition ! there are some limits in running system,

・ Re9ort :

・ Dyn9ro :

・ -un)tion odule :

Standard em9late

Program :eader

E?am9le6

Program DProgram name Enter the same name as Program itle

Program Summary S9e)i!i)ation do)ument $ Enter Pro)edure Summary

Com9letion Date Com9letion date 5unit test )om9letion date6

Enter ame+=5RS6= 5 1SPACE +eteen ame 5RS6 6

CodingStandards(er, the neest *ersion hen registered 9rogram D

Com9onent (ersion hi)h P is )reated

5enu:System>Status6

Rerite as +elo hen

SAP ECC &,0 ・・・ ERP2004

SAP ECC ",0 ・・・ ERP200&

Des)ri9tion 9la)e

he +eginning o! 9rogram

he +eginning o! odul9ool

Beneath o! the header hi)h is )reated automati)ally at the sour)e )ode ta+,

Program D $FGGGG''' Program ame$XXXXXXXXX Program Summary$XXXXXXXXXXXXXXXXXXXXX Creation Date $ HHHH//DD Created +y:Ryo@a arou5RS6 Coding Standards (ersion 7 De*elo9ment (ersion$SAP ECC ",0 A*aila+le Condition$nly A*aila+e !or SAP ECC ",0 Ser*er Ryo@a Systems n), 5C6 Co9yright Ryo@a Systems n), All Rights Reser*edREPR FGGGG''' SADARD PAE :EAD  LESFE 1#2  LEC. "&  ESSAED FP;F001,

Standard Template.txt

Page 14: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 14/49

0"/02/201" 0#$2%$&&  14/4'

FPT Software :eader Comment

:ead Comment

ABAP Standard Coding Rule

3 De)laration :eader

E?am9le6

Delete the 9arts

hi)h is not used

a+les De!initionABLES$ GGGGGGG,

n)lude De!initionCL.DE$ GGGGGGG,

Control De!initionCRLS$ LIGGGG HPE ABLE(E< .S SCREE ''',

y9e De!initionHPES$ BE - AIGGGG  GGGG5206 HPE C  GGGGG HPE GGGGGGGGG  ED - AIGGGG,

<or@ Area De!initionDAA$ <AIGGGG HPE AIGGGG  BE - <AIGGGGGG  GGGGG HPE GGGGGGGGG  GGGGG HPE GGGGGGGGG  ED - <AIGGGGGG,

nner a+le De!initionDAA$ IGGGG HPE ABLE - AIGGGG  IGGGGGG L;E ABLE - <AIGGGGGG  RIGGGG HPE RAE - GGGGGGGGG,

(aria+le De!inition

DAA$ <;IGGGGG HPE GGGGGGGGG  -LIGGGGG HPE C,-ELDSHBLS$

J-SIGGGGGK HPE G,

Constant De!initionCSAS$  CIGGGGG HPE G (AL.E =GGGGGGGGGG=,

Sele)tion S)reen De!initionPARAEERS$  PIGGGGG HPE GGGGGGGGG BLARH,SELECPS$  SIGGGGG -R GGGGGGGGG,

CLASS De!inition

 

Page 15: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 15/49

0"/02/201" 0#$2%$&&  1&/4'

FPT Software :eader Comment

:ead Comment

ABAP Standard Coding Rule

3

Re9ort

Dyn9ro

E*ent :eader

Delete the 9arts

hi)h is not used

nly E*ent :eader

 

CLASS CLIGGGG DE-,  P.BLC SEC,  E:DS$ IGGGG,EDCLASS,

ALFA,

A SELECSCREE,

SAR-SELEC,

ED-SELEC,

P-PAE,

ED-PAE,

A .SERCAD,

A LESELEC,

PRCESS BE-RE .P.,

PRCESS A-ER P.,

 

Dynpro Template.TXT 

Page 16: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 16/49

0"/02/201" 0#$2%$&&  1"/4'

FPT Software :eader Comment

:ead Comment

ABAP Standard Coding Rule

3

Enter -R name hi)h is )alled !rom PER-R )ommand

Enter the tem o, o! Stru)ture Chart on Detail S9e),

 5<hen there is no item o, omit the tem o,,6

Program :eader

De)laration :eader

Su+routine :eader

are )o9ied !rom

standard tem9late,

Delete the 9arts

hi)h is not used

Su+routine :eader 5 odule :eader 6

Su+routine name

tem o, o! Detail S9e),

Pro)edure Summary Des)ri9tion o! the 9ro)edure

-orm ????????????? 12#MXXXXXXXXXXPro)edure

 

PRCESS :ELPRE8.ES,

PRCESS (AL.ERE8.ES,

Page 17: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 17/49

0"/02/201" 0#$2%$&&  17/4'

FPT Software Coding

Coding

ABAP Standard Coding Rule

3

・ ・・・ N

・・ ・・・ O

・ ・・・

・ 9erator o! AD o9eration and R o9eration is riting ・・・ Q

at the same )olumn o! the )ommands,

・ Shi!ting 2 )olumns to the right 9er the logi) ・・・

hen riting )ommands 5@ey ord6,

3

ndent

he +eginning 9osition is as +elo,

1st )olumn lo+al Date De)laration 5HPES/DAA et),6

Sele)tion S)reen De!initionE*ent ;eyord

#th )olumn the other 9ro)edure des)ri9tion

5 Lo)al 5 inside -R 6 data de)laration et), 6

E?am9le6

Comment

(aria+le De!initionDAA$ <;IA HPE C,

SAR-SELEC,  PER-R AIPRC,

-orm AIPRC 21Main Pro)edure-R AIPRC,

  DAA$ LI<;I<RE526 HPE ,

- 5 5 <;IA CIC:EC;  R <;IB CIC:EC; 6  AD <;IC CIC:EC; 6,

  CASE <;IHPE,  <:E CIHPEI,  LI<;I<RE 1,  <:E CIHPEI,  LI<;I<RE 2,  <:E :ERS,  EDCASE,

  ED-,

  READ ABLE IBL <AIBL <: ;EH LI<;I<RE,  - 5 SHS.BRC 0 6,  RAS-ER <AIBL PI-L,  ED-,

ED-R, T AIPRC

① lo+al Date De)laration

② E*ent ;eyord

③ he other 9ro)eduredes)ri9tion

⑤ Shi!t 2 )olumnsCommand 5;eyord6

③ he other 9ro)eduredes)ri9tion

③ he other 9ro)eduredes)ri9tion④ AD o9eration  / R o9eration

③ the other 9ro)eduredes)ri9tion

⑤ Command 5;eyord6

Page 18: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 18/49

0"/02/201" 0#$2%$&&  1%/4'

FPT Software Coding

Coding

ABAP Standard Coding Rule

・ Do not rite asteris@ hen it is not ne)essary,

3

<hen the literal is used in more than 1 time or may+e modi!i)ated use the )onstant 9re!era+ly,

3

3

.se !or data sele)tion ・

.se !or )onstant

$$

(E )ommand ・

(E A B, B A,

・ (ECRRESPD

CP.E )ommand

SP )ommand

<:ERE SPRAS =U=,

0 Di*ision

5Di*ision hi)h denominator is 06 0 is 9ossi+le ma@e an a*oid 9ro)edure,

mit ASCED / DESCED

SR IBL BH -ELD1 ASCED-ELD2

ABLES Parameter

Can use +oth Asteris@56 dou+le Vuotation5T6,

Literal

.se as you li@e,

S9e)i!y ty9e

<hen de!ine Sele)tion S)reen (ari+le et),

re!er to di)tionary and de!ine the ty9e as mu)h as 9ossi+le,

Prohi+ition tem

Prohi+iton tem Su+stitution Plan

a+le <or@ Area5ABLES )ommand6

Re!eren)e o! SELECPS

!or Dyn9ro S)reen tem de!inition et),

it is not 9ro+lem to use,

nternal a+leDe!inition

.se CC.RS )ommand to de!ineinternal ta+le,

e?t Sym+ol

.se !or S)reen tem / Re9ort tem

5!or message et),6 E?am9le6

Sele)tion S)reen Comment / Blo)@ itleRe9ort Re9ort itle / tem itle

(aria+leSu+stitution

.se assignment o9erator 56

E?am9le6 E?am9le6

Rele*ant 9erator

KJ ・ J ・ K / E8 ・ E ・ .se +elo

L ・ ・ LE ・ E ・ JK ・ J ・ K ・ J ・ K

Arithmeti) 9erator

ADD・S.BSRAC・.LPLH・D(DE・ .se +elo

W ・ ・ ・ / ・ D ・ 5inde?6

nterru9tionPro)edure

.se C:EC;/EG )ommand and -lag to

9ass !olloing 9ro)edure,

S9e)i!y the Conditiono! Language ;ey

Literal:=UA=・=U= System (aria+le:.se SHLA.

E?am9le6 E?am9le6 <:ERE SPRAS SHLA.,

0 Di*ision

Be)ause shortdum9s ha99en i! denominator

Sort

Atta)h ASCED / DESCED

E?am9le6

DESCED.

 

.se .S / C:A Parameter to

Page 19: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 19/49

0"/02/201" 0#$2%$&&  1'/4'

FPT Software Coding

Coding

ABAP Standard Coding Rule

ot de!ine data ty9e a@e sure to s9e)i!y data ty9e,.S (AL.E5(I<;IGGG6,

De)laration in the logi)

um+er De!inition

X1

X2

$ Re!le)t the )hanged *alue to the Su+stantial Parameter,

$

3

)reate an ne addon message )lass,

5atta)h =,= hen there are more than 2 senten)es6,

 A

 E

 <

  Dis9lay in dialog +o?,

he 9ro)edures a!ter )ommand )ontinue as usual,

 S Status Dis9lay in the ne?t s)reen,

he 9ro)edures a!ter )ommand )ontinue as usual,

 G

3

Su+routine

5Parameter nter!a)e6

deli*er a+le ty9e data

Deli*er +y re!eren)e5X16, Deli*er +y *alue 5X26 ,

E?am9le6 .S (I<;IGGG ・・・ E?am9le6 .S (AL.E5(I<;IGGG6 ・・・

E?am9le6 E?am9le6 .S (AL.E5(I<;IGGG6 HPE GGGGG,

Lo)al (ari+le / -i?ed a@e sure to de)alare Yust under the -R

line,

【Re!eren)e Deli*er】 Add the re!eren)e o! Su+stantial Parameter to Pro*isional Parameter

and )hange the Su+stantial Parameter dire)tly,

.S )hange the 9arameter the o! same ith C:A,

【(alue Deli*er】 Add the *alue o! Su+stantial Parameter to Pro*isional Parameter

and )hange the *alue in the su+routine,

C:A

.S ot re!le)t the )hanged *alue to the Su+stantial Parameter,

essage

.se message o! addon )ommon message )lass 5FP;F0016 as mu)h as 9ossi+le,Re!er to )ommonmessagede!inition do)ument

.se de!ined uni!ied message in )ommon 9ro)edures,

<hen a99ro9riate message is not e?ist in )ommon message )lass

Addon message <hen entry message is 1 senten)e not atta)h =,= ,

entry rule

essage ith only == is !or+idden,

essage ty9e is determinated +y 9ur9ose,

essage y9e A)tion

A+normal End RLLBAC; is e?e)uted and 9rogram )loses,

Error Pro)edure +rea@s,

<arning Pro)edure +rea@s instantly 9ress EER to )ontinue,

n!ormation

A+normal End 5Short Dum9s6 he same as ty9e A,

<hen 9rogram ends short dum9s are out9ut,

aming 5(aria+le / )onstant6

Page 20: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 20/49

0"/02/201" 0#$2%$&&  20/4'

FPT Software Coding

Coding

ABAP Standard Coding Rule

Atta)h the +elo 9re!i? !or the *aria+le / )onstant,

Pre!i? Pre!i?

y9e AI AI LIA LIAI(BR;

AI AI(BA; LIAI LIAI(BAP<AI <AIECC LI<AI LI<AIECC

I IBDCDAA LII LIIBDCDAA

RI RI;.R LIRI LIRIAD

<;I <;IRES.L LI<;I LI<;IDH

CI CIAL LICI LICIERRR

-LI -LIPE LI-LI LI-LIPE

-SI J-SI(AL.EK LI-S JLI-SIABK

CI CIDAE LICI LICIDAE

PI PIB.;RS

SI SIBELR

BLI BLI1

RI RI1

RBI RBICLASS

CBI CBI-LE

PBI PBISAR

SI SI1

LI LI1

(I (I<AI(BAP ・・・

Parameter

: <;IS.RH : <;I;<E

・ Constant is named as the meaning,

: :

3

・ GI&%I170 &% 170

GI"&I1#2 "& 1#2 Column

GI"&I2&& "& 2&& Column

GI"&I%0 "& %0 Column

GI'0I120 '0 120 Column

・ DonZt use !ormat hi)h is e?)e9t !rom standard as mu)h as 9ossi+le,

3

A!ter 9rogram ma@ing must e?e)ute E?tended Program Che)@,

y9e temlo+al Lo)al

E?am9le E?am9le

Date y9e

a+le y9e Date y9e<or@ Area

nteral a+le

Range

(aria+le (ari+le

Count (aria+le

-lag (aria+le

-ield Sym+ol

Constant Constant

Parameter

Sele)t 9tion

Blo)@ name

S)reen tem Radio Button rou9

De!inition / Radio Button

+Ye)t Che)@ Bo?

Push Button

a+ Stri9 Control

a+le Control

Su+routine / Su+routine / Pre!i?

Pro*isional Pro*isional Parameter a))ording to (I+Date y9e

;ICDE= / =SA(EI;= used in Dyn9ro are not 9ossi+le to atta)h 9re!i? as a e?)e9tion,

(aria+le is named !rom dire)tionary name !or hi)h is !a)ility to )al)ulate origin data,

E?am9le6 (arial+e $ HPE (BAP;<E -alse Righ

E?am9le6 Constant $ HPE (BA;A.AR (AL.E =R= -alse CIR Righ CIA.AR1

Print -ormat

Re9ort !ormat 5 Re9ort Si>e in 1 9age6<idthRe)ommend

Ro Column

use the standard !ormat in SAP Print Setting, Ro

Ro

LengthRe)ommend

Ro

Ro

5<hen use manage the !ormat +y 9roYe)t,6

E?tended Program Che)@

Page 21: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 21/49

0"/02/201" 0#$2%$&&  21/4'

FPT Software Coding

Coding

ABAP Standard Coding Rule

Error must to +e sol*ed <arning / essage should +e sol*ed as mu)h as 9ossi+le,

Sele)t All tems

Page 22: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 22/49

0"/02/201" 0#$2%$&&  22/4'

FPT Software Dyn9ro

Dyn9ro

ABAP Standard Coding Rule

3

3

Set u9 !un)tion @ey at the 9oint hi)h is )orres9ond to the standard o! menu +ar,

EER EER EER

-1 :ELP

-# BAC;

-4 P(

-11 SA(E

-12 CAC

Shi!t W -# ED

-2 PC; CISELECIDEAL-& S CICREAE

-" .PD CIC:AE

-7 DSP CIDSPLAH

-% EGEC CIEGEC.EIBUEC

-' SALL CISELECIALL

Shi!t W -" RALL CIDESELECIALL

Ctrl W Shi!t W -& ASR CISRI.P

Ctrl W Shi!t W -" DSR Sort in Des)ending rder CISRID<

Ctrl W -' L CISERIR<

Ctrl W -10 DEL CIDELEEIR<

Ctrl W Shi!t W -1 S<C: CILEIDSPLAHIC:AE

Shi!t W -2 DEL CIDELEE

Ctrl W P PR CIPR

Ctrl W Shi!t W -' EGP E?9ort CIEGPR

Ctrl W PAE.P P CI-RSIPAE

PAE.P P CIPRE(.SIPAE

PAED< PW CIEGIPAE

CRLWPAED< PWW CILASIPAE

aming

aming Rule o! DHPR o, / . itle / . Status re!er to =Statement o! aming Standards=,

. Status

enu

-un)tion ;ey / -un)tion Code 5; Code6 / -un)tion e?t / )on

he !un)tion @ey hi)h is used as SAP standard

-un)tion ;ey un)tion Code -un)tion e?t

:ELP

BAC;

P. (AL.E SEARC:

SA(E

CACEL

ED

Standard !un)tion @ey 5Re)ommend6

-un)tion ;ey un)tion Code -un)tion e?t )on

Sele)t 5DBL Cli)@6Create

Change

Dis9lay

E?e)ute

Sele)t ALL

Desele)t All

Sort in As)ending rder

nsert Ro

Delete Ro

Dis9lay / Change

Delete

E?e)ute and Print

he -irst Page

he Pre*ious Page

he e?t Page

he Last Page

Page 23: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 23/49

0"/02/201" 0#$2%$&&  2#/4'

FPT Software Dyn9ro

Dyn9ro

ABAP Standard Coding Rule

3

N

it )an sho the *alue hi)h is same as standard ty9e automati)ally,

E?6

! re!eren)e item is setted in ad*an)e item shos as the setting,

)onstru)t the 9rogram +y yoursel!,

O

3

N D.LE .SERICADI0100 P.,

O SA(EI; ;ICDE,

  CLEAR ;ICDE,

=EGICADI????= / =.SERICADI????= CASE SA(EI;,

  <:E GGG,  ・・・

Q

S)reen tem De!inition

.se stru)ture !or de!ining s)reen item,

erit o! using stru)ture

t is 9ossi+le !or using Di) re!erring o9tion,

he setting o! digits is suggested automati)ally,

<hen there is a in9ut *alue 5Pulldon List6 in the item

e?t la+el o! in9ut item is made at the le!t automati)ally,

t is a99ro9riate to set item !or re!eren)e item,

Curren)y item +e)omes de)imal 2 digits as de!ault,

Su)h as UPH is no de)imal .SD is de)imal 2 digits,

<hen re!er to internal ta+le it needs to sear)h and set the *alue a+o*e

<hen 9ress hel9 +utton a*oid shoing the in)om9rehensi+le message,

<hen user 9ress the hel9 +utton at the item hi)h is made +y the internal ta+le

it may sho the message as =here is no te?t=,

<hen the item is made +y stru)ture +e)ause there is attri+ute in the ea)h item

the 9ro+lem as a+o*e don=t o))urs,

ethod o! .sing ; Code

<hen PA e*ent +rea@s 5in9ut )he)@ error et),6

re!er and )lear ;ICDE !or 9assing though the su+seVuent 9ro)essing normally,

ame Dyn9ro element ty9e =;= as =;ICDE=,

De!ine =SA(EI;= re!erring to SH.C,

At the +eginning o! D.LE

su+stitute the *alue o! ;ICDE to SA(EI;,Clear the *alue o! ;ICDE,

:erea!ter use SA(EI; to re!er to the !un)tion )ode,

Page 24: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 24/49

0"/02/201" 0#$2%$&&  24/4'

FPT Software Dyn9ro

Dyn9ro

ABAP Standard Coding Rule

3

3

3

<hen sort the )ontents o! ta+le )ontrol )ontinuously +y 9ressing sort +utton

add SABLE o9tion 5;ee9 u9 the out9ut order as last time6 to SR )ommand,

3

5.SERCAD6

・5n9ut )he)@ is not ne)essary6,

5EGCAD6

5EGCAD6

 

3

E?e)ution Point o! .ser Command

E?e)ute user )ommand 5.SERICADI????6 a!ter item )he)@,

Sa*e Pro)edure

<hen 9ress SA(E +utton )hange )on!irmation is not ne)essary,t or t out ) ange e?e)ute 9ro)e ure t no )on t on,

Sort Pro)edure o! a+le Control Data

SR )ommand don=t )ontrol the out9ut data order hen the item @ey is same,

S)reen ransition 5Pattern as Return6

he +asi) is as +elo hoe*er there is other *ariety +y +usiness reVuirements,

Ba)@ Button Ba)@ to the 9re*ious s)reen,

E?e)ute in9ut )he)@ in ad*an)e,

<hen the 1st s)reen )lose the 9rogram

E?it Button Close the 9rogram,

Can)el Button Ba)@ to the 1st s)reen,

<hen the 1st s)reen )lose the 9rogram,

Can)el Pre*ious Can)el Pre*ious Can)el

S)reen S)reen

Pre*ious

S)reen Close Close Close

Con!irmation Po9u9

<hen BAC;/EG/CACEL is 9ressed on the s)reen here is a sa*e 9ro)edure

1st S)reen 2nd S)reen #th SreenChe)@ Che)@ED

Page 25: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 25/49

0"/02/201" 0#$2%$&&  2&/4'

FPT Software Dyn9ro

Dyn9ro

ABAP Standard Coding Rule

: PP.PIIC-R

・・・ :

3

a@e the main 9rogram as re9ort 9rogram 5e?e)uta+le re9ort 9rogram6,

nsert the Dyn9ro o+Ye)t 5!rom 2nd Dyn9ro S)reen6 to the re9ort 9rogram,

.se CALL SCREE )ommand to mo*e to Dyn9ro S)reen,

3

n 9ro)essing o! PB/PA e?e)ute list out9ut logi)

)he)@ heather there is a )hange, ! there is a )hange sho )on!irmation 9o9u9,

-un)tion odule

itle Line essage Line Res9onse Button

Con!irmation he in9ut )ontents ill +e lost is it ;[Button1 Hes

Button2 o

Res9onse Hes Contiue the s)reen mo*e 9ro)edure,

o Sto9 mo*e 9ro)edure +a)@ to the 9re*ious s)reen,

the P Stru)ture o! Dyn9ro e?9ression !rom Sele)tion S)reen

5Don=t use the )onstitution hi)h )all Sele)tion S)reen !rom odulePoolP,6

Program ty9e is Re9ort in =Statement o! aming Standards=,

the ethod o! ut9utting List !rom Dyn9ro

a!ter using LEA(E LSPRCESS )ommand to start list 9ro)essor,

Re9ort

Dyn9ro100

Dyn9ro200

Page 26: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 26/49

0"/02/201" 0#$2%$&&  2"/4'

FPT Software -un)tion odual

-un)tion odule

ABAP Standard Coding Rule

3

・ <hen use !un)tion module hi)h ith e?)e9tion 9ro)edure )ertainly ma@e sure that they are e!!e)ti*e,

・ Don=t use -un)tion odule hi)h Release Date is +lan@ 5ot released6 as mu)h as 9ossi+le,

3

Pre!i?

m9ort I SI I

E?9ort EI ESI EI

Changing CI CSI CI

a+le

E?)e9tion

3

a+le 9arameter is !or+idden,

<hen use a+le Data 5nteral a+le6 as 9arameter re!erring to ta+le data ty9e stru)ture

Des)ri9tion ethod

<hen use CALL -.C to de!ine !un)tion module Pattern insertion is re)ommended,

5Re!er the release in!ormation at the attri+ute ta+6

aming 5Parameter6

Atta)h under 9re!i? to 9arameter,

Parameter.sual Stru)ture BL Date y9e

Prohi+ition

.nne)essary

a+le y9e Parameter

set use m9ort/E?9ort/Changing 9arameter,

E?am9le6

a+le Date y9eStru)ture

Page 27: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 27/49

0"/02/201" 0#$2%$&&  27/4'

FPT Software -un)tion odual

-un)tion odule

ABAP Standard Coding Rule

Stru)ture

Page 28: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 28/49

0"/02/201" 0#$2%$&&  2%/4'

FPT Software AL(

 L(

ABAP Standard Coding Rule

3

3

・ ! -ield name 5Data Element $ -ield La+el6 o! DB is di!!i)ult to understand

ame 1 \ Customer um+er

3

・ a@e Curren)y / .nit o! Vuantity in the stru)ture ma@e amount / Vuantity re!er to them,

・ Set Curren)y / 8uantity .nit !or the amount / Vuantity item in the !ield )atalog,

C.RRECH

8-ELDAE

S)reen -ield De!inition

.se Stru)ture to de!ine S)reen -ield,

-ield ame 5Column itle6

)hange the name to an a99ro9riate one,

E?am9le6 DB tem ame: ut9ut tem ame:

Don=t use the same !ield ame in a stru)ture,

Amount/8uantity tem

<hen there is a amount or Vuantity item ma@e them to re!er C.RRECH or 8-ELDAE,

Curren)y

8uantity .nit

Page 29: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 29/49

0"/02/201" 0#$2%$&&  2'/4'

FPT Software AL(

 L(

ABAP Standard Coding Rule

Page 30: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 30/49

0"/02/201" 0#$2%$&&  #0/4'

FPT Software Smart-orms

Smart-orms

ABAP Standard Coding Rule

3

Atta)h 9re!i? to the 9arameter5addon6 as same as -un)tion odule,

Pre!i?

PAI

<I

Su+ <indo <I

a+le AI

LI:5I6

Cell CI

LI

GI

ADI

RI

I

-I

-ILPI

PI

CI

<hen de!ine glo+al de)laration / )ontrol logi) !ollo the =ABAP Standard Coding Rule=,

3

Don=t de!ine indo in e*ery item gather de!ine them as a em9late in a )ertain le*el,

3

aming

Parameter

ode

Atta)h under 9re!i? to node,

ode

Page

ain <indo

Line y9e :EADER

Line y9e A LI5I6 <hen de!ine 9lural ones use 5I6,

Line y9e -ER LI-5I6

Line

e?t

Address

ra9hi)

em9late

-older

Alternati*eLoo9

Program Lines

Command

the thers

Layout De!inition

nternal Pro)edure

Considering the ser*i)ea+ility don=t do )om9li)ated 9ro)edure in the Smart-orms as mu)h as 9ossi+le,

5Do editing data in the original 9rogram in ad*an)e,6

Page 31: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 31/49

0"/02/201" 0#$2%$&&  #1/4'

FPT Software Smart-orms

Smart-orms

ABAP Standard Coding Rule

Page 32: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 32/49

0"/02/201" 0#$2%$&&  #2/4'

FPT Software Stru)turation

Stru)turation

ABAP Standard Coding Rule

3

・ the order o! 9ro)edure logi) )om9osition is as +elo,

N ALFA E?e)ute the 9re9ro)ess su)h assetting the initial *alue to s)reen item et),,

O A SELECSCREEE?e)ute sele)tion item )he)@ su)h as

authority )he)@ / s)reen item e?ist )he)@ et),,

SAR-SELEC

Q ED-SELEC

su)h as re9ort / !ile et), out9ut,

P-PAEExecute the procedure which right before outputting

a ne 9age su)h as out9ut the head o! re9ort,

] ED-PAE

^ A .SERCAD

Pro)edure

_ A LESELEC

Pro)edure in the re9ort s)reen,

` -R Pro)edure

 e?e)ute the detail 9ro)edure in the su+routine,6

3

3

nitial Pro)edure IPRC

ain Pro)edure AIPRC

End Pro)edure EDIPRC

SELECIARA

SELECIARAIU

SEIIBL

Pro)edure

<REI:EADER

<REIDEAL

<REI-ER

E*ent ;eyord Com9osition

nitial Pro)edure

Sele)tion S)reenPro)edure

ain Pro)edureE?e)ute main 9ro)edure su)h as Sele)t / edit date

out9ut re9ort et),, Don=t delete e*en i! not using,

End Pro)edure E?e)ute out9ut 9ro)edure

e Page Pro)edure

-ooter Pro)edure E?e)ute the 9ro)edure hi)h out9ut !ooter,

n9ut E*ent E?e)ute the 9ro)edure hi)h at e*ery n9ut E*ent,

Line Sele)tion E?e)ute the 9ro)edure hen the line is 9ressed

Pro)edure hi)h is )alled +y the )ommand PER-R,

Delete the @eyord hi)h not +e e?e)uted 5E?)lude SAR-SELEC6,

ot des)ri+e the detail logi) right under the e*ent @eyord,

5Right under the e*ent @eyord only )all the su+routine

Su+routine Segmentation

Di*ide the su+routine +y !un)tion unit !or reusing,

Su+routine 5-R6 ame

Consider the main 9ro)edure in the su+routine to +e easy to understand,

a@e sure the (er+ to +e in the +eginning,

E?am9le6

Sear)h Pro)edurendi*idual a+le

Plural ta+le Yoin/the 1st ta+le nameW=IU=

nternal a+le Edit

ut9ut head

Re9ort ut9ut Pro)edure ut9ut tem

ut9ut -ooter

Page 33: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 33/49

0"/02/201" 0#$2%$&&  ##/4'

FPT Software Stru)turation

Stru)turation

ABAP Standard Coding Rule

3

and design the stru)ture o! 9rogram systemati)ly,

odule is a unit as hi)h di*ide the 9rogram +y to9don !un)tion unit,

1,

2,

#,

3

he under is the general e?9lanation materials a+out stru)turation,

<hat=s Stru)turation Design

the Ba)@ground o! Stru)turation

Program is made Yust +y using -ollo Chart Coding -orm in the 9ast,

he stru)turation is 9oor and logi) is )om9li)ated )oding )hanging had a +ig )ost,

And Vuality as not good,

Stru)turation design analy>es !un)tion to the sim9le sha9e

Stru)turation design is a design method hi)h ma@e the 9rogram +e easy to understand,

the E!!e)t o! Stru)turation

A high 9rodu)ti*ity 5 )an +e managed +y module unit6,

Easy to maintenan)e,

Easy to see easy to understand, he thought o! design is easy to understand,

he time o! test is short,

<hat is odule

the rder o! Stru)turation

De)lare the !un)tion o! the 9rogram 5 -un)tion Analy>e6,

<rite main !un)tion +asing on the 9rogram date !lo,

Com+inate the main !un)tion and the su+sidiary !un)tion +y to9don a99roa)h,

Standardi>ation o! Program Stru)turation

the Basi) Stru)turation

he all 9rograms )onsist o! # 9ro)edures 5 sessions 6 as +elo,

Page 34: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 34/49

0"/02/201" 0#$2%$&&  #4/4'

FPT Software Stru)turation

Stru)turation

ABAP Standard Coding Rule

nitial Pro)edure

su)h as o9en !ile set initial *alue et),,

1,

Read !ile <rite to !ile

2,

Pro)edure hi)h is e?e)uted +e!ore main 9ro)edure

ain Pro)edure he ty9i)al 9ro)edure o! 9rogram su)h as ma@e re9ort ma@e !ile et),,

End Pro)edure Pro)edure hi)h is e?e)uted a!ter main 9ro)edure

su)h as )lose !ile et),,

Position in the stru)tural draing

Basi) Pro)edure y9e

ain 9ro)edure has # ty9es as +elo,

5Single or )om+ination6

SeVuential y9e

E?e)ute the lo ran@ module re9eatedly,

Control Brea@ y9e

e?e)ute re9eatedly until the )ondition is 5not6 met,

Program

nitialPro)edure

ainPro)edure

EndPro)edure

a@e-ile

READPro)edure

DetailPro)edure

a@e Re9ort

Pro)edure

 

Page 35: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 35/49

0"/02/201" 0#$2%$&&  #&/4'

FPT Software Stru)turation

Stru)turation

ABAP Standard Coding Rule

E?e)ute E?e)ute re9eatedly

only 1 time

<hen )ontrol +rea@ )ondition is met

+rea@ 9ro)edure

NOorNOorNis e?e)uted,

#,

5stJrn6 5strn6 5stKrn6

E?am9le6

Che)@ )ontrol hen it +rea@s

ut9ut the )ontents

or rite the )ontents to the other !ile,

at)hing y9e

Uust a!ter loading some data load the other data mat)h u9 the to re)ords +y a @ey,

he main reVuestion o! the P

E?e)ute only 1 time E?e)ute re9eatedly

1stPro)edure

2ndPro)edure

READPro)edure

DetailPro)edure

READPro)edure

Control Brea@Pro)edure

DetailPro)edure

Brea@Pro)edureN

Brea@Pro)edureO

Brea@Pro)edure

a@e Re9ortPro)edure

1stPro)edure

2ndPro)edure

aster READPro)edure

ransa)tionREAD

Pro)edure

<hen onlymaster

<hen ma)thed<hen onlytransa)tion

LP A IBSE <AIBSE,

  A -RS,  PER-R <REIC(ER,  ED A,

  A E< B.;RS,  PER-R <REI:EADER,  ED A,

  PER-R <REIDEAL,

  A ED - B.;RS,  PER-R <REI-ER,  ED A,

EDLP,

Page 36: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 36/49

0"/02/201" 0#$2%$&&  #"/4'

FPT Software Stru)turation

Stru)turation

ABAP Standard Coding Rule

Page 37: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 37/49

0"/02/201" 0#$2%$&&  #7/4'

FPT Software Per!orman)e

Per!orman)e

ABAP Standard Coding Rule

3

・ a@e the times o! ta+le a))ess as small as 9ossi+le,

rite the item +y dire)tionary order !rom the !irst DEG item,

・ :

b:

+y the order o! -R / U ta+le,

and get the data +y READ )ommand,

・ a+le su)h as te?t ta+le hi)h is e?9e)ted the re9eaded re)ord

not U the ta+le +ut sele)t the re)ord in a ne SELEC )ommand,

Se9arate the data su)h as name

the other internal ta+le hen ne))esary,

DB A))ess

.se DEG at the )onditon o! <:ERE )ommand as 9ossi+le,5 ! not use DEG 9rogram read the all re)ords one +y one !or sear)hing the target re)ord,

he 9er!orman)e is *ery +ad, 6

<hen use DEG at the )ondition o! <:ERE )ommand

5 <hen there is a omission or the order is di!!erent

DEG sear)h is only e!!e)ti*e !or the higher ran@ hi)h is )orre)t,6

<hen use /L;E S AL o9erator to the DEG item at th <:ERE B.DA J SHDA.

inde? sear)h is unor@ing, .se other o9erator as 9ossi+le, <:ERE B.DA K SHDA.

5 t is same as the SELECPS !or sear)h )ondition, 6

<hen Yoin ta+le rite the )ondition item hi)h is e?)e9t the <:ERE )ommand

<hen the amount o! the ta+le is small sele)t the data in ad*an)e together

E?am9le6 ransa)tion series E?am9le6 aster series

he relationshi9 o! aster and ame is 1$1,

Be)ause there is not re9eated store the

data to one internal ta+le,

he o))asion hen @ey item )an +e !o)used on

the s9e)i!i) )ondition 5Language ;ey6

not use <:ERE )ommand rite the )ondition

at the U )ommand,

hi)h is assumed to +e re9eated

!rom the main internal ta+le road into

Don=t use sele)tion loo9 SELEC~EDSELEC, 5.se -R ALL ERES to sele)t together in ad*an)e,6

Sele)t main data  SELEC ~  1c;.R  ~

  ABLE I(BA;  -R (BA; AS 1  U (BAP AS 2 ~

  <:ERE ~ ,

  :

Sele)t te?t data  SELEC ;.R  AE1

  ABLE I;A1  -R ;A1  -R ALL ERES I(BA;  <:ERE ;.R I(BA;c;.R,  :

  :

  LP A I(BA;  <AI(BA;,  :

Re!er the te?t data !rom main data  READ ABLE I;A1  <AI;A1  <: ABLE ;EH ;.R <AI;A1;.R,  :

  EDLP,

 SELEC 1cAR  2cA;G  IARA -R ARA AS 1 U A; AS 2 1cAR 2cAR  AD 2cSPRAS SHLA. <:ERE ~ ,

Page 38: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 38/49

0"/02/201" 0#$2%$&&  #%/4'

FPT Software Per!orman)e

Per!orman)e

ABAP Standard Coding Rule

and su++mit to BASS term,

-R ALL ERES

<hen use nonuniVue )ondition to sele)t one re)ord use o9tion .P 1 R<S not use SELEC SLE,

5in this instan)e you )an use sele)tion loo9,6

RDER By )ommand is sorting hile roading it +e)omes load,

<hen there are great num+er o! re)ords not use RDER BH as 9ossi+le,

<hen DEG is ne)essary !or ADD ta+le dis)uss set in the 9roYe)t,

<hen DEG is ne)essary !or SAP standard ta+le dis)uss ith a99li)ation sta!!

5 ne DEG ta@es o*er 10c20 *olume o! the ta+le data ne addition needs 9lenty o! dis)ussion, 6

-or high 9er!orman)e use -R ALL ERES )ommand to only sele)t the data hi)h is ne)essary,

E?am9le6

【Attention】

<hen JitIt+lK is no data o9tion -R ALL ERES is ignored all entries are loaded in,Be!ore -R ALL ERES )ommand ma@e sure to )he)h i! there is any data in the JitIt+lK,

.se -R ALL ERES )ommand hen there is any data in the JitIt+lK,

Re9eated data is destroyed !rom the result setting,

5 <hen stored internal ta+le is setted as uniVue i! there are re9eated datas in @ey unit

  the 9ro)edure +rea@s,6

Data ty9e and length must +e same +eteen data+ase ta+le and internal ta+le items,

RDER BH / 59erator in the )ondition6L;E / BE<EE / are not used )on)urrently,

! there are re9eated data on the internal ta+le !or )ondition

delete the re9eated datas inad*an)e !or de)reasing the sele)t re)ords !rom data+ase,

E?am9le6

  SELEC:

  -R ALL ERES JitIt+lK  <:ERE J)onditionK,

  DAA LII(BA;  L;E I(BA;,

Delete the re9eated data  LII(BA;M I(BA;M,  SR LII(BA; BH ;.R ASCED,  DELEE ADUACE D.PLCAES -R LII(BA; CPAR ;.R,

Sele)t the te?t data

  SELEC ;.R  AE1  AE2  ABLE I;A1 

Page 39: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 39/49

0"/02/201" 0#$2%$&&  #'/4'

FPT Software Per!orman)e

Per!orman)e

ABAP Standard Coding Rule

$

on.niVue $

only one data +e sele)ted,

3

・ <hen @ey a))ess seVuential sear)h is e?e)uted in the internal,

e?e)ute +inary sear)h as mu)h as 9ossi+le,

De9ending on the de!inition o! the internal ta+le @ey the mo*ement is di!!erent,

.niVue ;ey <hen there is a re9eated data in the @ey item shortdum9s error +rea@ out,

! there is a re9eated data in the entire sele)t datas

nternal a+le

here are # ty9es o! internal ta+le the )hara)teristi)s o! ea)h is as +elo,

SADARD a+le

;ey is nonuniVue,

5.se DEG !or @ey a))ess as mu)h as 9ossi+le,6

he sear) time is 9ro9ortional to the linear !un)tion o! the ta+le entries,

<hen use READ )ommand use BARH SEARC: )ommand to

5on this o))asion it need de!ine nonuniVue @ey sort +y @ey item in ad*an)e,6

t is suita+le !or LP~EDLP )ommand,

:AS: a+le

;ey must +e uniVue,

<hen @ey a))ess hush sear)h is e?e)uted in the internal,

he sear) time stays )onstant

-R ALL ERES LII(BA;  <:ERE ;.R LII(BA;c;.R,

Page 40: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 40/49

0"/02/201" 0#$2%$&&  40/4'

FPT Software Per!orman)e

Per!orman)e

ABAP Standard Coding Rule

not +e 9ro9ortional to the linear !un)tion o! the ta+le entries,

・ Don=t use DEG !or a))ess,

・ <hen @ey a))ess +inary sear)h is e?e)uted in the internal,

.se :AS:/SR a+le as mu)h as 9ossi+le,

・ he num+er o! the re)ords is small,

the ta+le !or head data,

5 <hen re)ords are small the 9er!orman)e is loer than SADARD ABLE,6

Don=t use APPED )ommand,

emory usage is +igger than the other ty9es,

t is suita+le !or dire)t a))ess5 READ )ommand o! s9e)i!ying @ey6 o! uniVue data,

SR a+le

.sually @ee9 the right sorted sha9e 5SR )ommand is 9rohi+ited6,

t is ; !or either uniVue @ey or nonuniVue,

he sear) time is 9ro9ortional to the linear !un)tion o! the ta+le entries,

! @ey is nonuniVue ado9t the entry hi)h DEG is smallest,

t is 9ossi+le !or DEG a))ess,

<hen use DEG to e?e)ute SER )ommand it )he)@s i! sort order is right,

in this instan)e the 9er!orman)e is loer than the other ty9es,

<hen a))ess !or SR ta+le ma@e sure to use ta+le @ey,

A99li)a+le )ondition o! ea)h ty9e

he # ty9es o! internal ta+le is used as the o))asions as +elo,

SADARD a+le

<hen not e?e)ute @ey a))ess5<:ERE ~・READ ~ <: 5ABLE6 ;EH ~6,

m9a)t is +ig i! use :AS:ED/SRED ABLE hen @ey is )hanged

the or@ o! editting is hard ,

E?am9le6 nly use !or the entire entries LP5seVuential sear)h6

he ta+le hi)h only e?e)ute READ/DELEE )ommand +y DEG,

:AS: a+le

Page 41: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 41/49

0"/02/201" 0#$2%$&&  41/4'

FPT Software Per!orman)e

Per!orman)e

ABAP Standard Coding Rule

・・・ SADARD ABLE

・・・ SRED ABLE

・・・ :AS:ED ABLE

EDLP

EDLP

Release the resour)e

ry not to )om9ress the resour)e +y the data hi)h is not used,

he o))asion e?)e9t a+o*e,

he o))asion hi)h uniVue @ey )an +e setted,

5o LP )ommand6 nly READ 9ro)edure is e?e)uted,

E?am9le6 aterial te?t ta+le

SR a+le

he o))asion hi)h e?)e9t a+o*e,

E?am9le6 tem data ta+le

y9i)al e?am9le o! use

LP nternal BL !or :eader

LP nternal BL !or tem

READ nternal BL !or e?t

hen the internal BL has not +een used use -REE )ommand to release the resour)e,

Page 42: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 42/49

0"/02/201" 0#$2%$&&  42/4'

FPT Software odi!i)atgion log

odi!i)atgion log

ABAP Standard Coding Rule

3

3

・・・

・・・

odi!i)atgion log

Start re)ord a!ter system integration test,

<hen Add / odi!y / Delete 9rogram atta)h num+er,

Ado9t seVuen)e num+er !rom =001= +y the num+er o! su99ort times,

e log is added under the old log,

E?am9le6

odi!i)ation Coment

Atta)h )omment right +e!ore or a!ter the line !or add / )hange / delete,

Change start

Change end

Program D $GGGGGGGGGG Program ame$XXXXXXXXX Program Summary$XXXXXXXXXXXXXXXXXXXXX

Com9letion Date $ HHHH//DD Com9oser:Ryo@a arou5RS6 Coding Standards (ersion 7 De*elo9ment (ersion$SAP ECC ",0 A*aila+le Condition$nly A*aila+e !or SAP ECC ",0 Ser*er Ryo@a Systems n), 5C6 Co9yright Ryo@a Systems n), All Rights Reser*ed odi!i)ation um+er $ 001 odi!i)ation Date $ HHHH//DD Change +y $ Ryo@a :ana@o5RS6 odi!i)ation Content $ XXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXX

odi!i)ation um+er $ 002 odi!i)ation Date $ HHHH//DD Change +y $ Ryo@a )hiro5RS6 odi!i)ation Content $ XXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXX

REPR FGGGG''' SADARD PAE :EAD  LESFE 140  LEC. &1  ESSAED FP;F001,

0015GGG6SAR

0015GGG6ED

odi!i)ation um+er $ .sually rite !rom the #rd 9la)e,

 

Page 43: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 43/49

0"/02/201" 0#$2%$&&  4#/4'

FPT Software odi!i)atgion log

odi!i)atgion log

ABAP Standard Coding Rule

・ ot delete the unne)essary logi) +y hi)h )hange or delete )an)el out as a )omment,

0015GGG6Start

E?am9le6

Add

odi!i)ation

5Can)el out

the e?isting logi)6

Delete

5Can)el out

the e?isting logi)6

<hen )hange5add/delete6 the logi) on)e more i! it is di!!i)ult to understand

+y using )omment to en)ir)le the target logi) only en)irle the 9re*ious )omment,

E?am9le6

he e?isting

modi!i)ation line

ChangeQ

Pattern 1

0015ADD6SAR  C:EC; 5 <;ID CIC:EC; 6, 0015ADD6ED

  - 5 <;IA CIC:EC;  R <;IB CIC:EC; 6,

  CASE <;IHPE, 0015D6Start <:E CIHPEI,  <:E CIHPEIS, 0015D6ED  LI<;I<RE 1,  <:E CIHPEI,  LI<;I<RE 2, 0015DEL6Start <:E CIHPEI., LI<;I<RE #, 0015DEL6ED  <:E :ERS,  EDCASE,

  ED-,

0015D6SAR N READ ABLE IBL <AIBL <: ;EH LI<;I<RE,  O  READ ABLE IBL <AIBL <: ;EH LI<;I<RE   D =ABC=, Q 0015D6ED

0015D6SAR  N READ ABLE IBL <AIBL <: ;EH LI<;I<RE,  O 0025D6SAR  READ ABLE IBL <AIBL <: ;EH LI<;I<RE    D =ABC=, Q

  READ ABLE IBL <AIBL <: ;EH D =DE-=, 0025D6ED 0015D6ED 

 

odi!i)ation ode:Add:5ADD6 / odi!i)ation:5D6 / Delete$5DEL6

SAR / ED:Start:SAR / End:ED

se9arator line $ u9 to the "0th 9la)e

Page 44: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 44/49

0"/02/201" 0#$2%$&&  44/4'

FPT Software odi!i)atgion log

odi!i)atgion log

ABAP Standard Coding Rule

! it is di!!i)ult to understand

as )hanging logi) only

Pattern 2

)omment in)luding the 9re*ious )

0025D6SAR 0015D6SAR N READ ABLE IBL <AIBL <: ;EH LI<;I<RE,  O  READ ABLE IBL <AIBL <: ;EH LI<;I<RE    D =ABC=,  Q 0015D6ED 

  READ ABLE IBL <AIBL <: ;EH D =DE-=, 0025D6ED

 

Page 45: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 45/49

0"/02/201" 0#$2%$&&  4&/4'

FPT Software odi!i)atgion log

Page 46: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 46/49

0"/02/201" 0#$2%$&&  4"/4'

FPT Software odi!i)atgion log

Page 47: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 47/49

0"/02/201" 0#$2%$&&  47/4'

FPT Software odi!i)atgion log

 

omment,

Page 48: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 48/49

0"/02/201" 0#$2%$&&  4%/4'

FPT Software Basi) Design

Basi) Design

ABAP Standard Coding Rule

3

se9erates +y lo)al/ser*er

・ a@e sure setting u9 the -4 sear)h !un)tion5!ile s9e)i!y dialog6 to the lo)al !ile name item,

3

<hen u9date addon ta+le ma@e sure to e?e)ute e?)lusion a))ess )ontrol 5lo)@ the target ta+le data6,

3

3

S)reen De!inition

Radio Button

<hen 9ro)edure se9arates +y 9ur9ose use radio +utton !or sele)tion,

E?am9le6

here are 9lural ty9es o! do)ument Destination o! in9ut/out9ut !ile

Code in9ut sele)tion hi)h the item is not re!erred to di)tionary is 9rohi+ited,

S9e)i!y -ile

De!ine !ormat/te?t as +elo to the ser*er !ile name item,

.9date Addon a+le

y9e o! n9utout9ut -ile

a+ +rea@ !ile is re)ommended,

Authority Che)@

Re)ei9t oods

Deli*ery oods

Both

ut9ut Do)ument

-ile Path

Lo)al -ile

AP Ser*er -ile

-un)tion Sele)tion

Please sele)t o,

nsert Change

Dis9lay Delete

nsert

Dis9lay Delete

Change

-un)tion Sele)tion

Logi) -ile ame

n9ut -ile ame

n9ut n9ut

ut9ut

Log

ut9ut

Logi) -ile ame

ut9ut -ile ame

Error -ile ame

Logi) -ile ame

Log -ile ame

Page 49: ABAP Standard Coding Rule (7th Edition)

8/16/2019 ABAP Standard Coding Rule (7th Edition)

http://slidepdf.com/reader/full/abap-standard-coding-rule-7th-edition 49/49

0"/02/201" 0#$2%$&&  4'/4'

Basi) Design

ABAP Standard Coding Rule

3

<hen there are 9lural !un)tions su)h as nsert/Change/Delete register transa)tion +y !un)tion unit

.ser authority )he)@,

ransa)tion

se9erate 9ro)edure in the 9rogram, 5Don=t set u9 sele)tion +utton on the initial s)reen6