When working with IDoc entities, you can create the execution payload with the segment handler utility.
Before you begin
Role required: admin
When using the API
withJSON(Object data), you can create the JSON manually or use the segment handler utility method explained in this topic. For detailed information about the API, see the following:
Procedure
-
Navigate to .
-
Create or paste a code snippet.
For example:
var obj = new SegmentHandler('460d3ff2ff5de210d3a2fffffffffff8');
// Create first E1EDK01
let k01_1 = obj.addSegment("E1EDK01")
.addField("BELNR", "1000")
.addField ("CURCY", "USD");
// Create another E1EDK01
let k01_2 = obj.addSegment("E1EDK01")
.addField("BELNR", "2000")
.addField("CUECY", "EUR");
// Create E1EDP01 with nested segments
let p01 = obj.addSegment("E1EDP01")
.addField("MENGE", "50")
.addField("POSEX", "0010");
let p20 = p01.addSegment("E1EDP20")
.addField("AMENG", "10")
.addField("WMENG", "5");
p20.addSement("E1EDP19")
addField("IDTNR", "MAT01"):
gs.info(JSON.stringify(obj.getData(), null, 2));
-
Select Run Script.
The payload is generated, for example:
sn_erp_integration: {
"data": {
"E1EDP01": [
{
"MENGE": "50",
"POSEX": "0010",
"E1EDP20": [
{
"AMENG": "10",
"WMENG": "5",
"E1EDP19": [
{
"IDTNR": "MAT01"
}
]
}
]
}
],
"E1EDK01": [
{
"BELNR": "1000",
"CURCY": "USD"
},
{
"BELNR": "2000",
"CURCY": "EUR"
}
]
}
}
Add the JSON in the withJSON(Object data) API and execute it in the query engine.