cancel
Showing results for 
Search instead for 
Did you mean: 

Inventory Manager 4.0 : Custom field values missing

Former Member
0 Kudos

Hello,

I have added a new field on Inventory Manager 4.0 in order to send a value to the BAPI on the Material Document creation process (Goods Receipts). I'm trying to do this for POReceiptAdd Transaction, working with MaterialDocument & replicating the field to MaterialDocumentItem Object and I'm not able to make it work yet. The value for my custom field is missing/empty when I see it on the ABAP Debug, this means it is not sent from the mobile App to the backend. I  have tested my classes extensions with a fixed set value on the custom POJO Class, it Works fine and the fixed value is sent to Backend (SAP), but when I try to capture the value from the transaction (Screen) is empty...

Viewing , my problem is very similar because it seems to be related to the Reading process of the custom field from transaction on the method I have override, specifically on this line:


u.getString("transaction.<ZCustomField>");

I want to know how is structured the string that must be set on this method in order to get the transaction's property data..... is "transaction.<Object>.<field> and the name of the object must be written as it was defined on the App??? or how is structured this string???

Please Help....

BR,

MC

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

The ATE is not working for me neither on my machine nor on the development server. So I can't inspect the transaction... I have really tried all morning to make ATE work but it just does not work at all... it freeze and stop working and hang up... So I just gave up trying to make ATE work... I think the problem is with my u.getString line code, I just have tested the app setting the fixed value on the transaction property (you know when you define the property configuration)... and still the parameter was not "sent" to backend. Now I just want to know something....

POReceiptAdd Transaction is linked to MaterialDocumentItem Object but the field I want to populate with the transaction value belongs to MaterialDocument Object... What I have done is create a property to the transaction POReceiptAdd... Create a property to the Object directly related to the transaction (this means MaterialDocumentItem) and create the property to the MaterialDocument Object. I saw the header text, which belongs to MaterialDocument object because in SAP is on the header of the document, was replicated as well as a property on the transaction and on the MaterialDocumentItem object... So I follow this approach because my new field behaviour is exactly the same... Now my question is... on my setProperties method the string which is received on the u.getString is like which of the following:

1.- GRSlipNumber = u.getString("transaction.MaterialDocumentItem.0.GRSlipNumber"); or

2.- GRSlipNumber = u.getString("transaction.MaterialDocument.0.GRSlipNumber"); or

3.- GRSlipNumber = u.getString("transaction.MaterialDocument.GRSlipNumber"); or

4.- GRSlipNumber = u.getString("transaction.MaterialDocumentItem.GRSlipNumber"); or

5.- GRSlipNumber = u.getString("transaction.GRSlipNumber");

Does the object name is all lower case ... or must be referenced as it was named on the app (meaning MaterialDocument)???

jason_latko
Advisor
Advisor
0 Kudos

Mariana,

I don't think the case matters on your getString line.  Please post a screen shot of your transaction that you added the new property to so I can see what you are doing there.  This transaction must have a server update step on it that runs a java steplet.  Is this the case?

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

  Well directly this transaction does not have a server update step... because the logic I think is the following:

When I view a item for a PO, I have the options of "Receive" or "Receive all" the item qty... If I select "Receive" option, one of the screen of "ReceiptAdd" screen set is shown

