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

Like operation in loop

Former Member
0 Likes
1,703

Hi All

I am passing to date and from date as input and fetching records from ekko into lt_ekko.

Now ,i had field 'customername' in output screen(importing parameter of a  function module).

LT_ekko has field verkf (customername) values as SDN SAP - 10 records.and SAP - 10 records and SDN - 10 records

My query is if the user gives input as SAP.i need to display SDN SAP records(along with SAP records) and delete SDN records from lt_ekko as it is my final table.

I am giving ranges

IF iv_customername IS NOT INITIAL.

    ls_r_custname-sign = 'I'.

    ls_r_custname-option = 'NP'.

    ls_r_custname-low = iv_customername.

    APPEND ls_r_custname TO lt_r_custname.

  ENDIF.

DELETE lt_ekko WHERE verkf IN lt_r_custname.

this delete statement is not working ,not deleting entries of SDN records.

Thanks

Vamsi

6 REPLIES 6
Read only

Former Member
0 Likes
1,056

hi mohan

with CP or NP there must be atleast one masking character.

can you insert this before above code and try.

concatenate iv_customername '*' into iv_customername.

Read only

0 Likes
1,056

Hi Adbul

Tried ,but not worked,sy-subrc = 4

Read only

0 Likes
1,056

If you use a range (IN, select-option) you could concatenate "*" at start and end of string, if you are using LIKE statement, use "%".

But for internal table criteria you could also use operator NS Contains No String, DELETE lt_ekko WHERE verkf NS string. (log_exp - Comparison Operators for Character-Like Data Types)

Regards,

Raymond

Read only

vinodkumar_thangavel
Participant
0 Likes
1,056

Hi,

Instead u can try using DELETE lt_ekko WHERE verkf NE iv_customername.

Regards,

Vinodkumar.

Read only

0 Likes
1,056

Vinodh

if i do verkf NE iv_customername, SDN SAP  records also gets deleted.i need SAP & SDN SAP records

Read only

Former Member
0 Likes
1,056

Hi Mohan,

Make following changes to your code snippet -

IF iv_customername IS NOT INITIAL.

    ls_r_custname-sign = 'I'.

    ls_r_custname-option = 'EQ'.

    ls_r_custname-low = iv_customername.

    APPEND ls_r_custname TO lt_r_custname.

  ENDIF.

DELETE lt_ekko WHERE verkf IN lt_r_custname.

Let me know incase of any help.

Thanks & Regards

Richa