Wednesday, December 11, 2019

FCC using Module Beans


FCC using Module Beans

Recently there was a requirement in our project to do some file conversions in a SFTP Channel.

The input file was something like this :

19263301|NCP-10C101-224|20190814|XE|100|546|20210814|00103282341|





The following blog can be used as reference -

https://blogs.sap.com/2014/09/24/fcc-parameter-reference-for-messagetransformbean-module/






                                                      AMOR FATI - LOVE OF FATE

Tuesday, October 15, 2019

Message Prioritization


In layman terms, message prioritization = queue prioritization,
& this can be achieved by setting up a filter via SXMB_ADM, registering the queues in SMQR.

Following links will help you to perform this -

https://archive.sap.com/kmuuid2/59e837d3-0201-0010-c096-dc1869733413/How%20To%20Prioritize%20Exchange%20Infrastructure%20Messages%20on%20the%20Integration%20Server%20(NW2004).pdf


https://help.sap.com/doc/saphelp_nwpi71/7.1/en-US/7b/94553b4d53273de10000000a114084/content.htm?loaded_from_frameset=true




AMOR FATI - LOVE OF FATE

IDOC Packaging

IDOC PACKAGING / COLLECTION


In some scnearios, we have to collect the idocs and dispatch them collectively.


For ex:


1. Collect of Purchase Orders and create a file at EOD everyday


2. Create a file with a maximum of 100 Idocs/records only. So, set the package size as 100 here.


This can be achieved by IDOC sender adapter. You need to define a package size in the adapter.

The package size defined here will be used to create IDoc packages in PI.






Some configuration needs to be done in ECC to work this -


In the partner profile of the Idoc,


Select the collect idocs options and also proivde the package size.






Report RSEOUT00
This report can be executed or scheduled as a background job to send the IDocs.

Sample Payload in SXMB_MONI




Challenges -


Ex. In a package of say 500 IDocs, if the field of an IDoc has wrong value which leads to mapping error in PI. The idocs may get stuck in queues.
So, we need to reprocess the idoc package from ECC.
When sending an IDoc package (assume N IDocs) if it goes into a data mapping error, we can fix the data at the source and resend the whole package again as follows-
1. In PI, find out what is causing the error & the idoc that contains the data.
2. In SXMB_MONI - extract all the idoc numbers in error state
3. Edit the error idoc in WE02
4. In ECC, use the report RC1_IDOC_SET_STATUS to change the status of the IDocs (to Ready for Dispatch)


5. Use RSEOUT00 and send the N IDocs again to PI


AMOR FATI - LOVE OF FATE


Monday, October 14, 2019

BAPI

WHAT IS A BAPI & BAPI WRAPPER ?


BAPI is a function module which is remotely enabled & does not raise any exceptions.
It is defined as business API’s for SAP objects. They play an important role in the technical integration & in the exchange of business data between SAP components & between SAP & non SAP components.

A BAPI wrapper is a Remote enabled Function Module in a backend system, that has a specific signature, so that it can be used in a mobile scenario.
Typically, it calls a BAPI in the backend system, so it 'wraps' a BAPI, hence the name.
As long as a Remote enabled FM follows the standard signature of a BAPI wrapper, it can be called a BAPI wrapper even if it doesnt actually call one.
Conceptually, a BAPI wrapper has the role of a private method of a business object (SyncBO) and resides in a backend system.

Let's say you want to mobilize a Sales Order scenario. You will need a set of BAPI wrappers (GETLIST, GETDETAIL etc) for distributing Sales Orders.
Now, if there already BAPIs in your backend that do this work, then all you need to do is write RFC FMs, which call the BAPIs on the backend instead of getting data directly from tables. If you don't have already BAPIs for a Sales Order, you can still make BAPI wrappers (since a BAPI wrapper is simply an RFC enabled FM), without using any BAPIs, but which get their data directly from the corresponding Sales Order table(s).
Then you can go ahead and use these BAPI wrappers.

The main thing is this:
1. To make a BAPI wrapper, you need to make a RFC FM with a particular signature. That FM can then be called a BAPI wrapper.
2. It does not matter how a BAPI wrapper does its work internally, as long as it's signature follows the standard. i.e. It may or may not call a BAPI.

Summarizing this can say that you create a function module (RFC or not) in which you call the BAPI you are trying to 'wrap'. This is oftenly done because (for example) the interface of a BAPI (import / export / tables) is quite 'large'. 
To avoid this, one creates a wrapper in which a lot of coding is already done before the BAPI is called. So when calling the wrapper, the calling program has (a lot) less to do before it can use the BAPI.

