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: 

CL_GUI_ALV_GRID - Editable ALV - Amount field error on pressing TAB

Former Member
0 Kudos

HI All,

I have searched many SCN threads but could find any answer for this. Many has faced this problem but solution is not posted by anyone.

I am using SET_TABLE_FOR_FIRST_DISPLAY method to display editable  ALV but when I am toggling on Amount field  with value 2.0 I am getting below errors :

  • Description does not match target field
  • Entry 2.00   does not exist in TCURC (check entry)
  • 1

My field catalog is as follows:

    ls_fcat-fieldname = 'ZPREM'.   ,

    ls_fcat-coltext = text-018.

    ls_fcat-ref_table   = 'T001'.

    ls_fcat-ref_field   = 'WAERS'.

    ls_fcat-cfieldname  = 'DMBTR'.

    ls_fcat-decimals_o  = 2.

    ls_fcat-outputlen = lc_20.

    APPEND ls_fcat TO p_lt_fcat.

    CLEAR ls_fcat .

Can anybody suggest how to overcome this issue.

Thanks,

Jit

1 ACCEPTED SOLUTION

christian102094
Participant
0 Kudos

You are using the wrong fields to specify the currency. Use CURRENCY, CFIELDNAME to specify currency information instead of REF_TABLE and REF_FIELD.

- CFIELDNAME: name of the field of the table where the currency is stored.

13 REPLIES 13

christian102094
Participant
0 Kudos

You are using the wrong fields to specify the currency. Use CURRENCY, CFIELDNAME to specify currency information instead of REF_TABLE and REF_FIELD.

- CFIELDNAME: name of the field of the table where the currency is stored.

0 Kudos

Hi Christian,

I am using below field catlog now --

    ls_fcat-fieldname = 'ZPREM'.

    ls_fcat-coltext = text-018.

    ls_fcat-ref_table   =  'VBAP' .

    ls_fcat-ref_field   = 'MWSBP'.

    ls_fcat-cfieldname  = 'DMBTR'.

    ls_fcat-decimals_o  = 2.

    ls_fcat-outputlen = lc_20.

    APPEND ls_fcat TO p_lt_fcat.

    CLEAR ls_fcat .

It gives me below error -

"2,30" cannot be interpreted as a number

0 Kudos

CFIELDNAME is the name of the field of the currency, and DMBTR is an amount, not a currency. Try specifying 'WAERS', for example, if there were a WAERS column in your output table.

Please note that there is also a field called CTABNAME, in which you should specify the table where CFIELDNAME is from.

Also, if the currency is fixed (for example, 'USD' for all the records) then you can use CURRENCY = 'USD' instead of using CFIELDNAME and CTABNAME.

0 Kudos

Thanks for the reply Christian ..

But now the issue is I am passing 2,3 value and standard SAP is expecting 2.3 based on user profile.

My user profile USR01-DCPFM = SPACE

0 Kudos

Change your user configuration. ALV will work based on that. Otherwise, you would have to handle all the conversions "manually" which would be more complex.

0 Kudos

how can some one ask user to change their settings. This is not good option.. There has to be some FM for getting amounts in required format..

Can anybody please suggest me. FM ' HRCM_STRING_TO_AMOUNT_CONVERT' is there but I am not sure how to get decimal and thousand separator values which I need to pass this FM

0 Kudos

What I meant is that ALV will accept numbers with ',' or '.' depending on the user settings. So, if the user uses ',' for decimals, then the ALV will accept them. It's handled automatically.

0 Kudos

Christian,

I am not sure why ALV is showing 0,0 value in display and internally expecting 0.0.

I guess there is still some thing wrong with my FCAT. Also I don't have currency field.

  ls_fcat-fieldname = 'ZPREM'.

    ls_fcat-coltext = text-018.

    ls_fcat-ref_table   =  'VBAP' .

    ls_fcat-ref_field   = 'MWSBP'.

    ls_fcat-cfieldname  = 'WAERS' .

    ls_fcat-decimals_o  = 2.

    ls_fcat-outputlen = lc_20.

    APPEND ls_fcat TO p_lt_fcat.

Am i missing some thing in above field catalog...

0 Kudos

Ok.

1. Is there a WAERS field in your output table?

2. What's the currency field that is related to ZPREM?

0 Kudos

No.. WAERS is not in output table. In fact there is no currency field in it. It's just amount.

0 Kudos

Then just don't consider any currency in the field catalog. And about the comma, one thing is the display format and the internal format. In ABAP, decimals are *always* separated by '.'

And the display will be according to the user settings.

0 Kudos

Christian Tapia Sabogal wrote:

And about the comma, one thing is the display format and the internal format. In ABAP, decimals are *always* separated by '.' And the display will be according to the user settings.

Please listen to Chistian he's right.

0 Kudos

HI Christian,

I am converting values in internal format based on user profile. It worked.

Thank you.