Skip to Content

B1if - Updating a B1 Object

Hello experts,

I'm attempting to update a B1 Object (PickLists), but I am currently receiving unexpected results. I was hoping someone could provide some clarification. My question is in regards to how to update an object that contains nested objects.

My scenario is as follows. I receive a REST request containing a JSON payload containing the object information I am targeting for update. I can perform the data transform successfully using Object template 156 (picklists), but my update appears to only effect the "most recent" pickline. i.e. a picklist contaning 2 picklines - 1st request to update first pickline - works as expected, but when the 2nd request comes in to update the 2nd pickline, the 2nd pickline is updated, but now the 1st pickline resets its pick qty to 0.

Ultimately, I think my question is how do you properly update a B1 object that contain nested objects? Using picklists object as an example, here is the template...

<PickLists>
<row>
<!-- multiple such elements are allowed -->
<Name>string</Name>
<OwnerCode>long</OwnerCode>
<PickDate>string</PickDate>
<Remarks>string</Remarks>
<UseBaseUnits>string</UseBaseUnits>
</row>
</PickLists>
<PickLists_Lines>
<row>
<!-- multiple such elements are allowed -->
<OrderEntry>long</OrderEntry>
<OrderRowID>long</OrderRowID>
<PickedQuantity>double</PickedQuantity>
<ReleasedQuantity>double</ReleasedQuantity>
<BaseObjectType>long</BaseObjectType>
</row>
</PickLists_Lines>

If I wanted to update a single pickline in a list of picklists_lines can I provide only the pickline I wish to update while not effecting the other lines? If so what is the key? I was assuming OrderRowID.

...

or, do I need to provide an entry for each picklists_line in the picklist, and provide a entry that is a delta for the pickline I wish to update?

Also, unrelated bonus question. Why do I only receive DocumentLinesBinAllocations results only after a pick has been completed? This seems to be different than the results received from a B1/HANA Service layer response ?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Dec 05, 2018 at 07:43 PM

    I think I figured it out, in case anyone else has a similar question...

    After some testing, it appears you need to provide an entry for each picklists_line in the picklist even if you don't intend to update it....

    <PickLists>
                <row>
                    <!--multiple such elements are allowed-->
                    <Name>...</Name>
                    <OwnerCode>...</OwnerCode>
                    <PickDate>...</PickDate>
                    <Remarks>...</Remarks>
                    <UseBaseUnits>...</UseBaseUnits>
                </row>
            </PickLists>
            <PickLists_Lines>
                <row> </row>   ---> an empty row will suffice here, I don't want to update this pick line, but it needs to be present to result in the expected behavior.  
                <row>
                    <!--multiple such elements are allowed-->
                    <OrderEntry> value </OrderEntry>
                    <OrderRowID> value </OrderRowID>
                    <PickedQuantity> updated value </PickedQuantity>
                    <ReleasedQuantity> updated value</xsl:value-of>
                    </ReleasedQuantity>
                    <BaseObjectType> value</xsl:value-of>
                    </BaseObjectType>
                </row>
            </PickLists_Lines>
    
    

    Not quite what I was expecting. I suppose it would be easier to just update the DB directly.

    Add comment
    10|10000 characters needed characters exceeded

    • Yes, for the sub object, you need to prepare the entire xxx_line.

      Based on current mechanism, It's not that easy. One reasonable explanation is that the application don't know how to treat other lines, delete or keep?