on 12-04-2012 7:10 AM
Hi,
I am new to SAP NCo 3.0 and starting off.
I am trying to run an RFC call using asp.NET MVC4. I am trying to execute a RFC "ZM07_PO_RELEASE_STRATEGY" with the below parameters,
FUNCTION ZM07_PO_RELEASE_STRATEGY
(
EXPORT STATUS:CHAR1,
IMPORT BY_PASS_WF:CHAR1 [optional:null],
IMPORT I_ACTION:CHAR3,
IMPORT I_EBELN:CHAR10,
IMPORT I_FRGCO:CHAR2 [optional:null],
IMPORT I_REJREASON:CHAR255 [optional:null],
IMPORT I_WIID:NUM(12),
TABLES RETURN_MESSAGES:STRUCTURE BAPIRET2
)
from the above function how can I return the table?
Below is the code which i am trying to execute. When i run the program i am getting the error saying that "Current row is undefined for empty table".
Kindly help me by providing sample code to excute the above type of RFC call which need to update the status in SAP.
try
{
RfcDestinationManager.UnregisterDestinationConfiguration(new SAPSystemConnection());
RfcDestinationManager.RegisterDestinationConfiguration(new SAPSystemConnection());
RfcDestination rfcPORelease = RfcDestinationManager.GetDestination("PORC");
RfcSessionManager.BeginContext(rfcPORelease);
RfcRepository repositoryPORelease = rfcPORelease.Repository;
IRfcFunction POReleaseBapi = repositoryPORelease.CreateFunction("ZM07_PO_RELEASE_STRATEGY");
IRfcTable POTable = POReleaseBapi.GetTable("RETURN_MESSAGES");
if (model.ActionType == "Approve")
{
POReleaseBapi.SetParameterActive("BY_PASS_WF", false);
POReleaseBapi.SetValue("I_ACTION", "REL");
POReleaseBapi.SetValue("I_EBELN", POObj.PONum);
POReleaseBapi.SetValue("I_FRGCO", POObj.FRGCO);
POReleaseBapi.SetParameterActive("I_REJREASON", false);
POReleaseBapi.SetValue("I_WIID", POObj.WrkItmID);
}
else if (model.ActionType == "Reject")
{
POReleaseBapi.SetParameterActive("BY_PASS_WF", false);
POReleaseBapi.SetValue("I_ACTION", "REJ");
POReleaseBapi.SetValue("I_EBELN", POObj.PONum);
POReleaseBapi.SetValue("I_FRGCO", POObj.FRGCO);
POReleaseBapi.SetValue("I_REJREASON", model.txtReason.ToString());
POReleaseBapi.SetValue("I_WIID", POObj.WrkItmID);
}
POReleaseBapi.Invoke(rfcPORelease);
RfcSessionManager.EndContext(rfcPORelease);
}
catch (Exception ex)
{
}
Thanks
Mahesh
Can you try adding this:
IRfcFunction commitBapi = repositoryPORelease.CreateFunction("BAPI_TRANSACTION_COMMIT");
commitBapi.Invoke(rfcPORelease);
before your "EndContext" statement?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.