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

issue in select option values..

Former Member
0 Likes
856

hey,

i have a select option, s_kunnr. User enters a value for s_kunnr-high, but it is not taken into account in the select statement !!

my code is

read table i_dyn_fields index 4.

if not i_dyn_fields-FIELDVALUE is initial.

wa_KUNNR-HIGH = i_dyn_fields-FIELDVALUE.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_KUNNR-high

IMPORTING

OUTPUT = wa_KUNNR-high.

wa_KUNNR-sign = 'I'.

if NOT WA_KUNNR-LOW is initial.

wa_KUNNR-option = 'BT'.

else.

wa_KUNNR-option = 'EQ'.

endif.

append wa_KUNNR to s_KUNNR.

clear wa_KUNNR.

ENDIF.

what is the issue ??

thks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
830

Instead of the logic you have written, you can write much simpler logic.

LOOP AT s_kunnr INTO s_kunnr.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = s_KUNNR-LOW

IMPORTING

OUTPUT = s_KUNNR-LOW.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = s_KUNNR-high

IMPORTING

OUTPUT = s_KUNNR-high.

MODIFY s_kunnr FROM s_kunnr.

ENDLOOP.

and you are done... AS per your logic it's correct but the only mistake is you are appending a new row in s_KUNNR and you are not passing the value in s_kunnr-sign. so that's why it is not fetching anything.. try passing 'BT' into s_kunnr-sign and that will also work.

Rewards point if it is useful.

Thanks,

Navneet

8 REPLIES 8
Read only

Former Member
0 Likes
830

wa_kunnr-low = somekunnr. " i hope it is there

read table i_dyn_fields index 4.
if not i_dyn_fields-FIELDVALUE is initial.
wa_KUNNR-HIGH = i_dyn_fields-FIELDVALUE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_KUNNR-high
IMPORTING
OUTPUT = wa_KUNNR-high.
wa_KUNNR-sign = 'I'.

if NOT WA_KUNNR-LOW is initial.
wa_KUNNR-option = 'BT'.
else.
wa_KUNNR-option = 'EQ'.

endif.
append wa_KUNNR to s_KUNNR.
clear wa_KUNNR.
ENDIF.

Read only

0 Likes
830

No Vijay. is there not a possibility that user does not enter any value for s_kunnr-low but directly enters for s_kunnr-high ?? should not SAP then take it as EQ according to my logic ??

Read only

0 Likes
830

if that is the case you have to provide that as LOW and option = 'EQ'.

if kunnr-low is initial.

kunnr-low = kunnr-high.

kunnr-option = 'EQ'.

endif.

but you still want ' ' to kunnr what ever you enter then you can go ahead with that..

Read only

Former Member
0 Likes
830

Try this,

Append S_KUNNR directly instead of using WA.

E.g.:

S_KUNNR-SIGN = 'i"

S_KUNNR-OPTION = 'BT'

S_KUNNR-LOW =

S_KUNNR-HIHG =

Thanks,

SKJ

Read only

Former Member
0 Likes
830

u should build your logic in a way that u first populate low and then high part of the selection option. Without populating low if u populate high value then it will give u error. So I think u should first populate low and then high and based on it decides value for option field like:

if NOT WA_KUNNR-high is initial.

wa_KUNNR-option = 'BT'.

else.

wa_KUNNR-option = 'EQ'.

endif.

Pl. check ur code again..

Read only

ian_maxwell2
Active Participant
0 Likes
830

On ranges:

- BT - Uses Low and High

- EQ - Uses Low

This would mean from looking at your code that in the case where EQ is used it is actaully looking for a record where Kunnr is blank instead of the value that you put in High.

Just got to switch a couple of things around

~Ian

Read only

Former Member
0 Likes
830
if NOT WA_KUNNR-LOW is initial.
wa_KUNNR-option = 'BT'.
else.
wa_KUNNR-option = 'EQ'.
wa_kunnr-low = wa_kunnr-high. <-=== add this your low is space,but you are using EQ 
endif.
append wa_KUNNR to s_KUNNR.
clear wa_KUNNR.
ENDIF.
Read only

Former Member
0 Likes
831

Instead of the logic you have written, you can write much simpler logic.

LOOP AT s_kunnr INTO s_kunnr.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = s_KUNNR-LOW

IMPORTING

OUTPUT = s_KUNNR-LOW.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = s_KUNNR-high

IMPORTING

OUTPUT = s_KUNNR-high.

MODIFY s_kunnr FROM s_kunnr.

ENDLOOP.

and you are done... AS per your logic it's correct but the only mistake is you are appending a new row in s_KUNNR and you are not passing the value in s_kunnr-sign. so that's why it is not fetching anything.. try passing 'BT' into s_kunnr-sign and that will also work.

Rewards point if it is useful.

Thanks,

Navneet