Friday, April 26, 2013

Scenarios ABAP Proxy to File on SAP PI 7.31 Java only installation

I have done and seen so many Proxy scenarios to File Scenarios. Today I am gonna blog this scenario using SAP PI 7.31 Java Only Installation. The blog will cover scenario from newly installed PI 7.31.

1. Create SLD on Your SAP PI

1.1. Create Product and Software component for SAP ERP




1.2. Create Product and Software component for FTP Server





2. Create Technical and Business System


2.1. Create SAP ERP Technical and Business System

Go and Log in to your SAP ERP. You go to transaction code RZ70. Put and execute as per below shot








2.2. Create FTP Technical and Business System

Please create Technical System as per screen shot below and assigned product and software component on step 1.2.



Add new business system based on created technical system per screen shot below





2.3. Assign Installed Software to Technical System and Business System

This software assignment will be firstly done for Technical System SEV that created on step 2.1





on Bussines System SEV_040, assignment should be done as well



3. Enterprise Service Builder (ESB) on SAP PI

3.1. ESB for SAP ERP

Below are steps you will need to create:

a. Import Software Component Version from SLD: EAI_KRB_FSCM, krb.com, 1.0




b. Create Namespace: http://krb.com/eai/fscm



c. Create Data Types: User, Users, UserDetail




d. Create Message Type: Users



e. Create Service Interface: users_ob



f. Create Action: SendUsers




3.2. ESB for FTP Server


Below are steps you will need to create:

a. Import Software Component Version from SLD: EAI_KRB_FTP, krb.com, 1.0



b. Create Namespace: http://krb.com/eai/fscm




c. Create Message Type and data type by copying Message type users from step 3.1. with all dependents objects



d. Create Service Interface: users_ib



e. Create Action: ReceiveUsers



f. Create Message Mapping: users_to_users



g. Create Operation Mapping: users_to_users



h. Create Process Integration Scenarios: KRB_FTP








4. Integration Directory (ID) on SAP PI


4.1. Create Configuration Scenario: KRB_FTP




4.2. Assign Business System: KRBFTP_SEV




4.3. Create Communication Channel for KRBFTP_SEV: FILE_RCV_USERS





4.4. Create Communication Channel for SAP ERP (SEV_040): SOAP_SND_USERS




4.5. Create Integrated Configuration: |SEV_040|users_ob| |





5. ABAP Proxy on SAP ERP

5.1. Generate Proxy based on Service Interface

on SAP ERP, go to transaction code SPROXY. You will find your software component version inside that transaction.
You should go and look for service interface that will be used by SAP ERP to send. In this case, it is service interface users_ob.








5.2. Configure Integration Engine for Service Interface on SAP ERP

on SAP ERP, go to transaction code SXMB_ADM. You will need to do two step:

a. Configure Sender / Receiver ID



b. Integration Engine Configuration



5.3. Create executable ABAP Program


Please take a note, below program has some unused declaration, but the program is still working for this scenarios.


*&---------------------------------------------------------------------*
*& Report zbc_downloadusers
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zbc_downloadusers LINE-SIZE 1023 .
************************************************************************
* (c) 2013 KRISBIANTO WOO STUDIO - All rights reserved.
*-----------------------------------------------------------------------
* This program is a reference program and sample for everybody
* May all sentient being have happiness and its causes
************************************************************************
*&----------------------------------------------------------------------
*& {FD} Functional documentation:
*&----------------------------------------------------------------------
*& TITLE
*& Sending Users to Ftp Server
*&----------------------------------------------------------------------
*& COMMENTS
*&
*&----------------------------------------------------------------------
*& {TD} Technical documentation:
*&----------------------------------------------------------------------
*& DESCRIPTION
*& POC Send Users to ftp server
*&
*&----------------------------------------------------------------------
*& Type of Report:
*& output NO
*& update NO
*&----------------------------------------------------------------------
*& UPDATES TO SAP TABLES
*& (Mandatory if update question was answered with Yes.)
*& SAP tables updated directly:
*& (list / “None”)
*& Function modules, methods, transactions, etc., called, which update
*& SAP tables indirectly:
*& - Posting function module NO
*& - Call transaction NO
*& - BAPI NO
*& (list of used modules/transactions/BAPI’s / “None”)
*&----------------------------------------------------------------------
*& {ML} Modification log:
*&----------------------------------------------------------------------
*& MODIFICATION LOG:
*& VSN DATE FULL NAME - DESCRIPTION
*& v000 25.04.2013 KRISBIANTO WOO INITIAL
*&----------------------------------------------------------------------

*=======================================================================
* DATA DECLARATION
*=======================================================================

************************************************************************
* TABLES *
************************************************************************
TABLES:usr02.

************************************************************************
* TYPES *
************************************************************************
* Type-pool
TYPE-POOLS: slis.


* Includes
INCLUDE .
INCLUDE .

TYPES:

BEGIN OF ty_message,
msg(132),
END OF ty_message,

BEGIN OF ty_usr02,
bname TYPE usr02-bname,
ustyp TYPE usr02-ustyp,
uflag TYPE usr02-uflag,
aname TYPE usr02-aname,
erdat TYPE usr02-erdat,
trdat TYPE usr02-trdat,
ltime TYPE usr02-ltime,
pwdchgdate TYPE usr02-pwdchgdate,
END OF ty_usr02.

************************************************************************
* VARIABLE *
************************************************************************
DATA: v_repid LIKE sy-repid,
v_datum LIKE sy-datum,
v_time LIKE sy-uzeit,
v_sysid LIKE sy-sysid,
v_name LIKE sy-uname.

