cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_PRODORD_GET_DETAILS - How to obtain values from a RfcStructureMetadata?

Former Member
0 Kudos

Hi to everybody,

I'm using:

- Visual Studio 2013

- nco30 x64

The aim is obtain the values from some fields from table "header" and table "components" relevat to the BAPI_PRODORD_GET_DETAIL

Surfing in the web, I found a post from Ronald Lim and I followed the steps described by Yearden Jacobson

I'm trying to use BAPI_PRODORD_DETAIL this is my code:

Private Sub GetProdOrdDetails(ByVal odp As String)

        Try

            Dim funcAPI As IRfcFunction = _ecc.Repository.CreateFunction("BAPI_PRODORD_GET_DETAIL")

            funcAPI.SetValue("Number", odp)

            Dim myTable As IRfcTable = funcAPI.GetTable("Header")

            Dim myElementMetadata As RfcStructureMetadata

            myElementMetadata = myTable.Metadata.LineType

            funcAPI.Invoke(_ecc)

            For i As Integer = 1 To myElementMetadata.FieldCount - 1

                MsgBox(myElementMetadata.Item(i).Name)

                MsgBox(myElementMetadata.Item(i).Documentation)

            Next

        Catch ex As Exception

            MsgBox("Error:" & ex.Message)

        End Try

    End Sub

No matter to get the fields name, description and so on, but I need getting the values for each field in the tables, but I don't know how to do.

Is there anybody who knows how?

I thank you in advance

Kind Regards

Celeghin Denis

Accepted Solutions (0)

Answers (1)

Answers (1)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Celeghin,

please check the samples and the tutorial included in the SDK download how to retrieve data from a table. It contains also the API documentation, which is telling which methods. Just summarized here: The IRfcTable is both an iterator and a data container. Loop over the rows by setting CurrentRow. The number of rows is stored in RowCount. Getting data from the current row is possible with the APIs inherited from IRfcDataContainer, all the Get.... methods. You could use GetString(fieldName) to get the string representation for all values. There are Get methods that fit better for certain data types, e.g. if ABAP tyoe is an INT4, GetInt() will return the .NET int representation of it.

Best regards,

Markus