Skip to Content

Add item product in Customer Quote using ABSL.

Hi experts, i found a problem trying to add a product using ABSL Code.

Basically, i was created a Script that calls a WS (this WS returs a List of products with the ID Product, Quantity and Measure) and when a try to add a product i have a message Exception.

1) Using this way, inside the script in the CustomerQuote Extension BO , the products was added but i have a message exception (The product doesnt exist )

var itemToCreate = this.Item.Create(); //In this line, the exception is raised :( itemToCreate.ItemProduct.ProductKey.ProductID.content = material.InternalID.content; itemToCreate.ItemProduct.QuantityMeasureUnitCode = itemResp.GUabsmg; itemToCreate.FirstRequestedItemScheduleLine.Quantity.content = itemResp.zRtCmp ;

2) I tried another way to add a product but i cannot see the node/association ItemProduct.

var itemToCreate : elementsof CustomerQuote.Item;

//In the following lines i have an error because i cannot to access to the association ItemProduct.

itemToCreate.ItemProduct.ProductKey.ProductID.content = material.InternalID.content; itemToCreate.ItemProduct.QuantityMeasureUnitCode = itemResp.GUabsmg; itemToCreate.FirstRequestedItemScheduleLine.Quantity.content = itemResp.zRtCmp ;

There is another way to add the products??

Thanks!!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 22 at 08:28 PM

    Hi Pranav, I tried by this way.

    In debug mode, the Warning is raised in the line var createitem = this.Item.Create();

    When the product is setted, in the followings lines, the product is saved :) but the warning is showed :(.

    Thanks!

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17 at 12:06 PM

    Hello Pablo,

    You need to provide the data with the Create call.

    Please have a look into the examples found via the Repository Explorer in the documentation for the CustomerQuote BO.

    HTH,
    . Horst

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 22 at 12:20 PM

    HI Pablo,

    In one my similar requirements ,I first created the item with all the mandatory fields and then created product:

    Please see the below code. Please let me know if you can create an item with the below approach.

    varcreateitem = this.Item.Create();

    createitem.Description.content = "Consulting Service";

    createitem.ExpectedNetAmount.content = weightedvalue;

    createitem.ExpectedNetAmount.currencyCode = "USD";

    createitem.Quantity.content = 1;

    createitem.Quantity.unitCode = "EA";

    if (createitem.ItemProduct.IsSet()){

    createitem.ItemProduct.ProductKey.ProductID.content = "10000000";

    createitem.ItemProduct.ProductCategoryHierarchyProductCategoryIDKey.ProductCategoryInternalID = "1";

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Pranav, thanks for the helping.

      I tried several times with this way. My problem is with the line,

      var createitem = this.Item.Create(); // In debug mode this line raise the message error "The item doesn´t have a product"

      Even when the message is raised, the product is created and saved. But the message error still appearing :(.

  • avatar image
    Former Member
    Mar 09 at 06:50 AM

    Hi Pablo,

    I have the same issue by adding products to a sales Quote via PDI absl code.

    If you use a custom action (getSuggestedProduct) like you, this message (Item contains errors) will occur.

    I solved this problem with a workaround; the same coding in the event BeforeSave works.

    E.g. bind a button with your custom action (getSuggestedProduct) and use this action only to set a transient field to true

    and in the event BeforeSave your real coding to add products and use an if-statement at the beginning of the coding...

    if(this.YYAddProducts == true){

    ..... // add products

    }

    this.YYAddProducts = false;

    and at the end (outside of the if-statement) set this field to false again. So you will ensure your coding will be executed only

    if an user clicks this button and not each time saving a sales quote.

    I think that is a bug that SAP has to fix, since the same coding works using the event BeforeSave... I have reported this issue to SAP and hope it will be fixed with the next releases.

    Best Regards,

    Burak Balkaya

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Burak,

      Finally i solved the issue consuming a Web service standar provided in the service explorer, even following the instructions in the repository explorer the problem persists. Then using the WS the problem is solved.

      The only problem is thats the products is not showing, but when is refreshed they appears.

      Regards Pablo.