Your Ad Here

Saturday, January 17, 2009

How to do Unicode conversion in ABAP program

In Unicode enabled systems its important to use the correct method to add, remove or check control characters that represents Horizontal-Tab, Vertical-Tab, New-Line, Form-Feed etc. This can be achieved using constants defined as attributes of ABAP class cl_abap_char_utilities.

These control characters are required while reading data from a tab delimited format or any file in an ABAP program. Similarly it’s used to export data from an abap program to a file in tab delimited format or any other format.

CLASS cl_abap_char_utilities DEFINITION LOAD.

CONSTANTS: bs(1) TYPE c VALUE cl_abap_char_utilities=>backspace,
cr(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
crlf(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
ff(1) TYPE c VALUE cl_abap_char_utilities=>form_feed,
ht(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
lf(1) TYPE c VALUE cl_abap_char_utilities=>newline,
vt(1) TYPE c VALUE cl_abap_char_utilities=>vertical_tab,
mn(1) TYPE c VALUE cl_abap_char_utilities=>minchar,
mx(1) TYPE c VALUE cl_abap_char_utilities=>maxchar.


After defining these variables, it can be used along with “concatenate” statement while exporting file from ABAP program. And it can be used with “replace all occurrences of” statement while reading data from an external file in an ABAP program.

Tuesday, November 18, 2008

ALE – IDOC

What is an IDOC?

An IDoc is simply a data container that is used to exchange information between any two processes that can understand the syntax and semantics of the data.

IDOCs are stored in the database. In the SAP system, IDOCs are stored in database tables. IDOCs are independent of the sending and receiving systems.IDOCs are independent of the direction of data exchange. Several SAP applications use the robust IDOC interface. IDocs serve the basic purpose of transferring data from one application to another.

What is the difference between ALE and EDI?


ALE
Application Link Enabling
Used mostly for SAP to SAP communication. Used in Distributed servers system. E.g. Say a Company has a central server at its head office and local servers at its branches. ALE is used to keep all the servers synchronized.
Does not need EDI subsystem for communication.
ALE is an SAP terminology. ALE is integrated with SAP product.


EDI
Electronic Data Interchange
Used Mostly for communication between any 2 systems on different networks. E.g. Communication by a company with its Suppliers and Customers.
Needs a EDI subsystem for communication
EDI is a technology in itself. It has its own set of standards. SAP supports EDI through IDOCs.


There are three types of records in IDOC.

Control Record
It contains all of the control information about an IDOC. It includes the IDOC number, sender and receiver information, and information such as the message type it represents and the IDOC Type. Control records are stored in EDIDC table. It is stored in EDIDC table.

Data Records
It contains the application data. It is stored in EDIDD table. Data Records contains two parts Administrative Section and Data Section. Administrative Section consists of Idoc number, Segment Name, Segment number, Version, Segment Hierarchy etc. Data Section contains the data of respective segment. Data records are of EDIDD type of structure. It is stored in EDID4 table.

Status Records
Whenever a process is taken place, system will generate status records. We can identify the process with the number of status record.
Status 01 - 49 for Outbound Process and status 50 - 75 for Inbound Process.

When IDoc is processed the messages are:
01 - IDoc is created
30 - IDoc is ready for dispatch
03 - IDoc is processed

The status can be maintained using transaction WE47.

The two available processes in IDOCs are,

Outbound Process
When sending out the data from our system, the used IDOC is called as Outbound IDOC.

Inbound Process
When the data is coming in, the process is called Inbound Process and the IDoc is known as Inbound IDoc.

Partner Profile
Partner profile is used to define the parameters for the electronic interchange of data with a trading partner using the IDoc interface. To communicate with a partner using the IDoc interface partner profile should be defined.
Partner profile is defined using transaction code WE20.


Steps in creating an IDOC

Create Idoc Type ( WE30)

Go to transaction code WE30
Enter the Object Name, select Basic type and click Create icon
Select the create new option and enter a description for your basic IDOC type and press enter
Select the IDOC Name and click Create icon
The system prompts us to enter a segment type and its attributes
Choose the appropriate values and press Enter
The system transfers the name of the segment type to the IDOC editor.
Follow these steps to add more number of segments to Parent or as Parent-child relation
Save it and go back
Go to Edit -> Set release

Create Segment ( WE31)
Go to transaction code WE31
Enter the name for your segment type and click on the Create icon
Type the short text
Enter the variable names and data elements
Save it and go back
Go to Edit -> Set Release
Follow steps to create more number of segments

Create Message Type ( WE81)
Go to transaction code WE81
Change the details from Display mode to Change mode
After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter
Click New Entries to create new Message Type
Fill details
Save it and go back

Assign Idoc Type to Message Type ( WE82)
Go to transaction code WE82
Change the details from Display mode to Change mode
After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter.
Click New Entries to create new Message Type.
Fill details
Save it and go back


Assign FM to Idoc Type & Message Type
Go to transaction code WE57
Change the details from Display mode to Change mode
After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter
Click New Entries to create new Message Type
Fill details
Save it and go back

Characteristics of Inbound FM
Go to transaction code BD51
Change the details from Display mode to Change mode
After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter
Click New Entries to create new Message Type
Fill details
Save it and go back

Create Outbound process code ( WE41)
Go to transaction code WE41
Change the details from Display mode to Change mode
After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter.
Click New Entries to create new outbound process code.
Fill details
Save it and go back

Create Inbound process code ( WE42)
Go to transaction code WE42
Change the details from Display mode to Change mode
After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter.
Click New Entries to create new Inbound process code.
Fill details
Save it and go back


Test tool for IDoc Processing
Go to transaction code WE19
Enter the IDoc Number


There are two types of IDOCs

Basic IDOCs
Basic IDOC type defines the structure and format of the business document that is to be exchanged between two systems.


Extended IDOCs
Extending the functionality by adding more segments to existing Basic IDOCs.
 

Copyright © 2008 SAP nxt. All Rights Reserved.
All product names are trademarks of their respective companies. This blog is in no way affiliated with SAP AG or any of its subsidiaries.
Every effort is made to ensure the content integrity. Information used from this blog is at your own risk.

Free Domain & Hosting