New Customer Creation

1. Create a new customer record and add all the necessary fields required for a successful customer create inside of SAP. If the customer number exists in SAP, it will update the record.

2. Map the fields in Maestro to their respective fields in the zpack. Notice how every object has a field called “Primary Key”.

3. Use a filter to only target the record we just added to Maestro

4. We are now ready to insert the new user into SAP. Behind the scenes, the connector runs the ZIMT.ZPACK.MDM.PROFISEE.WRITER zpack with the following payload:

{
  "COUNTER": 0,
  "PFS_NAME": null,
  "SAP_NAME": "KNA1",
  "paging": null,
  "LINES": [
    {
      "FIELDS": [
        {
          "FIELD_NAME": "NAME1",
          "VALUE_IN": "Francis Underwood",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "ORT01",
          "VALUE_IN": "Seattle",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "LAND1",
          "VALUE_IN": "US",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "KUNNR",
          "VALUE_IN": "0000089980",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "SPRAS",
          "VALUE_IN": "E",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "REGIO",
          "VALUE_IN": "WA",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "KTOKD",
          "VALUE_IN": "CUST",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "ANRED",
          "VALUE_IN": "0002",
          "VALUE_OUT": ""
        },
        {
          "FIELD_NAME": "SORTL",
          "VALUE_IN": "JC",
          "VALUE_OUT": ""
        }
      ],
      "LINE_NO": 0
    }
  ]
}

5. On success the response is

{
  "JSON": {
    "RESPONSE": [
      {
        "TYPE": "I",
        "ID": "",
        "NUMBER": "000",
        "MESSAGE": "Operation carried on",
        "LOG_NO": "",
        "LOG_MSG_NO": "000000",
        "MESSAGE_V1": "0000089980",
        "MESSAGE_V2": "",
        "MESSAGE_V3": "",
        "MESSAGE_V4": "/ZIMT/ZPACK_MDM_WRITER_PFS",
        "PARAMETER": "",
        "ROW": 0,
        "FIELD": "",
        "SYSTEM": ""
      }
    ]
  }
}

6. After creation in SAP, the connector will look at the member, build a composite primary key out of any fields that are primary in SAP and save it to the code column. Notice how the record’s code changed to 0000089980. This is because CustomerNumber is the only primary key for subobject KNA1, and the connector has assigned it a primary key.

Subobject Reading

1. Let’s see how a subobject with a complex primary key would work. In this case we will use the company codes subobject (KNB1).

2. We’ll target just company code objects that belong to CustomerNumber 0000000011 and just map over a few fields for demonstration

3. Now we execute this data transfer. The connector will take all the primary keys required for KNB1, sort them by alphabetical order, and create a colon separated primary key out of them. The result of the data read:

Subobject Update

1. Now let’s see what happens if we change an SAP primary key value inside of Maestro. We’ll change one record from Company Code ‘2222’ to ‘4444’ and one record from Customer 0000000011 to 0000000022.

2. Set up a map going the other direction. And filter it based on the customer number

3. Time to execute. Inside the connector, the code checks to see if the record has a primary key with a colon in it. If it does, it is considered an update, and the connector will parse out the old primary key values, and pair them up with the new values entered in Maestro. It then makes a call to the ZIMT.ZPACK.MDM.PROFISEE.WRITER with the following request data:

{
  "COUNTER": 0,
  "PFS_NAME": null,
  "SAP_NAME": "KNB1",
  "paging": null,
  "LINES": [
    {
      "FIELDS": [
        {
          "FIELD_NAME": "KUNNR",
          "VALUE_IN": "0000000011",
          "VALUE_OUT": "0000000011"
        },
        {
          "FIELD_NAME": "BUKRS",
          "VALUE_IN": "4444",
          "VALUE_OUT": "2222"
        }
      ],
      "LINE_NO": 0
    }
  ]
}

4. Back in Maestro we’ll see that the record we changed from company code ‘2222’ to ‘4444’ has had it’s primary key updated. The record where we changed the Customer Number did not write back, because it no longer is included in a filter based on Customer Number 0000000011 therefore the primary key was not touched by the SAP connector.

Leave a Reply

Your email address will not be published. Required fields are marked *