Quantcast
Channel: SCN : Blog List - Process Integration (PI) & SOA Middleware
Viewing all 676 articles
Browse latest View live

Triggering SLD-registration of PI components

$
0
0

Under certain circumstances (e.g. database server move), it might be necessary to re-register the PI components in the SLD. There are several possibilities to trigger this:

  • Server Restart
  • Restart of PI Applications
  • Configuration Wizard

 

A very simple and direct approach is calling the register method of the RuntimeCheck servlet via the browser:

 

Integration Repository

http://<pi host>:<pi port>/rep/rtc?op=register

Integration Directory:

http://<pi host>:<pi port>/dir/rtc?op=register

Adapter Framework:

http://<pi host>:<pi port>/AdapterFramework/rtc?op=register

RWB:

http://<pi host>:<pi port>/rwb/rtc?op=register

 

PI Domain and Integration Server will be created automatically.


12.06.png

 

For the Integration Server it is necessary to add two associations manually afterwards:

  • Business System
  • Application Server Java (Single-Stack) or Application Server ABAP (Double-Stack)

12.06-01.png

 

As result all PI components should be available and associated to the same PI Domain.

12.06-02.png

 

 

References

Note 1031321 - Self-Registration of Adapter Engine and RWB fails

Note 764176 - Manual correction of XI content in SLD

Note 1435392 - PI CTC: SLD Configuration after PI AEX initial setup


Versioning in SAP PI - Part 2, the detail

$
0
0

I have been tasked with understanding how SAP PI can support different interface versions. Specifically how we will support a SAP system that is being rolled out across the globe.

 

I recently wrote a short blog entry Versioning in SAP PIabout versioning and had a limited response so I decided the investigate the matter in a little more detail. The following is based upon my own analysis, interaction with other developers, SAP Developer Network, SAP Service Support and external developer resources.

 

Change Types

Firstly let’s understand the various change types:

 

Changes that are Backwards Compatible

  • Addition of new operations
  • Addition of new data types or modified data types

 

Changes that are not backwards compatible.

  • Removing an operation
  • Renaming an operation
  • Changing parameters
  • Changing Structures

 

There are three known strategies for versioning:

 

Strict - Any changes result in a new version of the interface. It does not support backwards or forwards compatibility.

 

Flexible - Any incompatible changes result in a new version of the interface. The interface is designed to support backwards compatibility but not forwards compatibility. This means that any backwards-compatible change is considered safe in that it ends up extending or augmenting a service without affecting the interface.

 

Loose - Any incompatible change results in a new version of the interface. The interface is designed to support backwards compatibility and forwards compatibility. Instead of accommodating known data requirements, special features are used to make parts of the service intrinsically extensible so that they remain able to support a broad range of future, unknown data exchange requirements. This will result in vague interfaces that place the burden of validation on the underlying service logic. Not a recommended approach.

 

How do we indicate a new version? Most developers and developer resources suggest using the XML namespace to clearly delineate the version. A namespace value is sent with every SOAP message, HTTP Post or XML document. This allows the system to correctly determine what to do with an incoming message.


 

Options

With regards to PI the following options were considered

 

a) Create a new SWCV.

According to SAP documentation ‘a software component version is a shipment unit for design objects in the ES Repository’. You use a SWCV to group together objects that are shipped or installed together.’ SAP uses this approach for the majority of their standard content. You can’t copy objects between releases of a SWCV but use the Transfer Design Objects Function (ESR Menu under tools). This tool will transfer objects only if the source objects are more recent than the target objects or the target objects don’t exist. You can preview the changes and see what will be updated (source version is more recent), what can’t be transferred (the target version is more recent) or what does not need to be transferred (the versions are the same).

 

b) Create a new namespace with a version number.

Create a new namespace using the same name as the original namespace but adding a version number to the end. This will differentiate the versions although any service consumers will have to reference a different endpoint.

 

c) Ensure that the interface is backwards compatible.

Ensure all changes to the interfaces are backwards compatible. For example any new fields are optional and coding or mapping changes support both releases.

 

d)  Add a version number to the object names

Add a version number to the object names within the same SWVC and Namespace.

 

Analysis

a) Create a new SWCV.

Although this is appropriate for deploying different versions of a particular software package it doesn’t allow both versions to be used. Integration Directory objects refer to the interface by Communications Component/Interface Name and Namespace and not the SWCV.  The system will not allow you to add two interfaces from separate SWCVs to the same Communications Component Interface Name and Namespace. Therefore this approach will not work.

 

b) Create a new namespace with a version number.

This approach allows for changes to be implemented without impact to existing interfaces. The current interface would be copied to the new namespace, modified and in the case of an inbound interface the source system would be given the new target. In the case of outbound interfaces the target system would find that the payload would contain a new namespace. 

 

c) Ensure that the interface is backwards compatible.

Backwards compatibility isn’t easy to achieve. The functional requirements evolve over time, planned changes are deferred or cancelled and what seems like a simple change that may not have any impact may change significantly. This may result in having to unpick changes to implement subsequent changes. It also means that interfaces are not being developed correctly. This presents a high risk to existing interfaces and is not a recommended approach.

 

d)  Add a version number to the object names

Although this would work it would be confusing to maintain and is not a clean and elegant solution. I believe this presents a high risk to existing interfaces. It would be very easy to apply a change to the wrong version. This is not a recommended approach.


Proposal

Based upon my analysis I would like to propose option B, using a new namespace for all future development and supporting flexible versioning. At a high level it would work as follows:

 

  1. Requirements reviewed, assessed
  2. Compatibility
    1. Changes not backwards compatible?
      1. Prior version frozen, new release created
      2. Development to use current release
    2. Changes backwards compatable
      1. Modify existing version
  3. Development
  4. Deployment
  5. New Version
    1. Existing consumers migrate when appropriate.
  6. Updated Version
    1. Made available to all consumers on this release.

….repeat

 

It is very important the process is documented and agreed with the relevant teams. We need to ensure that all parties are aware of the process and buy into it. Supporting documentation, including specifications must be updated so it becomes easy to identify the release they relate to.It is more important than ever that supporting documentation is maintained and completed in a timely manner. Developers working in different geographies need to rely on the documentation they have access to.

 

A very specific namespace naming convention should be used to make it easy to identify the release that the corresponding objects belong to.

 

Namespaces should be used to differentiate development work conducted between different projects or areas.  The naming conventions that we will therefore adhere to are as follows:

urn:xxxxx.com:PI:<Software Component>:<Region if not in SWC>:<Area>:<Sub-Area>:<Version>

             E.g. urn:xxxxx.com:PI:A_B2B_RSP:B2B:CRMPunchout:YYYY

 

Benefits

No impact on existing interfaces

Ability to support aggressive project timescales

Customers can migrate when they want


Concerns

a) Freezing code, It is not possible to check out OR lock code via a transport. PI has the ability to restrict access to SWCV’s, Namespaces and individual objects via permissions and this is currently used to ensure objects cannot be created or edited in the Q, R and P systems. However, this may become too onerous to maintain but it would work. We have processes in place to ensure that all development requests are managed centrally, are documented and reviewed prior undertaking any work.

 

b) Migration to new releases. As the other countries play catch-up we will need to support migration to the later releases and then, when appropriate, decommission the earlier releases. How is the catch-up managed? It is annual, bi annual or quarterly?

c) Bug fixing. We must ensure that any bug fixes requested are documented and reviewed to see if they are appropriate. We must ensure that these are bug fixes and not an attempt to slip changes in unannounced.

d) Change Requests. We will need to plan any changes and determine how they will be incorporated into existing developments.

 

e) Communication. The changes, specifically the new endpoints should be clearly communicated to the project responsible.

 

Testing

To validate the proposal I performed a test in development. I took a simple HTTP to RFC synchronous interface as an example. Given a material code and language the interface will return the material code and material description from R/3. I tested this before attempting to create a new version.

 

    1 Within the Enterprise Services Repository.

    1. Created a new namespace
    2. Copied ALL objects to the new namespace
    3. Checked the copied objects to ensure that they were copied correctly.
    4. Modify the message mapping to return a different message in the response
    5. Activated the objects

     

    2 Within the Integration Directory (configuration)

    1. Create a new scenario. Same name, adding release as per the namespace.
    2. Update communications component to use new interface
    3. Create new configuration to use new objects
    4. Activate objects

 

