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

problem in editable alv table .

Former Member
0 Likes
772

hello friends ,

i am facing a problem in editable alv ,the problem is while saving my data in internal table through editable alv one of my numeric field is being wrongly updated .

for eg : if i am entering '2.00 ' in the field the value updated is 0.02.

regards ,

arpit.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
733

Hi Arpit ,

Try to Use DECIMALS property of the field catalog

wa_fieldcat-decimals = '2'.

This will solve your problem.

Regards,

Nikhil

6 REPLIES 6
Read only

Former Member
0 Likes
733

>

> hello friends ,

> i am facing a problem in editable alv ,the problem is while saving my data in internal table through editable alv one of my numeric field is being wrongly updated .

>

> for eg : if i am entering '2.00 ' in the field the value updated is 0.02.

>

> regards ,

> arpit.

Hi Arpit,

Please provide us with your code so that we can review it and let you know where the problem is.

Regards

Sikha

Read only

guilherme_frisoni
Contributor
0 Likes
733

Hi,

the easiest way is to set ref_table and ref_fieldname for this field in fieldcatalog.

Set this values according thie column in the table you are updating values.

Regards,

Frisoni

Read only

Former Member
0 Likes
734

Hi Arpit ,

Try to Use DECIMALS property of the field catalog

wa_fieldcat-decimals = '2'.

This will solve your problem.

Regards,

Nikhil

Read only

0 Likes
733

thanks nikhil it really helped.

Read only

Former Member
0 Likes
733

Dear Arpit

Please check the below code and it may very useful

TABLES: VBAK, VBAP.
TYPE-POOLS: SLIS, ICON.

DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      ERDAT LIKE VBAK-ERDAT,
      END OF ITAB.
DATA: BEGIN OF JTAB OCCURS 0,
      VBELN LIKE VBAP-VBELN,
      MATNR LIKE VBAP-MATNR,
      KWMENG LIKE VBAP-KWMENG,
      END OF JTAB.
DATA: TB_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT LIKE LINE OF TB_FCAT,
      WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
      TB_EVENT TYPE SLIS_T_EVENT,
      WA_EVENT LIKE LINE OF TB_EVENT,
      TB_HEADER TYPE SLIS_T_LISTHEADER,
      WA_HEADER LIKE LINE OF TB_HEADER,
      WA_KEYINFO TYPE SLIS_KEYINFO_ALV.

CLEAR WA_FCAT.
WA_FCAT-ROW_POS = '1'.
WA_FCAT-COL_POS = '1'.
*WA_FCAT-REF_FIELDNAME  = 'VBELN'.
WA_FCAT-REF_TABNAME = 'VBAK'.
*WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-EDIT = 'X'.
WA_FCAT-SELTEXT_M = 'DOCUMENT'.
APPEND WA_FCAT TO TB_FCAT.

CLEAR WA_FCAT.
WA_FCAT-ROW_POS = '1'.
WA_FCAT-COL_POS = '2'.
*WA_FCAT-REF_FIELDNAME  = 'ERDAT'.
WA_FCAT-REF_TABNAME = 'VBAK'.
WA_FCAT-FIELDNAME = 'ERDAT'.
*WA_FCAT-EDIT = 'X'.
WA_FCAT-SELTEXT_M = 'DATE'.
APPEND WA_FCAT TO TB_FCAT.

CASE SY-UCOMM.
  WHEN 'VBELN'.
    WA_FCAT-SELTEXT_M = 'SURENDRA'.
    MODIFY TB_FCAT FROM WA_FCAT.
ENDCASE.

SELECT VBELN ERDAT FROM VBAK INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 15 ROWS.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM                = SY-REPID
   IS_LAYOUT                         = WA_LAYOUT
   IT_FIELDCAT                       = TB_FCAT
TABLES
    T_OUTTAB                          = ITAB
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Thanks

Surendra P

Read only

Former Member
0 Likes
733

hi Arpit ,

you can solve your problem by two ways.....

In fieldcatalog

APPEND these two fields 

 WA_FIELDCAT-REF_FIELD = ' '.        " refrence field 
 WA_FIELDCAT-REF_TABLE =  ' ' .  " refrence table

OR ,
APPEND this field 

WA_FIELDCAT-INTTYPE = 'C'.

hope this will help you

Regards

Gaurav