cancel
Showing results for 
Search instead for 
Did you mean: 

Product Category Import Failures: CPI to Marketing Cloud

Former Member
0 Kudos
1,152

Hello experts,

I've created an iFlow for importing Product Category data, which uses the CPI oData adapter to import (upload) Product-related data to the yMarketing system via SAP's "API_MKT_PRODCAT_HIERARCHY_SRV" service.

The inbound payload file I've been provided looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<productCategoryUpload>
    <sequence>000000240</sequence>
    <source>PIM_MPE_NA</source>
    <timestamp>2019-03-05T15:00:02.997+01:00</timestamp>
    <productCategories>                    
        <productCategory>
            <hierarchiyid>BOSCHLINK</hierarchiyid>
            <id>21417</id>
            <parentId>21388</parentId>
            <name>Band Saw Blades</name>
            <description>Cuts better than I expected!</description>
            <language>en-us</language>
        </productCategory>
        <productCategory>
            <hierarchiyid>BOSCHLINK</hierarchiyid>
            <id>21480</id>
            <parentId>21392</parentId>
            <name>Carbide Hole Saws</name>
            <description>Sawing holes and taking names!</description>
            <language>en-us</language>
        </productCategory>
        <productCategory>
            <hierarchiyid>BOSCHLINK</hierarchiyid>
            <id>21694</id>
            <parentId>21679</parentId>
            <name>Belt/Disc Sanders</name>
            <description>This thing is awesome!</description>/>
            <language>en-us</language>
        </productCategory>
    </productCategories>
</productCategoryUpload>


I setup two separate oData calls, per info contained in the API_MKT_PRODCAT_HIERARCHY_SRV structure guide. They are configured like this:

Call #1 -- ProductCategories
Service Type: oData (v2)
API Name: API_MKT_PRODCAT_HIERARCHY_SRV
API Action: MERGE
Resource Path: ProductCategories('ProductHierarchyID'=ProductHierarchyID,'ProductCategoryID'=ProductCategoryID)
Batch Enabled: Yes
Payload (single item shown as original payload data is split on productCategory in CPI mapping):

<?xml version="1.0" encoding="UTF-8"?>
<batchParts>
    <batchChangeSet>
        <batchChangeSetPart>
            <method>MERGE</method>
            <ProductCategories>
                <ProductCategory>
                    <ProductHierarchyID>BOSCHLINK</ProductHierarchyID>
                    <ProductCategoryID>21417</ProductCategoryID>
                    <ParentProductCategoryID>21388</ParentProductCategoryID>
                </ProductCategory>
            </ProductCategories>
        </batchChangeSetPart>
    </batchChangeSet>
</batchParts>


Call #2 -- ProductCategoryNames
Service Type: oData (v2)
API Name: API_MKT_PRODCAT_HIERARCHY_SRV
API Action: MERGE
Resource Path: ProductCategories('ProductHierarchyID'=ProductHierarchyID,'ProductCategoryID'=ProductCategoryID)/ProductCategoryNames
Batch Enabled: Yes
Payload (single item shown as original payload data is split on productCategory in CPI mapping):

<?xml version="1.0" encoding="UTF-8"?>
<batchParts>
    <batchChangeSet>
        <batchChangeSetPart>
            <method>MERGE</method>
            <ProductCategoryNames>
                <ProductCategoryName>
                    <ProductHierarchyID>BOSCHLINK</ProductHierarchyID>
                    <Language>EN</Language>
                    <Name>Band Saw Blades</Name>
                    <Description>Cuts better than I expected!</Description>
                </ProductCategoryName>
            </ProductCategoryNames>
        </batchChangeSetPart>
    </batchChangeSet>
</batchParts>


I then ran several tests, which all completed without http errors, however, I noticed errors in the yMarketing Import Monitor, which look like this:

IM Error #1 -- ProductCategories
Message(s):

  • Invalid content in field Sap-Cuan-SequenceId
  • Unexpected error in method if_hpa_sa_handler~process