The request will now have a new namespace but everything else is the same. Each interface was tested and both worked as expected.

 

The test highlighted the following points

  1. Certain objects, such as data types retain the original namespace once copied. A test should be performed with all object types so that post copy actions are documented.
  2. Documentation should indicate what objects in the Integration Directory MAY NOT need to be duplicated.  This may include Communications Components, Parties, and Communications Channels etc.  There is no reason to duplicate configuration objects that will not be impacted by the change. Although it makes sense to duplicate all the ESR objects certain ID objects will remain the same.

 

References: 

http://www.ibm.com/developerworks/webservices/library/ws-version/

http://soa.dzone.com/news/web-service-contract

http://www.oracle.com/technetwork/articles/web-services-versioning-094384.html

Advantages of Single Java Stack in SAP PI 7.3:-Good News for Java Resouces

$
0
0

From past many days I was searching a lots of blogs which can give me real picture of new and advantages of single Java Stack.But dont find any blog which can explain why  SAP is moving aways from its own stack ABAP to Single Java Stack.So,after consulting many SAP consultants and friends I thought to  submarized some of the  top 6 reasons or adavntages why SAP is planning to have single stack only in SAP PI 7.3.I hope it will help those guys who are not from SAP background and planning to join SAP.New SAP features will create  curiousity among Java resources to be part of changing SAP.  

 

  1. When there are 2 stack than messages keep jumping from one stack to another stack.It increases the processing time of the messages(Time taken to process the message completely from ABAP stack to Java Stack.Single stack will increase the performance and throughput will be better.
  2. Basis team will thank SAP for moving to single stack as it will help them to install the system fast and also in past restarting both the stack took long time ..now when they have single stack it will help not only to install the system the fast but also system restart will be fast as compare to SAP PI 7.1
  3. NO Support for ccBPM.BPM always reduce the performance of system.In SAP PI 7.3 interface will rely on SAP NWBPM(same as ccBPM)but performance will  be high.
  4. SAP is also trying to pull the large resource for Java Background who can help them to improve the SAP product and since new SAP PI 7.3 will not support ABAP mapping than people of  Java Background will help them to improve the performance of the system.New SAP PI 7.3 will support Java Mapping not ABAP mapping so it is the right time to pull Java resource to their court before they Go-Live.
  5. SAP is also advising customer to limit the usage of ABAP mapping and ccBPM and make most used of Java components.
  6. Most important advantages of single stack:-adapters will no longer be stack specific like Idoc adapter is in ABAP stack only.With SAP PI 7.3 Java stack will support all adapters including IDoc adapter.     

 

Definetly,SAP has taken a bold decision to move away from its own product i.e ABAP to Java,keeping in mind thart coming future is of SAP and inorder to capture the market they need to capture the large Java Resouce who are in market to  support them.    

EOIO in PI 7.31 single stack

$
0
0

Hello All,

 

In my current project we tried to process few interfaces as EOIO and we achieved by enabling it in Communication channel with queue name in version 7.3 single stack.

2.png

We had queue name as above it was working fine.

 

After upgrade of PI from 7.3 to 7.31 all the queues are getting struck in ECC in SMQ2 as below.

3.png

 

 

Solution:

We have changed the queue name to

 

XBQA<queue name> high priority

XBQZ< queue name> low priority

 

1.png


Regards

Vijay

SAP FEH Mail Alerts for ABAP Proxy(Inbound) in ECC

$
0
0

In case of Asynchronous Inbound Proxy Interfaces there is often a case where the Interface fails in the ECC system due to issues like Master data not being maintained, incorrect data received from legacy leading to conversion issues eg: Character in Amount or Quantity field, which needs to be continuously monitored through the XML Monitor transaction SXI_MONITOR or SXMB_MONI

 

SAP has introduced Forward Error Handling (FEH) for Proxy interfaces which also provides the option for sending Email Alerts via the Error and Conflict Handler (ECH) in the Post Processing Office (PPO) Framework whenever the Interface goes into Error. The First part of the Configuration for FEH has been explained in the detailed and informative blog by Michal Krawczyk hence this blog purely deals with the Email alert configuration in ECC.

 

Below are the detailed steps to be followed to enable this Alert mechanism in ECC -

 

Disclaimer: Please use Software component and Business process already configured for FEH. Given below is just an example taken for explaining the steps.

EMAIL CONFIGURATION in SPRO

1.     1. The first step in this configuration is to ensure that the standard BADi implementation /SAPPO/ORDER_CR_NOTIFY_DEFAULT of BADi  /SAPPO/ORDER_CREATE_NOTIFIY is active(it is normally active) as can be seen below:

 

FEH Step 1.png

 

2.    2.  In the Configuration Transaction SPRO, go to Define Worklists and give one of the below names as per your module:

             FEH Step 2 a.png

               FEH Step 2 b.png

 

3.     3. Go to Assign Worklist to Business processes and create a record for your respective interface. Please note that this is the same Software Component and Business process created for FEH configuration

            FEH Step 3 a.png

              FEH Step 3 b.png

 

4.    4. Go to Process Notifications for Orders in Worklist and create a record as below for your respective Interface

     FEH Step 4 a.png

       FEH Step 4 b.png

 

5.    5. After SAVE into customizing request, Choose the record and click on Printworkbench Settings and enter details as below and SAVE:

          FEH Step 5 a.png

            FEH Step 5 b.png

 

6.    6. The same priority maintained here needs to be maintained at the Business Process level, which needs to be done in Assign Priority to Business   

          Processes as below:

    FEH Step 6 a.png

      FEH Step 6 b.png   

 

7.    7. After this, Users need to be maintained in the Worklist defined(ZBP0). This is a one time activity that has to be done in every system(No transport request is created on saving these changes). Transaction code is /SAPPO/WL_CHANGE and execute, you would see your Component along with the Worklist wherein Users can be dragged and dropped as can be seen below:

          FEH Step 7.png

SAP also provides an option of assigning a complete Organizational Unit in which case all the users assigned to the group would get the Email alert notification. Email would be sent to the Email ID maintained in User settings as below:

       FEH Step 7 b.png

 

8.     8. After this, test your FEH with one failure scenario if an Email is triggered to your ID(your User ID needs to be maintained in the worklist) an Email in the below format should get triggered:

     FEH Step 8.png

 

ISSUE WHILE TRIGGERING PPO ALERT EMAIL

On completing the initial Configuration settings for the PPO mail alert, the interfaces were tested to check if they trigger an email to the Users maintained in the above mentioned user list, but there was an issue due to which the EMAIL was not getting triggered:

On contacting SAP it was learnt that there are some settings related to the MAIL functionality that need to be altered. There were two suggestions given by SAP for the same:

Please refer to the following customizing activity:
Cross-Application Components
--General Application Functions
----Print Workbench
------Define Shipping Control

Here the attribute "Storage Mode" is set to value "Print and archive" for Dispatch Control MAIL.

Please remark that the system does not support storage modes "Print and archive" or "Archive only" in this PPO-notification scenario.

As a result PPO orders are generated without triggering a mail notification.

 

To resolve this issue please choose storage mode "Print only" in the customizing activity mentioned above.

Configuration for the Print Workbench General Setting was done as suggested as can be seen below:

FEH Issue 1.png

 

However, this is a general setting for all documents using the print workbench with MAIL.

Alternatively you could adjust the PPO-specific application form /SAPPO/NF_NOTIFICATION_COLL which gets called in your PPO notification scenario via transaction EFRM:

-Choose Tx EFRM

-Enter /SAPPO/NF_NOTIFICATION_COLL

-Choose Change

-Double Click DOCUMENT in the hierarchy shown on the left

-Choose Storage Mode "Print only"

Also Configuration for the Print Workbench PPO Setting in /SAPPO/NF_NOTIFICATION_COLL was done as per alternate method suggested as can be seen below:

FEH Issue 2.png

 

Also, the Priority maintained in ‘Print Workbench Settings’ and that assigned at the Business Process level should be the same else there is some standard check that fails resulting in NO mail trigger.

Error while opening SAP PI7.1 Directory.

$
0
0

Hi Guys,

 

I have faced this issue few times in my project.When I was trying to open any of the configuration Scenerio I was getting this below error.I tried searching in SDN but didnt find any suitable answer which can help us to solve this issue.With the help of our Basis team we figured  out why this issue occured and solution to solve this issue.

 

If you see below when I tried opening receiver determination or receiver agreement of any of the configuration scenerio,I was getting this below error.

Please note it is not specific to any particular configuration scenerio.You will see same error with all the configuration scenerio.  

SDN.png

As the result of this issue,I was not able to make any changes in any of the configuration scenerio(if you want to make any changes in receiver agreement or sender sender agreement or Interface determination etc).Initially we thought that some objects were deleted and causing this problem.

 

Root Cause:-Service users expired(in some cases it may be locked).

 

Service users are used for internal communication between XI component. The service users provide dialog-free access to the involved XI components. They have SAP user roles in the ABAP part of the SAP Web Application Server (AS) that are available as user groups in the J2EE part.

 

Service User.png

For each component, if you see above,service users representing the respective components are created with the appropriate roles in the target components during installation. The passwords of the service users have to be defined during the installation process.

 

In my case,I was facing this issue with Directory,so I checked this user XIDIRUSER and I was surprised to see that this user was expired.When I changed the password(please use standard password only)and I tried to open the configuration scenerio again,I found that everythings is working now.

 

So,if you see this kind of issue with SLD,IR or ID,please check the respective service user with the help of basis team and check weather this service user is locked or expired.If expired,reset the password and open it again. 

 

Regards,

Abhinav Verma

Retaining SOAP Adapter Attachment Names

$
0
0

As per thread: SOAP Sender attachment named attachment-1 discussion, SOAP sender Adapter always replaces the incoming attachment names with attachment-1, attachment-2 etc.. And as Stefan Grube mentioned in the thread, this is the default SOAP adapter behavior since it was hardcoded in SOAP adapter for incoming attachments to XI. But most of the times, the business needs the original attachment names at the receiving target application. So, how can we achieve this.

 

In this blog, I am providing UDF code snippet using which we can retain original attachment names in the mapping by reading incoming attachments using mapping API for attachments (applicable from PI7.1 onwards). Also, with this procedure we can overwrite existing attachments with any content as bytes. Note:- the same can be achieved with a java mapping/XSLT with java enhancements as well.

 

String attachmentID = null;
java.util.Map map;
AbstractTrace trace;

//gets the input attachment from the source message
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
trace = container.getTrace();
//map = globalContainer.getParameters(); 
try
{
          //checks for the availability of attachments in the input message          if(inputAttachments.areAttachmentsAvailable())          {                    trace.addInfo("Attachments Available");                    //gets the attachmentIds and store it in an Object array                    Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);                    Object[] arrayObj = CollectionIDs.toArray();                     //Loops at the input attachments to get the content of the attachment                    for(int i =0;i<arrayObj.length;i++)                    {                              attachmentID =(String)arrayObj[i];                              trace.addInfo((i+1) + ") Attachment Name: " + attachmentID);                              Attachment attachment = inputAttachments.getAttachment(attachmentID);                              String contentType = attachment.getContentType();                              byte[] attachmentBytes = attachment.getContent();                              Attachment renameAttachment = outputAttachments.create(attachmentID, contentType, attachmentBytes);                               outputAttachments.setAttachment(renameAttachment);                              //remove each attachment if required. Uncommonent below                              //trace.addInfo("Removing Attachment no: " + (i+1) + " & Name: " + attachmentID);                              //outputAttachments.removeAttachment(attachmentID);                     }          } 
}
catch (Exception e)
{          e.printStackTrace();
}


return           var1;

 

Attachments sent from SOAP UI as SOAP message to XI.

 

SOAP UI.JPG

 

 

With the above UDF in the graphical mapping, the results will be as shown below for the inbound/mapping pipeline stages in MONI

 

PipelineSteps.JPG

Regards,

Praveen Gujjeti

SAP PI Troubleshooting

$
0
0

SAP NetWeaver Process Integration (SAP PI) is a component of the Netweaver product group used to facilitate the exchange of information among a company's internal software and systems and those of external parties . Here are some of the errors and its resolution which will definitely be useful.

 

 

 

    1. Cache Update Problems :-

 

Use transaction SXI_CACHE to update the Integration Directory cache. Alternatively, you can use the following URLs to update the CPA cache. Use XIDIRUSER to refresh the cache.


For complete cache refresh – http://<hostname>:<port>/CPACache/refresh?mode=full

For delta cache refresh – http://<hostname>:<port>/CPACache/refresh?mode=delta


If this does not solve the issue, check transaction SLDCHECK to ensure that connection to SLD is available. If the connection fails, check the configuration in the transaction SLDAPICUST. Make sure that the password maintained is correct and the maintained service user is not locked.

Now in the Integration Repository go to Environment → Clear SLD Data Cache. Also go to Integration Directoy and clear the cache using menu Environment → Clear SLD Data Cache.

Open the XI Start Page and click on Administration. On the Repository tab, choose Cache Overview. Refresh the cache using the buttons/icons on the right. Use XIDIRUSER to refresh the cache. Carry out cache refresh in the same way on the Directory and Runtime tabs.

If you are facing cache update problems in your BPM (say you have modified the BPM, but when executed old version of the BPM is picked up instead of the new one), run the transaction SWF_XI_CUSTOMIZING and press F9 carry out automatic BPM/Workflow Customizing.

 

 

    2. Routing Errors :-

 

  • NO_RECEIVER_CASE_BE or NO_RECEIVER_CASE_ASYNC

This means no receiver could be found. Check your Receiver Determination. Activate and update cache. Asysnchronous messages can be manually restarted.

  • TOO_MANY_RECEIVERS_CASE_BE

More than one receiver found. Check your ID configuration to ensure that there is exactly one receiver for the synchronous message. Multiple receivers for synchronous interfaces are not permitted.

 

      3.Mapping Errors :-


  • JCO_COMMUNICATION_FAILURE

Check whether RFC destination AI_RUNTIME_JCOSERVER is correctly configured

  • NO_MAPPINGPROGRAM_FOUND

Ensure that mapping program exists and is activated. If it exists then update the cache.

  • EXCEPTION_DURING_EXECUTE

This error occurs due to erroneous XML formatting. Check your mapping program and ensure that you supply valid input data.

 

4. Messages stuck in queues

 


Check the queues using transactions SMQ1 (outbound)/SMQ2 (inbound). Resolve the displayed errors. You can cancel the messages from SXMB_MONI. Execute LUW if necessary and avoid deleting entries manually.

 

 

5.Conversion Errors


        Unable to convert the sender service XXXX to an ALE logical system

This error occurs in case of scenarios with IDoc adapters. Whenever you use business systems, make sure that the corresponding logical system name is maintained in the SLD.

Open your business system in the Integration Directory. Switch to Change mode. Access the menu path Service → Adapter Specific Identifiers. Click the button that says ‘Compare with System Landscape Directory’ and chose Apply. Save and activate your change list.

In case of business services, you can manually type a logical system name in the Adapter Specific Identifiers if required. This name should match the corresponding logical system name defined in the partner SAP system’s partner profiles.

 

 

4.Errors on the outbound side


Sometimes the link between SAP XI and the target system (say ERP) goes down and messages fail on the outbound side. It may not be possible to restart them from using RWB or the transactions like SXI_MONITOR/SXMB_MONI . In such case generally, messages are picked up and sent via SAP XI when the link returns. However, in some scenarios, it may be possible that SAP XI server could not finish conversation with ERP. Main status of messages is “Processed successfully” – but there is an error in the outbound side as shown below. (Transactions – SXI_MONITOR/SXMB_MONI).

 

image

These messages do not get picked up automatically – and it is not possible restart them from using RWB or the transactions like SXI_MONITOR/SXMB_MONI.

Such messages could be processed in the following way:

  • Send data directly to Integration Engine
  • Change the status of failed message

This example shows how to solve the problem – two error messages are shown and one of them is solved here.

 

Step 1: Send data directly to Integration Engine


Go to Component Monitoring in SAP XI Runtime Workbench. Click on the Test Message tab for the Adapter Engine. Specify the URL of SAP XI Integration engine to send the message to e.g. http://<XIServer>:<J2EE Port>/sap/xi/engine?type=entry

image

Specify the header Information. Copy payload of the message using SXI_MONITOR/SXMB_MONI and paste it into Payload area in RWB.

image

 

Send the message using Send Message button.

 

Step 2: Change the status of failed message

Call the transaction SWWL.

image

 

Delete appropriate work items.

image

 

Check that the messages are complete in SXI_MONITOR/SXMB_MONI.

image

 

 

Another simpler way to accomplish this is to use transaction SXMB_MONI_BPE .  Select Continue Process Following Error under Business Process Engine -> Monitoring and Execute (F8). Update the selection criteria as required and Execute (F8). Choose the appropriate line item and click on Restart workflow button.

In these ways we can reprocess the messages failed on the outbound side. If the messages do not participate in BPM process, then they can still be traced via outbound queues or SM58 logs and restarted.

 

 

 

Hope this helps . Happy reading

Muhammad Siddique

 

 

 

 

 

 


 

 



Failed to connect to a stored procedure from sapi 7.3

$
0
0

Hello experts:

 

I have the following scenario I'm trying to build: Send information from a AbabProxy - PI - Jdbc through a stored procedure. It must answer a series of data, however the following error occurs through SXM_MONI.

 

com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'Licores_Mayor' (structure 'Statement'): com.microsoft.sqlserver.jdbc.SQLServerException: No se encontró el procedimiento almacenado 'Licores_Mayor'.


My Data type are:

 

DT_EnvFactura_Out_XI

     Request

          factura

          localidad

 

DT_EnvFactura_In_JDBC

     Statement

          Licores_Mayores

               Action

               factura

                    isInput

                    type

               localidad

                    isInput

                    type

 

Herewith the mapping done to see if I can help in solving this problem

 

 

Thanks community.

Leveraging PI Java Mapping to integrate PI 7.31 AEX with SFDC cloud Server

$
0
0

1.     Introduction  and Business Requirement:

 

1.1.     We have seen lot of blogs/docs regarding SFDC and PI integration in SCN then what is new in this blog? Well, in this blog I would like to share my learning/experience on the integration of PI with SFDC in different approach which is very simple, easy and fast way to configure (initial set-up may take little time) and run the interface without any complexity. Without spending more time on what is SFDC cloud server and its CRM capabilities I will jump directly to business requirement/scenario that I am explaining in this blog as most of us know about SFDC.

          Client was having requirement to create eligible customers from SFDC to SAP ECC, Update back SAP customer number from SAP ECC to SFDC as response, Creation of Sales Orders from SFDC to SAP and Update SAP Sales Order Number/Date as response. There were lot of blogs/use case docs regarding SAP PI with SFDC integration in SCN. I followed the steps and  started implementing it in PI, but I felt little complexity in building this interfaces as we have to maintain Session IDs, two SOAP receivers, URL settings, Content type change etc. Then I had searched in SFDC Developers Force link, on how other applications are integrating with SFDC. I got some important info that using Java API generated from enterprise WSDL document provided by SFDC it would be very easy to integrate the SFDC with java applications.

          As SAP PI supports java mapping in Operation mapping, I started developing the code and leveraged it to login to SFDC server and do the DML operations by directly calling simple Java method calls without bothering on session IDs, SOAP message header, Server URLs, Content Type etc. At end, we successfully implemented these scenarios and they are running in production smoothly. So I thought to share this new way of integrating the SAP PI 7.31 with SFDC Cloud Server by leveraging the java mapping program to SAP Ecosystem Community so that others can also get benefit from this blog.

1.2.     Business Scenario:

          1.2.1. Retrieve all the new customer information from SFDC server having StageName field as 'Order Pending' and create the Customers in SAP ECC with retried data info and Update back the SAP customer number back to SFDC.

          1.2.2. Retrieve all the new Sales Order Information from SFDC and create Sales Orders in SAP with retried data and update the SAP Sales Order Number back to SFDC.

 

2.     Currently available solutions in PI:

 

2.1.     Third party REST adapters which ready to use to integrate with SFDC server.

2.2.     Third party solution/packages.

2.3.     Using PI SOAP Receiver adapters and adding session IDs in SOAP message header. Please check blog links given in reference section. These are little complex scenario and difficult to manage the sessions IDs.

 

3.     What is the benefit of this new approach (Leveraging PI Java Mapping):

 

3.1.     No need to have any PI SOAP Receiver adapters! in Integration Directory.

3.2.     No need to add session ID token in the SOAP message header as we are not going to use any SOAP messages at all! We will be to using SFDC java API calls that are generated from enterprise WSDL document.

3.3.     No need to have SOAP lookup code for retrieve the Session ID and No need to use Dynamic Configuration code to set the Sever URL, No need to use MessageTransformBean for changing the content type.

3.4.     Supports request and response messages using simple asynchronous interfaces (i.e. asynch-synch-asynch flow).

3.5.     Simple step to generate the APIs from SFDC enterprise WSDL document. Simple API call Connector.newConnection() to login to SFDC server, Simple API calls like EnterpriseConnection.Create(), update(), query() etc. for DML operations to process the data in SFDC server. Please see the java code below for further info.

3.6.     Simple steps to import Java mapping class, SFDC jars (enterprise.jar, wsc-22.jar) in ESR, simple steps to test the SFDC connection, easy  to troubleshoot as we can add custom log info using getTrace().addInfo() and re-throw the SFDC API exceptions back to PI Mapping runtime.

 

4.     About SFDC login and WSDL document:


4.1.     SFDC Server API login and Security Token: We use user id and password to login to SFDC server through web browsers, while connecting SFDC from applications e.g. PI, web services, applications need to login through API i.e. through SFDC API call, SOAP based/Rest based web service calls. While login to server through API, we need additional security password called Security Token along with your password. It will be alphanumeric long string that will unique to the particular user id which has to be passed along with password by appending it to password i.e. Mypassword+SecurityToken (without + char).

          You can generate/re-set this security token from SFDC server. Click on Personal Setup --> select My Personal Information --> Reset My Security Token. The new security token is sent to the email address of user.

 

securityToken.jpg

 

If you are using any SOAP applications e.g. SOAP UI, PI SOAP adapter, you also need session Id to be passed in the SOAP Message header. You need to pass this every time while you hit the SFDC server and in some times, you have to maintain/manage this session IDs for complex transactions.  In our approach, we are login through SFDC APIs generated from enterprise WSDL, which does not require session ID to be maintained or to be added in the SOAP header! See 5.2.3 section for more info.


4.2.    SFDC Enterprise WSDL: To access the SFDC server’s Web services, you need a Web Service Description Language (WSDL) file.  SFDC provides the enterprise WSDL file to download from its server. Using this we can generate the APIs to login to SFDC server and do the DML Operations (Select/Insert/Update/Delete). We can download this WSDL by log in to your Salesforce.com organization and click Setup --> Develop --> API, right-click on ‘Generate Enterprise WSDL’ and save it in local drive, rename the file from .xml to .wsdl.

 

wsdlDownload.jpg

 

4.3. Generating Enterprise.jar using WSDL: First download the SFDC’s wsc-22.jar file from at https://code.google.com/p/sfdc-wsc/downloads/detail?name=wsc-22.jar&can=2&q=And to generate the enterprise.jar file, run the following command in command prompt. Provide the directory path of wsc-22.jar, enterprise.wsdl where these are stored and output directory path, make sure you have installed Java JDK 1.6+ in your system to run this command.

 

java –classpath pathToJAR/wsc-22.jar com.sforce.ws.tools.wsdlc pathToWsdl/WsdlFilename  pathToOutputJar/OutputJarFilename

 

e.g. java –classpath C:\SFDC\wsc-22.jar com.sforce.ws.tools.wsdlc C:\SFDC\enterprise.wsdl  C:\SFDC\enterprise.jar

 

5.     PI ESR Configurations:

 

5.1.     Below is Flow diagram of Retrieving SOs from SFDC updating in SAP data flow.

Flow Daigram.jpg

SAP side there will be a batch program running which will be scheduled in background, which will initiate the PI interface with asynch ABAP Proxy call. At receiver determination step, operation mapping is called and which in turn calls java program which does all the login to SFDC, issuing DML operations and processing of records returned from SFDC. Once DML operation is successful, java program forms the target message type structure and sends to receiver system. Since data is required at SAP ECC side, using receiver SOAP adapter in XI mode, asynch ABAP Proxy is called and forwards the records that is received from SFDC. Please refer below sections for java code.

 

5.2.     Java mapping code to login and to process SFDC data to do DML Operations:


5.2.1.     In SAP NWDS, create the class eg. PISelectSalesOrders which will extends the AbstractTransformation class so that it can override the transform() method. You need to import the enterprise.jar and wsc-22.jar file as library jars to compile the java code.

5.2.2.     Then next step is that in the transform() method, prepare a SQL Query string to be issued to SFDC Server, see below screen shot:

SelectQuery.png

5.2.3.     Login to SFDC Server through API: Please check the below screen shot to connect to SFDC server by using Connector.newConnection()  method call, please note that, for password input you have send both SFDC login password appended with security token corresponding to the user id.

Connection.png

5.2.4.     Issue SQL query using connection.query(queryString) method by passing SQL query that you formed in previous steps and store the response from SFDC server in QueryResult object. Use getTrace.addInfo() after every operations so that you will get to know what step it crossed and it would be helpful in case of trouble-shooting.

IssueQuery.png

5.2.5.     Process the Result using QueryResult object and form Target Message Type structure by using String builder object.

ProcessResult.png

5.2.6.     Similar to above other DML Operations like create/Update and Delete can be used, in below screen shot you can see that code is updating back the SAP Sales Orders from SAP ECC to SFDC by using connection.update().

UpdateRecords.png

 

5.2.7.  Please note that from SFDC side, Opportunity.Id column is unique Id using which we can retrieve/update/delete the records in SFDC, so we need to store this value in SAP custom Z table (e.g. SFDC_Opportunity_ID field) when we first retrieve the data. Set the flags in Z table whenever we update back the SO number or customer number so that we should not update same records again and again.

ztable.png

5.3.     Importing SFDC jar files into ESR using Imported Archives: Once you are done with java mapping program and testing, import the generated enterprise.jar and wsc-22.jar files into ESR namespace using Imported Archives Object along with java mapping jar/zip file.

5.4.     Create the Operation Mapping in the ESR and assign java mapping program to it. Now we all set to do testing the connection and issuing DML queries to SFDC. Ready from ESR side.

5.5.     Before testing the java mapping make sure that you have disabled VM parameter -Djava.protocol.handler.pkgs=com.sap.engine.httpdsrclient.protocols|iaik.protocol as this will disable to use iaik security package as default security package. For connecting SFDC server using https protocol we need to use underlying Java security package.

 

6.     PI ID Configurations:

 

Since login and issuing DML commands are all happening in Operation Mapping (Java Program) there are only little configurations required at ID side.

6.1.     If we are having Update/Create Query (SAPàPIàSFDC) then we can use simple File adapter at Receiver side to complete end to end scenario and while interface determination, Operation Mapping would be called and does the Update/Create operation.

6.2.     If we are having Select Query (Batch ProgramàPIà SFDC for fetching data, SAPßPIßSFDC Updating to SAP) wherein we have to fetch all the records from SFDC depending condition and Update the retried data to SAP then we should have ABAP Batch Programà PIà ABAP Proxy scenario where operation mapping will fetch all the records and forma the target Message Type and it would be send across to ABAP Proxy. For PI point of view this transaction is asynchronous but in java mapping it is handling request-response messages.

6.3.     In case of any errors while login or DML operations, Java program would throw error with appropriate log and Operation mapping will get fail and interface would fail which will send out PI alert mail to respective support team.


7.     Summary:

 

In summary, using PI java mapping and SFDC enterprise WSDL document, wsc-22.jar and SFDC java APIs we can easily integrate the SFDC Cloud Server without worrying on Session IDs, SOAP Header, Server URLs and concentrate only on business logics and DML query.  I really enjoyed while writing java code after long timeJ, here with this I would like to conclude this blog. Comments are welcome.

 

8.     References:

 

1.     http://www.salesforce.com/us/developer/docs/api/apex_api.pdf

2.     http://wiki.developerforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector

3.     https://code.google.com/p/sfdc-wsc/downloads/detail?name=wsc-22.jar&can=2&q=

4.     http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50a76cfa-4966-2d10-aba7-da496d9b5bcf?quicklink=index&overridelayout=true

5.     http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/802f8d03-9282-2d10-52b4-f9446e077099?QuickLink=index&overridelayout=true

IDOC to File Scenario using xml HTTP port and IDOC bundling concepts

$
0
0

Hi,

 

This is a scenario of IDOC to File using xml HTTP port at sender side and also including IDOC bundling concept together.

 

First, let us see the configurations required for sender side.

 

Step1: Create an RFC destination of type H in sm59

 

Path prefix contains namespace, sender service and sender component (i.e. IDOC as sender service)

/sap/xi/adapter_plain/?namespace=XXX&interface=XXX&service=XXX&qos=XX

/sap/xi/adapter_plain/?namespace=urn%3Asap-com%3Adocument%3Asap%3Aidoc%3Amessages&interface=ZZIFS_OILDEB_XXXXX.OILDEB06.ZZIFS_OILDEB06&service=DWN_DEV_ECC_XXX_XXX&qos=EO

 

C_4.jpg

 

Step 2: Create an xml HTTP port in we21 TCode with the RFC destination created in step 1.

 

C_3.jpg

 

Step 3: Use the port created in above step in partner profile in we20 TCODE.

 

C_2.jpg

 

After you are done with the configurations in ECC system, now comes the ESR part.

 

Create data type , message type and service interface for receiver side. Create external message for sender side(IDOC bundling).

 

Next step is to create message mapping with IDOC as sender and File structure as receiver.

ESR_1.jpg

 

In Operaion mapping, the sender service interface should be IDOC only.

 

ESR_2.jpg

 

Now comes the ID part,

 

Step1 : Create 2 communication channels. One for sender and and one for receiver

For sender channel, adpater should be of plain HTTP type.

 

Please note that the message protocol should be of type XI payload in HTTP body

 

ID_6.jpg

 

Receiver file communication channel is created as usually

ID_7.jpg

 

The other pipeline steps are created in usual manner.

Create the Sender agreement, Receiver determination, interface determination and receiver agreement in usual manner.

 

 

TESTING:

 

Please trigger an IDOC from we19

 

Testing needs to be done from ECC(unit testing client).

 

Now check the results in SXMB_MONI

 

Then you can check in message monitoring of PI system and also communication channel monitoring from RWB

 

 

Note: IDOcs won’t be visible in idx5 of PI system because it will skip coming here and directly reach the target system

 

It won’t be possible to test the scenario through Integration engine of RWB, because it will throw internal error: 500 sender agreement not found.

Because it will directly hit IE, so it doesn’t require any sender agreement but in this case we need to use a SA.

 

 

Regards,

Rohini Potham

Mutiple SAP PI system.Advantages and Features

$
0
0

Hi Guys,

 

Most you will be wandering why to use mutiple PI system.Before joining my current project,I was working with only one PI system which was used to integrated all the different system.But there are few adavatages and features which will help you to understand working and features of Mutilple SAP PI system.

 

Background:-

 

Some client doesnt want their system to be accessed or exposed  by any other 3rd party system directly or you cant get in touch with your client system directly.In this case,mutiple PI Box will solve your requirement.

 

SDN.png

Here,if we want to access the data from client BW system or their ECC system than we have to go through client PI system,clearing all validation,filteration and mapping.

 

Let me introduce mutipling PI concept.Before that let me tell you those you are new to PI world one basic information or simple way to understand 3rd party:-Anythings which is in your landscape or in your network are your system and anythings which is outside your landscape or network is 3rd Party system(most of times in my initial days I used to get confused with this ). 

 

CRM,BW and ECC of both parties are connected to PI system which is here acting as a bridge between your landscape and client landscape.Depending on what kind of communication you want from this system,you can make them one way or two way.But PI to PI communication will always be 2 Way communiction as both inbound and outbound interfaces will run.

  

Client PI system is connected to their SAP ECC,BW or CRM.As per the business requirement if we want to fetch the data from client system  which is not allowed directly so we introduced the concept of mutiple PI system.

 

Now when you want to connect your PI system with customer you should use proxy communication,It will help you to communicate with your client system.

Please keep in mind that  validation and filteration of data can be  done at both the PI level.

 

Communication between SAP ECC or BW can be of any type.You can have IDocs,File or any type of communication within your landscape but PI to PI will be PROXY only.

 

Suppose you have one interface which is outbound to your system.In this case you have to create the RFC connection in your system and same needs to be done in Client system.Any mismatch in details will leads to failure of this interface.And same needs to be done in case of inbound interface.

 

Fetaures of Mutiple PI system.

  1. Both Parties are well protected and no one can access your data directly without passing through PI system.Security is more.
  2. Performance and throughput is high as interfaces are checked and validated at 2 levels.
  3. Number of failed messages are less.

 

I would recomment that use of mutiple PI system is totally based on your business requirement.Most of the project doesnt use this features but if you are lucky and gets a chance to work with mutiple PI system.Please make best use of it.It will help you to increase your knowledge of PROXY(as proxy is widely used in this type of scenerio)and you will also get the chance to learn the UDF and Filter.  

 

Regards,

Abhinav Verma

write mapping message to RWB audit log when ICO is used in PI 730

$
0
0

The integrated Configuration(ICO) is recommended to be used in PI 730 because of the high performance of AAE. However the mapping error track mechanism is not as user friendly as that in ABAP stack. For the traditional ID contents combination in ABAP stack, no matter message mapping, java mapping or XSLT mapping is used, the error message can either simplly send out by throwing an exception or using <xsl:message/> and the error message will be shown in the ERROR tag in tcode: SXI_MONITOR. By analysing the error message in SXI_MONITOR is one of the most effective ways for a PI developer to locate the defect.

 

However when ICO is used, this becomes a different story. In the audit log of runtime workbench, the log just shows information like message is retrieved into the queue, the mapping is failed/successful etc. It won't display mapping error message, nor can it show the message from the exception directly. Java class like Abstracttrack cannot populate message to the audit log either.

 

I just found a way to write message from mapping to RWB audit log by using Java class AuditAccess. Wish you find it useful for you. Here is the tutorial when XSLT mapping is used. For message mapping or Java mapping, the process is almost the same.

 

Prerequisits:

1. you have to know how to use NWDI to develop Java class

2. you have to know how to create imported archive in PI ESR

3. you have to know how to get the source message id in the mapping process.

 

Steps:

1. download the JAR file com.sap.aii.af.ms.ifc_api.jar

2. create a Java class in NWDS and import the JAR file as the external source. Here is the Java source code ( i am totally new to Java. please ignore silly mistakes made in Java programming)

package com.xxx.util;
import com.sap.engine.interfaces.messaging.api.*;
import com.sap.engine.interfaces.messaging.api.auditlog.*;

public class errorLog {

public static void execute(String errorMsg,String messageid) {
  MessageKey key = null;
  AuditAccess audit = null;
  try{
   audit = PublicAPIAccessFactory.getPublicAPIAccess().getAuditAccess();
   key = new MessageKey(messageid, MessageDirection.OUTBOUND);
   audit.addAuditLogEntry(key, AuditLogStatus.ERROR, errorMsg);
  }catch (Exception e) {
   Exception me = new Exception(e);
  }
}
}

Info: there are two import parameters of the method:

a) The message you want to displayed in the audit log;

