cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Items to Production Order

Former Member
0 Kudos

The solution that I am starting soon needs to have Items issued to a Production order through the DI, however there is no Production order object available currently.

Can anyone suggest how I might achieve this functionality whilst avoiding updating tables directly?

Thanks,

Daniel Archer

Accepted Solutions (1)

Accepted Solutions (1)

barend_morkel2
Active Contributor
0 Kudos

unfortunately you are right,

there is no Production Order object available currently.

I contacted SAP in this regard and they said the object will ibe available in SBO 2005A SP1.

To my knowledge there is no way to update the values without the object - and it is against SAP's policy to update tables direcly - I suggest you log a note (or let your service centre log a note) to inform SAP about your predicament and ask them on assistance for the way forward...

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I have BO 2004 and I have tried to Add an InventoryGenEntry from a ProductionOrder but don't work.

I have used ur code and change the basetype to 202 or the enumerator WorkOrder. I never see the doc_lines with the itemcode and qty filled?! How I could modify the quantity entry ?

thx

Former Member
0 Kudos

Hi,

I m writing a c# application to print label for pallet. I take open production order from SAP BO 2004( sql query). When I print the Label , I would ISSUE ITEMS TO PRODUCTION ORDER.

It's the first time that i use this SDK.

I think that the issue is the same of Daniel...

How I could do that?

thx Marco Rullo

Former Member
0 Kudos

Daniel

We have modified the way we use the production order. It can be done only using FMS, but weve also used the UI part of the SDK to make it more user friendly. At the same time we also identify the planned price and actual produced price for controlling purposes.

We handle all of the calculation of the GI quantity in the production order itself (so we can use backflush), whats important to know is that the bom qty in the production order needs to be updated to get the GI correct posting. GR is calculated based on the planned qty. The other reason for doing it here is that you get a correct product valuation if you are using MAvg prrice.

The other good news is definately available in 2005, and is in testing for a 2004 patch release.

Dave

former_member185703
Active Contributor
0 Kudos

You should better <b>not</b> use FMS, but this currently undocumented way...

(Documentation Development is working to fix it; dvelopers seem to have been to fast for the documentation guys ) - just a code snippet. Please complete accordingly:

oGoodsReceipt =
oCompany.GetBusinessObject(BoObjectTypes.oInventoryGenEntry)

oGoodsReceiptLines = oGoodsReceipt.Lines

'instead of 202 what is used internally! - use "0"
oGoodsReceiptLines.BaseType = <b>0</b>
'If 4 is the key of the ProductionOrder
oGoodsReceiptLines.BaseEntry = 4

lRetCode = oGoodsReceipt.Add

Regards,

Frank

Former Member
0 Kudos

Hi Frank,

