Skip to Content
-2

RFC_READ_TABLE with Excel VB

Jan 23, 2017 at 11:01 AM

136

avatar image

I want to pass the value to field BEDNR . but I do not have exact value, so I want to pass like *TEST* . means I want to add "*" front and back. when I enter code shown in screen shot, RFC gives no result. How to use '*' to get the related entries from SAP.
capture.png (19.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Stefan Schnell
Jan 24, 2017 at 11:59 AM
0

Hello Duraisamy,

as far as I can see is your SQL statement correct.

I check it with this statement on the table SFLIGHT:

CARRID = 'AA' AND (PLANETYPE LIKE '%-%' AND PLANETYPE NOT LIKE '%300%')

Plantypes are 747-400 and A310-300. With this statement I expect only the flights with 747-400 planetype, and that is what I get.

Cheers
Stefan


sflight.jpg (76.6 kB)
Share
10 |10000 characters needed characters left characters exceeded
Stefan Schnell
Jan 23, 2017 at 11:39 AM
1

Hello Duraisamey,

try

oRow.Value(1) = "WERKS = '5000' AND BEDNR LIKE '%TEST%'"

Let us know your result.

Cheers
Stefan

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Stefan....

Thank you so mush for your reply.. Its working correctly.

If you do not mind , I have one more questions.

If I want to exclude some Item , how should I write ? . I want to include Which has TA17 and Want to exclude which has BADTA17

capture.png (12.3 kB)
0
Duraisamy Dhanaraj Jan 25, 2017 at 04:10 AM
0

Hi Stefan,

Thanks for your reply.. Sorry its not working. I am using Visual basic (VB) to download data from SAP table. First statement is working correctly. second is not working.


capture.png (6.0 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Duraisamy,

sure it is not working because the length of your line is to long.

This line is okay, because it is < 72 characters:

WERKS = '5000' AND LOEKZ <> 'X' AND BEDNR LIKE '%TA17%'

But this line is not okay, it is > 72 characters:

WERKS = '5000' AND LOEKZ <> 'X' AND (BEDNR LIKE '%TA17%' AND BEDNR NOT LIKE '%TG%')

OPTIONS is from type SO_TEXT072 (CHAR with a length of 72).

Add a new line.

Cheers
Stefan

length.jpg (18.3 kB)
length2.jpg (19.6 kB)
1
Duraisamy Dhanaraj Jan 25, 2017 at 10:09 AM
0

Hello Stefan, I am getting syntax error. when split it to two lines


capture.png (6.2 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Duraisamy,

try

Set oRow = oTOPT.Rows.Add
oRow.Value(1) = "WERKS = '5000' AND LOEKZ <> 'X' AND "
Set oRow = oTOPT.Rows.Add
oRow.Value(1) = "(BEDNR LIKE '%TA17%' AND BEDNR NOT LIKE '%TG%')"

Cheers
Stefan

1
Duraisamy Dhanaraj Jan 29, 2017 at 11:27 AM
0

hello Stefan.. Thank you so much.. Its working Correctly.

Share
10 |10000 characters needed characters left characters exceeded