b) The source message id.

 

3. Create an imported archive by using the JAR file exported from the developed Java class.

4. In your XSLT mapping, insert the following relevant code:

     4.1 Add a namespace prefix definition like this

<xsl:stylesheet version="1.0" ....  xmlns:el="com.xxx.util.errorLog">

     4.2 Receive runtime constant messageid. For message mapping or java mapping, message id can be get by deriving dynamic configuration.

     4.3 Pass message by calling Java method

    <xsl:choose>

     <xsl:when test="function-available('el:execute')">

      <xsl:value-of select="el:execute($message,$MessageId)"/>

     </xsl:when>

     <xsl:otherwise>errorLog->execute is not available.</xsl:otherwise>

    </xsl:choose>

      info:

          Constant $message will be the error message to be displayed in the audit log;

          Constant $MessageId is the message ID from runtime

 

Here is the sceenshot of the result:

screen.png

 

wish you find it useful. :-)

Send File to Two Different Locations using Adapter Module

$
0
0

Many a times we have a requirement where the client wants that any file which is send to external system should be archived on local file system/ FTP folder.

To take a backup of target file we have few alternatives available like we can opt a conventional way by adding one more receiver and assign one file receiver channel to it and then simultaneously send the message to third party as well as to the client's local system (let it be NFS or FTP), OS commands can also be one of the alternatives or we can write a adapter module to accomplish this requirement.

 

