Manipulating messages in the IDOC domain
Use ESQL from a Compute node to copy the incoming IDoc to the outgoing IDoc, and manipulate the message.
About this task
A valid IDoc message flows out of SAP and is sent to the MQSeries® link for R/3.
When this IDoc has been committed successfully to the outbound IBM® MQ queue, the input node of the message flow reads it from that queue and generates the syntax element tree.
The Compute node manipulates this syntax element tree and, when it has finished, passes the output message to subsequent nodes in the message flow. When the message reaches the output node, the IDOC parser is called to rebuild the bit stream from the tree.
The message flow must create an output message in a similar format to the input message.
See Field names of the IDOC parser structures for the field names in the DC (Control Structure) and DD (Data Structure) that are recognized by the IDOC parser
Procedure
SET OutputRoot = InputRoot;
SET OutputRoot.IDOC.DC[1].tabnam = 'EDI_DC40 ';
SET OutputRoot.IDOC.DD[2].sdatatag.MRM.maktx = 'Buzzing all day';
Results
The first line of the code copies the incoming IDoc to the outgoing IDoc.
The second line sets the tabname of the first DC.
The third
line uses the second DD segment, which in this example is of type E2MAKTM001
,
and sets the maktx field.
Accessing fields of the IDoc using ESQL
About this task
After the sdatatag
tag in an
ESQL statement, the next tag is MRM
, which you must
enter manually, followed by the field name that is to be manipulated.
Specify the name of the field within the message segment here, not
the name of the message segment.
For example, the following code sets the segment name of the IDoc:
SET OutputRoot.IDOC.DD[I].segnam = 'E2MAKTM001';
The following example sets the msgfn
field
within the E2MAKTM001
segment:SET OutputRoot.IDOC.DD[I].sdatatag.MRM.msgfn = '006';