Beas Service Layer (BSL), add routing positions to an Itemcode

  • Updated

Scenario description

There’s no standard Beas object available for addition routing positions to an Itemcode.

This is now 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 Routing Position.

Creation of the JSON string

In the following example the script variables that are previously to be filled, have the names <apl.xxxxx>.

It is very important that in the JSON string the “CatalogId” is set before the “ResourceId”, otherwise the contents of the “ResourceID” will be overwritten by the the “CatalogId”.

 

setvar=ls_json=&

{"RoutingId":"<apl.itemcode>","LineNumber":<apl.pos_id>, &

 "CatalogId":"<apl.ag_id>","ResourceId":"<apl.aplatz_id>”, &

 "Position":"<apl.pos_text>","SortId":<apl.sortid>, &

 "CostCenter":"<apl.kstst_id>","Description":"<apl.bez>", &

 "Instructions":"<apl.anweisungen>","MachineLaborTime":<apl.teaplatz>, &

 "SetupForCalculator":<apl.tr2aplatz>,"SetupForSchedule":<apl.tr2aplatz>, &

 "TimesPer":<apl.menge_je>,"TimesUnit":<apl.menge_zeitje>, &

 "UseFactor":<apl.nutzen>,"WorkSteps":<apl.anzahl>, &

 "InspectionPlanId":"<apl.qs_id>", &

 "UDF1":"<apl.udf1>","UDF2":"<apl.udf2>","UDF3":"<apl.udf3>","UDF4":"<apl.udf4>"}

Create the instance of the JSON string and insert a routing line

// create the instance for the BSL object

instance bsl b

b.post=RoutingLine=<ls_json>

// create new BOM line

if <b.ret_code> n<> 0 then

     message=error$**$Error writing Routing entries: <b.ret_text>

     return failure

end if

 

Example for creating a full routing (multiline)

// destroy existing old APL-Object

destroy=apl

// declare a datastore for filling routing lines to be created

declare=apl=ue_datastorevalues

// insert the routing line fields which you want/need into the datastore. These field can be from an existing

// itemcode, from a text file or others

apl=select ItemCode,  &

                  case Coalesce("POS_TEXT",'') when '' then "POS_ID" else "POS_TEXT" end as pos_text,  &

                  "POS_ID", "SortId", "AG_ID","KSTST_ID","APLATZ_ID","BEZ","TR2APLATZ","TR2APLATZ",  &

                   "TEAPLATZ","NUTZEN","ANZAHL","MENGE_JE","MENGE_ZEITJE",  &

                    "QS_ID","UDF1","UDF2","UDF3","UDF4","MASTER_POS_ID","AGTYP","ANWEISUNGEN"  &

       from "BEAS_APL"  &

       where "ItemCode" = <my_itemcode,dbstring> &

       order by “POS_ID”

 

// read the datastore line by line for inserting to Itemcode

for loop=1 to <apl.rowcount>

  apl.setrow=<loop>

  setvar=ls_json=&

   {"RoutingId":"<apl.itemcode>","LineNumber":<apl.pos_id>, &

   "CatalogId":"<apl.ag_id>","ResourceId":"<apl.aplatz_id>”, &

   "Position":"<apl.pos_text>","SortId":<apl.sortid>, &

   "CostCenter":"<apl.kstst_id>","Description":"<apl.bez>", &

   "Instructions":"<apl.anweisungen>","MachineLaborTime":<apl.teaplatz>, &

   "SetupForCalculator":<apl.tr2aplatz>,"SetupForSchedule":<apl.tr2aplatz>, &

   "TimesPer":<apl.menge_je>,"TimesUnit":<apl.menge_zeitje>, &

   "UseFactor":<apl.nutzen>,"WorkSteps":<apl.anzahl>, &

   "InspectionPlanId":"<apl.qs_id>", &

    "UDF1":"<apl.udf1>","UDF2":"<apl.udf2>","UDF3":"<apl.udf3>","UDF4":"<apl.udf4>"}

 

     // Create instance

     instance bsl b

     // Create routing entry to Itemcode

     b.post=RoutingLine=<ls_json>

     // check if error comes up during creation

     if <b.ret_code> n<> 0 then

         message=error$**$Error writing Routing entries: <b.ret_text>

         // stop insertion in case of an error

         goto=next_end

     end if

next

[next_end]

// destroy apl-Object

destroy=apl

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.