on 03-21-2011 12:50 AM
Hi,
I have recently started working on SAP and I am making BAPI calls using SAP .NET Connector 3.0, some of the calls are working but others are not. It may be just by chance that calls that are working have no parameters but calls with parameters are coming back with messages like 'No data found' when the data is there in actual. Below is some more detail about BAPI calls that are not working.
1) I wanted to experiment to pull sales orders. I created a sales order in SAP SD.
2) I am making a BAPI call 'BAPI_SALESORDER_GETLIST' to retrieve that sales order by passing it CUSTOMER_NUMBER and SALES_ORGANIZATION as these two are mandatory parameters other are option, therefore, I am deactivating others. Here is the code snippet. I always get 'No data found' and return type as 'E':
IRfcFunction soAPI = destination.Repository.CreateFunction("BAPI_SALESORDER_GETLIST");
soAPI.SetValue("CUSTOMER_NUMBER", "1200");
soAPI.SetValue("SALES_ORGANIZATION", "0001");
soAPI.SetParameterActive("DOCUMENT_DATE", false);
soAPI.SetParameterActive("DOCUMENT_DATE_TO", false);
soAPI.SetParameterActive("MATERIAL", false);
soAPI.SetParameterActive("MATERIAL_EVG", false);
soAPI.SetParameterActive("PURCHASE_ORDER", false);
soAPI.SetParameterActive("PURCHASE_ORDER_NUMBER", false);
soAPI.SetParameterActive("TRANSACTION_GROUP", false);
//destination object is created above and I think it is OK as I am not getting any connection related issues
soAPI.Invoke(destination);
IRfcStructure returnStructure = soAPI.GetStructure("RETURN");
string returnCode = returnStructure.GetString("TYPE");
if (returnCode.Equals("E") || returnCode.Equals("A"))
{
Console.WriteLine(returnStructure.GetString("MESSAGE"));
// throw new Exception(returnStructure.GetString("MESSAGE"));
}
else
{
Console.WriteLine("*********** SUCCESS **********");
}
I will appreciate any hints or clues to resolve this.
Thanks.
Edited by: Shankar Selvaraj on Mar 21, 2011 5:15 PM
Hi Shankar,
Is it resolved.
Regards,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shankar,
I think the issue with leading zeros.Customer number length is 10 .pass the leading zeros.
Regards,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
the BAPI 'BAPI_SALESORDER_GETLIST' is just created in SAP enviroment?
The syntax IRfcFunction soAPI = destination.Repository.CreateFunction("bapi_name"); is correct for call all bapi that are in SAP enviroment?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
repo = your repository
change
am = repo.GetStructureMetadata("RETURN");
IRfcStructure returnStructure = am.CreateStructure();
string returnCode = returnStructure.GetString("TYPE");
soAPI.Append(returnStructure);
if (returnCode.Equals("E") || returnCode.Equals("A"))
{
Console.WriteLine(returnStructure.GetString("MESSAGE"));
// throw new Exception(returnStructure.GetString("MESSAGE"));
}
else
{
Console.WriteLine("*********** SUCCESS **********");
hope that helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is am?
I am writing :
RfcStructureMetadata am= repo.GetStructureMetadata("RETURN");
IRfcStructure returnStructure = am.CreateStructure();
string returnCode = returnStructure.GetString("MESSAGE");
poS.Append(returnStructure);
if (returnCode.Equals("E") || returnCode.Equals("A"))
{
string s = returnStructure.GetString("MESSAGE");
// throw new Exception(returnStructure.GetString("MESSAGE"));
}
Here poS = "IRfcFunction poS = repo.CreateFunction("BAPI_PO_RELEASE");" that is not working.
will you please help, how do I get return message.
Thanks,
Shoyeb
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.