Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unit of Conversion issue based on 'Key Date' for a Material in BOM using the FM 'CS_BOM_EXPL_MAT_V2'

former_member283828
Participant
0 Kudos

Hi Team,

The material BOM ‘A’ has the material ‘B’ with Component UOM different from the Base UOM of the material ‘B’.

While exploding the Material (‘A’) BOM multi-level using the FM ‘CS_BOM_EXPL_MAT_V2’ , the FM is taking care of the converting the component UOM(STB-MNGKO) of the material (‘B’) to BASE UOM (STB-MNGLG). I think the conversion is done based on the data provided in ‘Additional Data->Units of Measure’ maintained in the Material Master of the Material ’B’.

The issue is we have maintained a different conversion factor (‘Additional Data->Units of Measure’) in Material Master for Material ‘B’ before a particular key date and want that particular conversion factor to be considered when the FM is executed before that key date but the FM is only considering the latest conversion factor even when the FM is executed by passing the Date (Import parameter: DATUV) before the key date.

There is no documentation for the FM ‘CS_BOM_EXPL_MAT_V2’.

Is there a way that the FM will pick the conversion factor for Material 'B' based on the key date.

Any suggestions/solutions on resolving this issue will be greatly appreciated.

The code used to for calling the FM is as below:

        CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
          EXPORTING
            capid                 = mv_capid
            datuv                 = key_date
            ehndl                 = '1' 
            rndkz                 = '1' 
            emeng                 = iv_req_quant
            mehrs                 = abap_true
            mmory                 = '0' 
            mtnrv                 = iv_material
            stlal                 = iv_bom_altern
            werks                 = iv_plant
          IMPORTING
            topmat                = es_topmat
          TABLES
            stb                   = lt_expl_data
          EXCEPTIONS
            alt_not_found         = 1
            call_invalid          = 2
            material_not_found    = 3
            missing_authorization = 4
            no_bom_found          = 5
            no_plant_data         = 6
            no_suitable_bom_found = 7
            conversion_error      = 8
            OTHERS                = 9.
        IF sy-subrc <> 0.
          l_error = abap_true.
        ENDIF.
8 REPLIES 8

iftah_peretz
Active Contributor
0 Kudos

Hey,

You can dig into the code of the function, and might find something, or simply iterate (LOOP) over lt_expl_data and on the desired material use your conversion based on any logic that fits your needs.

0 Kudos

The issue is with retrieving the conversion factor (In Material Master: ‘Additional Data->Units of Measure’) based on a particular key date.

The function module ‘CS_BOM_EXPL_MAT_V2’ is internally calling the FM 'MATERIAL_UNIT_CONVERSION' which is used to get the conversion factor from 'Component UOM' to 'Base UOM'.

Looks like 'Key Date' is not part of the Import Parameters of the FM 'MATERIAL_UNIT_CONVERSION' for it to retrieve the 'Conversion Factor' based on the key date.

Does SAP has provided any standard BAPI/Function Module to get the 'Conversion Factor' from 'Component UOM' to 'Base UOM' based on the key date?

The tcode MM19 is able to retrieve the Material Master details(‘Additional Data->Units of Measure’) based on Key Date. Do we have any Function Module/BAPI which does the similar job.

Any other suggestions will be greatly appreciated.

Thanks & Regards,

Kiran

0 Kudos

While providing more informations as required by members, please add the text under Comments and not under Answer, as you were not answering but only sharing more information. I have converted your above answer to comment

0 Kudos

Hey, I'm not in front of SAP system so I can't look for tables or FMs, but, do you have any way of deducing the old conversion units, like from products that were made on that date from the specific BOM?

0 Kudos

Hi Iftah Peretz,

Thank you for your response.

My query is the same Peretz as you, 'do you have any way of deducing the old conversion units'.

Because the FM ‘CS_BOM_EXPL_MAT_V2’(which is in turn calling FM 'MATERIAL_UNIT_CONVERSION') which has the date as Import parameter(Field : DATUV) though we provide the 'past date' when the conversion factor is different (for some of the components of the BOM) is retrieving the latest conversion factor.

Tcode MM19 is able to retrieve the Material Master details(Conversion Details:Additional Data->Unit of Measure) based on key date. Is there a way we can achieve the MM19 functionality I.e getting the Material Master details(Conversion Details:Additional Data->Unit of Measure) based on key date using the FM/BAPI.

Thanks & Regards,

Kiran

0 Kudos

Hey, besides putting a trace on MM19 and searching for your needs, you can use different coding ways to get the data (for example).

Lakshmipathi
Active Contributor
0 Kudos

Not sure whether you have gone through the documentation of MATERIAL_UNIT_CONVERSION

It says:-

Functionality

This function module converts a quantity from one unit of measurement to another. A requirement for this is that the units of measurement relate to a material. One of them must be the base unit of measure of the material, while the other must be defined as an alternative unit of measure for the material or be capable of being converted to an alternative unit of measure as per table T006.

How you have maintained?

0 Kudos

Hi Lakshmipathi,

Thank you for your response.

The alternative and base unit of measure is maintained for the material and the conversion is happening with the FM 'MATERIAL_UNIT_CONVERSION' but the issue is we have a maintained a different conversion factor from 'Alternative UOM' to 'Base UOM' in Material Master (Additional Data->Unit of Measure) before a particular key date and wanted the FM 'MATERIAL_UNIT_CONVERSION' to retrieve that conversion factor when executed for that key date.

MM19 tcode is able to get the Material Master data(Conversion Factor : Additional Data->Unit of Measure) based on a key date. Do we have any Function Module/BAPI through which we can get the MM data based on key date or any other suggested solution is greatly appreciated.

Thanks & Regards,

Kiran