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: 

Reading the data from ALV OUT PUT CELL with 3 decimals

vykuntrao
Participant
0 Kudos
287

How to read the data from ALV output cell which contains 3 decimals.

Am using REUSE_ALV_GRID_DISPLAY_LVC for displaying the data . In the field catalogue am passing

wa_fcat-fieldname = 'KBETR'.
wa_fcat-tabname = 'IT_VBAP'.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = '14'.
IF lt_agr_users IS NOT INITIAL.
wa_fcat-edit = 'X'.
ENDIF.
wa_fcat-scrtext_m = 'ZAIP(percentage)%'.

wa_fcat-decimals = 3.

To read data from alv output for the field KBETR using

IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.

IF NOT ref_grid IS INITIAL.


CALL METHOD ref_grid->check_changed_data .
ENDIF.

When am checking internal table data if I enter 1 in the output of alv after calling check_changed_data method am getting the value as .001 Not sure why it is getting divided by 10

Is there any thing that missing the field catalogue??

9 REPLIES 9

Sandra_Rossi
Active Contributor
0 Kudos
170

I guess you mean divided by 1000 (not by 10)

Sandra_Rossi
Active Contributor
0 Kudos
170

I'd say that the main issue it that you use old ABAP which is prone to such errors. Better use CL_SALV_TABLE, the catalog is automatically generated.

raymond_giuseppi
Active Contributor
0 Kudos
170

This is a currency field, it must be linked to a currency field, then will the number of decimals be correct on display.

  • Look for some standard reports that use this field and display their field catalog using the ALV consistency check (or use standard tools such a SALV class that handle it themselves or good old FM such as LVC_FIELDCATALOG_MERGE to generate the field catalog for old-fashioned styles)
  • Read some documentation on their Handling in ABAP Programs

0 Kudos
170

But this is nit currency field I want to capture value entered in output which is capable of reading upto 3 decimals

0 Kudos
170

Can you execute the ALV consistency check on your ALV display, and paste definition of the field (e.g. INTTYPE value)

vykuntrao
Participant
0 Kudos
170

yes sorry for typo.1

Sandra - What you mean by using that class can you explain in detail

vykuntrao
Participant
0 Kudos
170

Value in internal table is 0.100

matt
Active Contributor
170

Go to a search engine and type:

cl_salv_table site:blogs.sap.com

This will give you a great deal of information on how to use cl_salv_table, which, as Sandra Rossi commented is far easier to use than the function modules - and works better!

vykuntrao
Participant
0 Kudos
170
wa_fcat-fieldname = 'KBETR'.
wa_fcat-tabname = 'IT_VBAP'.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = '14'.
IF lt_agr_users IS NOT INITIAL.
wa_fcat-edit = 'X'.
ENDIF.
wa_fcat-scrtext_m = 'ZAIP(percentage)%'.
* wa_fcat-decimals_o = 3.
wa_fcat-decimals = 3.
* WA_FCAT-CFIELDNAME = 'WAERS'.

wa_fcat-datatype = 'CURR'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

This was given initially which passed datatype also in the field catalogue so it is not reading properly the value with 3 decimals. Once I removed the datatype in field catalogue then it worked perfectly

Keep sharing and learning