SlideShare a Scribd company logo
1 of 8
Download to read offline
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 1/8
Are you an ABAP coder or a
programmer?
TOPICS: ABAP Checklist Good Programming Practice
Guidelines
POSTED BY: SAP YARD OCTOBER 16, 2014
The difference between a normal programmer and a
good programmer is, the latter keeps his/her basics
right. Good programmers are distinguished by the
quality of their deliverables. They provide enough
documentation in their object so that the future
practitioners supporting their product do not curse
them. One of my Team Lead once told me, “your code
should not only meet the functionalities, it should also be
asthetically pleasing if someone happens to peep into it“.
Today, in this post I do not want to bore you with the
“Gyan” (Sanskrit word that roughly translates to
Enter email
Subscribe
RECENT POSTS
DELETING rows of the
internal table within the
LOOP. Is it a Taboo? A big
NO NO?
Quick Reference for Vistex
Technical
Offshore Development
Model in 10 Steps
SAP YARD
YOUR BACKYARD FOR SAP TECHNICAL TIPS AND SOLUTIONS
HOME SEE ALL POSTS ASK YOUR QUESTIONS ABOUT ME CONTACT ME
You and 92 other friends like this
SAP Yard
168 likes
Liked
SEARCH …
17
7
2
2
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 2/8
“sermons/preachings”). But, I would like to provide a
list of simple checks which every programmer should
remember even in their sleep…
Note: Numbers are only for bullet marker. It does not
rate one higher to next. Every point has different
weightage in different scenarios.
1) Define your variables with meaningful names (eg:
instead of v_var1; v_material is more meaningful).
Provide as much documentations/halfline comments
as possible. Align your code and demarcate your
blocks. Provide uniform spacing in between different
units and remove dead codes. Clean code would
reflect your personality..
2) In the AT SELECTION-SCREEN event, use UP TO 1
ROWS (or count( * ) UP TO 1 ROWS) in the SELECT
statement used for validating the data since the idea
is just to ensure that at least 1 row will be considered
for processing in the main selection event.
3) Internal table is defined with “TYPE
STANDARD/SORTED/HASHED TABLE OF”  “INITIAL
SIZE 0″ and work area is used instead of tables with
HEADER LINES. If you have multiple internal tables
of same type, you need not always define as many
work areas. Same work area should be used across
multiple internal tables, if they are of same type.
4) Declare  global internal tables only if they are
expected to be used globally (across multiple
subroutines) in the program. This is to avoid
unnecessary memory usage as local internal tables are
cleared from the memory on exiting the subroutine.
5) Wild cards like ‘A%’  should be avoided as much as
possible.
6) Always SELECT INTO internal table, except when
Ready Reckoner for SAP
Developers
Just a key and two clicks for
ALV consistency check
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 3/8
the table will be very large, use “UP TO N Rows” when
the number of records needed is known.
7) Use “JIT”, Just In Time concept to select data when
needed, use them and free them. Most programmers
have the habit of selecting all the tables one by one
first and then processing/massaging them later at the
end. This practice burdens the system by unnecessary
memory consumption by holding the data when they
are not needed. SELECTs should be done when
needed and FREE/REFRESH the tables as soon as it is
used and not needed afterwards.
8) SORT fields and SORT Order on the SORT
statement should be mentioned explicitly (e.g. SORT
ITAB BY FLD1 ASCENDING FLD2 DESCENDING).
9) HASHED table is used for processing large amount
of data (provided that you access single records only,
and all with a fully specified key).
10) DELETE or SORT is not used on a HASHED table
since it increases memory consumption.
11) Fields specified in the WHERE condition with the
critical operators NOT and <> (negative SQL
statements) cannot be used for a search using
database indexes. Whenever possible formulate SQL
statements positively. Avoid negation statements.
12) When IF or CASE, testing conditions are nested so
that the most frequently true conditions are
processed first. Also CASE is used instead of IF when
testing multiple fields “equal to” something.
13) READ TABLE INTO WORKAREA should be used
instead of only READ TABLE. If INTO work area is not
needed then, use the addition TRANSPORTING NO
FIELDS if the purpose of the read statement is only to
check the existence of the record in that table.
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 4/8
14) For copying internal tables use ‘=’ operator
instead of LOOPing and appending. SORT inside a
LOOP should be avoided.
15) Do not delete the records of internal table inside
the LOOP — ENDLOOP. Instead mark the rows to be
deleted by passing some identifier to the row field(s)
and delete all those identified after the end of LOOP.
Use Field Symbol, if you want to modify the fields of a
table in the LOOP. Usage of field symbol would avoid
modify statement inside the LOOP.
16) Use CONTROL BREAKS in the LOOP — ENDLOOP
syntax to avoid repeated reading of other internal
tables and for summarizing / updating the internal
tables.
17) DELETE ADJACENT DUPLICATES entries from
internal table before selection from database table
using “ FOR ALL ENTRIES” statement. Applicable
only in those cases where the table can possibly have
duplicate entries.
18) Nested SELECT should not be used instead,
“INNER JOIN” and/or “FAE” should be used. “FAE” is
to be used over “LOOP at ITAB / SELECT /
ENDLOOP”.
19) In SELECT statement, only the required fields
should be selected  from the database
table/structure/view. While using FOR ALL ENTRIES,
make sure to SELECT all the primary keys even if you
do not need some of them later as FAE retrieves
unique result set.  For selecting single row from a
database table, “SELECT UP TO 1 ROWS” is used
(when you do not have full primary key for your
WHERE clause). Always CHECK that the internal table
used in FOR ALL ENTRIES is NOT empty. “SELECT
SINGLE” is used only when full primary key
combination is known.  Avoid SELECT * as much as
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 5/8
possible.
20) When creating JOINs over database tables there
should be an index at least on the inner table for the
fields in the JOIN condition else use “ FOR ALL
ENTRIES” SELECT statement. Ensure that the inner
join uses the correct indexes.
21) SORT internal table by fields in the correct order,
which are used in a READ TABLE statement using
BINARY SEARCH. If the order of SORTING is invalid,
the BINARY SEARCH will never work. And you would
be scratching your head for a long time to find the
root cause if you need to do dry run where issues
could be replicated..
22) Avoid MODIFY, use explicit INSERT or UPDATE;
it is better for performance and support. MODIFY
statement is more attractive to programmers because
of the ease of usage. But, believe me, splitting your
table entries to INSERT and UPDATE is still better,
even though it might need one more select
statements. Tried and Tested in real projects.
23) For large internal tables where only some rows are
to be processed, use SORT and then the READ TABLE
command is used to set index to first relevant row
before LOOPing from that index. Use CHECK or IF…
EXIT…ENDIF as appropriate to exit from the loop.
Also called, Parallel Cursor technique.
24) SORTed table is used for range accesses involving
table key or index accesses. SORTed tables are
particularly useful in nested loop processing. LOOP
AT ITAB with a WHERE condition is preferred where
ITAB is a SORTED table (instead of STANDARD or
HASHED internal table) and the fields used in the
WHERE condition are the non-unique key fields of the
sorted table.
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 6/8
25) Use indexed table like VAPMA instead of VBAP to
identify sales orders for a particular MATNR (i.e in
situations when you have material and you do not
have VBELN (sales order number) in hand). Similarly
VAKPA etc. VBFA is used for forward search i.e.
preceding to subsequent. For subsequent to preceding
we should use alternate tables such as LIPS or VBRP
(VBGEL, VGPOS). Try to use Views instead of joining
multiple tables.
26) Run Code Inspector and Extended syntax checks
with character literals checkbox switched on to rectify
all relevant errors and warnings. SAP has provided
this cool feature, please use it. Proudly flaunt the
results with zero/ignorable warnings.
27) Use transaction code SCI/SCII to do the sanity
check of your deliverables before passing it to the
quality reviewers. Easy way to impress your reviewer.
28) Use transaction code ST05/ST12 to trace your
code. Make sure to check what indices your database
accesses are using. Check these indices against your
“WHERE” clause to assure they are significant. Check
other indices for this table and where you have to
change your “WHERE” clause to use it. Create new
indices if necessary after consulting your Basis team.
For client dependant tables, use MANDT as the first
field in the secondary index since it is internally
considered by SAP when retrieving the data from the
database tables.
Please note, this article is not intended for Performance
Tuning. This is an effort to remind the programmers
about the simple checks which we should take care as
part of good programming practice. Please feel free to
suggest if you think something is missing. We would be
happy to add them in this list.
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 7/8
2 COMMENTS
ON "ARE YOU AN ABAP CODER OR A PROGRAMMER?"
 