Thanks for the code snippet, I have tried to get it to work using (C#):

SAPbobsCOM.Documents doc = (SAPbobsCOM.Documents)_company.GetBusinessObject(BoObjectTypes.oInventoryGenEntry);

SAPbobsCOM.Document_Lines docLines = doc.Lines;

docLines.BaseType = 220; // tried 0 here too but didn't work - got a NullReference exception.

docLines.BaseEntry = 5;

docLines.ItemCode = "L2000";

docLines.Quantity = 5;

docLines.Add();

if(doc.Add() != 0)

GetError();

The error I am getting is:

-1004 - [IGN1] , 'Error (-1004) encountered.'

I think this is from using the wrong BaseType?

Message was edited by: Daniel Archer

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

I have tried to do what Frank told you and it works fine if you use BaseType = 0.

The only think is in your code you are adding a line with BaseType, BaseEntry referencing an other document.

Then you write on the same line ItemCode and Quantity and at the end you add an empty line...

So, to be clear:

1. If you want to create a document referencing a Production order you should only do

SAPbobsCOM.Documents doc = (SAPbobsCOM.Documents)_company.GetBusinessObject(BoObjectTypes.oInventoryGenEntry);

SAPbobsCOM.Document_Lines docLines = doc.Lines;

docLines.BaseType = 0;

docLines.BaseEntry = 5; 'DocEntry of your production order

if(doc.Add() != 0)

GetError();

The first line is allways created in an empty document!

2. You cannot create a document with a line pointing to the Production order and another one with a normal ItemCode.

When I try to do it I have the error: "If one of the lines is referenced to production, then all lines should be referenced [IGN1.BaseEntry][line: 1]"

3. If you want to create a document with more than one line the you must do it as following (you don't add the first line, only second and following):

order = pCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)

order.CardCode = "C60000"

order.DocDate = Now

order.DocDueDate = Now

'Document Lines - Set values to the first line

order.Lines.ItemCode = "A00001"

order.Lines.Quantity = 10

'Document Lines - Set values to the second line

order.Lines.Add()

order.Lines.ItemCode = " A00002"

order.Lines.Quantity = 5

iResult = order.Add()

Hope it helps

Trinidad.

Former Member
0 Kudos

Hi Trinidad,

First of all, thanks for explaining that further for me. However I am still unable to get the desired functionality working:

Basically the solution that I am trying to accomplish is to allow factory workers to be able to add labour items to a production order through a interface using the DI API (or DI Server) - to track time spent on jobs.

I have created a Production Order in SAP with 2 components (1 is a labour item) which have an Issue Method of "Manual" and then set the status of the Production Order to "Released"

With the DI API I then want to be able to issue the items (labour) to the existing Production order to account for the time spent on a job...

When I use the below snippet, I get a NullReference exception, but I'm not sure if the code will allow me to do what I have explained above?

SAPbobsCOM.Documents doc = (SAPbobsCOM.Documents)_company.GetBusinessObject(BoObjectTypes.oInventoryGenEntry);

SAPbobsCOM.Document_Lines docLines = doc.Lines;

docLines.BaseType = 0;

docLines.BaseEntry = 5; 'DocEntry of your production order

if(doc.Add() != 0)

GetError();

Thanks,

Daniel Archer

Former Member
0 Kudos

Daniel

Suggestion, set the labour item to 'backflush'. You cannot actually issue 'non stock items'. Then try it.

best wishes

Dave

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

Is the reference 5 the DocEntry of one of yours Production Order documents?

If this code does not work on your 2004 version please contact support, I'm working on a 2005 version. This is the first step of what you are trying to do, at least this part must work.

Regards

Trinidad.

Former Member
0 Kudos

Hi Dave, we want to be able to record when a production order takes more labour than was estimated...

Former Member
0 Kudos

Hi Trinidad,

Yes the DocEntry is 5 which relates to a Production Order doc...

I am still using 2004 currently, maybe I should plan to use 2005 for this development...

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

First of all, you want to create a ProductionOrder or an InventoryGenEntry?

In the 2005 version Adding an InventoryGenEntry from a ProductionOrder is not a problem. The code I show you works fine.

If this code does not work in your version:

1. Change to 2005 if you have already the 2005 version.

2. Create a Customer Message into the Service Marketplace for support, they will investigate why in your particular case it does not work.

I have tried to create a InventoryGenEntry with a line pointing to a ProductionOrder and a second line pointing to another item. It does not work in my version!

I have the error: "If one of the lines is referenced to production, then all lines should be referenced [IGN1.BaseEntry][line: 1]"

One thing you can do is try to reproduce the same behavior using the B1 application. Try create a InventoryGenEntry with a line referencing to a ProductionOrder and another one to another item you want to add, if it works using the B1 Application then try to reproduce the same by using DI. If it does not work then ask Support for it. They know which modification is included in which version and can guide you in your specific case.

If you receive a satisfactory answer from them please share it with this forum!

Regards

Trinidad.

Former Member
0 Kudos

Daniel

Add an aditional item into the bill of material. <b>In the base qty you need to add the quantity of labour / planned quantity.</b> Set this to 'back flush'.

What we do, and this was my comment about FMS, I use an additional field to enter additional quantities in the BOM. I use this field and an aditional field UDF storing the actual BOM qty to recalcualate the 'Base' field. In fact we stopped using the FMS in the end and put it into a UI SDK addon, as it made it more user friendly.

Its important that this field is updated, if you dont do this the valuation of your stock will be incorrect. (Ive spent ages trying to understand how SAP configured the costing in production, and how I could get it to do what I want).

Caution : Only thing you have to be careful here with is the FMS, there is/was a bug in the FMS that all numeric values were always returned with 2 decimal places. As a result you may find you need to store data as nvarchar, and then convert.

Hope thats of some help... if you need more info ... just leave a note.

Dave

Former Member
0 Kudos

Hi Trinidad,

I have come back to this issue now because the latest patch for 2004 has the ProductionOrder object included with it, however this still does not give me a solution!

I am now able to successfully run Franks code as pointed out in an earlier post however this only updates the completed quantity and doesn't issue any of the components to the Production order like I would like to happen.

Is there any way to "Issue Items To Production Order" through the DI like you do through the SBO Client - this is the functionality that I am trying to recreate...

Cheers!

Daniel

Former Member
0 Kudos

Daniel,

Did you ever get an answer to this? I'm trying to do something very similar and need to know which direction to head.

Thanks,

Curtis

Former Member
0 Kudos

Hi Curtis, unfortunately I didn't get any resolution, and since then the requirement for development has been dropped for a while. If you do manage to get a solution working please post on this thread, as I will probably be revisiting this in a few months.

Thanks,

Daniel

Former Member
0 Kudos

With a little help from SAP Support and a lot of trial and error, here's the solution:


oGoodsIssue = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit)

            oGoodsIssue.DocDate = Now

            oGoodsIssue.Lines.BaseEntry = OrderID
            oGoodsIssue.Lines.BaseLine = 0
            oGoodsIssue.Lines.Quantity = 1
           
            oGoodsIssue.Lines.Add()

            lRetCode = oGoodsIssue.Add

            If lRetCode <> 0 Then
                oCompany.GetLastError(lErrCode, sErrMsg)
                MsgBox("Error In AddLabor" & Chr(10) & sErrMsg, MsgBoxStyle.Exclamation, "Error Found")


            Else
                MsgBox("The document was added successfully", MsgBoxStyle.Information, "Data Posted")
            End If