CREAR SOLICITUD DE TRASLADO USANDO DI SERVER

Code with Edd

COMO CREAR UNA SOLICITUD DE TRASLADO EN SAP BUSINESS ONE USANDO DI SERVER.

Solicitud de traslado. Estructura que debe de tener el XML que se genera para crear una solicitud de traslado en SAPB1 utilizando la librería DI Server.

public AddResponseDocument AddInventoryTransferRequestV2(string SessionID, TransferRequestReq[] document)
{
    try
    {
        string soap_cmd = "";
        string response = "";

        soap_cmd = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>";
        soap_cmd += "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">";
        soap_cmd += "<env:Header>";
        soap_cmd += "<SessionID>" + SessionID + "</SessionID>";
        soap_cmd += "</env:Header>";
        soap_cmd += "<env:Body>";

        soap_cmd += "<dis:AddObject xmlns:dis=\"http://www.sap.com/SBO/DIS\">";
        soap_cmd += "<BOM>";
        soap_cmd += "<BO>";

        soap_cmd += "<AdmInfo>";
        soap_cmd += "<Object>oInventoryTransferRequest</Object>";
        soap_cmd += "</AdmInfo>";

        soap_cmd += "<StockTransfer>";
        soap_cmd += "<row>";

        soap_cmd += "<DocDate>" + DateTime.Now.ToString("yyyy-MM-dd") + "</DocDate>";
        soap_cmd += "<CardCode>" + document[0].cardCode + "</CardCode>";
        soap_cmd += "<Comments>" + document[0].comments + "</Comments>";
        soap_cmd += "<FromWarehouse>" + document[0].fromWarehouseCode + "</FromWarehouse>";
        soap_cmd += "<ToWarehouse>" + document[0].warehouseCode + "</ToWarehouse>";
        soap_cmd += "<PriceList>2</PriceList>";
        soap_cmd += "<JournalMemo>Solicitud de Traslados - </JournalMemo>";


        soap_cmd += "</row>";
        soap_cmd += "</StockTransfer>";

        soap_cmd += "<StockTransfer_Lines>";
        for (int i = 0; i < document.Length; i++)
        {
            soap_cmd += "<row>";
            soap_cmd += "<LineNum>" + i + "</LineNum>";
            soap_cmd += "<ItemCode>" + document[i].itemCode + "</ItemCode>";
            soap_cmd += "<Quantity>" + document[i].quantity + "</Quantity>";
            soap_cmd += "<Price>" + document[i].price + "</Price>";
            soap_cmd += "<UnitPrice>" + document[i].price + "</UnitPrice>";
            soap_cmd += "<DiscountPercent>" + document[i].discountPercent + "</DiscountPercent>";
            soap_cmd += "<Currency>" + document[i].currency + "</Currency>";
            soap_cmd += "<WarehouseCode>" + document[i].warehouseCode + "</WarehouseCode>";
            soap_cmd += "<FromWarehouseCode>" + document[i].fromWarehouseCode + "</FromWarehouseCode>";
            soap_cmd += "</row>";
        }
        soap_cmd += "</StockTransfer_Lines>";

        soap_cmd += "</BO>";
        soap_cmd += "</BOM>";
        soap_cmd += "</dis:AddObject>";
        soap_cmd += "</env:Body>";
        soap_cmd += "</env:Envelope>";

        response = NodeDIS.Interact(soap_cmd);
        AddResponseDocument res = this.xml.AddDocumentResponseV2(response);

        return res;
    }
    catch (Exception ex)
    {
        this.logger.LogError(ex, ex.Message + " | " + ex.StackTrace);
        return new AddResponseDocument { success = false, codeErr = 400, docEntry = null, docNum = null, message = ex.Message };
    }
}

Referencia: SAP Business One SDK – Help Center

https://help.sap.com/viewer/product/SAP_BUSINESS_ONE/9.3/es-ES


CREAR SOLICITUD DE TRASLADO USANDO DI SERVER
Web | + posts

Full Stack Web Developer && SDK SAPB1 Developer.

Melómano, Gamer (Xbox), Comprador compulsivo de Amazon y Posiblemente con TDAH.

Scroll hacia arriba