Recently I also came across the same situation, where SAP system is generating a message and after doing few transformations in PI I need to send transformed XML file message to external system and take a backup of the same target file on local FTP server.

Firstly I thought of adding one more "Business Component" (re-use the same mapping) and file receiver channel pointing to Local FTP folder in the existing scenario, but as expected client starts asking the same solution for multiple file interfaces . So to have a reusable kind of solution I created one generic adapter module which will create a backup of target message on local server and then send the same to external application.

 

So, the objective of this blog is to show how the target file message can be send to two different locations using one file receiver adapter.

 

Below module code has been defined in such a way that depending upon the parameters passed from channel it can back up a target message either on FTP or NFS server

 

package com.poc.sdn;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.TimedObject;
import javax.ejb.Timer;
import sun.net.TelnetOutputStream;
import sun.net.ftp.FtpClient;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
import com.sap.aii.af.service.auditlog.Audit;
import com.sap.engine.interfaces.messaging.api.Message;
import com.sap.engine.interfaces.messaging.api.MessageKey;
import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;
import com.sap.engine.interfaces.messaging.api.XMLPayload;
import com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;
/*\*
\* @author amitsrivastava5
\*
*/
public class BackUpFilesBean implements SessionBean, TimedObject {

 /\* (non-Javadoc)
\* @see javax.ejb.SessionBean#ejbActivate()
*/
@Override
public void ejbActivate() throws EJBException, RemoteException {
 // TODO Auto-generated method stub
}
/\* (non-Javadoc)
\* @see javax.ejb.SessionBean#ejbPassivate()
*/
@Override
public void ejbPassivate() throws EJBException, RemoteException {
 // TODO Auto-generated method stub
}
/\* (non-Javadoc)
\* @see javax.ejb.SessionBean#ejbRemove()
*/
@Override
public void ejbRemove() throws EJBException, RemoteException {
 // TODO Auto-generated method stub

}
/\* (non-Javadoc)
\* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
*/
@Override
public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
 // TODO Auto-generated method stub
}
/\* (non-Javadoc)
\* @see javax.ejb.TimedObject#ejbTimeout(javax.ejb.Timer)
*/
@Override
public void ejbTimeout(Timer arg0) {
 // TODO Auto-generated method stub
}
public void ejbCreate() throws javax.ejb.CreateException {
}
public ModuleData process(ModuleContext mc, ModuleData inputModuleData)
throws ModuleException {
Object obj = null;
Message msg = null;
MessageKey amk = null;
//Reading Type of Transport Protocol
String ServerType = (String) mc.getContextData("Server");
try {  
// Retrieves the current principle data, usually the message , Return type is Object
obj = inputModuleData.getPrincipalData();
// A Message is what an application sends or receives when interacting with the Messaging System.
msg = (Message) obj;
// MessageKey consists of a message Id string and the MessageDirection
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
//Reading file name from message header 
MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
String filename = msg.getMessageProperty(mpk);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "filename is" \+filename );
// Returns the main document as XMLPayload.
XMLPayload xpld = msg.getDocument();
byte\[\] inpbyt = xpld.getContent();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Input file read successfully"); 
//Archiving target file on FTP server
if (ServerType.equals("FTP"))
{
String HostName = (String) mc.getContextData("HostName");
String FTPDirectory = (String) mc.getContextData("FTPDirectory");
String Username = (String) mc.getContextData("Username");
String Password = (String) mc.getContextData("pwd");
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Connecting to FTP location");
FtpClient client = new FtpClient();
client.openServer(HostName);
client.login (Username,Password);
client.cd(FTPDirectory);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Connection to FTP location Successful");
TelnetOutputStream out = client.put("Backup_"+filename);
out.write(inpbyt);
out.flush();
out.close();
client.closeServer();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "File written sucessfully");
}
//Archiving target file on SAP file system
else if (ServerType.equals("NFS"))
{
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Write file on NFS location");
String NFSDirectory = (String) mc.getContextData("NFSDirectory");
File path = new File(NFSDirectory+"/" +filename);
FileOutputStream fos = new FileOutputStream(path);  
fos.write(inpbyt);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "File written sucessfully")
}
else
{
throw new CustomException("ServerType Parameter Is Not Having Valid Value");
}
// Set content as byte array into payload
xpld.setContent(inpbyt);
// Sets the principle data that represents usually the message to be processed
inputModuleData.setPrincipalData(msg);
}catch (Exception e) {
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,
"Module Exception caught:");
ModuleException me = new ModuleException(e);
throw me;
}
return inputModuleData;
}
}
class CustomException extends Exception
{
public CustomException(String message)
{
super(message);
}
}

 

 

 

