Skip to Content

Cannot access a PSM released node item in ABSL

Hi Experts,

I have asked the same question in the past and no one gave me the correct answer maybe because my question was not clear enough. Here is what I want to achieve: In SAP Business ByDesign In creating Purchase order, I am trying to default the value of Location of Service Provision when the item time is "Service" and the Process type is "Third party". The default value currently is "On-Site" and I want to make it "Supplier Service Center".


*Note: I know that if this was a "service order" then I can follow :https://apps.support.sap.com/sap/support/knowledge/public/en/2740657 But it's not the case *

So I went to the SDK and I created business object extenstion for the Purchase Order BO and I created an After-Modify event that Suppose to Take the value of the note element TypeCode under the node Item and check if the value was 19 - Service then I make the value of ServiceProvisionLocationTypeCode equals to 3.

I made sure that all the components are PSM released

This is why I did and I had the above errors. Can anyone help me with this explaining what is happening? or provide me with a code snippet that works!

Thanks,

Mousa

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jun 12, 2019 at 11:32 AM

    Hi,

    in your ABSL script, "this.item" carries a Collection of values. hence you need to loop each entry in order to access corresponding node fields.

    A sample code could be:

    var items = this.item;
    foreach(var inst in items)
    {
    inst.ServiceProvisionLocationypeCode = "19";
    }

    Thanks

    Saurabh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 12, 2019 at 12:45 PM

    Dear Mousa,

    I hope you are doing well!

    In order to satisfy your requirement, you have to remember that you are executing a script to check a BO Node that has 0..N multiplicity.

    This means that at any one time there can be 0 or N number of items for that Purchase Order instance.

    I can see Saurabh has already touched on that point, however here is the ABSL code in a similar design to yours:

    .

    In the above, you can see that you are accessing "An Instance" on the Item node using the GetFirst() function, and then checking the TypeCode element.

    Similarly, you should do the same using a ForEach loop (dependent on your scenario) and run through each item on the Purchase Order BO instance.

    .

    Hope this helps you and your developments! (Mark this as answered if the question was solved!).

    Kind regards,

    Andy Blankley


    tki1f.png (7.2 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Dear Andrew.

      Thanks for your output. I tried that and it didn't work under Root nor Item nodes when had an after modify event under them. I am trying to have a real-time response like whenever the user will change from Material to Service this will be in effect. Should that be something to do with the ABSL code or with UI designer (as I am still newbie in this).

      Thanks!

  • Posted on Jun 18, 2019 at 12:36 PM

    Hi,

    if you have just created the AfterModify action the Mass enabled flag was enabled in this case your "this" is a collectionand you have to loop over it:

    foreach(var inst in this){
    foreach{var item in inst.Item}{
    if(item.TypeCode == "19"){
    item.ServiceProvisioningTypeCode= "3";
    }
    }
    }

    this is the structure please check the syntax.

    best regards

    Thomas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.