Converting Data into IDoc Segment Format

The physical format of the IDocs records is always the same. Therefore, the application data must be converted into a 1000 character string.

Fill the data segments which make up the IDoc :

An IDoc is a file with a rigid formal structure. This allows the correspondents to
correctly interpret the IDoc information. Were it for data exchange between SAPsystems
only, the IDoc segments could be simply structured like the correspondent DDIC structure of the tables whose data is sent.

However, IDocs are usually transported to a variety of legacy systems which do not run SAP. Both correspondents therefore would agree on an IDoc structure which is known to the sending and the receiving processes.

Transfer the whole IDoc to an internal table, having the structure of EDIDD :

All data needs to be compiled in an internal table with the structure of the standard
SAP table EDIDD. The records for EDIDD are principally made up of a header
string describing the segment and a variable length character field (called SDATA)
which will contain the actual segment data.

FORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' E_THEAD.

TABLES: THEAD.

MOVE-CORRESPONDING E:THEAD to Z1THEAD.
MOVE ‚Z1THEAD’ TO IDOC_DATA-SEGNAM.
MOVE Z1THEAD TO IDOC_DATA-SDATA.
APPEND IDOC_DATA.
ENDFORM.“

Fill control record :

Finally, the control record has to be filled with meaningful data, especially telling
the IDoc type and message type.

IF IDOC_CONTRL-SNDPRN IS INITIAL.

SELECT SINGLE * FROM T000 WHERE MANDT EQ SY-MANDT.
MOVE T000-LOGSYS TO IDOC_CONTRL-SNDPRN.

ENDIF.
IDOC_CONTRL-SNDPRT = 'LS'.

* Trans we20 -> Outbound Controls muss entsprechend gesetzt werden.
* 2 = Transfer IDoc immediately
* 4 = Collect IDocs

IDOC_CONTRL-OUTMOD = '2'. "1=imediately, subsystem
CLEAR IDOC_CONTRL.
IDOC_CONTRL-IDOCTP = 'YAXX_TEXT'.
APPEND IDOC_CONTRL.

(85)

RELATED POSTS

IDOC'S INBOUND PROCESS

IDOC'S BASIC TOOLS 2
IDOC'S BASIC TOOLS
ABAP IDOC'S PROCESSING
IDOC'S OUTLOOK
ABAP IDOC'S INTRODUCTION
IDOC'S MESSAGE CONTROL
DIFFERENCE BETWEEN IDOC AND BAPI
IDOC'S OUT BOUND TRIGGERING
outbound triggaring part 3
ale change pointers

creation of idoc data

1 comments:

  1. bijuk@hcl.in said...

    Hi ABAP Expert

    I have a small requirement about the CUA (message type Userclone) IDOCs. We are trying to create a report with information about IDOCs, wherein I have collect all the information like, IDOC Date, UserID, LastName, FirstName, E-mail ID,Alias Name, User group, Valid from and Valied thru date. These are, as you would be knowing, information related to user changes, which once being changed in the CUA server are transferred as IDOCs to CUA Client. We currently collect the information the Tx Code WE09, by expanding the each IDOC from the tree and then going into each of individial Idocs and copying and pasting the information there. Would request with you to kindly help in idebtifying the Table from where these information are picked.

Post a Comment

Search for SAP ABAP,CRM,ERP topics here