terça-feira, 13 de novembro de 2018

Fiori for S/4HANA – Calling enjoySAP transactions from Fiori apps


EnjoySAP transactions such as ME21N, ME22N, ME29N, etc. have some particular challenges around passing appropriate parameters when called directly from other Fiori apps.  Understand a simple approach for how to workaround these challenges so you can call them confidently from any Fiori app.
There are some additional challenges when calling enjoySAP transactions from the SAP Fiori apps via app to app navigation.  These challenges can be overcome as we explain in this blog. You will need to settle in for this one – I promise you will learn some tips about List of Links dialogs and how Target Mappings work as well that will help you with other Fiori for S/4HANA scenarios!
Back in the day, one of the very early attempts to improve the UX of SAP GUI, long before SAP Fiori was even thought of, was called enjoySAP.   EnjoySAP brought a more consolidated UI where 3 levels of detail – header, items, and subitems – could be viewed and edited at the same time.  The enjoySAP approach was primarily used to improve certain Procurement transactions such as ME21, ME22, ME23, ME29 and others.   Like many such attempts these transactions still exist in SAPGUI, are still used by many users and still provide value to many users.   You can typically identify enjoySAP transactions by the suffix N on the transaction code, e.g. Transaction ME21N was the enjoySAP equivalent of ME21, ME29N was the enjoySAP equivalent of ME29, etc.   You can see an example of ME29N in the screenshot below.
A recent customer experience showed that trying to launch SAP GUI transaction ME29N directly from the Semantic Object based List of Links in SAP Fiori app Monitor Purchase Order Items (App id F2358) didn’t meet expectations, even though:
Essentially when you try to launch the transaction ME29N from a tile or via a link from another app such as Monitor Purchase Order Items, you will find that the Purchase Order number is not passed to the enjoySAP transaction in the same way as it is to other SAP GUI transactions.  Parameter passing just doesn’t work in quite the same way for enjoySAP transactions as it does for most other SAP GUI transactions.
You will see how to overcome this using SAP Fiori app Monitor Purchase Order Items (App id F2358)as an example. You can follow the steps below:
  1. Finding the list of links dialog you want to extend with your new link
  2. Add your app as a new link in the List of Links dialog
  3. Test your new link appears in the List of Links dialog
  4. Adjust the parameters used by your link
  5. Retest your link and parameters in the List of Links dialog
Adjusting the parameters will involve using a wrapper transaction. You will see what a wrapper transaction is and does in step 4 – Adjust the parameters. You will find a list of provided wrapper Transactions for enjoySAP Transactions at the end of this blog.
TIP: You can try this it out for yourself using a SAP S/4HANA Trial instance on https://cal.sap.com . The demo user S4H_PUR_DEM is assigned the Monitor Purchase Order Items app.

Find the List of Links dialog

Start by identifying the app that contains the List of Links dialog and making sure it is working.  In this blog we assume you have already activated the app.
  • Business Roles: Purchaser, Transportation Manager, Settlement Clerk (Freight Management)
  • Business Catalog: Purchasing – Purchase Order Processing
    SAP_PRC_BC_PURCHASER_PO
When you are in the SAP Fiori app Monitor Purchase Order Items (App id F2358), you can see a list of Purchase Orders you are monitoring. Every purchase order in the Purchase Order column is displayed as a hyperlink. When you select the hyperlink on a Purchase Order you are shown a List of Links dialog. From the list of links dialog you can then use any link to navigate to other apps related to Purchase Orders.
Click on More Links and you can see all the apps available.
You can navigate to any of the apps by clicking on the hyperlink.  You can even adjust which links are shown by default.
Just deselect the ones you don’t want and press Ok.
Then only the links you want are shown by default. The system will remember what you have selected for next time.
Technically these links are derived as follows:
  • In the Monitor Purchase Order Items app, the Purchase Order column is marked with the special annotation SemanticObject which is assigned to the semantic object id PurchaseOrder.
  • At runtime the Fiori launchpad identifies all the Target Mappings in tile catalogs assigned to you that contain the Semantic Object PurchaseOrder.
  • The end result is you see all the apps related to Purchase Orders assigned to you, i.e. that you are authorized to use
IMPORTANT: This derivation works regardless of the technology type of the app, so the List of Links might contain a mix of links to SAP Fiori apps, Web Dynpro ABAP apps, and SAP GUI transactions.
Normally when you click on a link the purchase order number is passed correctly. E.g. if we navigate to SAP Fiori app Manage Purchase Orders (F0842A) you should see the SAP Fiori app Manage Purchase Orders has already filtered on and drilled down to the detail of the purchase order you selected.
This works even if we are linking to a classic app such as Purchasing Documents per Supplier (SAP GUI transaction ME2L), Purchasing Documents per Account Assignment (SAP GUI transaction ME2K ) or Print Purchase Orders (SAP GUI transaction ME9F).  You can see what this looks like for transaction ME2L.
TIP: Remember that the standard SAP GUI approach to navigation is to pass the parameters and skip the first screen. This means:
  • Even if you pass a parameter to the transaction, after it has skipped the first screen it may subsequently clear the selection parameters.
  • That’s why if there are no documents to print for the Purchase Order and you launch transaction ME9F, you will only see the message “No suitable purchasing documents found”.
  • A good tip here is to compare how the transaction behaves when running the transaction directly in SAP GUI for Windows or SAP GUI for Java, i.e. without using the Fiori launchpad and without the Fiori Visual Theme.
