cancel
Showing results for 
Search instead for 
Did you mean: 

How can i get the value from Length,Width in Item Master Data to calculate?

Former Member
0 Kudos

Hi all experts,

My customer needs 1 columns in Item master data. To solve with his requirement, i create one UDF the store that information.

The UDF will calculate by width*length( Sales Tab). So when the user change or input the length or width, it will calculate and display in my UDF.

So does anybody know how i can get the value in Width and Length values from Sales Tab in Item Master Data?

Thanks

TONY

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Tony,

Try something like

select CONVERT(numeric(19,6),CONVERT(Numeric(19,6),Replace($[$-54.0.1] ,'m','')) * CONVERT(Numeric(19,6),Replace($[$-61.0.1] ,'m','')))

And make sure your UDF is of type Rate/Total

Regards

Edy

Former Member
0 Kudos

Hi Edy Simon,

Your code is right.but when i change Length or Width, my UDF doesn't recalculate again.

My UDF will calculate again when i click on search sign on it.

Thanks


TONY

Johan_H
Active Contributor
0 Kudos

Hi Tony,

The problem is that the width and height values are only committed to the database once you press update. That is why the FMS does not get triggered when you change width or height.

Please try the following, and let us know if it works for you:

  1. Use the query I suggested in your other question, or use the one suggested, and attach it to your FMS.
  2. Set the FMS to Auto refresh when field changes:Volume - Sales unit and Refresh regularly.
  3. Make a change to the width or the height, and press Update
  4. Refresh the Item master data window. The value of the Area UDF should now have been updated.

Regards,

Johan

Former Member
0 Kudos

Hi Jonhan,

I have followed your idea and it also works.but based on Mr.query, if i input 1000cm, it will display error

how can i select only the number to calculate?

Thanks

TONY

edy_simon
Active Contributor
0 Kudos

Hi Tony,

The query is taking the screen value for the calculation.

Example,

If the width value on the screen is 100m, the $[$-54.0.1] will return you '100m', hence you will need the replace($[$-54.0.1],'m','') to just return the 100.

Based on the above, I think you should now figured out how to modify the query .

Regards

Edy

Johan_H
Active Contributor
0 Kudos

Hi Edy and Tony,

That is not the problem, and Edy's solution is incorrect. Simply because that solution would mean that 100cm x 10m = 1.000 ?² when in reality it should be 100.000 cm²

The correct way to solve this problem, is by policy. In you company you need to agree on a single unit of measurement for length and width. So always use m or always cm or always mm, but never mixed.

If your database already contains mixed values, use the DTW to update all values to one and the same unit of measurement of your choice.

When importing new items, make sure that any measurements in a different unit, are first converted.

Regards,

Johan

P.S. @Tony: most people on SCN do not get payed to help out on this forum. One of the few incentives is collecting points. You, as the person who asked the question, can award these points by marking an answer as helpful or the solution. Marking your own answer as the solution, when it is not, and not even marking other answers as helpful, will make people less inclined to help you in future.

edy_simon
Active Contributor
0 Kudos

Hi Johan,

If SAP allows the user to have mix UOM, then what needs to be done is the conversion in the query.

It should not be too difficult ?

more over, there will never be a mix between Metric and British unit of measurement.

BTW, I did really miss that the user can put in different UOM ...

Cheers.

Edy

Johan_H
Active Contributor
0 Kudos

Hi Edy,

B1 allows mixed UOM, simply because SAP never deemed it necessary to enforce a single UOM policy. Using a single UOM policy, is more of a best-practices kind of thing. I can easily think up several scenarios that would benefit from a single UOM policy, and not a single one, that necessitates a multiple UOM policy. Also a multiple UOM policy makes automating processes that use measurements, unnecessarily complicated.

You are right though, that the solution can be implemented with a query with string functions and/or case statements. However that only proves my point. A simple agreement to only use m as UOM, or a complicated query, each time you have a new requirement ? In other words, always use the K.I.S.S. method.

Regards,

Johan

P.S. The UOM for each measurement is maintained in a separate own column. So for Height (SHeight1) the UOM can be found in SHght1Unit

Answers (1)

Answers (1)

Johan_H
Active Contributor
0 Kudos

Hi Tony,

Apparently you already solved this question yourself ?

Please see your own previous question.

Regards,

Johan

Former Member
0 Kudos

Hi Johan,

i confuse to use this query (select isnull(T0.sLength1,0)*isnull(T0.SWidth1,0) from oitm T0 where ItemCode=$[OITM.ItemCode])

If i use this query, it will be wrong because when i change value at Length or Width, it doesn't change value at UDF.

Do you know when i change values at Length or Width, it update values at UDF?

Thanks

TONY