Skip to Content
avatar image
Former Member

Create Goods Receipt PO via SAP B1 Service Layer on SAP1 Hana 9.2 PL06

After the upgrade of our SAP Hana system to v9.2 PL06, we have encountered and issue while creating Goods Receipt PO documents via Service Layer.

When trying to create a Goods Receipt PO document and link it to a Purchase Order document(Base Document), the Service Layer throws following error:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>502 Proxy Error</title>

</head><body>

<h1>Proxy Error</h1>

<p>The proxy server received an invalid

response from an upstream server.<br />

The proxy server could not handle the request <em><a href="/b1s/v1/PurchaseDeliveryNotes">POST /b1s/v1/PurchaseDeliveryNotes</a></em>.<p>

Reason: <strong>Error reading from remote server</strong></p></p>

</body></html>

Please Note that creating Goods Receipt PO document and link it to a Purchase Order document(Base Document) was working fine when we were running SAPB1 For Hana version 9.2 PL03. After the upgrade to version 9.2PL06 we cannot longer create Goods Receipt PO document and link it to aBase Document(Purchase Order) via Service Layer.

Please also note that creating Goods Receipt PO document without link it to a base document works fine.

As mentioned before the issue happens when creating Goods Receipt PO document and link it to a Purchase Order document(Base Document)

I prepare a Test function in C# so you guys I can show you where the error is received:

  public Boolean fReceivingIssueSAP1Hana(ref String sError) 
       {
           String sCardCode = "V23000";
           int iPONumber = 434;
           int iPOLineNbr = 0;
           String sItemCode = "A00001";
           int QtyReceived = 1;
           String sNewReceiptNumber = null;
           try
           {
               if (currentServiceContainer != null)
               {
                   currentOdataService.InitServiceContainer(currentServiceContainer);
                   Document oReceipt = new SAPB1HanaServiceLayer.SAPB1.Document();
                   oReceipt.DocType = "dDocument_Items";
                   oReceipt.CardCode = sCardCode;
                   oReceipt.DocDueDate = DateTime.Today;
                   oReceipt.DocDate = DateTime.Today;
                   DocumentLine oLine = null;
                   oLine = new DocumentLine();
                   //Link Goods Receipt PO Line with Base Document Line(Purchase Order Line)
                   Document oBaseDoc =  currentServiceContainer.PurchaseOrders.Where(cursor => cursor.DocNum == iPONumber).SingleOrDefault();
                   if (oBaseDoc != null)
                   {
                       DocumentLine oBaseDocLine = null;
                       oBaseDocLine = oBaseDoc.DocumentLines.Where(cursor => cursor.LineNum == iPOLineNbr).SingleOrDefault();
                       if (oBaseDocLine != null)
                       {
                           oLine.BaseEntry = oBaseDocLine.DocEntry;
                           oLine.BaseLine = oBaseDocLine.LineNum;
                           oLine.BaseType = 22; //Purchase Order
                       }
                   }
                   //
                   oLine.ItemCode = sItemCode;
                   oLine.Quantity = QtyReceived;
                   oReceipt.DocumentLines.Add(oLine);
                   Document newReceiptDoc = null;
                   try
                   {
                       currentServiceContainer.AddToPurchaseDeliveryNotes(oReceipt);
                       currentServiceContainer.Configurations.RequestPipeline.OnEntryStarting((arg) =>
                       { arg.Entry.Properties = currentOdataService.FilterNullValues(arg.Entry.Properties.ToList(), true); }); 
                       DataServiceResponse response = currentServiceContainer.SaveChanges(); //HERE IS WHERE THE ERROR HAPPENS!!!!!!!
                       if (null != response)
                       {
                           ChangeOperationResponse opRes = (ChangeOperationResponse)response.SingleOrDefault();
                           object retDoc = ((System.Data.Services.Client.EntityDescriptor)(opRes.Descriptor)).Entity;
                           if (null != retDoc)
                           {
                               newReceiptDoc = (Document)retDoc;
                               sNewReceiptNumber = newReceiptDoc.DocNum.ToString();
                           }
                       }
                       return true;
                   }
                   catch (Exception ex)
                   {
                       sError =  ex.Message;
                       if (ex.InnerException != null) { sError =  ex.InnerException.Message; }
                       currentServiceContainer.Detach(oReceipt);
                       return false;
                   }
               }
               else
               {
                   sError = "ERR~~System Is Not Connected To SAPB1 Hana database";
                   return false;
               }
           }
           catch (Exception ex)
           {
               sError = ex.Message;
               if (ex.InnerException != null) { sError = ex.InnerException.Message; }
               return false;
           }
       }


Can you please assist?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers