WorkflowGen and SAP Integration

Technical overview

WorkflowGen can quickly and easily integrate SAP transaction calls for importing or exporting data into your processes and .NET web forms, which offers a lightweight and powerful workflow front-end for SAP.

There are two integration possibilities:

SAP PI or XI

This solution provides a range of web services that can easily be integrated with your WorkflowGen processes or .NET web forms based on SAP’s standard PI/XI integration platform.

SAP BAPIs

This solution provides standard RFC-based BAPI services that can easily be integration with your WorkflowGen processes or .NET web forms based on SAP’s BAPI RFC standard.

You can now simplify WorkflowGen and SAP integration without having to add new middleware, relying instead on standard SAP methods.

Since WorkflowGen processe are generally quick to integrate and deploy, you can now offer powerful workflows to a maximum number of users without having to worry about a SAP per-user license model.

Examples of use

  • SAP Master Data Management: Coordinate all activities relating to the creation and maintenance of products, vendors, customers, and other key master data.

  • SAP User Role Management: You can retrieve a SAP user’s current profile and display it in a web form that can be modified by an authorized user. The changes can then be validated by a supervisor and if approved, the new information will be updated into SAP.

  • Display/update product order information

  • Display/update customer information

  • Display/update employee information

@wfg-admin, where can I find more information/instructions on how to implement the integration?

Hello.
Here is how we managed to interface workflowgen with our SAP.

Develop a C# dll to call SAP. For this you will need sap connecter for .net.
SAP Connector for Microsoft .NET

Once you’ve developped your dll, you can add it to workflowgen and define an application :

This application can be used in your workflows.

Here an example of code to “call” a SAP Bapi. You will find on internet many exemples to call SAP from C# code.

> public string AssignRole(string iSystem, string iUserName, string iRole, string iDateFrom, string iDateTo)
>         {
>             ECCDestinationConfig config = null;
>             RfcDestination system = null;
>             // Mise dans une table locale pour faciliter le traitement
>             DataTable localTable = null;
>             // Récupération des infos de connexion à SAP
>             config = new ECCDestinationConfig();
>             RfcDestinationManager.RegisterDestinationConfiguration(config);
>             system = RfcDestinationManager.GetDestination(iSystem);
>             RfcRepository repo = system.Repository;
>             try
>             {
>                 // Appel de la bapi get detail pour le user
>                 IRfcFunction bapi_get = repo.CreateFunction("BAPI_USER_GET_DETAIL");
>                 bapi_get.SetValue("USERNAME", iUserName);
>                 bapi_get.Invoke(system);
> 
>                 // Récupération du résultat
>                 IRfcTable bapiGetRoles = bapi_get.GetTable("ACTIVITYGROUPS");
> 
>                 localTable = bapiGetRoles.ToDataTable("ACTIVITYGROUPS");
>                 localTable.AcceptChanges();
>             }
>             catch (Exception ex)
>             {
> 
>                 RfcSessionManager.EndContext(system);
>                 RfcDestinationManager.UnregisterDestinationConfiguration(config);
>                 return (ex.ToString());
>             }

>             // Suppression des rôles qui n ont rien à faire ici
>             foreach (DataRow row in localTable.Rows)
>             {
>                 if (row["ORG_FLAG"].ToString() != "")
>                     row.Delete();
>                 try
>                 {
>                     if (row["AGR_NAME"].ToString() == iRole)
>                     {
>                         DateTime ToDate = DateTime.ParseExact(row["TO_DAT"].ToString(), "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None);
>                         if (ToDate < DateTime.Now.Date)
>                             row.Delete();
>                     }
>                 }
>                 catch (Exception ex)
>                 {
>                     //Nothing to do in that case
>                 }
>              }
>              localTable.AcceptChanges();
> 
>             try
>             {
>                 // Préparation de l appel pour la mise à jour
>                 IRfcFunction bapi_assign = repo.CreateFunction("BAPI_USER_ACTGROUPS_ASSIGN");
>                 bapi_assign.SetValue("USERNAME", iUserName);
>                 IRfcTable bapiAssignRoles = bapi_assign.GetTable("ACTIVITYGROUPS");
> 
>                 // Alimentation de la table : reprise des anciens roles + ajout du nouveau
>                 foreach (DataRow row in localTable.Rows)
>                 {
>                     bapiAssignRoles.Append();
>                     bapiAssignRoles.SetValue("AGR_NAME", row["AGR_NAME"].ToString());
>                     bapiAssignRoles.SetValue("FROM_DAT", row["FROM_DAT"].ToString());
>                     bapiAssignRoles.SetValue("TO_DAT", row["TO_DAT"].ToString());
>                 }
>                 bapiAssignRoles.Append();
>                 bapiAssignRoles.SetValue("AGR_NAME", iRole);
>                 bapiAssignRoles.SetValue("FROM_DAT", iDateFrom);
>                 bapiAssignRoles.SetValue("TO_DAT", iDateTo);
> 
>                 //Appel de la seconde BAPI
>                 bapi_assign.Invoke(system);
> 
>                 // Récupération du résultat
>                 IRfcTable bapiAssignReturn = bapi_assign.GetTable("RETURN");
> 
>                 // Mise dans une table locale pour faciliter le traitement
>                 DataTable localReturn = null;
>                 localReturn = bapiAssignReturn.ToDataTable("RETURN");
>                 localReturn.AcceptChanges();
> 
>                 //Préparation du retour (retour vide si OK)
>                 string message = "";
>                 foreach (DataRow row in localReturn.Rows)
>                 {
>                     if (row["TYPE"].ToString() != "S")
>                         message += row["TYPE"].ToString() + "/" + row["MESSAGE"].ToString();
>                 }
> 
>                 // Cloture de la connexion RFC
>                 RfcSessionManager.EndContext(system);
>                 RfcDestinationManager.UnregisterDestinationConfiguration(config);
>                 return (message);
>             }
>             catch (Exception ex)
>             {
> 
>                 RfcSessionManager.EndContext(system);
>                 RfcDestinationManager.UnregisterDestinationConfiguration(config);
>                 return (ex.ToString());
>             }
>         }
>     }

Best regards