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

Editable ALV

Former Member
0 Likes
1,101

I have made the field NETPR editable in an ALV.

When I give value NETPR = 50 the value changes to 0.50 after saving.

Can anyone help me regarding this?

1 ACCEPTED SOLUTION
Read only

nishant_jain3
Explorer
0 Likes
1,070

Hi,

please add one more line to your filedcat for NETPR.

wa_fieldcat-fieldname   = 'NETPR'.

  wa_fieldcat-scrtext_m   = 'Net Price'.

  wa_fieldcat-col_pos     = 4.

  wa_fieldcat-edit        = 'X'.

wa_fieldcat-datatype = 'CURR'.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

It should work.

13 REPLIES 13
Read only

Former Member
0 Likes
1,070

It is because of decimal places of NETPR which is 2.Were you are using it.

Read only

Former Member
0 Likes
1,070

it has got length 11 with 2 decimal places. Try using the decimal places also.

Read only

0 Likes
1,070

Hi Sagar,

Thanks for your response.

I tried giving 20.00, still it takes as 0.20

Regards,

Riya

Read only

0 Likes
1,070

Which currency are you using NETPR

Read only

Read only

0 Likes
1,070

Unit is NZD

Read only

0 Likes
1,070

I think the value of NZD is too low.So it is displaying like it.

Note 456691 - FAQ: Price determination in purchasing

Can I use net prices that have more than 11 digits (including decimal places)?

Answer:

The field for the net price can be filled only with 11 characters (including 2 decimal places). A larger value usually leads to an overflow error ('price overflow error'). You can avoid this error by i) reducing the related quantity, ii) splitting the material item into several items, or iii) changing the price unit of measure accordingly.

The same applies for effective prices, which cannot exceed 13 digits (including 2 decimal places).

If you have further questions about this, we recommend that you open a customer message and forward it to SAP Development Support.

See also Note 584997.

Read only

dhruv_mehta
Active Contributor
0 Likes
1,070

Send the code u have used to create field symbol. and

there can be problem in your Decimal Notations in standard setting. Just goto SU01 enter ur userid

go to defaults tab and check what is Decimal Notation there and set acc to ur requirement.

Read only

0 Likes
1,070

What Dhruvin mentioned also a probability. Give a shot at that also.

Go to SU01->Give your user name->Go to tab Defaults->Check the decimal notation field and pick one from the drop down.

Read only

0 Likes
1,070

Hi,

Please find the code below.

 

  PERFORM build_fieldcatalog.

  PERFORM set_specific_field_attributes.
PERFORM display_alv_report.

FORM BUILD_FIELDCATALOG .
  wa_fieldcat-fieldname   = 'VBELN'.
  wa_fieldcat-scrtext_m   = 'Document No'.
  wa_fieldcat-col_pos     = 0.
  wa_fieldcat-outputlen   = 10.
  wa_fieldcat-emphasize   = 'X'.
  wa_fieldcat-key         = 'X'.
  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.


  wa_fieldcat-fieldname   = 'POSNR'.
  wa_fieldcat-scrtext_m   = 'Line Item'.
  wa_fieldcat-col_pos     = 1.
  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.

  wa_fieldcat-fieldname   = 'MATNR'.
  wa_fieldcat-scrtext_m   = 'Material No'.
  wa_fieldcat-col_pos     = 2.
  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.

  wa_fieldcat-fieldname   = 'QUANT'.
  wa_fieldcat-scrtext_m   = 'Quantity'.
  wa_fieldcat-col_pos     = 3.
  wa_fieldcat-edit        = 'X'. "sets whole column to be editable
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.

  wa_fieldcat-fieldname   = 'NETPR'.
  wa_fieldcat-scrtext_m   = 'Net Price'.
  wa_fieldcat-col_pos     = 4.
  wa_fieldcat-edit        = 'X'. "sets whole column to be editable
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.

  wa_fieldcat-fieldname   = 'VRKME'.
  wa_fieldcat-scrtext_m   = 'Unit'.
  wa_fieldcat-col_pos     = 5.
  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.

  wa_fieldcat-fieldname   = 'MWSBP'.
  wa_fieldcat-scrtext_m   = 'Tax'.
  wa_fieldcat-col_pos     = 6.

  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.


  wa_fieldcat-fieldname   = 'NETWR'.
  wa_fieldcat-scrtext_m  = 'Total Price'.
  wa_fieldcat-col_pos     = 7.
  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.
ENDFORM.                    " BUILD_FIELDCATALOG

FORM DISPLAY_ALV_REPORT .
  gd_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program       = gd_repid
      i_callback_pf_status_set = 'STATUS_SET'
      i_callback_user_command  = 'USER_COMMAND'
      is_layout_lvc            = gd_layout
      it_fieldcat_lvc          = it_fieldcat
      i_save                   = 'X'
    TABLES
      t_outtab                 =  gdt_vbap
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " DISPLAY_ALV_REPORT

FORM status_set USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'EDIT1' EXCLUDING rt_extab.
ENDFORM. "status_set


FORM SET_SPECIFIC_FIELD_ATTRIBUTES .
  DATA ls_stylerow TYPE lvc_s_styl .
  DATA lt_styletab TYPE lvc_t_styl  .


  LOOP AT gdt_vbap INTO gds_vbap.

      ls_stylerow-fieldname = 'QUANT' .
      INSERT ls_stylerow into table gds_vbap-field_style.
      ls_stylerow-fieldname = 'NETPR' .
      INSERT ls_stylerow into table gds_vbap-field_style.
       MODIFY gdt_vbap FROM gds_vbap.

  ENDLOOP.
ENDFORM.                   


FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.


  CASE sy-ucomm.
    WHEN '&DATA_SAVE'.

            loop at gdt_vbap into gds_vbap.
             MODIFY gdt_vbap  FROM gds_vbap TRANSPORTING  NETPR.

      ENDLOOP.

  ENDCASE.
ENDFORM.                  

Read only

nishant_jain3
Explorer
0 Likes
1,071

Hi,

please add one more line to your filedcat for NETPR.

wa_fieldcat-fieldname   = 'NETPR'.

  wa_fieldcat-scrtext_m   = 'Net Price'.

  wa_fieldcat-col_pos     = 4.

  wa_fieldcat-edit        = 'X'.

wa_fieldcat-datatype = 'CURR'.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

It should work.

Read only

0 Likes
1,070

Thanks Nishit.

It worked.

Read only

Former Member
0 Likes
1,070

Hi,

Try the suggestion of or you can try this:

wa_fieldcat-fieldname   = 'NETPR'.
  wa_fieldcat-scrtext_m   = 'Net Price'.
  wa_fieldcat-col_pos     = 4.
  wa_fieldcat-edit        = 'X'. "sets whole column to be editable

  wa_fieldcat-ref_table = 'VBAP'.

  wa_fieldcat-ref_field  = 'NETPR'.
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.

I tried it and it worked! ^_^

Regards,

Jake