DATA: rc LIKE sy-subrc.

DATA: v_mode LIKE dd26e-enqmode VALUE 'E',
v_tabname LIKE rstable-tabname,
v_varkey LIKE rstable-varkey,
v_scope,
v_wait.
DATA: v_trans(2) VALUE ' @'.


************************************************************************
* WORKAREA *
************************************************************************


DATA: gs_layout TYPE slis_layout_alv.
DATA: gs_print TYPE slis_print_alv.
DATA: gt_usr02 TYPE STANDARD TABLE OF ty_usr02 WITH HEADER LINE.
DATA: gs_usr02 TYPE ty_usr02.

DATA: gs_output TYPE zcl_users1,
gs_user TYPE zcl_user,
gs_users TYPE zcl_users,
gs_usdet TYPE zcl_user_detail.



************************************************************************
* INTERNAL TABLES *
************************************************************************
DATA: gt_subclaim TYPE STANDARD TABLE OF icl_claimsscrinfo WITH HEADER LINE,
gt_item TYPE STANDARD TABLE OF iclitem WITH HEADER LINE,
gt_payments TYPE STANDARD TABLE OF icl_payo WITH HEADER LINE,
gt_itemev TYPE STANDARD TABLE OF iclitemev WITH HEADER LINE.
DATA: gt_user TYPE zcl_user_tab.
DATA: gt_message TYPE STANDARD TABLE OF ty_message WITH HEADER LINE.

DATA: gt_xevents TYPE slis_t_event." WITH HEADER LINE.
DATA: gt_field TYPE slis_t_fieldcat_alv. "WITH HEADER LINE.

************************************************************************
* RANGES *
************************************************************************

************************************************************************
* CLASSES *
************************************************************************
DATA: o_users TYPE REF TO zcl_co_users_ob.

*=======================================================================
* SELECTION SCREEN
*=======================================================================
SELECTION-SCREEN BEGIN OF BLOCK blok1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_bname FOR usr02-bname,
so_ustyp FOR usr02-ustyp.
SELECTION-SCREEN END OF BLOCK blok1.

*=======================================================================
* INITIALIZATION
*=======================================================================
INITIALIZATION.

* Set Default value
PERFORM f_set_default.

*=======================================================================
* AT SELECION SCREEN
*=======================================================================
AT SELECTION-SCREEN.


*=======================================================================
* START-OF-SELECTION
*=======================================================================
START-OF-SELECTION.

* Refresh object and variables
PERFORM f_start_init.

* get data
PERFORM f_get_user.

*=======================================================================
* END-OF-SELECTION
*=======================================================================
END-OF-SELECTION.

* Here's the information, PI, Catch it fast
PERFORM f_send_proxy_user.

*&---------------------------------------------------------------------*
*& Form F_SET_DEFAULT
*&---------------------------------------------------------------------*
* set defalt value
*----------------------------------------------------------------------*
FORM f_set_default .

* Nothing yet

ENDFORM. " F_SET_DEFAULT
*&---------------------------------------------------------------------*
*& Form F_START_INIT
*&---------------------------------------------------------------------*
* Initial everything
*----------------------------------------------------------------------*
FORM f_start_init .


CLEAR: gs_usr02, gs_output, gs_user, gs_users, gs_usdet.
REFRESH: gt_usr02, gt_user.

ENDFORM. " F_START_INIT

*&---------------------------------------------------------------------*
*& Form F_GET_USER
*&---------------------------------------------------------------------*
* Get user
*----------------------------------------------------------------------*
FORM f_get_user .

SELECT bname ustyp uflag aname erdat trdat ltime pwdchgdate FROM usr02
INTO TABLE gt_usr02
WHERE bname IN so_bname
AND ustyp IN so_ustyp.
ENDFORM. " F_GET_USER
*&---------------------------------------------------------------------*
*& Form F_SEND_PROXY_USER
*&---------------------------------------------------------------------*
* Send Proxy Users
*----------------------------------------------------------------------*
FORM f_send_proxy_user .
TRY.
CREATE OBJECT o_users
* EXPORTING
* logical_port_name =
.
CATCH cx_ai_system_fault .
ENDTRY.

TRY.
LOOP AT gt_usr02.
CLEAR: gs_usdet, gs_output, gs_users, gs_user.
MOVE-CORRESPONDING gt_usr02 TO gs_usdet.
gs_user-user_detail = gs_usdet.
APPEND gs_user TO gt_user.
ENDLOOP.

gs_users-user[] = gt_user[].
gs_output-users = gs_users.
CALL METHOD o_users->users_ob
EXPORTING
output = gs_output.
CATCH cx_ai_system_fault .
ENDTRY.
IF sy-subrc NE 0.
ROLLBACK WORK.
WRITE : text-i01. "'Users data cant sent to XI'.
ELSE.
COMMIT WORK.
WRITE : text-i02. "'Users sent successfully to XI'.
ENDIF.

ENDFORM. " F_SEND_PROXY_USER

Program Attribute and Text elements as below screen shots:



6. Testing

6.1. SAP ERP Send and Monitor


a. Execute Program on Step 5.3



b. Check on SXI_MONITOR



6.2. SAP PI 7.31 Monitoring

There are some other way to see the message in SAP PI 7.31. One of that can be seen in below screen shot.
this is through configuration and monitoring -> adapter engine -> Message monitoring.






6.3. FTP Server Side

File is generated on FTP Server



I wish this reference will be useful in the future.

4 comments: