Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRfcTransaction create transaction #7

Open
RollyRolls0712 opened this issue Sep 17, 2021 · 2 comments
Open

IRfcTransaction create transaction #7

RollyRolls0712 opened this issue Sep 17, 2021 · 2 comments

Comments

@RollyRolls0712
Copy link

im trying to create or insert data to bapi sap using IRFCTRANSACTION im encountered below error.

attempted to read or write protected memory. this is often an indication that other memory is corrupt
IRfcTransaction

Thank you.

@metalsimyaci
Copy link
Owner

Hi Roly,

IRFCTRANSACTION is a section developed for experimentation. The main problem in the section is that the function that will receive the TransactionID needs to be registered in the system. This is a topic in the SAP NetWeaver RFC library documentation that I don't fully understand yet.
Research on the subject continues. I will try to find a method to use transaction with SAPCO2 as soon as possible.

Maybe calling another transaction function like in Sapnco instead of function registration can solve our problem.

//sapnco example

 var dest = SAPUtils.GetRfcDestination(connectionTarget);
var repo = dest.Repository;
var func = repo.CreateFunction("BAPI_MATERIAL_SAVEDATA");
var transaction = repo.CreateFunction("BAPI_TRANSACTION_COMMIT");

SetHeadData(func, material.HeadData);
SetMaterialDescription(func, material.MaterialDescription);
func.Invoke(dest);
transaction.Invoke(dest);

var resultTable = func.GetTable("RETURNMESSAGES");
var errorMessages = SAPUtils.GetListFromRFCTable<ReturnTableMessage>(resultTable);

if (errorMessages.All(x => x.TYPE == "S" || x.TYPE == "H"))
{
    material.MaterialStatus = MaterialStatuses.Success;
    material.ErrorMessages = string.Empty;
}
else
{
    material.MaterialStatus = MaterialStatuses.Error;
    material.ErrorMessages = string.Join("\n", errorMessages.Select(x => x.ToString()));
}

return material;

Thank you for your feedback.

@RollyRolls0712
Copy link
Author

hi metalsimyaci ,

thank you for your feedback however sapnco is for .netframework only ill using .core already see below the details.
image
thank you,

@metalsimyaci metalsimyaci added this to To do in Rise of SAPCO2 Sep 21, 2021
@metalsimyaci metalsimyaci moved this from To do to Revolution Begin (2022 Q1) in Rise of SAPCO2 Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Rise of SAPCO2
Revolution Begin (2022 Q1)
Development

No branches or pull requests

2 participants