Now watch what happens when you add enjoySAP transaction ME29N to the list of links. Keep reading!

Add a new link in the List of Links dialog 

You follow the same process regardless of whether you are adding a SAP Fiori app, a custom Fiori app, or a classic app such as a SAP GUI Transaction or Web Dynpro ABAP application.
You can add GUI Transaction Release Purchase Order (transaction code ME29N) to the List of Links in Monitor Purchase Order Items by following these steps:
  1. In the Launchpad Designer, you create a custom tile catalog.
  2. You create a reference from the relevant Tile for ME29N in tile catalog SAP_TC_PRC_BE_APPS to your custom catalog
  3. You create a reference for the Target Mapping related to ME29N to your custom catalog.
  4. Assign your custom catalog to a security role, and make sure the security role is assigned to the user.
Before you start you find the tile catalog you need in the SAP Fiori apps reference library.  Just use the filter All apps for SAP S/4HANA, search for your GUI transaction by name or transaction code.  Once you have found it, the tile catalog will be listed in the Implementation Information tab, in the Configuration section. Take a look at the configuration details in the screenshot below for transaction ME29N in the Fiori Apps reference library
Notice particularly the Semantic Object and Action – those 2 fields map the Tile to the Target Mapping and can be used to help you find the matching details in the Launchpad Designer.
Now you can start.

1. Creating a custom Tile Catalog

In the Launchpad Designer, press the Add Catalog icon in the footer.
TIP: You access the Launchpad Designer using your content administration user and the link https://<yourhost>:<yourport>/sap/bc/ui5_ui5/sap/arsrvc_upb_admn/main.html?scope=CUST
Give your catalog an id and title.

2. Creating a Reference to an existing Tile definition

You create a reference from the relevant Tile for ME29N in tile catalog SAP_TC_PRC_BE_APPS using the Create Reference option.
Select the catalog and find the tile definition you want to copy. You know it’s something to do with Purchase Order so you can use the search field to narrow down the list.  Once you have found it select the tile definition,  then press Create Reference.
Add the reference to your custom catalog.

3. Create a Reference for the matching Target Mapping 

Creating a reference for a target mapping is much the same as creating a reference for a tile. That is:
  • Go to the Target Mappings tab of the same Technical Catalog.
  • Find the target mapping for Semantic Object = PurchaseOrder and Action releaseSingle.
  • Use the Create reference option to add the reference to your custom catalog, just as you did for the tile.
IMPORTANT: Notice the Configure option in the footer – you can use that to check and/or adjust the details of the target mapping.

4. Assign your custom catalog to your user

Then add your custom catalog to a security role assigned to your test user as explained in How to Create and Generate Backend Security Authorizations for SAP Fiori 2.0.
You can see a simple example of what your security role might look like below.

Test your link appears in the List of Links dialog 

Once your test user has been assigned to the custom catalog you can reopen your Fiori Launchpad and retest.
You will now see in the Monitor Purchase Order Items when you select the link on the Purchase Order column that your link Release Purchase Order has been added to the list of links.
What you expect is that when you click on the link transaction ME29N is launched and the Purchase Order number should be passed. When you test you will find transaction ME29N is launched. However the Purchase Order is NOT passed!
What went wrong? Keep reading!

Adjust the Parameters used by your link

If we check the Target Mapping there is no parameter provided to define what should be passed to transaction ME29N.  No problem – we can add that into our target mapping in our custom catalog.  By comparing our target mapping for ME29N to the target mappings for other apps used in the same list of links in the same technical catalog we work out that the source parameter passed by the link in Monitor Purchase Order Items is called PurchaseOrder.  So far so good.
What we want to do is add a parameter map the source parameter PurchaseOrder to set the target selected Purchase Order field in transaction ME29N. Now in most transactions this is easy, because selection fields are usually on the initial screen of the transaction.  So all you need to know is the technical name of the selection field and assign that to your parameters in the target mapping.
However not so fast with an enjoySAP transaction. Look at transaction ME29N.  In an enjoySAP transaction you can’t add the Purchase Order on the initial screen.
With an enjoy transaction you need to:
  • Select the Other Document button in the main window
  • Enter the new Purchase Order number in the dialog window
  • Select the Other Document button in the dialog window
