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: 

ALV OUTPUT Display issue

Former Member
0 Kudos

Hello All,

ALV Output Display Issue..

I have an internal table, where the values are correctly populated as below,

in field catalog table also the values are same as displayed above.

But in ALV display,

For the Currency 'KRW' the NETPR value displayed is different.

I.e. in table = 1200.00

     in ALV  =  120,000.

is it due to the difference in data type of NETPR..in table it is p(6) dec(2), whereas in fieldcat table it is c(30).

Please help me out.

1 ACCEPTED SOLUTION

former_member207661
Active Participant

hi Giri,

This is clearly due to number of decimal in a particular currency, KRW in this scenario.

KRW(Korean Won) do not have any decimal point and hence have 1 as a minimum unit.

SAP, when storing data in Database or internal tables, uses same field for all currencies and hence stores 120000 KRW as 1200.00 and 1200.00 EUR as 1200.00

That is why, when displaying amount on screen, corresponding Currency field is important.

In this scenario, as rightly mentioned in another response, you can use SAP Std FM CURRENCY_AMOUNT_SAP_TO_DISPLAY to convert it to correct format.

You can check that this FM converts 1200.00 EUR to 1200.00 EUR, but 1200.00 KRW to 1200000 as explained above.

Hope this helps.

Warm Regards,

Shyam Agrawal

9 REPLIES 9

Former Member
0 Kudos

hi giri,

try with fcat-DECIMALS_OUT = '2'.

romit_raina
Active Participant
0 Kudos

Hello Giri,

Seems  something is messed up while building the Final table which is displaying as output.

This is not issue of Data Type because rest of below fields in the output are coming correct only the value of the Currency Key - KRW.

Also while looking closely to above 2 screens, data which is coming to the output of Currency Key - KEW is all INCORRECT.

I would suggest you to please check the final table(output) during debugging, which data is coming for above currency key.

Thanks

Romit Raina

Former Member
0 Kudos

Hi,

While building the fieldcat, have you put ref table and field? In that case, it is the same as the type of the field on the internal table declaration?

Regards

Ernesto

jimmy_chan2
Explorer
0 Kudos

Hi,

please check fieldcatalog setting

IF fieldname = 'CMPRE'.          "Amount Field
   fieldcatalog-cfieldname = 'WAERK'.   "Reference Currency code
   fieldcatalog-ctabname  = 'IT_TABNAME'.

ENDIF.

Regards,

Jimmy

former_member202771
Contributor

Hi Giri,

Convert currency format using.

FM CURRENCY_AMOUNT_SAP_TO_DISPLAY


Thanks and Regards,

Anil

prince_isaac
Active Participant
0 Kudos

Hi Giri

This is a matter of how the currencies are defined in the system as to how many decimals should be displayed.  As reference check table TCURX for exception currencies which should show NOT 2 decimal places.  For your field catalog create a dictionary object and on your amount field link it to a currency and you will not have to worry about display as SAP will handle it.

regards

Prince Isaac

raymond_giuseppi
Active Contributor
0 Kudos

First read some documentation as ALV Grid Control  -> The Field Catalog , Generating the Field Catalog, Fields of the Field Catalog, Value Display with Currency/Quantity Unit.

Then check your final table definition (and how values are passed) did you use CURR types or DEC types, did you give reference to a currency code (CUKY) column in the first case, execute also The Consistency Check.

Regards,

Raymond

former_member207661
Active Participant

hi Giri,

This is clearly due to number of decimal in a particular currency, KRW in this scenario.

KRW(Korean Won) do not have any decimal point and hence have 1 as a minimum unit.

SAP, when storing data in Database or internal tables, uses same field for all currencies and hence stores 120000 KRW as 1200.00 and 1200.00 EUR as 1200.00

That is why, when displaying amount on screen, corresponding Currency field is important.

In this scenario, as rightly mentioned in another response, you can use SAP Std FM CURRENCY_AMOUNT_SAP_TO_DISPLAY to convert it to correct format.

You can check that this FM converts 1200.00 EUR to 1200.00 EUR, but 1200.00 KRW to 1200000 as explained above.

Hope this helps.

Warm Regards,

Shyam Agrawal

0 Kudos

Thank u so much Shyam, The issue is solved.