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 data retrieval when range is specified..

Former Member
0 Likes
473

hi,

In my selection screen I set the value for kunnr-low as 100 and kunnr-high as 200. i just have one record in my custom table but that has kunnr set as 1300. so when these values are entered, no data must be retrieved, but that record with kunnr 1300 is being retrieved..here is my code..

APPEND i_dyn_fields.

MOVE: 'S_KUNNR-LOW' TO i_dyn_fields-fieldname.

APPEND i_dyn_fields.

MOVE: 'S_KUNNR-HIGH' TO i_dyn_fields-fieldname.

APPEND i_dyn_fields.

CALL FUNCTION 'DYNP_VALUES_READ'

...

..

read table i_dyn_fields index 3.

if not i_dyn_fields-FIELDVALUE is initial.

wa_KUNNR-low = i_dyn_fields-FIELDVALUE.

wa_KUNNR-sign = 'I'.

wa_KUNNR-option = 'EQ'.

append wa_KUNNR to s_KUNNR.

clear wa_KUNNR.

ENDIF.

read table i_dyn_fields index 4.

if not i_dyn_fields-FIELDVALUE is initial.

wa_KUNNR-HIGH = i_dyn_fields-FIELDVALUE.

wa_KUNNR-sign = 'I'.

wa_KUNNR-option = 'BT'.

append wa_KUNNR to s_KUNNR.

clear wa_KUNNR.

ENDIF.

something is wrong in the wa_kunnr-option !! i tried setting it to BT for kunnr-low, then no values where retrieved, but then it will fail when a single value is entered !!

how to deal with this ??

thanks

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
453

You must make sure that the customer numbers are in the internal format, which means it needs to have leading zeros. You can use the function module CONVERSION_EXIT_ALPHA_INPUT to convert from external format, to internal format.

read table i_dyn_fields index 3.
if not i_dyn_fields-FIELDVALUE is initial.

wa_KUNNR-low = i_dyn_fields-FIELDVALUE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = wa_KUNNR-low
  IMPORTING
    OUTPUT        = wa_KUNNR-low.

wa_KUNNR-sign = 'I'.
wa_KUNNR-option = 'EQ'.
append wa_KUNNR to s_KUNNR.
clear wa_KUNNR.
ENDIF.



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'.
wa_KUNNR-option = 'BT'.
append wa_KUNNR to s_KUNNR.
clear wa_KUNNR.
ENDIF.


Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
454

You must make sure that the customer numbers are in the internal format, which means it needs to have leading zeros. You can use the function module CONVERSION_EXIT_ALPHA_INPUT to convert from external format, to internal format.

read table i_dyn_fields index 3.
if not i_dyn_fields-FIELDVALUE is initial.

wa_KUNNR-low = i_dyn_fields-FIELDVALUE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = wa_KUNNR-low
  IMPORTING
    OUTPUT        = wa_KUNNR-low.

wa_KUNNR-sign = 'I'.
wa_KUNNR-option = 'EQ'.
append wa_KUNNR to s_KUNNR.
clear wa_KUNNR.
ENDIF.



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'.
wa_KUNNR-option = 'BT'.
append wa_KUNNR to s_KUNNR.
clear wa_KUNNR.
ENDIF.


Regards,

Rich Heilman

Read only

0 Likes
453

Yes Rich, You are right..Ur solutions works. Sorry Vijay, I tried urs, but had the same issue.

Read only

Former Member
0 Likes
453
read table i_dyn_fields index 3.
if not i_dyn_fields-FIELDVALUE is initial.
wa_KUNNR-low = i_dyn_fields-FIELDVALUE.
wa_KUNNR-sign = 'I'.
wa_KUNNR-option = 'EQ'.

ENDIF.

read table i_dyn_fields index 4.
if not wa_kunnr-low is initial.
 if not i_dyn_fields-FIELDVALUE is initial.
    wa_KUNNR-HIGH = i_dyn_fields-FIELDVALUE.
      wa_KUNNR-option = 'BT'.
     append wa_KUNNR to s_KUNNR.
     clear wa_KUNNR.
  ENDIF.
else.
 if not i_dyn_fields-FIELDVALUE is initial.
    wa_KUNNR-LOW = i_dyn_fields-FIELDVALUE.
      wa_KUNNR-option = 'EQ'.
      wa_KUNNR-sign = 'I'.
     append wa_KUNNR to s_KUNNR.
     clear wa_KUNNR.
  ENDIF.
endif.