Previous post Next post
Great staff, thanks a lot
Dear William – Thank you
so much for your feedback.. Glad that
you like it.
Regards,
SAPYard.
Leave a comment
Your email address will not be published.
Name *
 
Mutero william | July 30, 2015 at 12:50
pm | Reply
SAP Yard | July 30, 2015 at 1:41
pm | Reply
8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard
http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 8/8
Raju
Email *
respond2raju@gmail.com
Website
Comment
Post Comment
COPYRIGHT 2015 | SAPYARD BY WWW.SAPYARD.COM
ALL PRODUCT NAMES ARE TRADEMARKS OF THEIR RESPECTIVE COMPANIES. SAPYARD.COM IS NOT AFFILIATED TO SAP AG.

More Related Content

What's hot

Excel tips%20simple%20tax%20india%20dot%20org
Excel tips%20simple%20tax%20india%20dot%20orgExcel tips%20simple%20tax%20india%20dot%20org
Excel tips%20simple%20tax%20india%20dot%20orgSeshasalam Murugesan
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reportsvbpc
 
Part3 Explain the Explain Plan
Part3 Explain the Explain PlanPart3 Explain the Explain Plan
Part3 Explain the Explain PlanMaria Colgan
 
Row, Column, Index, Match, Offset Functions. Excel Tutorial
Row, Column, Index, Match, Offset Functions. Excel TutorialRow, Column, Index, Match, Offset Functions. Excel Tutorial
Row, Column, Index, Match, Offset Functions. Excel TutorialIlgar Zarbaliyev
 
