Hi Team,
I have a customised class in which I want to call a standard class method example
the class is WhsUnshipLoadLine and the method is unship().
now this method takes formdatasoucre as parameter but since I am using it in custom class and this method is not being called from a form, I want to somehow pass recid as argument in this parameter when calling this method in my class. Is it possible to convert a recid value to formdatasource format and then passing it in the method parameter? Please help.
As I said - look at the method, borrow what you need and ignore isn't relevant or useful in your scenario. If you the logic in isunpickingfullloadline(), then use it.
Thanks you Martin, but there are few conditions on WHSUnshipLoadLineForm class as well which I think need to be checked before using Whshnship class for this process.
For example - whsunshiploadlineform.isunpickingfullloadline() method.
Please correct me if am wrong?
1. I already addressed this above. Yes, you need a custom method, but you shouldn't implement something similat to WhsUnship class. You should use this class in your method.
2. Yes, both entities and classes can have more than one method.
Actually my scenario is… I have created a custom table XYZWhsUnshipLoadLineTable and a custom data entity ‘XYZWhsUnshipLoadLineEntity’ for this table. A third party is filling the data in this custom table through OData and now we need to create a OData action on this entity so that they can call this action method and through that method the we could perform the unshipping of quantity automatically.
It’s like once they have filled the data into the table we have to call the whsunshiploadlineform.unship() method and reduce the quantity for the laod lines which they have sent into the table.
Now my question is -
1. Since the method takes formdatasource as the argument then I will I have to write my own logic similar to whsunship class to reduce the quantity right?
2. Can I create multiple methods inside my entity class to perform this activity.
Please see screenshot below
Example-
Please see my suggestion above. If you don't like it, please explain what problem you have with it.
Repearing "Any suggestions please help" is useless, because it provides no information on the topic.
Any suggestions please help
Any suggestions please help
Thank you Martin,
Actually I am creating a OData action method in which I want to call this method and automatically perform the unship method functionality. Shoul I write a replicate of that method in my custom class to perform that functionality without automatically without form interaction.
Please help.
What RecId do you have? If it's a RecId of WHSTmpLoadLineInventory table, it's useless without a reference to a temporary data set. WHSTmpLoadLineInventory is a temporary table is has no data in database at all.
Regarding the method, you can see thayt it isn't good for your purpose, because it requires a form data source, while you don't have any. And you can't create a form data source without a form.
I would look into unship() method and borrow the logic I need. You'll see that most work is done by WHSUnShip class.
Note that other parts of the method are not relevent in your case. For example, the logic getting records selected in a grid makes no sense when you don't have a form. Also, there is no point in running a while select against multiple records if you have just a single one (I'm not sure by that, it's just an assumption).
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156