You can use the SAP GUI technical help (F1) on the Purchase Order field to check that the screen field name is MEPO_SELECT-EBELN
So in theory just using the Configure option to add the target parameter value MEPO_SELECT-EBELN to your Target Mapping should work.
TIP: You can just confirm that you are ok with breaking the reference.  That simply means that if the original target mapping you referenced is changed in the future, you will not longer pick up those changes automatically.
Now refresh clear the user’s web browser cache, login and test again. There is no change!
Why doesn’t it work?
Well unlike most SAP GUI transactions, with an enjoySAP transaction such as ME29N, because the selection parameter is not on the initial screen, the standard SAP GUI approach of passing a parameter and then skipping the initial screen doesn’t work. You need to do something different.
You will get a clue on what to do from looking at the delivered target mapping for Display Purchase Order (Semantic Object PurchaseOrder, Action display) , which you would expect to be calling transaction ME21N. But it doesn’t. It calls transaction MMPURPAMEPO.
What you can see is that for each of these enjoySAP transactions there is typically a wrapper transaction (see the list at the end of this blog) that makes up for this difficulty when calling the transaction from elsewhere.
For ME29N the wrapper transaction is MMPURUICALLME29N which has a parameter P_EBELN and looks like this:
Ok so instead of calling ME29N directly you want a target mapping that calls MMPURUICALLME29Ninstead.
So that there is no confusion between the original referenced version and your own, make sure you:
  • Use a different Action for the same Semantic Object – in the example you can see the action is called releaseSingleAdvanced
    • Note: Actions are freely definable
  • Change the title of the target mapping so you can tell whether you are calling the original referenced version or your revised version – in the example you can see the title is Release Purchase Order Individually
NOTE: If you wish you can also create a custom tile to match your target mapping.  It’s not essential in this scenario, just good practice if you want your users to be able to add a tile to their home page to go directly to the SAP GUI transaction.  Of course if they go directly to ME29N from the home page there will be no Purchase Order value passed.
Once you are happy that it is working, you can always remove the original referenced version from your catalog and adjust the texts and actions to their final values.
Adjust the security role assigned to the user.  Make sure:
  • The custom catalog is assigned and updated
  • The user is authorized to use both transaction ME29N and the wrapper transaction MMPURUICALLME29N
  • If you need to run the User Comparison to make sure the user’s details are up to date.
  • Clear the web browser cache and login again as your test user.

Retest your link & parameters via the List of Links dialog 

Now when you go into Monitor Purchase Order Items and select the Purchase Order you will see your new target mapping listed as the link Release Purchase Order Individually.
Select your new link Release Purchase Order Individually.  Transaction ME29N is launched passing the Purchase Order number.
Success!

List of Wrapper Transactions for enjoySAP Transactions

There are a number of similar wrapper transactions delivered for enjoySAP equivalents listed below.  Which one you call depends on your target transaction and what you need to pass to it.
EnjoySAP TransactionWrapper TransactionParameters (technical names)
MD03MMPURUICALLMD03P_WERKS, P_MATNR, P_NOSKIP, P_ANZDL
ME21NMMPURPAME21NP_EBELN
ME21NMMPURUIME21NNone (looks for all requisitions ready to be converted to Purchase Orders)
ME21NMMPURUIPRCREQP_BANFN, P_BNFPO
ME28MMPURUICALLME28P_ID, P_APPID
ME29NMMPURUICALLME29NP_EBELN
ME49MMPURUICALLME49P_EKORG, P_SUBMI, P_ID, P_APPID
ME54NMMPURUICALLME54NP_BANFN
ME55MMPURUICALLME55P_ID, P_APPID
MEPOMMPURPAMEPOP_EBELN, P_EBELP, P_EDIT, P_TAB
ME53NMMPURPAMEREQP_BANFN, P_BNFPO, P_EDIT
MIGOMMPURPAMIGOP_MBLNR, P_MJAHR, P_ZEILE
MIROMMPURPAMIRO (Goods)P_BELNR, P_GJAHR
MIROMMSRVSESINV (Services)P_LBLNI, P_USER
MIROPOSTIVDOCP_EBELN, P_EBELP, P_USER
ML81NMMPURUIML81NP_LBLNI, P_DISPL, P_EBELN
ML81NMMSRVENTRYP_LBLNI, P_USER
ML81NMMSRVSESP_EBELN, P_EBELP, P_EDIT
MRBRRELINVDOCP_BUKRS, P_BELNR, P_GJAHR
MR8MCANINVDOCP_BELNR, P_GJAHR
 

Becoming a SAP Fiori for SAP S/4HANA guru

You’ll find much more on our SAP Fiori for SAP S/4HANA wiki
 Brought to you by the S/4HANA RIG

Nenhum comentário:

Postar um comentário