cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

2 IDOC getting created for 1 Order in datahub

0 Likes
2,014

Hello,

We are upgrading datahub from 6.0 to 6.7.

Datahub is generating 2 IDOCs for single order. They are of type ORDERS01 and SALESORDER_CREATEFROMDAT202. Ideally only ORDERS01 should be created. We have overridden ORDERS01 in our custom order-target extension. But here both of these get created. Any suggestions for what I might be doing wrong are welcomed.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

mansurarisoy
Contributor
0 Likes

I think you defined ORDERS01 target item definitions from scratch, since in OOTB extensions SALESORDER_CREATEFROMDAT202 is sent for Order and ORDERS05 for cancellations. If you are not using saporder-target extension and your extensions do not depend on it, I suggest you to remove your extension list. This is the easiest way to prevent creation of SALESORDER_CREATEFROMDAT202 IDocs. But if you need saporder-target extension you have different options (as I know) to prevent IDoc creation.

1. Override item definitions with filterExpression attribute set as false. I think you need to define this for every item type of SALESORDER_CREATEFROMDAT202, but you may also try only for SALESORDER_CREATEFROMDAT202$EDI_DC40. This is the mandatory segment for IDocs, so just preventing this may prevent whole IDoc, but may give error. Just give a try.

Example of the item definition is as follows

<item>
	<type>SALESORDER_CREATEFROMDAT202$EDI_DC40</type>
	<exportCode>idockeyfield=SALESDOCUMENTIN</exportCode>
	<description>IDoc control header</description>
	<canonicalItemSource>CanonicalOrder</canonicalItemSource>
	<filterExpression>false</filterExpression>
	<attributes/>
</item>

2. In one of the projects, I created a custom GroupingHandler for this purpose. It was for products (saparticle extension) and the target system was HybrisCore but I believe it can work in this scenario as well.

CustomPublicationIgnoreHandler.java

package com.datahub.custom.publication.grouping;

import com.hybris.datahub.grouping.TargetItemCreationContext;
import com.hybris.datahub.grouping.ConfigurablePublicationGroupingHandler;
import com.hybris.datahub.model.CanonicalItem;

import java.util.Collections;
import java.util.List;
import java.util.Set;

public class CustomPublicationIgnoreHandler extends ConfigurablePublicationGroupingHandler {
    
    private final Set<String> targetItemTypes;

    public CustomPublicationIgnoreHandler(Set<String> targetItemTypes) {
        this.targetItemTypes = targetItemTypes;
    }

    public <T extends CanonicalItem> List<T> group(T item, TargetItemCreationContext context) {
        return Collections.emptyList();
    }

    public <T extends CanonicalItem> boolean isApplicable(T item, TargetItemCreationContext context) {
        String targetItemTypeCode = context.getTargetItemTypeCode();
        return this.targetItemTypes.contains(targetItemTypeCode);
    }

}

Spring definition:

<!-- Publication Ignore handler to not publish unnecessary Target Items --><br><bean id="customPublicationIgnoreHandler"<br>      class="com.datahub.custom.publication.grouping.CustomPublicationIgnoreHandler"><br>    <constructor-arg><br>        <set><br>            <value>SALESORDER_CREATEFROMDAT202$EDI_DC40</value><br>            <value>SALESORDER_CREATEFROMDAT202$E1SALESORDER_CREATEFROMDAT2$E1BPSDHD1</value><br>            <!-- Other types to ignore --><br>        </set><br>    </constructor-arg><br>    <property name="order" value="100" /><br></bean>

P.S. I changed the code according your needs, but not tested in my local. I believe it should work.

For more details for publication handler: https://help.sap.com/viewer/c65fa30c12ec4c2dbe04becf73f0943d/latest/en-US/c5d74a453cb84dfc8bff123912...

Hope this helps

0 Likes

Hello mansurarisoy,

Thanks a lot for taking the time and explaining things.

