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

parameter

Former Member
0 Likes
808

hi every body,

can anyone please tell me ......

my requirement is like this in my selection screen there is a parameter which accepts both numeric and character

as an input . if i give both char & numeric but it should accept only character.

thanks inadvance....

with regards,

vidya.

7 REPLIES 7
Read only

Former Member
0 Likes
779

Hi,

Can you please post the code for parameter in quoestion ? Also make u'r requiremnet more clear ?

Regards,

Ben.

Read only

Manohar2u
Active Contributor
0 Likes
779

Try this way.

At selection-screen on p_input.

if p_input ca '0123456789'.

Message s000 with 'Invalid input'

exit.
endif.

Regds

Manohar

Read only

Former Member
0 Likes
779

Declare your parameter as character type so that it will consider both numarics and charcters.

and write selection screen validation logic as below

At selection-screen on p_input.

if p_input ca '0123456789' and p_input ca sy-abdce.

Message e000 with 'Invalid input'.

endif.

Read only

Former Member
0 Likes
779

hi,

Can u explain clearly.

if we give both nume and char , do u want to select only the characters from the given input or do u want to give error message when we give both in the input field.

Regards,

Lucky.

Read only

Former Member
0 Likes
779

Hi can you please try this code:

SELECTION-SCREEN BEGIN OF BLOCK b1.

PARAMETERS : p_belnr LIKE bkpf-belnr.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON p_belnr.

IF p_belnr CA '0123456789'.

IF p_belnr CA 'abcdefghijklmnopqrstuvwxyz'

OR p_belnr CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

MESSAGE ID 'ZZ' TYPE 'E' NUMBER '001'.

ENDIF.

ENDIF.

Read only

Former Member
0 Likes
779

Hi Vidya,

I am assuming like this,

1) if u give only char, it should accept

2) if u give only numeric char, it should accept

3) if u give combination, then it should not

If this is ur requirement, please follow the code below.

parameters : p(10) type c.

At selection-screen on p.

if p co '0123456789'.

exit.

elseif p ca '0123456789'.

Message e000(YSIMPLE) with 'Invalid input'.

stop.

endif.

start-of-selection.

write : / p.

Hope this will help u in some way.

Read only

Former Member
0 Likes
779

Hi Vidya,

parameter : data1(10) type c.

data : lv_len type i,

l_pos like sy-tabix,

lv_char type c,

lv_data(10) type c.

describe field data1 length lv_len in character mode.

do lv_len times.

l_pos = sy-index - 1.

lV_char = data1+l_pos(1).

if lv_char co sy-abcde.

concatenate lv_data lv_char into lv_data.

endif.

enddo.

write lv_data.

Rgds,

Prakash