Sunday, January 17, 2010

IDOC

ALE EDI IDOC is the core values of SAP.

ALE

ALE allows us to assign SAP data to different sections of an enterprise based company and share the common data and exchange the data among sections and/or external SAP/non-SAP system.

ALE provides a platform for EDI. SAP EDI uses IDOC to exchange routine business data among different sections of an enterprise based business entity through ALE.

EDI

we know EDI is the reason to push SAP into successful IT world. Even XML and web services can do the same jobs as SAP EDI do, SAP EDI still are accepted by the top levels of global business entities. IDOC is the media used by EDI to pass/exchange data among different systems.

IDOC

SAP IDOC technique is complex. This is because SAP packages and BAPI are huge, Clients are unlimited, and non SAP systems are countless around the world. Why say so?

we can find the answer in SAP Netweaver.

Saturday, January 2, 2010

Transaction Codes

The first thing we need to do when we learn the SAP ABAP coding is to find out the assistance programs such as collecting system transaction codes . we can create our own ABAP report to list all transaction codes in SAP database. The report used RTTI codes to search all data in all tables in SAP.

REPORT Z_searchTABLES MESSAGE-ID z_allmes.
parameters: dbtab type c length 32,
cols type c length 132,
where type c length 132.
class gettableinfo definition.
public section.
class-methods main
importing
dbtab type csequence
cols type csequence
where type csequence. "-parameters is --CARRID EQ '002'
private section.
class-methods display
importing
value(result) type standard .
endclass.
class gettableinfo implementation.
method main.
data: field-symbols table.
desc=>describe_by_name(
exporting p_name = dbtab
receiving p_descr_ref = desc
exceptions type_not_found = 4 ).
if sy-subrc = 4.
message 'Type not found' type 'I' display like 'E'.
return.
endif.
try.
strc?= descr.
catch cx_sy_move_cast_error into error.
message error type 'I' display like 'E'.
return.
endtry.
find regex component-name in cols.
if sy-subrc <> 0.
" delete components index sy-tabix.
endif.
endloop.
try.
...
catch cx_sy_struct_creation cx_sy_table_creation into error.
message error type 'I' display like 'E'.
return.
endtry.
try.
create data table_ref type handle tabsc.
...
catch cx_sy_create_data_error into error.
message error type 'I' display like 'E'.
return.
endtry.
try.
select (cols)
from (dbtab) into corresponding fields of table table
where (where).
catch cx_sy_sql_error into error.
message error type 'I' display like 'E'.
return.
endtry.
display( ttable ).
endmethod.

method display.
DATA alv TYPE REF TO cl_salv_table.
TRY.
cl_salv_table=>factory(
IMPORTING r_salv_table = alv
CHANGING t_table = result ).
alv->display( ).
CATCH cx_salv_msg.
MESSAGE 'ALV display not possible' TYPE 'I'
DISPLAY LIKE 'E'.
ENDTRY.
endmethod.
endclass.

START-OF-SELECTION.
gettableinfo=>main( EXPORTING dbtab = dbtab
cols =cols
where =where ).


Run the report and then input the transaction codes table name. Search result will list out all transaction codes data.

ABAP Objects

ABAP Objects is the exciting OO based SAP programming technique. We need to get used to its concepts and then we can find out that how it is easy for us to create a SAP program such as a SAP report based on its class, object, attributes, methods, and function modules.

The following is the example:

class demo definition.
public section.
interfaces: inf_data.
class-methods main.
methods: getdata, showdata, deletedata, updatedata.
private section.
class-datas: count type i, input type c length 25. "---classic ABAP codes
endclass.

class demo implementation.
method main.
data dataclass type ref to cl_bapi_cc.
create object dataclass.
dataclass->insertdata( ).
getdata( ).
call function showdatainalv importing id exporting result_tab.
endmethod.
endclass.

start-of-selection.
demo=>main().

We define a class type, implement this class type, and finally start this class type as an object to run the program.

We can discover from the code that classic ABAP codes only are the subset of ABAP object codes.

some tips to learn SAP ABAP

Compared with .Net programming technique, SAP ABAP is mainly the business focused. From the point view of information system technology, SAP ABAP mainly is the language to develop the distributed multiple-tier SAP information systems.

frone tier:

SAP installed SAPGUI distributed SAP client software in different desktops. Software integrated client licenses and presentation logic into user desktop. Presentation logic included components to connect to the middle tier of Netwaver AS Web aplication server.

middle tier:

SAP Netweaver web application server is the middle tier of SAP system. It is the database based server to host all application logics of SAP system. ABAP programming mainly is using this application server to send user requests from client desktop to application server, to get responses from this application server back to the user desktop, and to process the requests and responses with various back-end database servers of SAP system such as MAXDB, SQL Server, ORacle, and DB2, etc.

backend tier:

SAP has a built-in database called MAXDB which can be used to store all ABAP programming codes and persistent data. When we create a simple ABAP program, we store codes in this database. When we run this simple program, SAP copied the codes into memory area and run it for you. If the program is not used anymore in the memory, the codes can be discarded automatically based on the SAP special garbage collection mechanism.

SAP ABAP uses its own syntax to build up the programs. Now the syntax is OO based. SAP successfully integrated ABAP basic syntax into OO technique and have had a brand new ABAP programming technique called ABAP Objects.

SAP ABAP

having been working over 4 years of asp.net web development, Luickly I got a new IT career to turn my attentions from .net programming area into SAP ABAP programming area due to the outperformance of my .net programming jobs.

At the beginging of getting SAP Netweaver 7.01 2009 training course from SAP Australia Pty Ltd, I felt excited and confused in matching my existing .net OO programming knowledge with ABAP workbench technique. I am struggling in getting familar with ABAP codes and programming technique.

After one month of continuing studying with SAP Netweaver software 2009 trial version, finally I can have a clear view of SAP technology. Based on the training from SAP, I upgraded my SAP knowledge and SAP programming skills based on the new ABAP Objects book from SAP Press com web site by myself. Now I can say I have gotten familiar with the modern SAP programming technique. I will create a serial review of SAP ABAP codes here to share ABAP knowledge with you.