Module configuration to Backup file on FTP server

 

If target file needs to be archived on FTP server then below module parameters need to be passed in file receiver channel

Capture.PNG

 

Note - "Server" parameter value ("FTP" or "NFS") will call the corresponding method in module to archive files on FTP or NFS server.

 

Module Configuration to Backup file on NFS server

 

Capture.PNG

Configuring External Communication Channel Control (step-by-step guide with examples)

$
0
0

As explained athttp://help.sap.com/saphelp_nwpi71/helpdata/en/45/0c86aab4d14dece10000000a11466f/content.htmSAP PI 7.1 offers the possibility of controlling Communication Channels externally by using HTTP GET or POST request to the following URL:

 

http(s)://<host>:<port>/AdapterFramework/ChannelAdminServlet?party=party&service=service&channel=channel&action=action

 

This will require:

  1. Assign the necessary permissions.
  2. Enable external control of the desired Communication Channels in Communication Channel Monitor of Runtime Workbench.


Unfortunately in the help.sap.com link is not explained properly how the roles should be assigned. For that reason I found it necessary to create this document which explains in detail all the steps required.

 

1- Assign the necessary permissions.


Athttp://help.sap.com/saphelp_nwpi71/helpdata/en/45/0c86aab4d14dece10000000a11466f/content.htm are specified 2 roles that user needs:

  • xi_af_channel_admin_display
  • xi_af_channel_admin_modify