Triad 2010 excel_chapter_1
Triad 2010 excel_chapter_1Triad 2010 excel_chapter_1
Triad 2010 excel_chapter_1Dalia Saeed
 
Sap abap modularization interview questions
Sap abap modularization interview questionsSap abap modularization interview questions
Sap abap modularization interview questionsPradipta Mohanty
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)Kranthi Kumar
 
New Dynamic Array Functions. Excel Tutorial
New Dynamic Array Functions. Excel TutorialNew Dynamic Array Functions. Excel Tutorial
New Dynamic Array Functions. Excel TutorialIlgar Zarbaliyev
 
SAP ABAP online training
SAP ABAP online trainingSAP ABAP online training
SAP ABAP online trainingImagine life
 

What's hot (17)

Excel tips%20simple%20tax%20india%20dot%20org
Excel tips%20simple%20tax%20india%20dot%20orgExcel tips%20simple%20tax%20india%20dot%20org
Excel tips%20simple%20tax%20india%20dot%20org
 
Excel tips
Excel tipsExcel tips
Excel tips
 
35 excel tips
35 excel tips35 excel tips
35 excel tips
 
Excel useful tips
Excel useful tipsExcel useful tips
Excel useful tips
 
Excel tips
Excel tipsExcel tips
Excel tips
 
The ABAP Query
The ABAP QueryThe ABAP Query
The ABAP Query
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reports
 
Project Report on SAP
Project Report on SAPProject Report on SAP
Project Report on SAP
 
Part3 Explain the Explain Plan
Part3 Explain the Explain PlanPart3 Explain the Explain Plan
Part3 Explain the Explain Plan
 
