Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Match first three character

Hi Expert!

Kindly, need your help and guide.

I want to get customer code, customer name from KNA1 table where customer name start with 'ACP'.


I try to code as below, but, the program return wrong


TABLES: KNA1.

types:

begin of lty_kna1,

   kunnr like kna1-kunnr,

   name1 like kna1-name1,

   end of lty_kna1.

data: it_kna1 type standard table of lty_kna1 with header line.

select kunnr name1

   into table it_kna1

   from kna1 where name1 LIKE 'ACP%'.

if sy-subrc = 0.

   write:/ it_kna1-name1.

else.

   write:/ 'wrong program'.

endif.



Your help is really appreciated,


regards,

Liyana

Former Member
Former Member replied

Hi, Everyone.

thank you for helping,

The program already success with amendment as below:

TABLES: KNA1.

types:

begin of lty_kna1,

   kunnr like kna1-kunnr,

   name1 like kna1-name1,

   end of lty_kna1.

data: it_kna1 type standard table of lty_kna1 with header line.

select kunnr name1

   into table it_kna1

   from kna1 where name1 LIKE 'ACP%'.

   write:/1  'Customer',20 'Name1'.

   LOOP AT it_kna1.

   write:/1 it_kna1-kunnr, 20 it_kna1-name1.

   ENDLOOP.


regards,

liyana

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question