Application Development and Automation 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: 
Read only

Excel Problem - UOM conversion

Former Member
0 Likes
1,088

Hi All,

I got a internal table populated with values, in my report i got a option for report or excel. When i choose report and execute, the itab is displayed with the UNIT Of

Measure in english e.g CAR for Carton and PC for Piece.

However im passing the same itab to the FM 'MS_EXCEL_OLE_STANDARD_DAT'

But im getting the unit of measure as KAR instead of CAR and ST instead of PC.

This is my itab structure.

data : begin of it_bom_final occurs 0,

sort(3) type n,

matnr like mast-matnr, " Material

maktx like makt-maktx, " Material Description

<b>bmein like stko-bmein, " UOM</b>

bmeng like stko-bmeng, " Base Qty

matnr1 like stpox-idnrk, " BOM component

maktx1 like stpox-ojtxp, " Object description (item)

<b>meins like stpox-meins, " Comp UOM</b>

menge like stpox-menge, " Comp Qty / Consumption rate

ausch like stpox-ausch, " scrap percent

end of it_bom_final.

*---

I need to download as CAR and PC in excel also.

Letme know the solution for this.

Thanks in advance

S

Message was edited by:

senthil kumar

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
804

Hi Sentil, what you are seeing here is the internal representation of the data. Not sure why SAP does this, but sometimes, the code will have a conversion routine against it which will give a different internal code. This is done with unit of measures and I have seen it with Order Types in SD as well. In you case, I think it may be as easy as doing the conversion routine against the value. Try Calling the function module CONVERSION_EXIT_CUNIT_OUTPUT,

Regards,

Rich Heilman

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
805

Hi Sentil, what you are seeing here is the internal representation of the data. Not sure why SAP does this, but sometimes, the code will have a conversion routine against it which will give a different internal code. This is done with unit of measures and I have seen it with Order Types in SD as well. In you case, I think it may be as easy as doing the conversion routine against the value. Try Calling the function module CONVERSION_EXIT_CUNIT_OUTPUT,

Regards,

Rich Heilman

Read only

0 Likes
804

So you coding would be something simular to this.



report zrich_0001.

data : begin of it_bom_final occurs 0,
sort(3) type n,
matnr like mast-matnr, " Material
maktx like makt-maktx, " Material Description
bmein like stko-bmein, " UOM
bmeng like stko-bmeng, " Base Qty
matnr1 like stpox-idnrk, " BOM component
maktx1 like stpox-ojtxp, " Object description (item)
meins like stpox-meins, " Comp UOM
menge like stpox-menge, " Comp Qty / Consumption rate
ausch like stpox-ausch, " scrap percent
end of it_bom_final.


loop at it_bom_final.


  call function 'CONVERSION_EXIT_CUNIT_OUTPUT'
    exporting
      input                = itab_bom_final-bmein
*   LANGUAGE             = SY-LANGU
    importing
*   LONG_TEXT            =
      output               = itab_bom_final-bmein
*   SHORT_TEXT           =
   exceptions
     unit_not_found       = 1
     others               = 2.


  call function 'CONVERSION_EXIT_CUNIT_OUTPUT'
    exporting
      input                = itab_bom_final-meins
*   LANGUAGE             = SY-LANGU
    importing
*   LONG_TEXT            =
      output               = itab_bom_final-meins
*   SHORT_TEXT           =
   exceptions
     unit_not_found       = 1
     others               = 2.


  modify it_bom_final.

endloop.

Regards,

Rich Heilman

Read only

0 Likes
804

Hi Rich,

This is peculiar,

SORT MATERIAL UOM QTY BOM COMPONENT

8 100026655 CAR 1 400000972 EA

5 100026655 CAR 1 400300811 LBS

1 100022821 M 500 200000688 M

2 100051224 CAR 1 400300816 LBS

1 100051224 CAR 1 200000688 M

3 100026655 CAR 1 400002336 PC

8 100026655 KAR 1 400000972 EA

1 100026655 KAR 1 200009715 M

2 100026655 KAR 1 750000078 LBS

3 100026655 KAR 1 400002336 ST

4 100026655 KAR 1 400300811 LBS

1 100051224 KAR 1 200000688 M

Some where its reflecting correctly and somewhere its wrong.

and the sort field is alinged wrongly.

Is it because i have moved at the top it_bom_final-sort = sy-tabix. ??

Kindly clarify

Regards

S

Read only

0 Likes
804

Thanks Rich, Its working fine.

Instead of looping at the final itab, i have loop at the initial itab and used th FM where its actually fetching the UOM.

Thanks a Lot.

Regards,

S