Row, Column, Index, Match, Offset Functions. Excel Tutorial
Row, Column, Index, Match, Offset Functions. Excel TutorialRow, Column, Index, Match, Offset Functions. Excel Tutorial
Row, Column, Index, Match, Offset Functions. Excel Tutorial
 
Excel_useful_tips
Excel_useful_tipsExcel_useful_tips
Excel_useful_tips
 
Triad 2010 excel_chapter_1
Triad 2010 excel_chapter_1Triad 2010 excel_chapter_1
Triad 2010 excel_chapter_1
 
Sap abap modularization interview questions
Sap abap modularization interview questionsSap abap modularization interview questions
Sap abap modularization interview questions
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)
 
New Dynamic Array Functions. Excel Tutorial
New Dynamic Array Functions. Excel TutorialNew Dynamic Array Functions. Excel Tutorial
New Dynamic Array Functions. Excel Tutorial
 
SAP ABAP online training
SAP ABAP online trainingSAP ABAP online training
SAP ABAP online training
 
Elosimple excel inventory
Elosimple excel inventoryElosimple excel inventory
Elosimple excel inventory
 

Viewers also liked (11)

Présentation "Pourquoi les Juifs craignent ?" Georges Smadja
Présentation "Pourquoi les Juifs craignent ?" Georges SmadjaPrésentation "Pourquoi les Juifs craignent ?" Georges Smadja
Présentation "Pourquoi les Juifs craignent ?" Georges Smadja
 
Office Assistant
Office AssistantOffice Assistant
Office Assistant
 
Curr_TIS_final(Feb 2015)
Curr_TIS_final(Feb 2015)Curr_TIS_final(Feb 2015)
Curr_TIS_final(Feb 2015)
 
Dr. Al-Natour CV, Sept. 19, 2015
Dr. Al-Natour CV, Sept. 19,  2015Dr. Al-Natour CV, Sept. 19,  2015
Dr. Al-Natour CV, Sept. 19, 2015
 
30 Days to a Decluttered Inbox
30 Days to a Decluttered Inbox30 Days to a Decluttered Inbox
30 Days to a Decluttered Inbox
 
CV Chinese Andrea Tomaselli
CV Chinese Andrea TomaselliCV Chinese Andrea Tomaselli
CV Chinese Andrea Tomaselli
 
Afectiuni prostata
Afectiuni prostataAfectiuni prostata
Afectiuni prostata
 
Dr. Al-Natour CV, Sept. 19, 2015
Dr. Al-Natour CV, Sept. 19,  2015Dr. Al-Natour CV, Sept. 19,  2015
Dr. Al-Natour CV, Sept. 19, 2015
 
Modelo de pruebas de Reles de Proteccion
Modelo de pruebas de Reles de ProteccionModelo de pruebas de Reles de Proteccion
Modelo de pruebas de Reles de Proteccion
 
Casa da Musica Oporto. OMA
Casa da Musica Oporto. OMA Casa da Musica Oporto. OMA
Casa da Musica Oporto. OMA
 
Il Ciclo Bretone
Il Ciclo BretoneIl Ciclo Bretone
Il Ciclo Bretone
 

Similar to Are you an abap coder or a programmer?

Z abap coding_standards_v2_0_t
Z abap coding_standards_v2_0_tZ abap coding_standards_v2_0_t
Z abap coding_standards_v2_0_tRasika Jayawardana
 
ABAP Coding Standards Reference Guide
ABAP Coding Standards Reference GuideABAP Coding Standards Reference Guide
ABAP Coding Standards Reference GuideStacy Taylor
 
Mohan Testing
Mohan TestingMohan Testing
Mohan Testingsmittal81
 
Db performance optimization with indexing
Db performance optimization with indexingDb performance optimization with indexing
Db performance optimization with indexingRajeev Kumar
 
Sql coding-standard-sqlserver
Sql coding-standard-sqlserverSql coding-standard-sqlserver
Sql coding-standard-sqlserverlochaaaa
 