Tcode BAPI - will give you a list of BAPIs

Some comooly used BAPIs -

PO Creation : BAPI_PO_CREATE

Sales order Creation : BAPI_SALESORDER_CREATEFROMDAT2
sales order change : BAPI_SALESORDER_CHANGE
Delivery : BAPI_OUTB_DELIVERY_CONFIRM_DEC



AMOR FATI - LOVE OF FATE







IDOC Search

Searching IDOC Content

WE09 Search for IDocs by Content, searches in business database
WE10 Search for IDoc in Archive

In WE09, in the " criteria for search in data records " - 

enter the segment name, field name and the value you want to search.

It will list out all the idocs with the specific criteria you mentioned.





AMOR FATI - LOVE OF FATE

Sunday, October 13, 2019

SAP Batch Jobs

We can only run BTCTRNS1 if you do upgrades of your system.



Run the program BTCTRNS1 in SE38. This resets the status of the jobs leaving RDDIMPDP unaffected. Released jobs will have a suspended status or cancelled for upgrade.

BTCTRNS1 alters the status of jobs, if they are active and if it is critical to your system you should decide when to run the program. Make sure your system is ready for this. If they do not give any impact to your system then you can run the program.

RDDIMPDP job that handles transport requests is unaffected when running the program.


Basically, BTCTRNS1 is for suspending your jobs and BTCTRNS2 is for resuming the suspended jobs.




AMOR FATI - LOVE OF FATE





SM12

SM12 - LOCK MONITORING


The SAP System is equipped with a special lock mechanism that synchronizes access to data on the database. 

The purpose of the lock mechanism is to prevent two transactions from changing the same data on the database simultaneously

Lock entries are usually set and deleted automatically when user programs access a data object & release it again. 

1. You can use SM12 to check and delete lock entries.
2. In SM12, check any lock entry older > 2 days. If any outdated entry found, check the corresponding user is user online/offline in AL08 or SM04 (you can get the transaction code that been use by the user). Get the user contact from SU01 and inform about the lock else if the user is offline, release the table from lock by deleting the lock.

Important profile parameters for the lock concept:-
enque/table_size – Size of the lock table managed by the enqueue server in the main memory. The lock table contains information on which locks are currently held by whom. You can check whether the update server is functioning correctly, since the lock table can grow very fast if the update function stops. If no update problems exist, you can use this parameter to increase the size of the lock table. Default value: 4096Kb
rdisp/wp_no_enq – Number of enqueue work processes that are to run on this instance.
rdisp/enqname – Name of the application server that provides the enqueue service.

The lock modes:-
Shared Lock (S) – Several users can access locked data at the same time in display mode. Requests from further shared locks are accepted, even if they are from different users. An exclusive lock set on an object that already has a shared lock will be rejected.
Exclusive (E) – An exclusive lock protects the locked object against all types of locks from other transactions. Only the same lock owner can reset the lock .




AMOR FATI - LOVE OF FATE

BPM Introduction

Business Process Management deals with cross component BPM. This includes SAP workflow in SAP backend and processing of message on Integration Server.

Cross Component Business Process Management provides SAP NetWeaver Process Integration with functions for stateful message processing, that is, the status of an integration process is persisted on the Integration Server. 

This means that an integration process can, for example, wait infinitely until further messages are received or until a particular deadline is reached. 

Moreover, it is possible to process messages further within an integration process.

There are lot of other scenarios when we need to use BPM. i.e. Splitting of messages, Merging of messages, Multicast a message to various systems, Send an Alert, Make the asynchronous call into the synchronous,etc.

SAP PI BPM is used for cross-system integration and managing a higher level business process between disparate systems. 

A typical scenario is a Sales Order acceptance process where several systems would need to be consulted before accepting the order such as a inventory check, global ATP check etc.

We use SOAP adapter to connect to BPM.

The Service Interface pattern is always STATELESS XI 3.0 COMPATIBLE

 Steps in the Integration Process Modeling:-

 Messaging Relevant Steps-
  • Receive Step
  • Send Step
  • Transformation Step (Mapping)
  • Receiver Determination

 Control Steps-
  • Block
  • Container Operation
  • Control Step
  • Fork
  • Switch
  • While Loop
  • Wait
  • User Decision



AMOR FATI - LOVE OF FATE

PROXIES


We can integrate SAP System with PI with 3 different adapters -


  1. IDOC
  2. RFC
  3. PROXY

