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: 

how to create required field in alv?

Former Member
0 Kudos

hi friends^^

how to create required field in alv?

i don't find required option in fieldcatalog and others.

is it possible?

6 REPLIES 6

Former Member
0 Kudos

Hi,

Try the field key_sel in field catalog if you are using in ALV Grid using FM. it should be work for column level.

regards,

SB

0 Kudos

thanks for you answer.

but key_sel does't.

key_sel = 'X'. -> does not required field.

i want to make required field(obligatory field) in editable alv.

please answer me..

0 Kudos

Hi,

In the field catlog KEY_SEL = 'X' which enables your required field.

do reward points also do send the code..

0 Kudos

Hi

While saving check if the required field is not marked with 'X'.

then show the message "Reqd field to be entered'.

do reward points

0 Kudos

Source code..

PLANETYPE is key_sel = 'X'.

But does't required field...

REPORT zs32editable1 .

TYPE-POOLS : slis.

DATA : gt_sflight TYPE TABLE OF sflight.

DATA : gt_fieldcat TYPE slis_t_fieldcat_alv,

gs_fieldcat LIKE LINE OF gt_fieldcat,

gs_layout TYPE slis_layout_alv.

START-OF-SELECTION.

SELECT *

INTO CORRESPONDING FIELDS OF TABLE gt_sflight

FROM sflight.

gs_layout-colwidth_optimize = 'X'.

gs_layout-edit = 'X'.

gs_fieldcat-fieldname = 'PLANETYPE'.

gs_fieldcat-key_sel = 'X'.

append gs_fieldcat to gt_fieldcat.

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

is_layout = gs_layout

IT_FIELDCAT = gt_fieldcat

TABLES

t_outtab = gt_sflight

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.

Former Member
0 Kudos

Hi,

if u don't want to display i.e. Hide the field.

U declare the fieldcatlog -NO_OUT = 'X'.

Now this field hide but if u want display u can click the layout in the alv display screen. Then u move to display list.

Thanks,

Durai.V