Translate

Saturday, 16 February 2013

Difference between.....


Difference between 
1. RFC and BAPI
2. Function Module & BAPI 
3. BAPI and BADI 
4. BADI and User-exit
5. User-exit & Customer exit.
6. Conversion & Interface
7. SAP Memory & ABAP Memory 
8. SELECT-OPTIONS & Ranges
9. SELECT single & SELECT upto 1 rows
10. Check Table & Value Table 
11. Table & Structure 
12. Fieldstrings & Structure 
13. Cluster Tables & Pool Tables 
14. End-of-Selection & End-of-Page
15. Joins & For All Entries 
16. SE01, SE09& SE10
17. Syntax Error &    Runtime Error
18. Check &   Continue
19. Default & Initialization
20. NACE &   TNAPR
21. /h, /hs &/ha
RFC
BAPI
1. RFC is the protocol used by SAP for remote communication, that is, for communications between remote (independent) systems. 
BAPI are RFC enabled function modules. The difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA.
In this case you only specify the business object and its method from external system in BAPI there is no direct system call. While RFC are direct system call.
2. RFC is used for communications between two independent SAP systems, or for communications between an SAP system and a non-SAP system, such as an external application. It can also be used for communications between modules on the same system.   

3. Using the RFC interfaces you can extend the functionality of R/3 applications from an external program. 

4. It is not possible to connect SAP to Non-SAP systems to retrieve data using RFC alone.
RFC can access the SAP from outside only through BAPI and same is for vice versa access.  

Function Module 

BAPI
Function module has a single bound functionality  while a BAPI object can contain many functionalities
Each Bapi Object has Interface, Key Fields, Attributes, Methods and Events.  
Bapi Function Modules can be attached to these Bapi objects
BDC 
BAPI
In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap system
Where as BAPI's are remotely enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.

BAPI

BADI
BAPI stands for Business API (Application Program Interface).
A BAPI is remotely enabled function module ie; it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI is standard SAP function modules provided by SAP for remote access. Also they are part of Business Object Repository (BOR).
A BADI is a Business Add-in - one of SAP's methods of implementing a user-exit or change to standard SAP code. BADI's are ABAP object based changes instead of the more common subroutines/function modules. 


BADI

USER-EXIT
BADI's can be used any number of times
USER-EXITS can be used only one time.
Ex: - if you're assigning a USER-EXIT to a project in (CMOD), then you can not assign the same to other project.
BADI's are oops based.


USER-EXIT

CUSTOMER EXIT
User exits are a type of system enhancement that were originally developed for the R/3 SD.
The SAP developer creates a special include in a module pool. These includes contain one or more subroutines that satisfy the naming convention userexit_<name>. The calls for these subroutines have already been implemented in the R/3 program.
A user exit is considered a modification, since technically objects in the SAP namespace are being modified.

User exit - A user exit is a three character code that instructs the system to access a program during system processing.

SXX: S is for standard exits that are delivered by SAP. XX represents the 2-digit exit number.
UXX: U is for user exits that are defined by the user. XX represents the 2-digit exit number
Customer exits are “hooks” provided by SAP within many standard programs, screens and menus on which customers may “hang” custom functionality to meet business requirements
There are three main types of customer exits: function module exits, screen exits and menu exits

Function Module Exit: allows customer to add code via a function module at a specific location in an SAP application program

Menu Exit: allows customer to add items to a pull down menu in a standard SAP program. These items may be used to call add-on programs or custom screens.

Screen Exit: allows customer to add fields to a screen in an SAP program via a subscreen. The subscreen is called within the standard screen’s flow logic.


CONVERSION

INTERFACE
Converting Legacy System DATA into a flat file
Converting Flat File into SAP
Conversion is one time process
Interface is periodic process.
Converting Legacy System DATA into a flat file:
Meaning that it is mainly a one shot deal for example: 
Bringing our  customer master to SAP from the legacy system, converting the fields used in legacy to the fields & values used in SAP.

Converting Flat File into SAP:

A program (or) group of programs that handle the passing of data from one system to another .These programs work together to export the data from one system & import into a target system ,may be these programs run once a day ,may be twice ,may every hour throughout the day .
It is a good way to keep the data in two (or ) more systems in sync with each other 



SAP MEMORY

ABAP MEMORY
SAP memory (also known as global memory), if the data has to be passed b/w two main sessions, we can use SAP Memory (SPA/GPA Parameters).  SAP Memory can also be used to pass data b/w internal sessions.
Within a main session, when ever you start an application program, it opens up an internal sessions with in the main session. The internal session has a memory area that contains the ABAP program and its associated data.  So when ever you want to pass data between two internal sessions, then you can use ABAP Memory (i.e. import, export). 

Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens .
The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements.







You can retain or pass data across internal sessions. The EXPORT TO MEMORY andIMPORT FROM MEMORY statements allow you to write data to, or read data from, the ABAP memory. 



SELECT-OPTIONS

