MII odyssey -How to pass Table structure to BAPI using JCo Interface of ERP System Interface in MII 12.
I have often come across several situations in XMII application which are easily manageable and some of them are extremely complex. These complex scenarios require understanding of ERP and XMII. However, here I would like to illustrate one of the scenarios which I came across while doing MII project.
Business would like to submit several related goods in to an operation and get a single confirmation for the operation rather than for each goods.
Mapping MII objects to structures in BAPI
In one of our MII project, Requirement was to pass more than one record to BAPI table and get single confirmation Number and Confirmation count. As there are very few threads on this, thought of writing a Blog which could be useful.
Our requirement was to do confirmation of PO/Operation. Each Operation may have one or more component list (materials) associated to accomplish the task. Component list information needs to be passed to GOODMOVEMENTS and LINK_CONF_GOODSMOV table and PO/Operation information to TIMETICKETS table.
This section gives step by step approach on how to map table structure to BAPI, i. e how to add multiple rows to BAPI tables. To Illustrate I have considered standard BAPI, BAPI_PRODORDCONF_CREATE_TT which is mainly used for doing confirmation in SAP.
Let’s see how multiple records are passed to GOODSMOVEMENTS and LINK_CONF_GOODSMOV, single record to TIMETICKETS, and get single confirmation number and count.
ERP System Interface-JCo Interface
Advantage of ERP System Interface- JCo Interface over SAP- JCo Interface.
ERP JCo Interface does all functionality in one single block like:
JCo Start Session,
JCo Function call,
JCo End Session.
Hence it avoids many action blocks in transaction. Hence I have taken ERP JCo interface.
Here are the Steps
1. Create Local/Transaction Parameter of type XML which has similar structure to node items of BAPI table. Say GOODSMOVEMENTS, LINK_CONF_GOODSMOV are two Items shown below which has similar row structure of BAPI table GOODSMOVEMENTS, LINK_CONF_GOODSMOV.
2. Create table nodes which has table structure same as created Items. Below figure shows TableGM and TableLINK_CONF pointing to GOODSMOVEMNETS structure and LINK_CONF_GOODSMOV structure.
3. Create Transaction for requirement. Simple Transaction is shown below for explanation.
4. Transaction has MaterialConfirmationQry_0 block which gets all component list used for Operation( multiple row output data)
5. Repeater_0 is configured to repeat on each row of MaterialConfirmationQry_0.
6. Assignment_0 contains mapping of each repeater row to transaction Items GOODSMOVEMENTS and LINK_CONF_GOODSMOV as shown in below Fig.
7. Assignment_1 maps these Items to transaction tables as shown in below figure. That is each Item is mapped to transaction TableGM/GOODSMOVEMENTS.Here select Append XML radio button in Link Type, so that each item is added one after other.
8. Finally Tables are now ready with multiple rows.Map this Transaction table to BAPI table in SAP_JCo_Interface_0 block links as shown in below figure. Select Assign XML in Link type while mapping table so that all records are mapped in XML. In below a row is added to TIMETICKETS table of BAPI (select Assign Value radio option for this).
9. Conditional_4 block contains check for BAPI success.
10. Conditional_1 block contains check for Return Type of DETAIL_RETURN table is I in BAPI Response.
11. Assignment_2 block for assigning transaction output variables with confirmation number, confirmation count, and Message from BAPI Response.