Search code examples
ui-automationabapsaprfcdynpro

Mimic SAP Transaction in RFC


How would one go about creating a SAP RFC that runs a transaction with parameters and return its data?

I have seen someone use a PERFORM BDC_DYNPRO and when I run the code through the debugger it seems to run the actual transaction screens. How do you go about setting this up?


Solution

  • There's plenty of RFCs in SAP systems that does exactly that - they're called BAPI functions. Filling parameters can be tricky sometimes and documentation for some of them are not really helpful. Take a look in transaction BAPI to see a list.

    You can also create documents in transactions through code using IDOCs, that should be called using built-in IDOC RFCs.

    BDCs are not really recommended for what you're trying to achieve, as they simulate the screenflow inside the system and that can consume a lot of resources for some simple tasks (like adding a new item to a document). BDCs also depends on positional references and that can be a pain to implement/maintain. BAPIs are always preferred over BDCs, however, in some cases you don't have BAPIs for a transaction and there's no other solution than using BDCs.

    Finally, as I said some BAPIs can be really tricky to implement, so a RFC "wrapper" could be a way of simplifying the integration processes.