These are not 2 roles, but 2 actions that must be assigned to a specific role, and this role to the user concerned (for that reason many colleagues could not assign the specified roles, because these roles do not exists as such).

 

For assigning the necessary permissions follow the instructions below:

  1. Enter Netweaver Administrator (http://<server>:<port>/nwa) and over Configuration Management --> Security select “Identity Manager”.

   01_NWA.png

   b.  Select “Role” from drop-down list and select “Create Role”. In the Overview tab type a name and optionally a description.

   02_IDManager_1.png

     Then on "Actions assigned" tab on Available actions search for key *xi_af_channel_admin* and select the two actions needed, then select “Add”. Actions must be transferred to Assigned Actions at right side.

   02_IDManager_2.png

     Finally at “Assinged users” tab search for the user/s you want to assign the permissions and select “Add”. Then select “Save”.

   02_IDManager_3.png

 

2- Enable Communication Channels External Control at Runtime Workbench.

 

Enter Runtime Workbench (http://<server>:<port>/rwb/) and select “Display”. Then select “Adapter Engine” and finally “Communication Channel Monitoring”.

03_RWB_1.png

This opens a window in which we can search the Communication Channels that we must control externally. Once selected the desired Communication Channel will be seen that “External Control Off” is selected by default, for that reason it must be necessary change it to “External Control On”.

03_RWB_2.png

Now the channel will be enabled to be controlled externally. For doing this we use the URL:

 

http(s)://<host>:<port>/AdapterFramework/ChannelAdminServlet?party=party&service=service&channel=channel&action=actionsetting in ‘channel’ the name of the Communication channel to be controlled and in ‘action’ the value ‘start’ or ‘stop’ to activate/de-activate the channel.

When the HTTP GET/POST to the URL is made the service returns an XML with the new state of the Communication Channel.

 

Here is an example of how to stop a Communication Channel:

04_Test_1.png

Then if we look at the state in Communication Channel Monitoring will see that the channel is stopped and we can see that the control of it is set to “External”

04_Test_2.png

To start again the Communication Channel use the same URL but using the action ‘start’ instead of ‘stop’.

04_Test_3.png

Now in Communication Channel Monitoring we can see that the channel is running again.

04_Test_4.png

There is a third action we can use called “status” which is used to know the status of the Communication Channel. If you do not specify any particular channel in the service will return an xml with the state of all Communication Channels of Integration Directory. In addition you can perform such filters in order to check the status of all the Communication Channels that belong to a specific Communication Component using the “service” parameter.

 

Here is an example of status request for all Communication Channels of BS_TPI_00 Business System:

04_Test_5.png

 

That's all. I hope you find useful this guide.

 

Alejandro.


Importing XSD’s Schema With External References (step-by-step guide)

$
0
0

The goal ofthis guideis to provide adetailed step by step to importXSD´s schemawithexternal referencesby using SAP PItool“Import External Definitions…”


In my case I have worked with a customer who uses OASIS UBL 2.1 as standard to Exchange messages (https://www.oasis-open.org/).

 

First, customer provides me the XSD nested structure in a zipped file.

 

1.jpg

2.jpg

 

Procedure:


All the schemasmust be importedunder the samenamespace to keep the reference amongst them.

 

3.jpg

 

Select the menu Tools > Import External Definitions… (We use the massive import tool).

 

4.jpg

 

This initializes a wizard

 

5.jpg

 

 

Select the Software Component Version and the Namesapace.

 

6.jpg

 

Choose all the XSD files to import, in this step isimportant to selectthe option'ImportAllReferences', so it will automatically reference the XSD's.

 

7.jpg

 

Click ‘Continue’, the message ‘Generate proposals…’ appears.

 

8.jpg

 

Finally it show the list of files to import, in the column name ‘Source’you can see those who has reference to other XSD file.

 

9.jpg

 

Sometimes it is necessary to modify a file name since PI doesn´t accept some characters.

 

10.jpg

 

At last click 'Finish'.

 

11.jpg

 

 

E.g. UBLContractNoticemain schema has reference to:

 

UBLCommonAggregateComponents

UBLCommonBasicComponents

UBLCommonExtensionsComponents

 

12.jpg

 

13.jpg

 

 

if some references are still missing, we will see fields in red on the message as shown in below example.

 

14.jpg

 

I hope you find useful this guide.

 


SAP PI Mapping skill: the duplicate target node also can mapped by repeat source node

$
0
0

Recently, a new requirement come, I need to update the exsited mapping. But I don't want change the exsited mapping, so I duplicate the target node. And I find that the duplicate node also can map by repeat source node, and produce repeat xml instance node.

I share it to all of you.

XI is very power and beyond our imagine.

 

The second E101CRMXIF_DOC_FLOW is duplicated from the first one.

 

 

The mapping rule for the duplicate E101CRMXIF_DOC_FLOW

 

 

The result. The third and forth E101CRMXIF_DOC_FLOW come from the duplicate E101CRMXIF_DOC_FLOW.

 

SAP PI - UDF to capture multiple result sets from a Stored Procedure in DB

$
0
0

Finally, my first blog post to SCN!

 

I was wondering when will I get a chance to write like the experts and finally here I am. I am really happy about it.

 

My blog post addresses a scenario to capture multiple Result Sets by calling a Stored Procedure.

 

I thought a sender JDBC channel would be capable enough to handle multiple result sets when a JDBC call is made to a Stored Procedure. But that was not the case. I tried a pass through scenario on a JDBC-to-File in which I called a JDBC Stored Procedure and tried writing it to a file directly. The Channel captured only the first result set by default and ignored the rest. So, I wrote a UDF which directly connects to the DB and captures multiple result sets.

 

Before we begin, there are few terminologies which need to be kept in mind.

 

Stored Procedure: A stored procedure is a subroutine available to applications that access a relationaldatabase system. A stored procedure (sometimes called a proc, sproc, StoPro, StoredProc, sp or SP) is actually stored in the database data dictionary.

Result Set: An SQL result set is a set of rows from a database, as well as metadata about the query such as the column names, and the types and sizes of each column.

Result List: This class is used in advanced user-defined functions (execution type "Context values" or "All values of a Queue") to return the result of a function.

 

System Setup:

PI: SAP PI 7.31

DB: MS SQL Server 2008

 

Assumptions and Pre-requisites:

  • The DB resides on the PI server. If you wish to access the DB on a remote server using the code, you need to deploy the required JDBC Drivers on the PI System and have the required jars in place. In my case, the jar required is sqljdbc4.jar. Since the DB resided on the PI Server itself, it had the required drivers and jars already in place.
  • Access to the DB is available. There is little basic knowledge required for writing a SP in DB.

 

Let’s Begin!

 

Stored Procedure:

 

The table name in DB is STUDENT_INFORMATION. The STUDENT_INFORMATION table looks like below:

 

Student_Table.JPG

 

My Stored Procedure looks something like as below:

 

CREATE PROCEDURE uspStudentDetails

AS

SELECT StudentName FROM<DB_Name>.dbo.STUDENT_INFORMATION

SELECT StudentGrade FROM<DB_Name>.dbo.STUDENT_INFORMATION

SELECT StudentNo FROM<DB_Name>.dbo.STUDENT_INFORMATION

SELECT StudentName FROM<DB_Name>.dbo.STUDENT_INFORMATION

SELECT * FROM <DB_Name>.dbo.STUDENT_INFORMATION

GO

 

Where <DB_Name> is the name of the data base being used on the MS SQL Server. Since there are 5 select statements in my SP, it will return 5 result sets. The output of each result is captured in each context (please see the output queue at the end of the blog).

 

I have generalized the UDF so that it takes the connection details, user id, password and stored procedure name as input to make the call to the DB and fetch the required details. The connection details are the same that you mention in your JDBC sender channel.

 

JDBC_Connection_Parameter.JPG

 

The general format of the Connection is: jdbc:sqlserver://<hotname>:<port>;databaseName=<DBName>

 

 

UDF DETAILS:

 

UDF Type: Queue

Input Constant Parameters: String[] db_connect_string, String[] db_user_id, String[] db_password, String[] storedproc_name

Output: ResultList[] result;

 

UDF Code:

 

try {

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

         Connection con = DriverManager.getConnection(db_connect_string[0],db_user_id[0],db_password[0]);

        

         String SQL = "EXECUTE dbo."+storedproc_name[0];

         Statement stmt = con.createStatement();

         boolean results = stmt.execute(SQL);

 

         do {

             if(results) {

                ResultSet rs = stmt.getResultSet();

                                                                ResultSetMetaData rsmd = rs.getMetaData();

                                                                 int numberOfColumns = rsmd.getColumnCount();

                while (rs.next()) {

                                for (int k=1;k<=numberOfColumns;k++){

                                                                                                                                                                                                result.addValue(rs.getString(k));

                                                                                }

                }

                                                                                                                                result.addContextChange();

                rs.close();

             }

             results = stmt.getMoreResults();

 

             } while(results);

           stmt.close();

      }

 

    catch (SQLException e)

                         {               

  1. result.addValue(e.getMessage());

                            }

      catch (Exception e) {

         result.addValue(e.getMessage());

      }

 

 

 

 

Mapping:

 

SP_Call_Mapping.JPG

 

Output Queue:

Since the length of the UDF was long I captured the first 4 result sets in one snapshot and the 5th resultset in another snapshot.

The below queue displays the first four result sets captured from the UDF.

 

Output queue for result set 1 - 4:

Output_queue_rs1to4.JPG

 

The below output queue is in continuation to the above one.

Output Queue for Result Set 5:

Output_queue_rs5.JPG

 

Since this is my first blog, Please share your feedback and comments below.

 

 

 

Thanks,

Arkesh

 

 

P.S.: I would like to thank my colleagues Anand, Sriram and Preetam for their kind support and guidance.

Command EDIT in SXMB_MONI to insert Dynamic Configuration attributes

$
0
0

In many projects I've seen using ASMA attributes, usually to retrieve the name of the file or the server from which a file have to be picked up. Every person who has used them at least once know how difficult could be performing unit testing for those attributes, especially in the early stages of the development when you don't have any real file or you cannot upload anything on the remote or local server for testing.

 

Recently I have discovered the possibility to Edit Messages in error directly from SXMB_MONI, by typing the command 'edit' in the command menu:

ScreenHunter_118 Jul. 19 18.01.jpg

 

This will bring you to the web-based editor where, if you have the permissions (given by role SAP_XI_MESSAGE_MODIFY), you can edit the payload of the message and save it for re-processing:

ScreenHunter_119 Jul. 19 18.03.jpg

The interesting feature is that you can edit also the additional attributes, like the dynamic configuration, in the same page:

ScreenHunter_120 Jul. 19 18.05.jpg

Once saved, you can re-process the message in SXMB_MONI and get the desired result inside dynamic configuration

ScreenHunter_121 Jul. 19 18.07.jpg

 

Of course, message editing is not encouraged in production systems unless really required and roles must be properly setup to restrict it.

 

Have fun!

Antonio

Global PI Survey 2013: New record, 4 weeks to go

$
0
0

About the Survey

Focus of the survey is to collect the latest state of the positioning, use and organization of SAP NetWeaver PI and SAP integration in companies all around the globe. Target group are employees from companies using SAP NetWeaver PI as an integration platform.

 

The survey contains 23 general questions and 9 questions about this year’s special topic 'B2B and EDI'. Apart from minor adjustments, the general questions stay the same each year, so that the survey can also show changes in the use and positioning of PI over the years.

 

The global PI survey for 2013 can be found at the following URL:

http://www.surveymonkey.com/s/R2BBVLD

 

More information about the survey:

Global Survey for SAP NetWeaver Process Integration 2013

 

Current Status, new Target

This year's target was to reach a number of 400 participants, as there were less responses from some countries in 2012. Based on our figures from July 15th we achieved the number of 449 participants with still one more month to go. Therefore already a big thank you to all of you who have participated in the survey! New target is to set a new record with 500 responses till the end of the survey on August 24th.

 

Following a pre-release of two results as a motivation for all of you having not particapted in the survey so far.

 

Current Result: Number of participants based on user group / country

Results.png

(As an appreciation of the exceptional number of participants from VNSG, we have kept the headline descriptions in Dutch)

 

Current Result: SAP NetWeaver PI release used in production

PIRelease.png

 

Feedback and planned Improvements for next Year

One feedback we got is that the survey form currently requires you to reply to all questions. In the next survey we want to make more questions and sections optional, as not each single topic may be relevant for or known by each participant. Another planned improvement is to make an easier distinction whether you are a participant from an enduser or whether you are a consultant working for an IT service provider or a freelancer. For sure, the survey in 2014 will also put more focus on SAP NetWeaver Process Orchestration and SAP NetWeaver BPM.

 

If you have other areas for improvement please let us know.

 

For more background about our interest group see our central blog International Focus Group for SAP NetWeaver Process Integration.

Viewing all 676 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>