pixiSupplierOrderLineDelete
Deletes one or more supplier order lines (purchase order lines) and returns a status row with SUCCESS, WARNING or ERROR.
Deletes supplier order lines (purchase order lines) by their IDs. The actual deletion is done by the internal procedure pixi.SupplierOrderLineDelete. According to the header comment, the supplier order itself may be updated as well.
Steps:
-
Opens a transaction. If the caller already has one open, a savepoint is set instead.
-
Resolves the user. If
UserIdis not passed, the ID is looked up fromUserNameviainf.UserGetByName. If that name does not exist, the ID of the userpixiAdministrationis used. -
Collects the lines to delete:
- the single ID from
SupplierOrderLineId(a value of0is treated likeNULL); - every ID from the comma-separated list
SupplierOrderLineIds. Elements are trimmed, empty elements are ignored and duplicates are removed.
Both parameters can be combined.
- the single ID from
-
Calls
pixi.SupplierOrderLineDeletewith the user ID, the single ID and the ID list. -
Checks whether any of the requested IDs still exists in
SupplierOrderLine. If so, the result isWARNINGwith the messageSome Purchase Orderlines items from list were not deleted.Otherwise the result isSUCCESS. -
Commits and returns one status row with
ReturnCodeandErrorMessage.
If an error occurs, the transaction is rolled back and a row with ReturnCode = ERROR and the SQL error text is returned.
Notes
- The definition of
pixi.SupplierOrderLineDeleteis not attached. Therefore it is open:- which tables it changes;
- under which conditions it refuses to delete a line, for example because goods were already received;
- whether it updates the supplier order header.
WARNINGis not a rollback. Lines that could be deleted stay deleted and the transaction is committed.- The existence check after the deletion reads
SupplierOrderLinewithNOLOCK. - Every non-empty element of
SupplierOrderLineIdsmust be an integer. A non-numeric element causes a conversion error. The whole call is then rolled back and returnsERROR. AppNameis required but not used by this procedure.UserNamehas no default and must always be sent, even ifUserIdis passed.- If the procedure runs inside an outer transaction, it returns no status row on success. This does not apply to normal SOAP calls.
- If an error occurs inside an outer transaction that is still committable, the savepoint is not rolled back.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
AppName
Required
|
varchar(255) string |
– |
Name of the calling application. Required, but not used by the procedure. Example: |
UserId
|
int | NULL |
ID of the Pixi user who performs the deletion. If Example: |
UserName
Required
|
varchar(50) string |
– |
Pixi user name. Used to determine the user ID when Example: |
SupplierOrderLineId
|
int | NULL |
ID of a single supplier order line to delete. Example: |
SupplierOrderLineIds
|
varchar(8000) string |
– |
Comma-separated list of supplier order line IDs to delete. Spaces around the elements are trimmed and empty elements are ignored. All elements must be integers. Can be combined with Example: |
Result set 1 · Always for normal SOAP calls. Not returned on success if the procedure runs inside an outer transaction.
Status row with the result of the deletion.
| Column | Type | Description |
|---|---|---|
ReturnCode
|
varchar(20) string |
|
ErrorMessage
Nullable |
nvarchar(4000) string |
|
Response example
<SqlRowSet1>
<row>
<ReturnCode>WARNING</ReturnCode>
<ErrorMessage>Some Purchase Orderlines items from list were not deleted.</ErrorMessage>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| WARNING | Some Purchase Orderlines items from list were not deleted. | At least one of the requested supplier order line IDs still exists after the deletion. The internal procedure did not delete it; the reason is not visible in this code. Other lines were deleted and the changes were committed. Check the status of the remaining lines before retrying. |
| ERROR | {ERROR_MESSAGE()} | Any SQL error during processing, for example a conversion error when `SupplierOrderLineIds` contains a non-numeric element, or an error raised by `pixi.SupplierOrderLineDelete`. The transaction is rolled back. Send only integer IDs in the list. |
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiSupplierOrderLineDelete>
<AppName>MyShopConnector</AppName>
<!-- <UserId>12</UserId> -->
<UserName>api.user</UserName>
<!-- <SupplierOrderLineId>45871</SupplierOrderLineId> -->
<!-- <SupplierOrderLineIds>45872,45873,45874</SupplierOrderLineIds> -->
</ns1:pixiSupplierOrderLineDelete>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiSupplierOrderLineDelete>
<AppName>MyShopConnector</AppName>
<!-- <UserId>12</UserId> -->
<UserName>api.user</UserName>
<!-- <SupplierOrderLineId>45871</SupplierOrderLineId> -->
<!-- <SupplierOrderLineIds>45872,45873,45874</SupplierOrderLineIds> -->
</ns1:pixiSupplierOrderLineDelete>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
'AppName' => 'MyShopConnector',
// 'UserId' => '12',
'UserName' => 'api.user',
// 'SupplierOrderLineId' => '45871',
// 'SupplierOrderLineIds' => '45872,45873,45874',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiSupplierOrderLineDelete', $soapArguments);
- SQL object:
- dbo.pipiSupplierOrderLineDelete