Scenario description
For adding BOM lines to an Itemcode you have an API available (ue_api_wobom).
This is also possible via the Beas BSL.
Important NOTE
This BSL object has not yet been officially released. This means any support from Boyum side is chargeable as Premium Service.
Solution
You have to create a JSON string for adding a BOM Position.
Creation of the JSON string
In the following example the script variables that are to be filled have been noted as <stl.xxxxx>.
setvar=ls_json=&
{"BillOfMaterialId":"<stl.itemcode>","ItemCode":"<stl.art1_id>","LineNumber":<stl.pos_id>, &
"INPUT_QTY":<stl.menge_verbrauch>, &
"Position":"<stl.pos_text>", "SortId":<stl.sortid>,"Active":"<stl.aktiv>", &
"Length":<stl.abm1>,"Width":<stl.abm2>,"Height":<stl.abm3>,"WarehouseId":"<stl.whscode>", &
"RoundingType":<v_roundbom>,"RoundingDecimal":<stl.round_dec>, &
"UDF1":"<stl.udf1>","UDF2":"<stl.udf2>","UDF3":"<stl.udf3>","UDF4":"<stl.udf4>"}
Create an instance of the JSON string and create a BOM line
// create the instance for the BSL object
instance bsl b
// create new BOM line
b.post=BillOfMaterialLine=<ls_json>
if <b.ret_code> n<> 0 then
message=error$**$Error writing BOM entries: <b.ret_text>
return failure
end if
Example for creating a full BOM (multiple lines)
// destroy existing old STL-Object
destroy=stl
// declare a datastore for filling BOM lines to be created
declare=stl=ue_datastorevalues
// insert the BOM line fields which you want/need into the datastore. These field can be from an existing
// itemcode, from a text file or others
stl=select "ItemCode", &
case coalesce("POS_TEXT",'') when '' then "POS_ID" else "POS_TEXT" end as "POS_TEXT", &
"POS_ID", "SortId", 'J‘ as AKTIV","ART1_ID", &
"MENGE_VERBRAUCH","MENGE_JE","AUSSCHUSS","ABM1","ABM2","ABM3", &
coalesce("UserText",'') as "UserText", &
"WhsCode","INFO","UDF1","UDF2","UDF3","UDF4","ROUND_TYPE","ROUND_DEC" &
from "BEAS_STL" &
where "ItemCode" = <my_itemcode,dbstring> &
order by “POS_ID”
// read the datastore line by line for inserting to Itemcode
for loop=1 to <stl.rowcount>
stl.setrow=<loop>
setvar=ls_json=&
{"BillOfMaterialId":"<stl.itemcode>","ItemCode":"<stl.art1_id>","LineNumber":<stl.pos_id>, &
"INPUT_QTY":<stl.menge_verbrauch>, &
"Position":"<stl.pos_text>", "SortId":<stl.sortid>,"Active":"<stl.aktiv>", &
"Length":<stl.abm1>,"Width":<stl.abm2>,"Height":<stl.abm3>,"WarehouseId":"<stl.whscode>", &
"RoundingType":<v_roundbom>,"RoundingDecimal":<stl.round_dec>, &
"UDF1":"<stl.udf1>","UDF2":"<stl.udf2>","UDF3":"<stl.udf3>","UDF4":"<stl.udf4>"}
// Create instance
instance bsl b
// Create BOM entry to Itemcode
b.post=BillOfMaterialLine=<ls_json>
// check if error comes up during creation
if <b.ret_code> n<> 0 then
message=error$**$Error writing BOM entries: <b.ret_text>
// stop insertion in case of an error
goto=next_end
end if
next
[next_end]
// destroy stl-Object
destroy=stl
Comments
0 comments
Please sign in to leave a comment.