RANGES
Here both SELECT-OPTIONS & RANGES works for the same purpose.  They both are used for the range selection from selection screen.  The main diff. between them is :


While we use SELECT-OPTIONS, system implicitly creates the select options internal table which contains the fields of SIGN, OPTION, LOW & HIGH.

In case of RANGES, this internal table should be defined explicitly. 

Example 1: 
REPORT YARSELECT. 


TABLES YTXLFA1. 
SELECT-OPTIONS : VENDOR FOR TXLFA1-LIFNR. 
INITIALIZATION. 
VENDOR-LOW    =   1000.   " It specifies the range starting value. 
VENDOR-HIGH    =   2000.  " It specifies the range ending value. 
VENDOR-OPTION  =  'BT'.  " specifies ranges value is in between. 
VENDOR-SIGN      = 'I'.       "specifies both inclussive.

APPEND VENDOR. 
- - - - 
- - - - 
SELECT LIFNR LAND1 NAME1 
FROM LFA1
 INTO TABLE ITAB

WHERE LIFNR IN VENDOR. 
Example 2:


select-options: bukrs for zstock-bukrs. 
  
Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look like this: 
  
IEQABFI 
  
This is because BUKRS is set as a table as follows: 
  



begin of bukrs occurs 0, 
  SIGN(1)    type c, 
  OPTION(2) type c, 
  LOW         like bukrs, 
  HIGH         like bukrs, 
end of bukrs. 
  
Now, when you create the following range, it will have the exact same fields set inside its table: 
  

REPORT YARRANGE. 


TABLES YTXLFA1. 
RANGES: VENDOR FOR YTXFLA1-LIFNR. 

- - - -  
- - - -- 
- - - -  




SELECT LIFNR LAND1 NAME1 
FROM LFA1 
INTO TABLE ITAB  


WHERE LIFNR IN VENDOR. 
Here with RANGES  user has to design an internal table with fields -  
SIGN,OPTION,LOW and HIGH EXPLICITLY. 
-----------------------------------------------------
Now, when you create the following range, it will have the exact same fields set inside its table: 
  
Ranges: bukrs for zstock-bukrs. 
  
The difference is, because ranges doesn't show on the selection screen, you will have to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low & bukrs-high all manually.

  


Some Tips: 
Sign is always I (for Include) or E (for Exclude) 
Option can be a whole range, which includes: 
EQ        (Equal)  
BT        (Between))  
CP        (Contain Pattern) 
So let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow: 
  
ranges: bukrs for zstock-bukrs. 
  
bukrs-sign = 'E'.             "Exclude 
bukrs-option = 'CP'.        "Pattern 
bukrs-low = 'AB*'.            "Low Value 
bukrs-high = ''.                "High Value 
append bukrs. 
  
Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.







SELECT upto 1 rows
The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. 


The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. 

The most important thing to remember about theSELECT SINGLE is
There are several things to remember:
1) It retrieves only one row
2) It does not need an ENDSELECT statement
3) THE FULL KEY OF THE TABLE MUST BE INCLUDED IN 
THE WHERE CLAUSE OF THE SELECT STATEMENT

Select single * will fetch the first matching value into a work area.
Select upto fill fetch all the values and fill the internal table with first matching record.
single * will use work area
Select upto 1 rows will use internal table.



Check Table 

Value Table
Check table Validates the data - because it contains all valid set of values .


Value table doesn't validates the data.
This is nothing but a Parent & Child relationship . Here data can be maintained at client level , no development involved.
Value table is maintained at domain level


Table  

Structure 
Represent the Database Tables where data actually resides.

Are record declarations that do not correspond to a Database Table.
Just like user-defined data type.

Tables can be defined independently of the database in the ABAP Dictionary
Defined like a table and can then be addressed from ABAP/4 programs. 

The fields of the table are defined with their (database-independent) ABAP/4 data types and lengths.

Structures contain data only during the runtime of a program.


Tables which exists at the underlying DB
Structures doesnot exists at the Underlying DB

Filed Strings

Structure 
There is no differnts b/w field string and structure both are same...but 

The term field string is used in program
the term structure is used in tables.

Both are used to declare a group of common variables/field that is frquently used in sap.

Field string can hold one record at a time.
Structure contains data temporarily during program run time.
No database table are generated from it.
field string is the one we create in programs,classes,Fms,etc...these
structure is the one we create in the data dictionary.these are global




Cluster Tables 

Pool Tables
The data from several (Small) different tables can be stored together in a Table pool or Table cluster.
(Large) tables assigned to a Table pool or Table cluster are referred to as Pooled tables or Cluster tables.





A cluster table is similar to a pooled table. It has a many-to-one relationship with a table in the database. Many cluster tables are stored in a single table in the database called a table cluster. 

A pooled table in R/3 has a many-to-one relationship with a table in the database.
Table Clusters
Several logical data records from different cluster tables can be stored together in one physical record in a Table cluster.
A Cluster key consists of a series of freely definable key fields and a field (Pageno) for distinguishing continuation records. 
A Cluster also contains a long field (Vardata) that contains the contents of the data fields of the cluster tables for this key. 
If the data does not fit into the long field, continuation records are created. Control information on the structure of the data string is still written at the beginning of the Vardata field.
The intersection of the key fields of the cluster tables forms the Primary key of the Table cluster.

