Drop down boxes on screen painter

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
theChiel
Posts: 304
Joined: Mon Feb 23, 2004 10:30 pm
Location: US of A via ALBA

Drop down boxes on screen painter

Post by theChiel » Tue Nov 05, 2013 9:21 am

I have a screen field that references a domain that allows values 1 thru 5. What settings do I need to make on screen printer to make the entry only possible via the selection of the drop down ... that is, I Want the field open for data entry but not to allow entry via the keyboard just the drop down.


Thanks
What do you mean there's no undo !!!

Gothmog
Posts: 1952
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Drop down boxes on screen painter

Post by Gothmog » Tue Nov 05, 2013 10:10 am

Isn't it the standard behaviour for a listbox screen element ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67

theChiel
Posts: 304
Joined: Mon Feb 23, 2004 10:30 pm
Location: US of A via ALBA

Re: Drop down boxes on screen painter

Post by theChiel » Wed Nov 06, 2013 1:14 pm

That's was I thought but I can still key in a value.
What do you mean there's no undo !!!

Rich
Posts: 7116
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool
Contact:

Re: Drop down boxes on screen painter

Post by Rich » Thu Nov 07, 2013 10:15 am

Check out function group VRM....

Set your screen element to drop downlist in the properties window and then do something like this:

Code: Select all

PROCESS BEFORE OUTPUT.
        Module Init_Screen_0100.
...

Code: Select all

*&---------------------------------------------------------------------*
*&      Module  INIT_SCREEN_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text    Initialise the screen,  populating the drop down lists
*               etc.
*----------------------------------------------------------------------*
Module Init_Screen_0100 Output.
       Perform Init_Screen Changing g_Screen_0100
                                    g_Screen_0200.
EndModule.
(Note that SAP documentation states the only command to be used in a screen module is a PERFORM. It then goes onto say that FORMS are depreciated and should not be used...... :?

Code: Select all

Form Init_Screen Changing pc_Screen_0100 Type Screen_0100
                          pc_Screen_0200 Type Screen_0200.
*

     If pc_Screen_0100-Initialised = c_False.
*
*       If this is a create there will be no bank delivery methods as
*       they are populated by READ_DATA,  so do that here.
*
        If pc_Screen_0100-Activity = c_ac_Create.
           Perform Get_Bank_Delivery_Methods Changing pc_Screen_0100
                                                      pc_Screen_0200.
        EndIf.
*
        Perform Init_Country_Drop_Downs.

Code: Select all

*Eject
*&---------------------------------------------------------------------*
*&      Form  INIT_COUNTRY_DROP_DOWN
*&---------------------------------------------------------------------*
*       text  Intialise a country code drop down list
*----------------------------------------------------------------------*
*       -->   pu_Drop_Down - the drop down to initialise
*----------------------------------------------------------------------*
Form Init_Country_Drop_Down Using pu_Drop_Down Type Drop_Down_Name.
*
     Statics: t_Values Type Drop_Down_Values.
*
     Data: t_Countries Type Countries,
           w_Country   Type Country,
           w_Value     Type Drop_Down_Value.
*
*    Need to set up the drop down lists ?
*
     If t_Values Is Initial.
*
*       Get the Country codes and names
*
        Select Land1 Landx50
          Into table t_Countries
          From T005t
         Where Spras = sy-Langu.
*
        Loop at t_Countries Into w_Country.
             w_Value-Key  = w_Country-Land1.
             w_Value-Text = w_Country-Landx50.
             Append w_Value to t_Values.
        EndLoop.
     EndIf.
*
     Call Function 'VRM_SET_VALUES'
       Exporting
          Id              = pu_Drop_Down
          Values          = t_Values
       Exceptions
          Id_Illegal_Name = 1
          Others          = 2.
EndForm.
*Eject
*&---------------------------------------------------------------------*
*&      Form  INIT_COUNTRY_DROP_DOWNS
*&---------------------------------------------------------------------*
*       text  Initialises the value for the country code drop down lists
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
Form Init_Country_Drop_Downs.
     Perform Init_Country_Drop_Down Using 'G_SCREEN_0100-BEN_COUNTRY'.
     Perform Init_Country_Drop_Down Using 'G_SCREEN_0100-REC_COUNTRY'.
EndForm.
You need to change the G_SCREEN_0100-BEN|REC_COUNTRY' to the name of the screen fields you want to use.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com

Post Reply