Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reporting Standards

Former Member
0 Likes
460

Hi All,

I am new to sap-abap programming .Can any one of you tell me the SAP standards that are to be followed while writing an abap program ?

Also can I use joins for the four tables at once . I heard that this would have performance issues so we ll go for 'For all entries' . Under what conditions does

joins and ' For all entries' are same in terms of performance wise.

4 REPLIES 4
Read only

Former Member
0 Likes
428

Hi.

Regarding table joins versus "for all entries":

A join is often the best way, even on several tables.

Note however that ABAP will not allow joins for certain tables.

The performance of the database query using a join of several tables depends on the underyling database (Oracle or whatever), not just on the SAP system. For example, Oracle may decide to use an inefficient data-retrieval plan.

It can also happen that an ABAP report runs fast for one set of selection criteria, but slowly for other criteria. For one of our reports, if you run it for all our companies, it runs fast if you go to the trouble of using the company select-option and listing every company, but if you do the logically equivalent thing of leaving the company select-option blank, then it takes about 10 times as long. The reason is that in one case the query that ABAP sends to Oracle prods Oracle into using a particular table index that it does not use in the other case.

So there is no simple answer.

I prefer to use joins where possible. When joins work well, they are better.

John

Read only

Former Member
0 Likes
428

Hi,

See the programming standards are given by your company to follow with..

Ex: use TY_name for cdeclaring types,

IT_TABLE for internal tables,

l_it_table for lacal internal tables,

gc_variable for global variables.. etc..

And regarding the fetching of data, Using FOR ALL ENTRIES is a better way in most of the cases..

regards,

nazeer

reward if useful

Read only

Former Member
0 Likes
428

Hi Madhu,

I am giving few points, hope it will help you.

1. All the objects that we develop must start only with <b>'Z' or 'Y'</b>, say whether it is a

report or a smart form or a table , data element, domain etc.

2. Kindly <b>avoid hard code</b> in your code, that is, avoid using ' ' , instead u can use text

elements for them.

3. Use <b>SY-SUBRC</b> after every <b>select statements</b> and also function modules.

4. The program flow of your report must be as follows:

INCLUDE

TABLES

TYPES (Including TYPE-POOLS)

CONSTANTS

DATA

INFOTYPES ( HR Specific)

INTERNAL TABLES

FIELD-SYMBOLS

FIELD-GROUPS

INSERT

CONTROLS

SELECT-OPTIONS

PARAMETERS

INITIALISATION

AT SELECTION-SCREEN

START-OF-SELECTION

GET

END-OF-SELECTION

AT LINE-SELECTION

AT PFXX

AT USER-COMMAND

TOP-OF-PAGE

END-OF-PAGE

FORM

CLASS

METHOD

INTERFACES

5. Use pretty printer for your program.

6.The naming conventions for a <b>select option or parameter must be so_ and pr_ </b>respectively.

7.The work area and internal table must be named<b> wa_ and it_</b> resp.

8. Use <b>'binary search'</b> for a READ statement.

9. Do the extended program check and code inspector check for your programs.

10.try to avoid select * instead use select matnr ernam.. etc.

Regards,

Thasneem

Reward if useful

Read only

Former Member
0 Likes
428

hi

Hi,

<b>inner join</b>

... FROM tabref1 [INNER] JOIN tabref2 ON cond

Effect

Selects data from the transparent database tables or views specified in tabref1 and tabref2. tabref1 and tabref2 either have the same form as in variant 1 or are themseleves joine expressions. The key word INNER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized in the ABAP-Dictionary.

In a relational data structure, it is quite normal for data that belongs together to be split up across several tables to help standardization (see relational database). To regroup this information in a database query, you can link tables using a join command. This formulates conditions for the columns of the tables involved. An inner join contains all combinations of lines from database table tabref1 with lines from database table tabref2 that meet the condition specified in the logical condition ON cond.

Inner join between table 1 and table 2 where column D sets the join condition:

... <b>FOR ALL ENTRIES</b> IN itab WHERE cond

Effect

Only selects the records that meet the logical condition cond when each replacement symbol itab-f is replaced with the value of component f of the internal table itab for at least one line of the table. SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records.

Got this from F1 help.

Refer F1 help for sample code.

<b>

Kindly reward points if u feel the answer helped u, </b>

regards

ravish