cancel
Showing results for 
Search instead for 
Did you mean: 

passing wildcard to getlist() BAPI

Former Member
0 Kudos

Hi, I am trying to grab a list of WBS elements out of R/3 (4.7x200, Basis 6.20) and having trouble with something. If I pass a specific WBS element to the BAPI, then I get the list of elements I expect. For example, if I pass "ELEMENT", then I get back the list "ELEMENT, ELEMENT_LEVEL1, ELEMENT_LEVEL2" and so forth. That's fine, but I want to pass a wildcard so that I can get a range. For example, I would like to send "ELEM*" to the BAPI so I can get the results I got in the previous example as well as "ELEMNOP".

When I pass any wildcard I know of (like * or %), I get an WBS element not found type of error. Is it possible to pass a wildcard of some kind and get a large group of similarly named WBS elements?

Here's what I've tried. Thanks in advance, Ed.


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myMessage As New BAPI_METH_MESSAGETable
        Dim myElements As New BAPI_WBS_ELEMENT_EXPTable
        Dim myHierarchy As New BAPI_WBS_HIERARCHIETable
        Dim myMilestones As New BAPI_WBS_MILESTONE_EXPTable
        Dim myElementTable As New BAPI_WBS_ELEMENTSTable
        Dim myActivities As New BAPI_NETWORK_ACTIVITY_EXPTable
        Dim myReturn As New BAPIRETURN1
        Dim elem As BAPI_WBS_ELEMENT
        Dim i As Integer
        Dim myProjDefs As New BAPI_PROJECT_DEFINITION_EX
       ' >>>>> Textbox1 is where I enter the WBS elements I want.
       ' >>>>> I've tried passing wildcards here, but fail to get anything back.
        Myproxy1.Getinfo(TextBox1.Text, myProjDefs, _
            myReturn, myElementTable, myActivities, myElements, _
            myHierarchy, myMessage, "", myMilestones, "", "")
       ' Print errors
        Label1.Text = myReturn.Message.ToString
        
   ' hide the box and button
        Me.Visible = False
        TextBox1.Visible = False
     ' list results
        For i = 0 To myElements.Count - 1
            Response.Write(myElements(i).Wbs_Element & "<br />")

        Next
    End Sub

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Edward,

Im not familiar with your process but does the bapi accept wildcards?

Try running the bapi method inside SAP using the wildcards. You should always follow the parameter rules of the bapi. Remember that your program will just supply the parameters and will still follow the rules of the BAPi.

Reward if it helps.

Best Regards,

Kenny

Former Member
0 Kudos

Thanks Kenny,

I guess there is my answer. I tried running the BAPI with a wildcard and it returned the same thing the SAP .NET connector did: "Z_* does not exist." However, "Z_ACTUAL_PROJECT_NAME" did work. That's rather annoying. I want a way to pull a list of all the non-closed projects so I can populate a listbox in a .NET app. That's the ultimate goal.

Any ideas?

Former Member
0 Kudos

Have you looked at some of the reports in the area that return you the list and do accept the wildcard? You may have to ultimately do multiple bapi calls. One for the list of elements and one per element in the list for the requisite detail.

Enjoy