SAP RFC "RFC_READ_TABLE" can search for job names like "*" and "%" of sm37

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
weiyinvelee
Posts: 1
Joined: Thu Oct 24, 2019 8:01 pm

SAP RFC "RFC_READ_TABLE" can search for job names like "*" and "%" of sm37

Post by weiyinvelee » Thu Oct 24, 2019 8:19 pm

English is not good, please forgive me

You can search for information by giving the full name with the job name.
How to search like sm37, you can use * or % search range

Like this
StrMaterial = "111-AA1-Y-*"
But it doesn't work, so there should be other ways, or the instructions of the seniors.
For example,
tblOptions(1, "TEXT") = "JOBNAME EQ '" & StrMaterial & "'"
EQ want to change?

Code: Select all

Private Sub GetBins()

    Set objFileSystemObject = VBA.CreateObject("Scripting.FileSystemObject")
    Set filOutput = objFileSystemObject.CreateTextFile("C:\LQUA.CSV", True)


    Set RFC_READ_TABLE = funcControl.Add("RFC_READ_TABLE")
    Set strExport1 = RFC_READ_TABLE.Exports("QUERY_TABLE")
    Set strExport2 = RFC_READ_TABLE.Exports("DELIMITER")
    Set tblOptions = RFC_READ_TABLE.Tables("OPTIONS")
    Set tblData = RFC_READ_TABLE.Tables("DATA")
    Set tblFields = RFC_READ_TABLE.Tables("FIELDS")
    
    strExport1.Value = "TBTCO"
    strExport2.Value = ","
    
    'StrMaterial = InputBox("Please Input Part Number")
    StrMaterial = "111-AA1-Y-*"
    '設定要找的job name是那一個, 多個條件時就直接在同一行之後用&來接AND
    tblOptions.AppendRow
    tblOptions(1, "TEXT") = "JOBNAME EQ '" & StrMaterial & "'"

Gothmog
Posts: 1955
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: SAP RFC "RFC_READ_TABLE" can search for job names like "*" and "%" of sm37

Post by Gothmog » Mon Oct 28, 2019 5:12 am

Hello!

Each line in table OPTIONS is a WHERE clause in the Open SQL SELECT statement.
The wildcard is %, and the operator is LIKE for such a selection.

Like so:

Code: Select all

StrMaterial = "111-AA1-Y-%"
tblOptions.AppendRow
tblOptions(1, "TEXT") = "JOBNAME LIKE '" & StrMaterial & "'"
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67

Post Reply