Tuesday, June 3, 2008

SAP ABAP SELECT-OPTIONS to have Upper and Lower Case

SAP ABAP SELECT-OPTIONS to have Upper and Lower Case

SELECT-OPTIONS by default displays all characters in UPPER CASE. This happens once the user hits the ENTER Key. If you wish to force Lower Case on the field values entered in the SELECT-OPTIONS fields use the addition LOWER CASE.

The Syntax is as follows.

SELECT-OPTIONS:  s_ernam for vbak-ernam LOWER CASE.

The code is as follows.

REPORT ZEX_SELECTOPTIONS.

Tables: VBAK,
        VBAP.

Data: int_vbak type vbak occurs 0 with header line.

Select-options: s_vbeln for vbak-vbeln ,
                           s_auart for vbak-auart,
                           s_ernam for vbak-ernam LOWER CASE.


Select * INTO int_VBAK from VBAK where
         VBELN in s_vbeln.
APPEND int_VBAK.
CLEAR int_VBAK.
ENDSELECT.


loop at int_vbak.
Write:/ int_vbak-vbeln, int_vbak-AUART.
endloop.

write:/ s_vbeln-low, s_auart-low, s_ernam-low.

In the above example, s_ernam has the addition of LOWER CASE where as s_auart does not have the addition. Once you execute the program the output will show auart in upper case where as ernam in the case that has been entered by the user as it is.

Not: If TYPE addition is used to refer data types from the ABAP dictionary, then you cannot use the LOWER CASE addition.

If you enter the following data

Sales Order     4969
Order Type      or
Created By      JohN

Then the Output would be as follows.

Select Options in SAP ABAP      
                                
4969       OR                   
4969       OR   JohN            

This is because s_ernam has the LOWER CASE addition where as s_auart does not have the addition.



No comments:

Post a Comment