Skip to Content
avatar image
-2
Former Member

RFC_READ_TABLE with Excel VB

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Jan 24, 2017 at 11:59 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23, 2017 at 11:39 AM

    Hello Duraisamey,

    try

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

    Let us know your result.

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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)
  • avatar image
    Former Member
    Jan 25, 2017 at 04:10 AM

    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.

    Add comment
    10|10000 characters needed 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)
  • avatar image
    Former Member
    Jan 25, 2017 at 10:09 AM

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

    Add comment
    10|10000 characters needed 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

  • avatar image
    Former Member
    Jan 29, 2017 at 11:27 AM

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

    Add comment
    10|10000 characters needed characters exceeded