Tips for Database Performance
Tips for Database PerformanceTips for Database Performance
Tips for Database PerformanceKesavan Munuswamy
 
Db2 sql tuning and bmc catalog manager
Db2 sql tuning and bmc catalog manager Db2 sql tuning and bmc catalog manager
Db2 sql tuning and bmc catalog manager Krishan Singh
 
Pl sql best practices document
Pl sql best practices documentPl sql best practices document
Pl sql best practices documentAshwani Pandey
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performanceguest9912e5
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsDave Stokes
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.combigclasses.com
 
Abap performance tunning tips
Abap performance tunning tipsAbap performance tunning tips
Abap performance tunning tipsJay Dalwadi
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1ReKruiTIn.com
 
White paper on Spool space in teradata
White paper on Spool space in teradataWhite paper on Spool space in teradata
White paper on Spool space in teradataSanjeev Kumar Jaiswal
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsNirav Shah
 
Interview qq
Interview qqInterview qq
Interview qqsuryaaaaq
 
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERSIICT Chromepet
 
Sydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexesSydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexespaulguerin
 
How to Fine-Tune Performance Using Amazon Redshift
How to Fine-Tune Performance Using Amazon RedshiftHow to Fine-Tune Performance Using Amazon Redshift
How to Fine-Tune Performance Using Amazon RedshiftAWS Germany
 
Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09guest9d79e073
 

Similar to Are you an abap coder or a programmer? (20)

Z abap coding_standards_v2_0_t
Z abap coding_standards_v2_0_tZ abap coding_standards_v2_0_t
Z abap coding_standards_v2_0_t
 
ABAP Coding Standards Reference Guide
ABAP Coding Standards Reference GuideABAP Coding Standards Reference Guide
ABAP Coding Standards Reference Guide
 
Mohan Testing
Mohan TestingMohan Testing
Mohan Testing
 
Db performance optimization with indexing
Db performance optimization with indexingDb performance optimization with indexing
Db performance optimization with indexing
 
Sql coding-standard-sqlserver
Sql coding-standard-sqlserverSql coding-standard-sqlserver
Sql coding-standard-sqlserver
 
Tips for Database Performance
Tips for Database PerformanceTips for Database Performance
Tips for Database Performance
 
Db2 sql tuning and bmc catalog manager
Db2 sql tuning and bmc catalog manager Db2 sql tuning and bmc catalog manager
Db2 sql tuning and bmc catalog manager
 
Pl sql best practices document
Pl sql best practices documentPl sql best practices document
Pl sql best practices document
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
 
Abap performance tunning tips
Abap performance tunning tipsAbap performance tunning tips
Abap performance tunning tips
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
 
White paper on Spool space in teradata
White paper on Spool space in teradataWhite paper on Spool space in teradata
White paper on Spool space in teradata
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
Interview qq
Interview qqInterview qq
Interview qq
 
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
 
Sydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexesSydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexes
 
How to Fine-Tune Performance Using Amazon Redshift
How to Fine-Tune Performance Using Amazon RedshiftHow to Fine-Tune Performance Using Amazon Redshift
How to Fine-Tune Performance Using Amazon Redshift
 
Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09
 

More from SAPYard

Flow Chart to get Free access to SAP HANA Cloud Platform
Flow Chart to get Free access to SAP HANA Cloud PlatformFlow Chart to get Free access to SAP HANA Cloud Platform
Flow Chart to get Free access to SAP HANA Cloud PlatformSAPYard
 
SAP HANA for Beginners from a Beginner
SAP HANA for Beginners from a BeginnerSAP HANA for Beginners from a Beginner
SAP HANA for Beginners from a BeginnerSAPYard
 
Unwanted character ‘#’ in the short text print outs and reports sap yard
Unwanted character ‘#’ in the short text print outs and reports   sap yardUnwanted character ‘#’ in the short text print outs and reports   sap yard
Unwanted character ‘#’ in the short text print outs and reports sap yardSAPYard
 
