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

alv oops raising error message

Former Member
0 Likes
1,003

Hi,

iam displaying output using alv oops.

one of the char field is editable i want to give only numeric values only.i cannot change datatype to numc for that field.if user enters char value(like abc) and click on any button in alv output i want to raise a error message and i want to stop the user in alv report output.

Regards,

Suresh

1 ACCEPTED SOLUTION
Read only

agnihotro_sinha2
Active Contributor
0 Likes
794

hi,

i think u need to use the GET_CHANGED_DATA method in the CL_GUI_ALV_GRID class.

It will return the changed data.. Then u check the data and accordingly raise the error mess..

regards,

ags

4 REPLIES 4
Read only

agnihotro_sinha2
Active Contributor
0 Likes
795

hi,

i think u need to use the GET_CHANGED_DATA method in the CL_GUI_ALV_GRID class.

It will return the changed data.. Then u check the data and accordingly raise the error mess..

regards,

ags

Read only

uwe_schieferstein
Active Contributor
0 Likes
794

Hello Suresh

I assume that the editable field in your ALV list is defined as CHAR type in the underlying table (structure). In order to prevent non-numeric entries I would use the following approach:

  • Define additional column for your ALV list, e.g.:

TYPES: BEGIN OF ty_s_outtab.
  INCLUDE type <name of z-table> AS data.
TYPES:  numfield(4)    TYPE n.  " Assumption: Your editable field is CHAR4, e.g. charfld
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab  TYPE STANDARD TABLE OF ty_s_outtab WITH DEFAULT KEY.

DATA: gt_outtab TYPE ty_t_outtab. " your itab for ALV list

  • Build fieldcatalog automatically and add additional column for NUMFIELD:

" Call fm LVC_FIELDCATALOG_MERGE with your z-table

  LOOP AT gt_fcat INTO ls_fcat
                            WHERE ( fieldname = <name of editable field> ).
     " Suppress this field
       ls_fcat-tech = 'X'.
       MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.


    " Modify LS_FCAT to reflect the additional NUMC4 field
      ls_fcat-fieldname = 'NUMFIELD'.
      ls_fcat-rolltype = ...  " change technical details from CHAR4 -> NUMC4

      ls_fcat-edit = 'X'.  " Now the NUMC4 field is editable

      INSERT ls_fcat INTO gt_fcat INDEX syst-tabix.
  ENDLOOP.

  • Initial load of outtab: shuffle values from CHAR4 to NUMC4 field

REFRESH: gt_outtab.
  LOOP AT gt_data INTO ls_data.
    clear: ls_outtab.

    ls_outtab-data = ls_data.
    move ls_data-charfld TO ls_outtab-numfield.
    
    APPEND ls_outtab TO gt_outtab.
  ENDLOOP.

Regards

Uwe

Read only

0 Likes
794

Hi Uwe,

I need your help regarding the following issue.

iam displaying report output using alvoops.

in the output list one of numc field is editable with length 4.

in field catalog i set lzero = 'X'. now output displaying with leading zeros.

now problem is if numc field doesnot contain any value out put displaying as '0000'.

i dont want '0000' and i want blank space in output list.

i want to edit alv grid for the numc field values like '0010','0009',0001and blank.

if i edit alv grid with numc value '0010' it showing only '10' doesnot consider leading zeros.

i want to validate the entered values for numc field.

Regards,

Suresh

Read only

0 Likes
794

TRY...

wa_Field_catalog-NO_ZERO = 'X'.

Cheers,