07-03-2007 9:30 AM
07-03-2007 9:36 AM
Assuming that you have to retrieve the customer data from Kna1(Customer Master) table....
it can be done using the below select statement....
data itab type standard table of kna1.
<b>select *
from kna1
into table itab
where name1 like 'A%'
or name1 like 'a%'.</b>
regards,
sai ramesh
07-03-2007 9:34 AM
Hi
U can use the following code, it's better to use field MCOD1 instead of NAME1, because NAME1 is case sensitive.
DATA: T_KNA1 LIKE STANDARD TABLE OF KNA1.
SELECT * FROM KNA1 INTO TABLE T_KNA1 WHERE MCOD1 LIKE 'A%'.
Max
07-03-2007 9:36 AM
Assuming that you have to retrieve the customer data from Kna1(Customer Master) table....
it can be done using the below select statement....
data itab type standard table of kna1.
<b>select *
from kna1
into table itab
where name1 like 'A%'
or name1 like 'a%'.</b>
regards,
sai ramesh
07-03-2007 9:37 AM
you can write a select on table KNA1
data : it_kunnr type standard table of kna1.
select * from kna1 into table it_kunnr where name1 like 'A%'.
Message was edited by:
Chandrasekhar Jagarlamudi
07-03-2007 9:53 AM
What's this question got to do with ABAP Objects -- unless you want to create a generic search class and then in your method call with parameter using the letter you want to start the search with..
That's probably why this Forum is hard to follow now due to the large amount of Off Topic questions and replies.
Not trying to be hard but keeping the questions in the Forum ON topic makes it both much more valuable for everyone and easier to navigate.
Cheers
Jimbo
07-03-2007 10:01 AM
Hello Aarif
Although all provided solutions work this is just <i>quick-and-dirty</i> programming.
The following sample may be useful jet I agree with James that the choice of the forum is wrong.
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_FIND_CUSTOMER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zus_sdn_find_customer.
DATA:
gs_selopt TYPE bapikna110,
gs_result TYPE bapikna111,
gt_selopt TYPE STANDARD TABLE OF bapikna110,
gt_result TYPE STANDARD TABLE OF bapikna111,
gs_return1 TYPE bapireturn1.
DATA:
gs_range TYPE bapicustomer_idrange,
gt_range TYPE STANDARD TABLE OF bapicustomer_idrange,
gt_addressdata TYPE STANDARD TABLE OF bapicustomer_addressdata.
PARAMETERS:
p_name TYPE name1_gp DEFAULT 'A*'.
START-OF-SELECTION.
TRANSLATE p_name TO UPPER CASE.
CLEAR: gs_selopt.
* gs_selopt-comp_code = __
gs_selopt-tabname = 'KNA1'.
gs_selopt-fieldname = 'MCOD1'. " Matchcode -> good choice for select
gs_selopt-fieldvalue = p_name.
APPEND gs_selopt TO gt_selopt.
CALL FUNCTION 'BAPI_CUSTOMER_FIND'
EXPORTING
* MAX_CNT = 0
pl_hold = 'X'
IMPORTING
return = gs_return1
TABLES
selopt_tab = gt_selopt
result_tab = gt_result.
CLEAR: gs_range.
gs_range-sign = 'I'.
gs_range-option = 'EQ'.
LOOP AT gt_result INTO gs_result.
gs_range-low = gs_result-customer.
APPEND gs_range TO gt_range.
ENDLOOP.
CALL FUNCTION 'BAPI_CUSTOMER_GETLIST'
* EXPORTING
* MAXROWS = 0
* CPDONLY =
* IMPORTING
* RETURN =
TABLES
idrange = gt_range
addressdata = gt_addressdata
* SPECIALDATA =
.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'BAPICUSTOMER_ADDRESSDATA'
TABLES
t_outtab = gt_addressdata
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END-OF-SELECTION.
Regards
Uwe