0

I am working with SapNwRfc (https://github.com/huysentruitw/SapNwRfc) I was able to use the .net framework and to connect with my sap production server.

However I have some issues on get everything working with calling bapi that return result in table format.

I would like to test the calling if BAPI_COMPANY_LIST that takes no input and return a structure with the company list here's the code:

sapFunction = sapConnection.CreateFunction("BAPI_COMPANYCODE_GETLIST");
var result = sapFunction.Invoke<SAPbapi_company_get_list_results>();

where I defined the class this way

public class SAPbapi_company_get_list_results
    {

        public CompanyDetails[] Details { get; set; }

        public class CompanyDetails
        {
            [SapName("COMP_CODE")]
            public string COMP_CODE { get; set; }

            [SapName("COMP_NAME")]
            public string COMP_NAME { get; set; }
        }
    }

When I call the invoke method I got an error like (seems that I do not have mapped the result to .NET but in the documentation, I did not find any advice.

Any help will be appreciated

enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
user730712
  • 106
  • 1
  • 6
  • `BAPI_COMPANY_GETLIST` returns a parameter named `COMPANY_LIST`, maybe that's an issue, considering that the error is "RFC_INVALID_PARAMETER" "field 'DETAILS' not found", and that your attribute is named `Details`... N.B.: a BAPI can return several parameters, so it's important to name them correctly. – Sandra Rossi Aug 24 '21 at 12:12
  • good the code that works was little different (it depends on the SAP ECC VERSION) but your suggestion helped me correct the things – user730712 Aug 26 '21 at 12:29
  • Thanks for the feedback. Maybe you can turn your comment to an answer, that would help future visitors. – Sandra Rossi Aug 26 '21 at 12:40

0 Answers0