Skip to Content
avatar image
Former Member

Novice Question on Passing table parameter to a BAPI in C#

Hello everybody,

I'm almost new to the SAP .Net connector. I've written only 2 working projects and i'm stuck on the third.

I'm trying to create a sales order on C# using BAPI_SALESORDER_CREATEFROMDAT1 and i keep getting this error from SAP: "Please enter sold-to party or ship-to party".

Now, i'm passing table BAPIPARTNRTable as a "ref" parameter. I don't know what i'm doing wrong. This is the first time i pass a table as an output parameter so maybe i'm doing something wrong. Here is what i do:

BAPIPARTNRTable bapiPartNrTable = new BAPIPARTNRTable();

BAPIPARTNR bapiPartNr = new BAPIPARTNR(); //Structure

BapiPartNr.Partn_Role = PartFunc.Text; //AG (sold-to)

bapiPartNr.Partn_Numb = SoldTo.Text; //Sold-to number


Then i pass table "bapiPartNrTable" as ref.

Seems like SAP is getting an empty table, i don't know why since i used the add method to add a record to it.

Please help.

Thank you very much

Javier Villarreal.

PS: My call looks like this:

proxy.Bapi_Salesorder_Createfromdat1("", bapiHeader, "", out bapiPayer, out bapiReturn, out SalesDocument, out bapiShipTo, out bapiSoldTo, ref bapiCCardTable, ref bapiCublbTable, ref bapiCuinsTable, ref bapiCuprtTable, ref bapiCucfgTable, ref bapiCuvalTable, ref bapiItemInTable, ref bapiItemExTable,

<b>ref bapiPartNrTable</b>, ref bapisdHeaduTable);

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 02, 2004 at 01:37 PM

    Javier, the call looks correct to me.

    You can try to right click on the call line in your code, and choose "Run to cursor" debug option - and when it gets there, right click on the name of the table in parameters list, and do "Add Watch". Then, in the Watches section, explode your table tree, go to SAPTable, and, even lower, to CollectionBase, and check the "Count" parameter - it will show the number of rows in the table.

    Another thing to try (if your code is fully correct and the row is there) - Function Builder / Single Test in SAP FrontEnd, where you can enter the same parameters you specify in your code, and see what BAPI will say in response. It may be that you need some additional data for the call to go through.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Anton,

      I tried both things. I went down the three and i have the record. When i test the function in SE37 it works exactly with the same parameters.

      Do you have any other idea?. Have you passed a table to a function call or BAPI ?. If so, can you show me the code?-

      thank you very much for helping me


      Javier ..

  • avatar image
    Former Member
    Sep 09, 2004 at 09:31 PM


    Populate ITM_NUMBER field in structure ORDERS_PARTNERS with '000000'

    Add comment
    10|10000 characters needed characters exceeded