Table Pools
A Table pool or Table cluster should be used exclusively for storing internal control information
(screen sequences, program parameters, temporary data, continuous texts such as documentation). 
Data of commercial relevance is usually stored in transparent tables.
A table in the database in which all records from the pooled tables assigned to the table pool are stored corresponds to a Table pool.
The Table pool's primary key consists of two fields:
1) TABNAME for the name of a pool table
2) VARKEY for the interdependent contents of the key fields in the corresponding pool table.
The table in the database has a different name than the tables in the DDIC, it has a different number of fields, and the fields have different names as well. Pooled tables are an SAP proprietary construct. 





END-OF-SELECTION

END-OF-PAGE
Will trigger at the end f every page
Will trigger only once at the end of processing all the events.

END-OF-SELECTION is the last of the events called by the runtime environment to occur. It is triggered after all of the data has been read from the logical database, and before the list processor is started
To define page footer, use the END-OF-PAGE event. This event occurs if, while processing a list page, the system reaches the lines reserved for the page footer, or if the RESERVE statement triggers a page break. Fill the lines of the page footer in the processing block following the event keyword END-OF-PAGE
END-OF-SELECTION occurs after all the database related SELECT statements have finished their execution.
So,END-OF-SELECTION occurs before END-OF-PAGE bcoz
database fetch is completed before displaying the report.

when a report is written and when a new page begins,
the top-of-page event is triggered and the statements in this event block are executed.
Like-wise when the end of the page is reached,theEND-OF-PAGE event is triggered and the statements in this event block are triggered.

The END-OF-PAGE is decided by the size of the page which is determined by the LINE-COUNT addition in the REPORT statement.



JOINS 

FOR ALL ENTRIES 
Joins are used to fetch data from two database table based on certain joining condition.

For all entries is used to fetch data from database table based on the data present in the internal table.
Join statement is used to create a view on two or more tables that is we can select the entries from two or more tables simultaneously.. Like if we want VBAK (SO header tab) and VBAP (SO item tab) details in single work area we go for join statement.
For all entries option is used when we want to select data into the table on the basis of already existing internal table data. Like we have SO header details in vbak_itab internal table and now we want SO item details in separate vbap_itab then we will go for this option...


SE01
SE09
SE10
To display the workbench Requests
Workbench Request and it is client specific
Customizing Requests which is Global
Especially for administrative purpose means administrator can achieve all the tasks from here

workbench requests related to developers to make the changes
Customizing requests related to business analysts

Syntax Error
Runtime Error
Syntax error means you are not using proper syntax in coding
Runtime error means syntax is correct but you are trying to do some operation whih is logically not possible like 

the error which occurs during runtime.....
for example: if u give 5/0...then it gives runtime error.
if u declare a internal table with 5 feilds and u select4 feilds and try to place in internal table...it gives runtime error.
A program with a syntax error cannot be executed.



The program with a runtime error can be executed but dumps under certain conditions.

Example: You have a division statement in 
Your program. If for some reason the denominator becomes zero then you will get a runtime error (something like DIVISION_BY_ZERO).
Syntax errors are static error that can be detected by the compiler
Runtime errors are dynamic error that cannot be detected by the compiler.



Check
Continue
check is conditional
DO 4 TIMES.
  CHECK sy-index > 2.
  WRITE sy-index.
ENDDO.

*output:*3 4
continue is non conditional

DO 4 TIMES.
  IF not sy-index > 2.
    CONTINUE.
  ENDIF.
  WRITE sy-index.
ENDDO.


*output:*3 4
Check statement is like IF and EXIT combined. That is if check statement fails then it skips the programming code next..
Continue statement is used inside the loops if we want to again start the loop with the same record thus there is no exit..


Default 
Initialization
Default is one of the selection screen statement used to default a value in a particular parameter in the selection screen
Initialization is a event in reports where you can initialize values in all types of fields in the selection screen

NACE
TNAPR
The transaction code where you can maintain the output types for the applications...
NACE - Initial Customizing Screen
where your going to attach the layout which u have designed to the particular output type - Specifies the kind of output to be produced.
The output type can specify, for example, a printed form that you need for internal use or a form that you want to send to a customer or vendor (for example, an order confirmation). The output type can also be an internal electronic mail message that you want to send to staff in another department.
Print program - If you want to inform a partner about changes to output that was already issued, you enter the name of a program and a routine in the Form routine field.
The routine in the program checks which changes should result in a changed output being sent.

TNAPR table has the details of the driver programs for Scripts and Smart forms.
In table TNAPR, pass the driver program name in PGNAM field. Smart form name is obtained in SFORM field.





/h
/hs
/ha
Start Debugger
Start System Debugging
Start Debugging without Screen Handling

1 comment:

Unknown said...

Good Information...