Proxy communication always by passes the Adapter Engine and will directly interact with the application system and Integration engine. So it will give us better performance.

Proxies communicate with the XI server by means of native SOAP calls over HTTP.

Easy to handle messages with ABAP programming.

Proxy is good for large volumes of data. we can catch and persist the errors ( both system
application fault ) which was generated by Proxy setting.


2 types of proxies available -

Java Proxies: - 

Java proxies are used when JAVA applications needs to send or receive messages with
other applications. JAVA proxies are generated from the WSDL description  of the interface 
in the Integration Repository, and the result is a .jar file containing generated java classes
corresponding to the integration objects. 

ABAP Proxies: - 

ABAP proxies are used when ABAP applications needs to send or receive messages. ABAP
proxies are generated on the Application server with transaction SPROXY, based on the
WSDL representation of the message interface.


There are 2 types of ABAP Proxies - 

1. Client proxy / outbound proxy

2. Server proxy / inbound proxy




Client Proxy 





Server Proxy






Steps required for developing ABAP Proxies in dual stack :

1. Create a source data type and a target data type.
2. Create Message types for the source and target data types.
3. Create Message Interfaces includes Inbound Message interface and Outbound
    Message interface.
4. Create message mapping between the source and target message types.
5. Create Interface mapping.
6. Create ABAP proxies using the transaction SPROXY in the application system.


Creating ABAP Proxies in Application system 

Go to SPROXY transaction in R/3 system.

Here we can see all the Integration Repository objects. Select the outbound interface for
which we want to create the proxy. Right click on the interface and select create option.









Steps required for developing ABAP Proxies in single stack :

1. Create a source data type and a target data type.
2. Create Message types for the source and target data types.
3. Create Message Interfaces includes Inbound Message interface and Outbound
    Message interface.
4. Create message mapping between the source and target message types.
5. Create Interface mapping.
6. Create ABAP proxies using the transaction SPROXY in the application system.

Creating ABAP Proxies in Application system: 

Go to SPROXY transaction in R/3 system.

Here we can see all the Integration Repository objects. Select the outbound interface for
which we want to create the proxy. Right click on the interface and select create option.


Objects that need to be developed in ID :

Create sender and receiver communication component
Create sender and receiver communication channels
Create Integrated Configuration.

In sender communication channel we should select Adapter type is SOAP Adapter

Transport Protocol : HTTP
Message Protocol  : XI3.0








AMOR FATI - LOVE OF FATE

Saturday, October 12, 2019

PI TO PO MIGRATION

We cannot upgrade from dual stack PI to single stack PO.

All integration content has to be moved/redesigned and tested






  • Connectivity
    • Communication Channels (Replace all ABAP adapters with JAVA adapters)
      • IDoc -> IDoc_AAE
      • XI -> SOAP (XI 3.0)
      • HTTP -> HTTP_AAE
      • WS -> WS_AAE
    • RFC Destinations
      • Use Destinations in NWA to create HTTP and RFC connections to backends

  • Mapping
    • No more use of ABAP/ABAP-XSLT: Redesign in Java!
    • Keep on using Swing Client! NWDS/Eclipse is not comfortable enough

  • Routing
    • Classic Routing -> Integrated Configuration (ICO)
      • Make sure you understand the settings for Staging & Logging!
    • Multi-Adapter Engine Usage (ICO-ICO)
    • Usage of iFlows & Folders in NWDS/Eclipse (optional, but recommended)

  • BPM
    • Redesign ccBPMs: replace BPM by Adapter Modules (e.g. Async-Sync Bridge) or Collect BPMs
    • Create BPM processes to replace ccBPM

  • Basis
    • CTS+ now e.g. via ABAP Stack of SAP Solution Manager
    • User Management now locally (UME) or connected to Active Directory
    • Set up NWDI for BPM Design Time Repository & Transport

  • Monitoring
    • No more SXMB_MONI
    • All messages are visible in PIMON

  • Alerting
    • New Message based alerting available, configured in DIR/NWA

  • Backend Systems (SAP ECC/ERP, CRM, SRM, …)
    • IDoc – WE21: New IDoc Port to connect with IDoc_AAE via RFC Destination type T (SAP Gateway)
    • ABAP Proxy – SXMB_ADM: Point to Adapter Engine RFC Destination instead to Integration Engine (configured globally or per outbound Service Interface/Proxy)




INT4 & FIGAF can be used for automated testing of interfaces.






AMOR FATI - LOVE OF FATE