This ScreenSet has linked the POReceiptAdd Transaction, If I see this Transaction properties, the object releated is "MaterialDocumentItem" (I guess this is because the majority of the fields belongs to the item i'm receiving... but also I have there the header text which is saved on SAP on the Document Header not the item... )

Well I have include my "new" field on the transaction POReceiptAdd (Because I want to capture the value when I'm receiving), on the MaterialDocumentItem Object and on the MaterialDocument Object as you can see on the following images:

 

But this transaction does not has a update step, because i think this only save locally on the collection. Now when you transmit there you have another transaction which indeed has a update step... meaning called the steplet of the post receipt...

But.... I know I dont have to extend this steplet class because when I set a fixed value on the extended custom POJO class....

This value is saved on the Material Document in the backend... but the GRSlipNumber doesn't.....

What might be wrong????

BR,

MC

jason_latko
Advisor
Advisor
0 Kudos

Mariana,

Looking at PostReceipts action in the editor, the action loops over the Orders collection in the main object.  If there are local Receipts under the Order, then that order gets bundled up and posted.  Look at the properties on the OrderPostReceipts transaction that actually calls the steplet.  Those are the properties that will be available to you using the getString command in java.  You don't have a GRSlipNumber here, so you wont be able to access that.  It doesn't look like we pass up a MaterialDocument as you were thinking.  It should exist under the Items collection here, since Items are a collection of MaterialDocumentItems.  In POReceiptAdd transaction, you added GRSlipNumber to the transaction.  How are you populating the data there?  Is it a new screen field?  Anyway, that new data should be available using:

u.getString("transaction.items.0.grslipnumber")

The zero row is the first row in the collection, followed by 1, 2, etc...

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Yeap, there is a new field on the screen... which is linked to the transaction property GRSlipNumber of POReceiptAdd.. in the first image you can see it below headerText field... it's called "Vale". ... let me test this item thing you said earlier... I thought you were passing the MaterialDocument Object... because it is the parent of MaterialDocumentItem... and the POJO class for MaterialDocument is executed when I create a GR for a PO...

Former Member
0 Kudos

Hi I tested it with u.getString("transaction.items.0.grslipnumber")... and nop... it does not work... I'm using an extended custom MaterialDocument POJO Class... I have to remark this "new" field it's already declared on the standard POJO Class but it's always blank, never get filled with a value... In fact it is declared and manipulated on setProperties(com.syclo.sap.jco.JCO.Table tbl) method..... but I had to extend the POJO Class to override the methods:

public void setProperties(User u, MaterialDocumentCreateBAPI bapi,   String gm_code) and

public void setProperties(User u, int itemIndex, int returnIndex, MaterialDocumentCreateBAPI bapi, String gmCode) in order to set the value to that class parameter from the transaction... but I can't make it work.... because of u.getString("transaction.XX.0.Field")...

It's obviously that line... because I change that line for a fixed value like: GRSlipNumber = "VDClas"; and the value is sent to the backend....

BR,

Mariana

jason_latko
Advisor
Advisor
0 Kudos

Mariana,

Are you sure your new field is getting saved to the MaterialDocumentItem object from the screen?  Can you see the field on a detail screen after the receipt transaction runs?  Can you access other MaterialDocumentItem properties from the transaction.items.0 record using getString in your extended POJO?

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

I have tried to Access other property of MaterialDocumentItem in my extended POJO class... in fact I have tried this line:


GRSlipNumber = u.getString("transaction.Items.0.headerText");

but I does not work!!! . I have tried after that line of code....this


GRSlipNumber = u.getString("transaction..headerText")

Just in case.... and nothing... Now I don't get it... headerText is a standard value why is not visible by my POJO?.... what happen with my POJO class??? ... I named the class ZMaterialDocument extend MaterialDocument declared the constructor same as SUPER MaterialDocument class ... called super method within and after that override the methods setProperties I want to override... I know MaterialDocumentCreateBAPI won't recognize ZMaterialDocument... but I have extended that BAPI Class too in order to send the value that wasn't consider on the standard.... I have named it ZMaterialDocumentCreateBAPI extend from MaterialDocumentCreateBAPI.. so I have added a property to that class type ZMaterialDocument and override the constructors calling super and afterwards set the properties for the ZMaterialDocument parameter.... Both classes are on a custom package (not the standard)... I have changed the configuration on config PANEL too...

Please help...

MC

jason_latko
Advisor
Advisor
0 Kudos

Mariana,

Which setProperties have you overridden in MaterialDocument class?  It does not make sense that you are getting back no data in those getString calls.  You cannot do transaction.headerText because headerText is part of the items collection, not in the root of the transaction.  Are you sure you have headerText set?  Try another property like transaction.OrderID, or transaction.items.0.id.

Have you requested and received the original source to make this easier to debug?

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

hi

I have override these methods on ZmaterialDocument :

public void setProperties(User u, MaterialDocumentCreateBAPI bapi, String gm_code)

public void setProperties(User u, int itemIndex, int returnIndex, MaterialDocumentCreateBAPI bapi, String gmCode)

Indeed it does not make sense... the header text is on the screen and every time I do a GR I put something on that field and this value is sent to SAP... so it has to have something on it... Let me try the property you suggest...

Jason, I'm a Little bit stubborn... so I'm trying to avoid asking the original source... Anyway I can't debug it because I have the VM connection refuse error when I'm trying to do a remote debug of my classes (i saw several people have that error reported on SDN)... So if I ask for it.... would be as a reference documentation...  not to debug it...

Le me try the orderID thing.... and I'll get back to you

BR,

Mariana



jason_latko
Advisor
Advisor
0 Kudos

Mariana,

Ok, I wasn't aware you couldn't debug things.  That makes it very difficult indeed.  You don't even know if your code is running.  I would suspect not.  Maybe you could write something to the log in your overridden methods?

Logger log = new Logger(_imUser, "processResults");

log.info("Testing new field method!");

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

and that log where is save? I was looking for an user log on the server but I didn't find anything that tells me the apps steps executed...

jason_latko
Advisor
Advisor
0 Kudos

Mariana,

The logs are in the Agentry directory under SAP\MobilePlatform3\Server\log.  I believe you will need to turn them on in the cockpit.  Also, are you running SMP as a service or command window?  For debugging, I would run as a command window where you will see the log entries echoed in real time as they execute.

First stop and disable the SMP Windows service on that machine.

Next change your command target on the server start shortcut to: C:\SAP\MobilePlatform3\Server\go.bat

That will run the server in a command window where server activity will be displayed, including any log statements in the java.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

.... I made it work!!!!!!....


Well the thing is when you asked me for the methods.... I thought uhhmmm which method of these two is this thing calling??... the method the apps is calling on execution is: setProperties(User u, int itemIndex, int returnIndex, MaterialDocumentCreateBAPI bapi, String gmCode)... then I realize the position is not always zero... meaning I have to pass the itemIndex to the string.... so....when i put this line of code .... and run it.... It worked just fine....


u.getString("transaction.items."+itemIndex+".GRSlipNumber");

Thank you because I think you help me understand the update process with the transaction and transaction values....I was a little bit confused

BR,

Mariana

BTW the tip you wrote about the debug ... I'm going to test it later... I'll let you know if everything work ok with that


Answers (1)

Answers (1)

jason_latko
Advisor
Advisor
0 Kudos

Mariana,

Yes, you have the correct syntax for your getString:  transaction.<Object>.<field>.  You only use object if you are passing up a sub-collection.  In that case you also need an index: transaction.object.index.field.  Normally, you just use transaction.field.  You should first test that your value is being saved to the transaction.  Have you verified this?  Use the ATE (Agentry Test Environment) to verify this by inspecting the transaction after it has been saved.  You may need to change your screensets.ini file on the server in order for PPC to render correctly on the ATE:

[Win32]

1=PPC

Modify the Win32 section in that file to look like the section above, then restart the server.

Jason Latko - Senior Product Developer at SAP