Friday, 3 April 2020

Navigation from SAP S/4 HANA to SAP ECC 6.0 to view the replicated sales order

Recently I was assigned an interesting development, the requirements was to have a button “View legacy Sales Order” on standard sales order screen (VA03) on SAP S/4 HANA system if user clicks that button the system should open VA03 – display sales order that got replicated in the legacy ECC system using a RFC – single sign on (Different system).

Below are the step by step development that I did to accomplish the same.

◉ In t-code SE41 Copied the standard program SAPMV45B and status U to ZSAPMV45B and status ZU

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ Created a new button with a function code “ZXXX” in SE41 in copied program ZSAPMV45B and status ZU

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ It is important to add the screen flow for this in t-code VFBS for function codes

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ It is important to add the paths between process. locations for this in t-code VFBS

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ Created an implicit enhancement as below to enable the new GUI status in the module ‘MV45AF0C_CUA_SETZEN’ of SAPMV45A.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ SET PF-STATUS ‘ZU’ OF PROGRAM ‘ZSAPMV45B’ EXCLUDING CUA_EXCLUDE. This button is enabled only for certain order types as specified in the TVARVC table.
◉ Now the button is visible on the SO screen what happens next is the interesting thing at the click of this button. I created another explicit enhancement for click at module ‘MV45AF0F_FCODE_BEARBEITEN’ of SAPMV45A.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

Here the following logic will help us to take it to legacy ECC sales order display.

◉ There is output type determination defined in NACE in S/4 system – so every sales order that gets created in SAP S/4 HANA based on this output type assigned will create an outbound IDOC to ECC and creates a sales order there as the order is successfully saves in S/4.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

RSNASTED itself determines the associated IDOC outbound function module, executes it to fill the EDIDx tables and passes the prepared IDOC to the port. You can call the standard processing routines from any ABAP, by executing the following call to the routine.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ The Output types of order will have the Partners which is also the RFC destination of the legacy system that is defined in SM59.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ Check the existence of RFC destination in table ‘RFCDES’
◉ If RFC exists check the ping to destination using FM ‘CAT_CHECK_RFC_DESTINATION’.
◉ If ping is successful use the following BAPI to check the existence of legacy sales order ‘BAPI_SALESORDER_GETSTATUS’ using the RFC destination.
◉ If BAPI call is successful, then call the custom RFC FM to run the BDC at RFC destination using CALL FUNCTION ‘RFC_CALL_TRANSACTION_USING’ STARTING NEW TASK ‘UPDATE’ DESTINATION RFCDEST – The tables has BT_DATA that contains the VA03 BDC recoding.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

◉ This will open up “VA03” if the order exists in legacy ECC else it will display order does not exist.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

If Order exists and it will be displayed in Legacy ECC screen it will be in regular VA03.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP HANA, SAP ABAP ECC

No comments:

Post a Comment