cancel
Showing results for 
Search instead for 
Did you mean: 

Filter a `MeasureUnitCode`-List?

geronimo31011
Participant

Hi all,

how can I filter a `MeasureUnitCode`-List? E.g. I would like to offer only matching measure units for length or volume entities.

In the material OIF you can find the tap "General" > "UoM Characteristics". Here you can enter information about "Net/Gross Weight", "Net/Gross Volume", "Length", "Width" and "Height". Thereby only matching units are displayed in the unit code dropdown lists. If I see this correctly via the sdk, in each case the data type is `MeasureUnitCode`. Now when I'm using the same data type for volume or length input, I get the complete code list. Of couse I can create new code lists, but I would prefere to use standard lists.

I have already searched for the problem but found no answer. Maybe someone can help me?

Kind regards,

Michael

Accepted Solutions (1)

Accepted Solutions (1)

jravnik
Participant
0 Kudos

geronimo18 in case you are still looking for an answer to your question - it is possible to "filter" that code list.

We used it for an custom BO, where we needed it for a certain field with data type "Measure" (which as a structured data type does include a "MeasureUnitCode" as unitCode), i.e.:

[Label("Gross Weight")]
element GrossWeight : Measure;

Then in the UI Designer we added an unbound string data field with the initial value "GROSS_WT":

With a right-click on the bound data field the Codelist Context Mapping can be accessed for the sub-field "unitCode":

In there the mapping for QuantityTypeCode needs to be linked to the newly created unbound data field:

After those steps, the UI automatically filters the code list and just shows possible values for the Gross Weight.

Same can be applied for other measure "types":

  • GROSS_WT
  • NET_WT
  • GROSS_VOL
  • NET_VOL
  • DIM_LENGTH
  • HEIGHT
  • BREADTH

Hope that helps.

Best regards
Jürgen

geronimo31011
Participant

Hi jravnik,

thank you very much! After the long time I did not even expect that someone solves this problem. In the meantime I had solved it by workaround and created a new codelist. As described in the beginning, this is of course not a nice solution, but it was pragmatic because the content of the list will probably not change. For future developments it is of course good to know how to do it correctly.

Kind regards,
Michael

Answers (3)

Answers (3)

former_member689468
Participant

This is something Im struggling with also and I cant belive its so hard to find an answer to such a simple request

geronimo31011
Participant

Hi Josip,

yes, there is still no answer for this question and I have not found a solution either. As a workaround I have created own code lists which have the same codes as the `MeasureUnitCode` list so that the codes are compatible. However, this is of course not a clean solution, because it does not react to adjustments of the `MeasureUnitCode` list. Hopefully a solution will be found at some point, especially because SAP demonstrates in their own views that this actually works in the system. So it is frustrating as a partner developer not to be able to use this functionality.

Kind regards,
Michael

Reinaud
Explorer

Hi Michael,

I think this also does not (fully) cover your needs, but what you can do is set a default UoM value for a specific field, and make it read-only. This only works if you e.g. have fields like weight, length and volume for example. You could then define the field as follows in your BO:

[Label("Split Percentage")] element SplitPercentage : Quantity = {content = 0, unitCode = "P1"};

[Label("Split Amount")] element SplitAmount : Amount = {content = 0, currencyCode = "EUR"};

And then subsequently make the UOM part read-only in your screen, but leave the input field available.

But of course, this will not work anymore if you use one field in which you may want to capture multiple dimensions.

Kind regards,

Reinaud Schreur

geronimo31011
Participant
0 Kudos

Hi Reinaud,

thank you also for the answer, Yes, unfortunately that does not cover my requirement. I have already added default values, but the business user should be able to change the UoM. For this reason it's not an option to make the field read-only. The user shouldn't be able to select for example kilometer in a volume field, simply because it makes no sense and that is where my request comes from. As you can see the function of the mentioned SAP standard view fulfills this requirement and therefore i would like to adapt this behavior.

Kind regards,
Michael

mjveerhuis1
Active Contributor

Hi Michael,

UoM Characteristics in the product master offer the possibility to add more details on volume and dimensions related to the specific product / material. When I understand you correctly, you want to display a certain selection of unit of measure entries (instead of the set standard entries) relevant for your project.

Unfortunately this cannot be done by a code list restriction list. I would also not advice to make a new code list. If the unit of measures you have in mind are valid for the whole user population in your organisation, I would suggest you block the ones you do not want to see in Configuration – Activity List - Quantities and Units of Measures and set the status of certain physical units from 2 – released to 3 – blocked.

You will then no longer see these entries in the drop down lists in the UoM Characteristics tab of the product master or in any other screens that use these entries.

Kind regards,

MJ

geronimo31011
Participant
0 Kudos

Hi Marie-José,

thank you for your reply. However, i would like to have the same inputs on volume and dimensions in a separate view. So I want use this kind of inputs outside the material data in a custom BO. Therefore unfortunately blocking some UoM will not help.

Kind regards,
Michael