bgRFC Framework in SAP
bgRFC Framework in SAPbgRFC Framework in SAP
bgRFC Framework in SAPSAPYard
 
Vistex Chargeback
Vistex ChargebackVistex Chargeback
Vistex ChargebackSAPYard
 
Vistex Contract Overview
Vistex Contract OverviewVistex Contract Overview
Vistex Contract OverviewSAPYard
 
Quick Help in Vistex Technical
Quick Help in Vistex TechnicalQuick Help in Vistex Technical
Quick Help in Vistex TechnicalSAPYard
 
Simple SAP Security Breach !!
Simple SAP Security Breach !!Simple SAP Security Breach !!
Simple SAP Security Breach !!SAPYard
 
Hello SAP Ehp7 !!
Hello SAP Ehp7 !!Hello SAP Ehp7 !!
Hello SAP Ehp7 !!SAPYard
 
Offshore development model in 10 steps sap yard
Offshore development model in 10 steps   sap yardOffshore development model in 10 steps   sap yard
Offshore development model in 10 steps sap yardSAPYard
 

More from SAPYard (10)

Flow Chart to get Free access to SAP HANA Cloud Platform
Flow Chart to get Free access to SAP HANA Cloud PlatformFlow Chart to get Free access to SAP HANA Cloud Platform
Flow Chart to get Free access to SAP HANA Cloud Platform
 
SAP HANA for Beginners from a Beginner
SAP HANA for Beginners from a BeginnerSAP HANA for Beginners from a Beginner
SAP HANA for Beginners from a Beginner
 
Unwanted character ‘#’ in the short text print outs and reports sap yard
Unwanted character ‘#’ in the short text print outs and reports   sap yardUnwanted character ‘#’ in the short text print outs and reports   sap yard
Unwanted character ‘#’ in the short text print outs and reports sap yard
 
bgRFC Framework in SAP
bgRFC Framework in SAPbgRFC Framework in SAP
bgRFC Framework in SAP
 
Vistex Chargeback
Vistex ChargebackVistex Chargeback
Vistex Chargeback
 
Vistex Contract Overview
Vistex Contract OverviewVistex Contract Overview
Vistex Contract Overview
 
Quick Help in Vistex Technical
Quick Help in Vistex TechnicalQuick Help in Vistex Technical
Quick Help in Vistex Technical
 
Simple SAP Security Breach !!
Simple SAP Security Breach !!Simple SAP Security Breach !!
Simple SAP Security Breach !!
 
Hello SAP Ehp7 !!
Hello SAP Ehp7 !!Hello SAP Ehp7 !!
Hello SAP Ehp7 !!
 
Offshore development model in 10 steps sap yard
Offshore development model in 10 steps   sap yardOffshore development model in 10 steps   sap yard
Offshore development model in 10 steps sap yard
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 