Data:

HIERARCHY_ID: BOSCHLINK
CATEGORY_ID: 21417
PARENT_CATEGORY_ID: 21388
CUAN_E_PROD_CAT:
CUAN_E_PCAT_TR:
SEQUENCE_ID:
SEQUENCE_NUMBER: 00000000000000000000
REQUEST_TIMESTAMP: 0.0
EXT_DOCUMENT_ID:
EXT_REFERENCE_ID:
OPERATION_NO: 1
    CUAN_S_COMPONENT:
        PROPERTY: PARENT_CATEGORY_ID
    CUAN_S_COMPONENT:
        PROPERTY: HIERARCHY_ID
    CUAN_S_COMPONENT:
        PROPERTY: CATEGORY_ID


IM Error #2 -- ProductCategoryNames
Message(s):

  • Invalid content in field Sap-Cuan-SequenceId
  • Unexpected error in method if_hpa_sa_handler~process

Data:

HIERARCHY_ID: BOSCHLINK
CATEGORY_ID: null
LANGU: E
NAME: Band Saw Blades
DESCRIPTION: Cuts better than I expected!
SEQUENCE_ID:
SEQUENCE_NUMBER: 00000000000000000000
REQUEST_TIMESTAMP: 0.0
EXT_DOCUMENT_ID:
EXT_REFERENCE_ID:
OPERATION_NO: 1
COMPONENTS:


My first thought is I need to include the Sequence ID or some other unique transaction identifier like Request Timestamp in my payloads, but am not sure if this can be done via the CPI "batchParts" outbound xml message.

<batchParts>
    <batchChangeSet>
        <batchChangeSetPart>
            . . .
        </batchChangeSetPart>
    </batchChangeSet>
</batchParts>

If possible, then what are the data element names and where must they be added? If not possible, then can you please provide some specifics (documentation, examples) on how this can be accomplished?

Best regards,

John

View Entire Topic
former_member247020
Active Participant
0 Kudos

Hi,

when using MERGE/PATCH you have to provide the Sap-Cuan-SequenceId with the Sap-Cuan-RequestTimestamp or Sap-Cuan-SequenceNumber.

You can add this as a message header in the Content Modifier or in the Message Mapping.
When doing this in the Message Mapping under <batchChangeSetPart> you find the corresponsing entities for mapping header values with header name and value. simple duplicate the <headers> subtree and create a mapping for Sap-Cuan-SequenceId and Sap-Cuan-RequestTimestamp or Sap-Cuan-SequenceNumber

  • Sap-Cuan-RequestTimestamp: check sequence of imports. data with lower sequence number is ignored
  • Sap-Cuan-SequenceNumber: check timestamp of imports. Data with older timestamp is ignored.

br,

Johannes


former_member576423
Participant
0 Kudos

Hi johannes.hirling , josef.ehbauer, kabras , schneidert , vervinckt.joyca : I am trying to upload the product category manually using csv, i am getting a weird error.

HIERARCHY_ID;CATEGORY_ID;PARENT_CATEGORY_ID;LANGU;NAME;DESCRIPTION

PRODH;PRODH;PRODH;EN;PRODH;PRODH

01;01;PRODH;EN;Winter;Winter

0101;0101;01;EN;Blazers;Blazers

Log Message:

Warning Attribute name DESCRIPTION,,, is invalid. Attribute values are ignored.

Can you assist what is the error?

I have tried with the template file as well and getting a same error. Shall i raise this with SAP Support ticket?

Regards,

Mayank

vervinckt_joyca
Active Contributor

Mayank,

Sounds like something is wrong with your CSV file.

In your error message, it shows three comma's after DESCRIPTION. Can you check if there's any spaces or tabs added at the end of the line? Best to check this with Notepad. Excel and CSV can often behave strange.

You indicate you have tried with the template file as well, did you download the template and immediately upload it again, without opening, changing, saving that template file?

Kr

Joyca