Yes, we have overridden ORDERS01 for adding some custom attributes in our order-target-extension. We have a dependency on sap-order extension so can not remove it. For now, I am trying to add your 1st solution to add filterExpression for SALESORDER_CREATEFROMDAT202$EDI_DC40. But seems like the compiler and datahub fail to understand it. Maybe it's not present in the default hybris xml schema. Here is the error I get -

 Error loading extension xyzorder-target-datahub-extension.xml: org.xml.sax.SAXParseException; lineNumber: 52; columnNumber: 12; cvc-complex-type.2.4.b: The content of element 'item' is not complete. One of '{"http://www.hybris.com/schema/":dependencies, "http://www.hybris.com/schema/":updatable, "http://www.hybris.com/schema/":status, "http://www.hybris.com/schema/":attributes}' is expected.
Is there any other schema that I need to add?Thanks
mansurarisoy
Contributor

Hi niraj18 ,

It looks like attributes is mandatory in item definition. Can you try by adding an empty tag like <attributes/> I think this should work. I am updating my initial answer as well

Hi,

Thanks that was the issue. I was able to build the target extension and now only one IDOC of type ORDERS01 is getting created. But now in IDOC the fields are not getting populated with the data provided. Previously in SALESORDER_CREATEFROMDAT202 following fields like sndprn, sndpor, rcvprn were getting populated correctly from the local.properties file or from configurations sent from hybris. But now in ORDERS01 IDOC it's taking default values from sapidocoutboundadapter.properties.

Does it have anything to do with the changes which we have done or is there something else which I need to do in order to get all the proper data from either local.properties or from hybris loaded configurations.

