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

Customer search

Former Member
0 Likes
485

HI gurus,

I have customers number like 2, 21, 22 and 23...

my code:

DATA: BEGIN OF LT_CUST OCCURS 0,
        KUNNR LIKE KNA1-KUNNR,
        NAME1 LIKE KNA1-NAME1,
      END OF LT_CUST.

PARAMETERS: I_CUST LIKE KNA1-kunnr.

REPLACE ALL OCCURRENCES OF '*' IN I_CUST WITH '%'.
SELECT KUNNR NAME1 FROM KNA1 INTO TABLE LT_CUST WHERE KUNNR LIKE I_CUST.

LOOP AT LT_CUST.
WRITE: / LT_CUST-KUNNR, LT_CUST-NAME1.
ENDLOOP.

when i pass 2 as parameter then i get 2 in basic list.

When i pass 2* as parameter, i am not getting any values.

when i pass *2 as parameter, i am getting 2 in basic list, thats fine.

how to achieve 2* as search parameter and the result is 2, 21, 22 and 23.

Giri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
462

Giri,

try this...

give the parameter value in range...

CUTOMER_RANGE2-SIGN = 'I'.
        CUTOMER_RANGE2-OPTION = 'CP'.
        CUTOMER_RANGE2-LOW = CUSTOMER_NUMBER.
        APPEND CUTOMER_RANGE2.


      SELECT KUNNR NAME1 FROM KNA1
                         INTO CORRESPONDING FIELDS OF TABLE
                         LT_KNA1
                         WHERE KUNNR IN CUTOMER_RANGE1.

hope this will solve ur problem,

Regards

Syed

HI gurus,

I have customers number like 2, 21, 22 and 23...

my code:

DATA: BEGIN OF LT_CUST OCCURS 0,
        KUNNR LIKE KNA1-KUNNR,
        NAME1 LIKE KNA1-NAME1,
      END OF LT_CUST.

PARAMETERS: I_CUST LIKE KNA1-kunnr.

REPLACE ALL OCCURRENCES OF '*' IN I_CUST WITH '%'.
SELECT KUNNR NAME1 FROM KNA1 INTO TABLE LT_CUST WHERE KUNNR LIKE I_CUST.

LOOP AT LT_CUST.
WRITE: / LT_CUST-KUNNR, LT_CUST-NAME1.
ENDLOOP.

when i pass 2 as parameter then i get 2 in basic list.

When i pass 2* as parameter, i am not getting any values.

when i pass *2 as parameter, i am getting 2 in basic list, thats fine.

how to achieve 2* as search parameter and the result is 2, 21, 22 and 23.

Giri

3 REPLIES 3
Read only

valter_oliveira
Active Contributor
0 Likes
462

Hello,

That's a normal result. Go to tcode SE16, choose table KNA1, and make the same testing. The result will be the same.

This happens because of the CONVERTION routine. There is no field with patern '2*'.

To achive your goal, test with '000000002', instead of '2'.

Regards.

Valter Oliveira.

Read only

Former Member
0 Likes
463

Giri,

try this...

give the parameter value in range...

CUTOMER_RANGE2-SIGN = 'I'.
        CUTOMER_RANGE2-OPTION = 'CP'.
        CUTOMER_RANGE2-LOW = CUSTOMER_NUMBER.
        APPEND CUTOMER_RANGE2.


      SELECT KUNNR NAME1 FROM KNA1
                         INTO CORRESPONDING FIELDS OF TABLE
                         LT_KNA1
                         WHERE KUNNR IN CUTOMER_RANGE1.

hope this will solve ur problem,

Regards

Syed

Read only

Former Member
0 Likes
462

Hi Giri,

You should get the expected output with that code, please check again and let me know. If the problem is resolved please close the thread.

Yugandhar.