Are you an abap coder or a programmer?

  • 1. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 1/8 Are you an ABAP coder or a programmer? TOPICS: ABAP Checklist Good Programming Practice Guidelines POSTED BY: SAP YARD OCTOBER 16, 2014 The difference between a normal programmer and a good programmer is, the latter keeps his/her basics right. Good programmers are distinguished by the quality of their deliverables. They provide enough documentation in their object so that the future practitioners supporting their product do not curse them. One of my Team Lead once told me, “your code should not only meet the functionalities, it should also be asthetically pleasing if someone happens to peep into it“. Today, in this post I do not want to bore you with the “Gyan” (Sanskrit word that roughly translates to Enter email Subscribe RECENT POSTS DELETING rows of the internal table within the LOOP. Is it a Taboo? A big NO NO? Quick Reference for Vistex Technical Offshore Development Model in 10 Steps SAP YARD YOUR BACKYARD FOR SAP TECHNICAL TIPS AND SOLUTIONS HOME SEE ALL POSTS ASK YOUR QUESTIONS ABOUT ME CONTACT ME You and 92 other friends like this SAP Yard 168 likes Liked SEARCH … 17 7 2 2
  • 2. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 2/8 “sermons/preachings”). But, I would like to provide a list of simple checks which every programmer should remember even in their sleep… Note: Numbers are only for bullet marker. It does not rate one higher to next. Every point has different weightage in different scenarios. 1) Define your variables with meaningful names (eg: instead of v_var1; v_material is more meaningful). Provide as much documentations/halfline comments as possible. Align your code and demarcate your blocks. Provide uniform spacing in between different units and remove dead codes. Clean code would reflect your personality.. 2) In the AT SELECTION-SCREEN event, use UP TO 1 ROWS (or count( * ) UP TO 1 ROWS) in the SELECT statement used for validating the data since the idea is just to ensure that at least 1 row will be considered for processing in the main selection event. 3) Internal table is defined with “TYPE STANDARD/SORTED/HASHED TABLE OF”  “INITIAL SIZE 0″ and work area is used instead of tables with HEADER LINES. If you have multiple internal tables of same type, you need not always define as many work areas. Same work area should be used across multiple internal tables, if they are of same type. 4) Declare  global internal tables only if they are expected to be used globally (across multiple subroutines) in the program. This is to avoid unnecessary memory usage as local internal tables are cleared from the memory on exiting the subroutine. 5) Wild cards like ‘A%’  should be avoided as much as possible. 6) Always SELECT INTO internal table, except when Ready Reckoner for SAP Developers Just a key and two clicks for ALV consistency check
  • 3. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 3/8 the table will be very large, use “UP TO N Rows” when the number of records needed is known. 7) Use “JIT”, Just In Time concept to select data when needed, use them and free them. Most programmers have the habit of selecting all the tables one by one first and then processing/massaging them later at the end. This practice burdens the system by unnecessary memory consumption by holding the data when they are not needed. SELECTs should be done when needed and FREE/REFRESH the tables as soon as it is used and not needed afterwards. 8) SORT fields and SORT Order on the SORT statement should be mentioned explicitly (e.g. SORT ITAB BY FLD1 ASCENDING FLD2 DESCENDING). 9) HASHED table is used for processing large amount of data (provided that you access single records only, and all with a fully specified key). 10) DELETE or SORT is not used on a HASHED table since it increases memory consumption. 11) Fields specified in the WHERE condition with the critical operators NOT and <> (negative SQL statements) cannot be used for a search using database indexes. Whenever possible formulate SQL statements positively. Avoid negation statements. 12) When IF or CASE, testing conditions are nested so that the most frequently true conditions are processed first. Also CASE is used instead of IF when testing multiple fields “equal to” something. 13) READ TABLE INTO WORKAREA should be used instead of only READ TABLE. If INTO work area is not needed then, use the addition TRANSPORTING NO FIELDS if the purpose of the read statement is only to check the existence of the record in that table.
  • 4. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 4/8 14) For copying internal tables use ‘=’ operator instead of LOOPing and appending. SORT inside a LOOP should be avoided. 15) Do not delete the records of internal table inside the LOOP — ENDLOOP. Instead mark the rows to be deleted by passing some identifier to the row field(s) and delete all those identified after the end of LOOP. Use Field Symbol, if you want to modify the fields of a table in the LOOP. Usage of field symbol would avoid modify statement inside the LOOP. 16) Use CONTROL BREAKS in the LOOP — ENDLOOP syntax to avoid repeated reading of other internal tables and for summarizing / updating the internal tables. 17) DELETE ADJACENT DUPLICATES entries from internal table before selection from database table using “ FOR ALL ENTRIES” statement. Applicable only in those cases where the table can possibly have duplicate entries. 18) Nested SELECT should not be used instead, “INNER JOIN” and/or “FAE” should be used. “FAE” is to be used over “LOOP at ITAB / SELECT / ENDLOOP”. 19) In SELECT statement, only the required fields should be selected  from the database table/structure/view. While using FOR ALL ENTRIES, make sure to SELECT all the primary keys even if you do not need some of them later as FAE retrieves unique result set.  For selecting single row from a database table, “SELECT UP TO 1 ROWS” is used (when you do not have full primary key for your WHERE clause). Always CHECK that the internal table used in FOR ALL ENTRIES is NOT empty. “SELECT SINGLE” is used only when full primary key combination is known.  Avoid SELECT * as much as
  • 5. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 5/8 possible. 20) When creating JOINs over database tables there should be an index at least on the inner table for the fields in the JOIN condition else use “ FOR ALL ENTRIES” SELECT statement. Ensure that the inner join uses the correct indexes. 21) SORT internal table by fields in the correct order, which are used in a READ TABLE statement using BINARY SEARCH. If the order of SORTING is invalid, the BINARY SEARCH will never work. And you would be scratching your head for a long time to find the root cause if you need to do dry run where issues could be replicated.. 22) Avoid MODIFY, use explicit INSERT or UPDATE; it is better for performance and support. MODIFY statement is more attractive to programmers because of the ease of usage. But, believe me, splitting your table entries to INSERT and UPDATE is still better, even though it might need one more select statements. Tried and Tested in real projects. 23) For large internal tables where only some rows are to be processed, use SORT and then the READ TABLE command is used to set index to first relevant row before LOOPing from that index. Use CHECK or IF… EXIT…ENDIF as appropriate to exit from the loop. Also called, Parallel Cursor technique. 24) SORTed table is used for range accesses involving table key or index accesses. SORTed tables are particularly useful in nested loop processing. LOOP AT ITAB with a WHERE condition is preferred where ITAB is a SORTED table (instead of STANDARD or HASHED internal table) and the fields used in the WHERE condition are the non-unique key fields of the sorted table.
  • 6. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 6/8 25) Use indexed table like VAPMA instead of VBAP to identify sales orders for a particular MATNR (i.e in situations when you have material and you do not have VBELN (sales order number) in hand). Similarly VAKPA etc. VBFA is used for forward search i.e. preceding to subsequent. For subsequent to preceding we should use alternate tables such as LIPS or VBRP (VBGEL, VGPOS). Try to use Views instead of joining multiple tables. 26) Run Code Inspector and Extended syntax checks with character literals checkbox switched on to rectify all relevant errors and warnings. SAP has provided this cool feature, please use it. Proudly flaunt the results with zero/ignorable warnings. 27) Use transaction code SCI/SCII to do the sanity check of your deliverables before passing it to the quality reviewers. Easy way to impress your reviewer. 28) Use transaction code ST05/ST12 to trace your code. Make sure to check what indices your database accesses are using. Check these indices against your “WHERE” clause to assure they are significant. Check other indices for this table and where you have to change your “WHERE” clause to use it. Create new indices if necessary after consulting your Basis team. For client dependant tables, use MANDT as the first field in the secondary index since it is internally considered by SAP when retrieving the data from the database tables. Please note, this article is not intended for Performance Tuning. This is an effort to remind the programmers about the simple checks which we should take care as part of good programming practice. Please feel free to suggest if you think something is missing. We would be happy to add them in this list.
  • 7. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 7/8 2 COMMENTS ON "ARE YOU AN ABAP CODER OR A PROGRAMMER?"   Previous post Next post Great staff, thanks a lot Dear William – Thank you so much for your feedback.. Glad that you like it. Regards, SAPYard. Leave a comment Your email address will not be published. Name *   Mutero william | July 30, 2015 at 12:50 pm | Reply SAP Yard | July 30, 2015 at 1:41 pm | Reply
  • 8. 8/11/2015 Are you an ABAP coder or a programmer? | SAP Yard http://www.sapyard.com/are­you­an­abap­coder­or­a­programmer/ 8/8 Raju Email * respond2raju@gmail.com Website Comment Post Comment COPYRIGHT 2015 | SAPYARD BY WWW.SAPYARD.COM ALL PRODUCT NAMES ARE TRADEMARKS OF THEIR RESPECTIVE COMPANIES. SAPYARD.COM IS NOT AFFILIATED TO SAP AG.