idoc=ORDERS01.IDOC[
edidc40=ORDERS01.IDOC.EDIDC40[
tabnam=EDI_DC40
mandt=000
docnum=986107057
status=03
direct=1
outmod=2
idoctyp=ORDERS01
cimtyp=YORDERS1
mestyp=ORDERS
sndpor=XXX
sndprt=LS
sndprn=XXX
rcvpor=SAP000
rcvprt=LS
rcvprn=SAP000
credat=20220316
cretim=074911
segment=1
]
Thanks a lot for your help. I am accepting this as an answer as it solved the initial issue I had.
mansurarisoy
Contributor
0 Likes

In default extensions, the fields are populated from the properties. Are you saying that the properties are not loaded as it should be? You can check it the properties loaded to Data Hub by activating logger. Follow the steps in: https://help.sap.com/viewer/c65fa30c12ec4c2dbe04becf73f0943d/latest/en-US/599465be2dd14ce3956b50ea8a...

0 Likes

I enabled that logger and I can see that all the properties are loaded in datahub while startup. But those properties are not coming in IDOC. We have these properties set -

But in IDOC Attached in my previous comment, you can see that even though the sndpor is set as HY_DHUB_US in properties it's coming as XXX. And the same for some other essential properties.

mansurarisoy
Contributor
0 Likes

If you are using a database with Data Hub, can you try to execute the following query to see what is DB record for transformation?

SELECT tad.attributename, 
tad.active, 
tad.transformationexpression,
tad.modifiedtime,
tim.itemtype,
tim.exportcode,
ts.targetsystemname,
cim.itemtype
  FROM [datahub_stg].[dbo].[TargetAttrDef] AS tad
  JOIN TargetItemMeta AS tim ON tim.id = tad.targetitemmetadata
  JOIN CanonicalItemMeta AS cim ON cim.id = tim.canonicalitemsource
  JOIN TargetSystem AS ts ON ts.id = tim.targetsystem
  WHERE tad.attributename LIKE '%rcvpor%';

0 Likes

Yes, I am using a database for Datahub. I ran the query you gave and here are the records for transformation -

+---------------+--------+---------------------------------------------------------------------------------+---------------------+--------------------------------------+------------------------------------+------------------+-----------------------------+
| attributename | active | transformationexpression | modifiedtime | itemtype | exportcode | targetsystemname | itemtype |
+---------------+--------+---------------------------------------------------------------------------------+---------------------+--------------------------------------+------------------------------------+------------------+-----------------------------+
| RCVPOR | 1 | 'HYBUSAOUT' | 2022-03-16 11:51:07 | ORDERS05$EDI_DC40 | idockeyfield=BELNR | SapErpSystem | CanonicalOrderCancelRequest |
| RCVPOR | 1 | receiverName?:'HYBUSAOUT' | 2022-03-16 11:51:07 | SALESORDER_CREATEFROMDAT202$EDI_DC40 | idockeyfield=SALESDOCUMENTIN | SapErpSystem | CanonicalOrder |
| RCVPOR | 1 | 'HYBUSAOUT' | 2022-03-16 11:51:08 | ORDERS05$EDI_DC40 | idockeyfield=BELNR | SapS4HanaSystem | CanonicalOrderCancelRequest |
| RCVPOR | 1 | receiverName?:'HYBUSAOUT' | 2022-03-16 11:51:08 | SALESORDER_CREATEFROMDAT204$EDI_DC40 | idockeyfield=SALESDOCUMENTIN | SapS4HanaSystem | CanonicalOrder |
| RCVPOR | 1 | @defaultSapTargetSystemInfoLookup.getAttributeValue('receiverName') | 2022-03-16 11:51:12 | DEBMAS07$EDI_DC40 | idockeyfield=KUNNR|sendorder=50 | SapErpSystem | CanonicalPartyRelationship |
| RCVPOR | 1 | @defaultSapTargetSystemInfoLookup.getAttributeValue('receiverName') | 2022-03-16 11:51:14 | ADR2MAS03$EDI_DC40 | idockeyfield=OBJ_ID|sendorder=30 | SapErpSystem | CanonicalPartyRelationship |
| RCVPOR | 1 | @defaultSapTargetSystemInfoLookup.getAttributeValue('receiverName') | 2022-03-16 11:51:14 | ADR3MAS03$EDI_DC40 | idockeyfield=OBJ_ID_P|sendorder=30 | SapErpSystem | CanonicalPartyRelationship |
| RCVPOR | 1 | @defaultSapTargetSystemInfoLookup.getAttributeValue('receiverName') | 2022-03-16 11:51:14 | DEBMAS07$EDI_DC40 | idockeyfield=KUNNR|sendorder=50 | SapS4HanaSystem | CanonicalPartyRelationship |
| RCVPOR | 1 | @defaultSapTargetSystemInfoLookup.getAttributeValue('receiverName') | 2022-03-16 11:51:14 | ADRMAS03$EDI_DC40 | idockeyfield=OBJ_ID|sendorder=30 | SapS4HanaSystem | CanonicalPartyRelationship |
| RCVPOR | 1 | receiverName!=null?receiverName:@sapReturnLogicalSystemLookup.getReceiverName() | 2022-03-16 11:51:17 | ORDERS05$EDI_DC40 | idockeyfield=BELNR | ErpSystem | CanonicalOrder |
+---------------+--------+---------------------------------------------------------------------------------+---------------------+--------------------------------------+------------------------------------+------------------+-----------------------------+
We use SAP Erp System.
mansurarisoy
Contributor
0 Likes

That's very strange your query did not return any results for ORDERS01 transformation you are using. Can you see any errors in the startup logs like "could not load" stating that an extension could not be loaded properly? And can you execute the query with the following WHERE clause instead of attributename?

tim.itemtype LIKE 'ORDERS01%'
0 Likes

Yes, there are 2 extensions that did not load sapcustomer-raw & customcustomer-raw with error -> [ValidationFailure{FATAL, rawAttribute: "Canonical attribute transformation cannot be modifiedCanonicalParty, title, RawDEBMAS"}]. But I guess these are realated to customer so it shouldn't affect order processing. And I ran query with ORDERS01 as item type and this is what I got from db ->

| attributename | active | transformationexpression      | modifiedtime        | itemtype                 | exportcode      | targetsystemname | itemtype                   |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| BELNR | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| ZTERM | 1 | paymentMode | 2022-03-16 11:51:12 | ORDERS01$E1EDK01 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| VSART | 1 | '01' | 2022-03-16 11:51:12 | ORDERS01$E1EDK01 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| AUGRU | 1 | 'INT' | 2022-03-16 11:51:12 | ORDERS01$E1EDK01 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Y1SDREF | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| BELNR | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Y1SDREF | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| XBLNR | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Y1SDREF | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Z1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| BELNR | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Z1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| LIFSK | 1 | commentqualf== null ?'' :'WW' | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Z1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| YYSHOPORDER | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Z1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| YYPROMO | 1 | promoCode | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Z1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| YYEMAIL | 1 | email | 2022-03-16 11:51:12 | ORDERS01$E1EDK01$Z1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| QUALF | 1 | qualfcode | 2022-03-16 11:51:12 | ORDERS01$E1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrderCodes |
| BELNR | 1 | qualfvalue | 2022-03-16 11:51:12 | ORDERS01$E1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrderCodes |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK02 | idockeyfield=ID | SapErpSystem | CanonicalOrderCodes |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK14 | idockeyfield=ID | SapErpSystem | CanonicalOrderOrganization |
| QUALF | 1 | organization | 2022-03-16 11:51:12 | ORDERS01$E1EDK14 | idockeyfield=ID | SapErpSystem | CanonicalOrderOrganization |
| ORGID | 1 | organizationID | 2022-03-16 11:51:12 | ORDERS01$E1EDK14 | idockeyfield=ID | SapErpSystem | CanonicalOrderOrganization |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK17 | idockeyfield=ID | SapErpSystem | CanonicalFreeFreight |
| QUALF | 1 | freeFreightQUALF | 2022-03-16 11:51:12 | ORDERS01$E1EDK17 | idockeyfield=ID | SapErpSystem | CanonicalFreeFreight |
| LKOND | 1 | freeFreight | 2022-03-16 11:51:12 | ORDERS01$E1EDK17 | idockeyfield=ID | SapErpSystem | CanonicalFreeFreight |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDK36 | idockeyfield=ID | SapErpSystem | CanonicalCardPayment |
| CCINS | 1 | creditCardType | 2022-03-16 11:51:12 | ORDERS01$E1EDK36 | idockeyfield=ID | SapErpSystem | CanonicalCardPayment |
| CCNUM | 1 | tokenizedPayment | 2022-03-16 11:51:12 | ORDERS01$E1EDK36 | idockeyfield=ID | SapErpSystem | CanonicalCardPayment |
| EXDATBI | 1 | abapDate(expiryDate) | 2022-03-16 11:51:12 | ORDERS01$E1EDK36 | idockeyfield=ID | SapErpSystem | CanonicalCardPayment |
| CCNAME | 1 | creditcardholdername | 2022-03-16 11:51:12 | ORDERS01$E1EDK36 | idockeyfield=ID | SapErpSystem | CanonicalCardPayment |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| PARVW | 1 | partnerRoleCode | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| PARTN | 1 | partnerId | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| IHREZ | 1 | documentAddressId | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| NAME1 | 1 | firstName | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| NAME2 | 1 | lastName | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| STRAS | 1 | street | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| ORT01 | 1 | city | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| STRS2 | 1 | houseNumber | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| LAND1 | 1 | countryIsoCode | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| PSTLZ | 1 | postalCode | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| REGIO | 1 | regionIsoCode | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| ORT02 | 1 | district | 2022-03-16 11:51:12 | ORDERS01$E1EDKA1 | idockeyfield=ID | SapErpSystem | CanonicalPartnerRole |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDKT1 | idockeyfield=ID | SapErpSystem | CanonicalOrderComment |
| TDID | 1 | commentqualf | 2022-03-16 11:51:12 | ORDERS01$E1EDKT1 | idockeyfield=ID | SapErpSystem | CanonicalOrderComment |
| TSSPRAS | 1 | commentlang | 2022-03-16 11:51:12 | ORDERS01$E1EDKT1 | idockeyfield=ID | SapErpSystem | CanonicalOrderComment |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDKT1$E1EDKT2 | idockeyfield=ID | SapErpSystem | CanonicalOrderComment |
| TDID | 1 | commentqualf | 2022-03-16 11:51:12 | ORDERS01$E1EDKT1$E1EDKT2 | idockeyfield=ID | SapErpSystem | CanonicalOrderComment |
| TDLINE | 1 | comment | 2022-03-16 11:51:12 | ORDERS01$E1EDKT1$E1EDKT2 | idockeyfield=ID | SapErpSystem | CanonicalOrderComment |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDP01 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| MENGE | 1 | quantity
0 Likes
| 2022-03-16 11:51:12 | ORDERS01$E1EDP01         | idockeyfield=ID | SapErpSystem     | CanonicalOrderItem         |
| POSEX | 1 | entryNumber | 2022-03-16 11:51:12 | ORDERS01$E1EDP01 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$E1EDP19 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| MENGE | 1 | quantity | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$E1EDP19 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| POSEX | 1 | entryNumber | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$E1EDP19 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| QUALF | 1 | '002' | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$E1EDP19 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| IDTNR | 1 | productCode | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$E1EDP19 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$Z1EDP02 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| MENGE | 1 | quantity | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$Z1EDP02 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| POSEX | 1 | entryNumber | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$Z1EDP02 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| MVGR1 | 1 | priceType== null ?'' : 'SP' | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$Z1EDP02 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| PSTYV | 1 | freeItem == null ?'' : 'TANN' | 2022-03-16 11:51:12 | ORDERS01$E1EDP01$Z1EDP02 | idockeyfield=ID | SapErpSystem | CanonicalOrderItem |
| ID | 1 | orderId | 2022-03-16 11:51:12 | ORDERS01$EDI_DC40 | idockeyfield=ID | SapErpSystem | CanonicalOrder |
| MESTYP | 1 | 'ORDERS' | 2022-03-16 11:51:12 | ORDERS01$EDI_DC40 | idockeyfield=ID | SapErpSystem | CanonicalOrder |

added 2nd comment cause whole result wont fit in single comment. This is the complete result when ran with ORDERS01 in Where clause.

mansurarisoy
Contributor
0 Likes

I think you define TargetItem for ORDERS01$EDI_DC40 without all the fields in your extension. Because you did not define all the attributes, DefaultIDocOutboundAdapter assigns default values to them in setIDOCFields() method. Try defining all attributes (or at least the ones you need to be correct) in your extension. That should resolve your problem.

0 Likes

I have defined all the fields required in my custom extension for ORDERS01 now.

I even hardcoded one of the fields but still I get the same IDOC from datahub with XXX fields populated from sapidocoutboundadapter. Below is the fields which I added for ORDERS01$EDI_DC40 type.

<item>
<type>ORDERS01$EDI_DC40</type>
<exportCode>idockeyfield=ID</exportCode>
<description>IDoc Control Header segment</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalOrder</canonicalItemSource>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>ID</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>orderId</transformationExpression>
<exportCode></exportCode>
<mandatoryInHeader>true</mandatoryInHeader>
</attribute>
<attribute>
<name>MESTYP</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>'${saporder.ordermessagetype}'</transformationExpression>
<exportCode />
<mandatoryInHeader>true</mandatoryInHeader>
</attribute>
<attribute>
<name>CIMTYP</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>'${saporder.extension}'</transformationExpression>
<exportCode />
<mandatoryInHeader>true</mandatoryInHeader>
</attribute>
<attribute>
<name>BELNR</name>
<transformationExpression>orderId</transformationExpression>
</attribute>
<attribute>
<name>MANDT</name>
<transformationExpression>'${targetsystem.saperp.mandt}'</transformationExpression>
</attribute>
<attribute>
<name>DOCNUM</name>
<transformationExpression>@sapIDocNumberSeriesGenerator.generate()</transformationExpression>
</attribute>
<attribute>
<name>MESTYP</name>
<transformationExpression>'${saporder.ordermessagetype}'</transformationExpression>
</attribute>
<attribute>
<name>SNDPOR</name>
<transformationExpression>'HY_DHUB_US'</transformationExpression>
</attribute>
<attribute>
<name>SNDPRN</name>
<transformationExpression>'${sapidocoutboundadapter.sendername}'</transformationExpression>
</attribute>
<attribute>
<name>RCVPOR</name>
<transformationExpression>'${targetsystem.saperp.receivername}'</transformationExpression>
</attribute>
<attribute>
<name>RCVPRN</name>
<transformationExpression>'${targetsystem.saperp.receivername}'</transformationExpression>
</attribute>
</attributes>
</item>
mansurarisoy
Contributor
0 Likes

I tried the your definition in my Data Hub extension. At first try it gave me the following error.

Failed to load extension from URL [jar:file:customextension-target.jar!/META-INF/customextension-datahub-extension.xml]
com.hybris.datahub.extensionloading.ExtensionImportException: Extension cannot be loaded, missing properties : saporder.extension

After defining saporder.extension property. I saw the following logs in terminal.

[c.h.d.e.l.i.TargetModelLoader] Loading target item Item{type='ORDERS01$EDI_DC40', description='IDoc Control Header segment', updatable=true, canonicalItemSource='CanonicalOrder', status=ACTIVE, attributes=Attributes{attribute=[Attribute{name='ID', collection=false', localizable=false', transformationExpression='orderId', exportCode='ExportCode{value='', expression='false}', mandatoryInHeader=true, secured=false, override=false, disabled=false}, Attribute{name='MESTYP', collection=false', localizable=false', transformationExpression=''SALESORDER_CREATEFROMDAT2'', exportCode='ExportCode{value='', expression='false}', mandatoryInHeader=true, secured=false, override=false, disabled=false}, Attribute{name='CIMTYP', collection=false', localizable=false', transformationExpression=''test'', exportCode='ExportCode{value='', expression='false}', mandatoryInHeader=true, secured=false, override=false, disabled=false}, Attribute{name='BELNR', collection=false', localizable=false', transformationExpression='orderId', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='MANDT', collection=false', localizable=false', transformationExpression=''000'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='DOCNUM', collection=false', localizable=false', transformationExpression='@sapIDocNumberSeriesGenerator.generate()', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='MESTYP', collection=false', localizable=false', transformationExpression=''SALESORDER_CREATEFROMDAT2'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='SNDPOR', collection=false', localizable=false', transformationExpression=''HY_DHUB_US'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='SNDPRN', collection=false', localizable=false', transformationExpression=''ZHYBRIS120'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='RCVPOR', collection=false', localizable=false', transformationExpression=''SAPSHD120'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}, Attribute{name='RCVPRN', collection=false', localizable=false', transformationExpression=''SAPSHD120'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}]}, expression=null}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='ID', collection=false', localizable=false', transformationExpression='orderId', exportCode='ExportCode{value='', expression='false}', mandatoryInHeader=true, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='MESTYP', collection=false', localizable=false', transformationExpression=''SALESORDER_CREATEFROMDAT2'', exportCode='ExportCode{value='', expression='false}', mandatoryInHeader=true, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='CIMTYP', collection=false', localizable=false', transformationExpression=''test'', exportCode='ExportCode{value='', expression='false}', mandatoryInHeader=true, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='BELNR', collection=false', localizable=false', transformationExpression='orderId', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='MANDT', collection=false', localizable=false', transformationExpression=''000'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='DOCNUM', collection=false', localizable=false', transformationExpression='@sapIDocNumberSeriesGenerator.generate()', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='MESTYP', collection=false', localizable=false', transformationExpression=''SALESORDER_CREATEFROMDAT2'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='SNDPOR', collection=false', localizable=false', transformationExpression=''HY_DHUB_US'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='SNDPRN', collection=false', localizable=false', transformationExpression=''ZHYBRIS120'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='RCVPOR', collection=false', localizable=false', transformationExpression=''SAPSHD120'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}
[c.h.d.e.l.i.TargetModelLoader] Loading target attribute Attribute{name='RCVPRN', collection=false', localizable=false', transformationExpression=''SAPSHD120'', exportCode='null', mandatoryInHeader=false, secured=false, override=false, disabled=false}

And in DB the following query gave me the correct results.

SELECT tad.attributename, 
tad.active, 
tad.transformationexpression,
tad.modifiedtime,
tim.itemtype,
tim.exportcode,
ts.targetsystemname,
cim.itemtype
  FROM TargetAttrDef AS tad
  JOIN TargetItemMeta AS tim ON tim.id = tad.targetitemmetadata
  JOIN CanonicalItemMeta AS cim ON cim.id = tim.canonicalitemsource
  JOIN TargetSystem AS ts ON ts.id = tim.targetsystem
  WHERE tim.itemtype = 'ORDERS01$EDI_DC40'

Result:

Can you try to trace the logs to find anything suspicious to prevent extension from loading?

Hello mansurarisoy,

Thank you so much for your help. It's working now. There were no errors in log but I rebuilt the jar once more and it's working now. I am getting all the data populated in the IDOC correctly and I am able to send the order to SAP Backend. Your answer on another post related to datahub regarding the IFC Path change also helped me. Thanks once again.

mansurarisoy
Contributor

I am glad I could help 🙂

Answers (0)