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

abap general

Former Member
0 Likes
417

Hi experts, can any one give answer to these following questions,it's an urgent reqiurement.

1. How to allowing only two values 'F' or ' M' for GENDER filed?

i tried this by maintanig at domain level,but is there any other solutions.i just need another way for getting this.

2 REPLIES 2
Read only

Sm1tje
Active Contributor
0 Likes
391

Do you need this is a report or as a search help (value / check table)...where do you want to use it?

In report for example you can do a check at selection screen and check what user entered. Or create a new customizing table and a search help for example...

Need more info about why, where and how you want to use this.

Read only

Former Member
0 Likes
391

Assuming you're using a Dialog/Module program..

In your Global area (_TOP)


TYPE-POOLS             vrm.
DATA: 
      lgen_field   TYPE vrm_id,
      lgen_result  TYPE STANDARD TABLE OF vrm_value,
      lgen_val     LIKE LINE OF ltype_result.

In your PBO routine


REFRESH lgen_result. clear lgen_result.
lgen_val-key = 'F'.
lgen_val-text = 'Female'.
append lgen_val to lgen_result.
lgen_val-key = 'M'.
lgen_val-text = 'Male'.
append lgen_val to lgen_result.

* Field name to assign drop down values
  lgen_field = 'YOURGENDORFIELD'.

  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            id              = lgen_field
            values          = lgen_result
       EXCEPTIONS
            id_illegal_name = 1
            OTHERS          = 2.

In the screen painter ensure that your Value List on the Field attribute screen is set to 'A' (From Program)

I know you can use this in a selection screen to, but I do not have an example of it.