Professional Documents
Culture Documents
gv_x = 3.
COMMIT WORK.
What will be the value of gv_x at the COMMIT WORK?
No, the value of gv_x will not be 3; when commit is
executed by the system the value of gv_x that will be
passed is dependent at the point of function call therefore
during the first call the value of gv_x will be 1 & during the
second call the value of gv_x will be 2.
Development on SAP-PI
Enterprises Service Repository :
Create Data Type
Development on SAP-ECC
In proxies, it will generate 3 objects at Application System
:
ABAP Class.
Structure for Message Type.
Structure of Data Type.
Inbound Proxy:
T-code : SPROXY
(Inbound Proxy)
Post the data in Table
Post the data using Function Module
Inbound Proxy is Complete.
Outbound Proxy:
T-code : SPROXY
Open the node for your Service (Inbound / Outbound) &
Right click
Click on CREATE PROXY.
This Development is for Outbound Proxy.
In this Case, choose Outbound Service Interface for
Creation of Proxy.
After Completing this creation process, this screen will
be there.
For this example, code for filling & Sending Proxy data
Subroutine will be as below :
SECOND BLOG
ABAP Proxy is one of the easiest way to communicate
with SAP/Non-SAP application for an ABAPer. As it gives
control directly to you in the form of classes and
methods. Proxies will allow you to expose application
functionality via web interfaces.
ABAP Proxy can be used to provide SAP data to outside
world or to consume outside data into SAP. Proxies can be
written in any SAP application system viz. ECC, SRM, CRM
etc. You can use transaction SE80 or SPROXY to generate
proxies. Mostly used for communication with PI system or
for web service consumption.
Type and direction of ABAP Proxy w.r.t. ECC
A proxy will have the same attributes as that of service
interface Inbound/Outbound
and Synchronous/Asynchronous.
Prerequisites
Namespace
urn:companyname.com:proxy_to_file_nested
Interface RecordsetOut
objects
implement
message
interfaces
from
Integration Repository. Proxy generation converts nonlanguage-specific interface descriptions in WSDL into
executable interfaces in the application system. Proxies
the
different.
interpretation
Because
of
data/communication
source system
sends
is
employee
Save it.
that
Table
type
of
DATA:
BEGIN OF I_PA0000 OCCURS 0,
PERNR LIKE PA0000-PERNR,
MASSN LIKE PA0000-MASSN,
END OF I_PA0000,
BEGIN OF I_PA0001 OCCURS 0,
PERNR LIKE PA0000-PERNR,
WERKS LIKE PA0001-WERKS,
PERSG LIKE PA0001-PERSG,
PERSK LIKE PA0001-PERSK,
BTRTL LIKE PA0001-BTRTL,
ABKRS LIKE PA0001-ABKRS,
KOSTL LIKE PA0001-KOSTL,
ORGEH LIKE PA0001-ORGEH,
PLANS LIKE PA0001-PLANS,
END OF I_PA0001,
BEGIN OF I_PA0002 OCCURS 0,
PERNR LIKE PA0000-PERNR,
NACHN LIKE PA0002-NACHN,
VORNA LIKE PA0002-VORNA,
GESCH LIKE PA0002-GESCH,
GBDAT LIKE PA0002-GBDAT,
END OF I_PA0002,
BEGIN OF I_PA0007 OCCURS 0,
PERNR LIKE PA0000-PERNR,
SCHKZ LIKE PA0007-SCHKZ,
ARBST LIKE PA0007-ARBST,
END OF I_PA0007,
BEGIN OF I_PA0008 OCCURS 0,
PERNR LIKE PA0000-PERNR,
TRFAR LIKE PA0008-TRFAR,
TRFGB LIKE PA0008-TRFGB,
TRFGR LIKE PA0008-TRFGR,
TRFST LIKE PA0008-TRFST,
STVOR LIKE PA0008-STVOR,
SELECT PERNR
" Personnel number
TRFAR
" Pay scale type
TRFGB
" Pay Scale Area
TRFGR
" Pay Scale Group
TRFST
" Pay Scale Level
STVOR
" Date of Next Increase
WAERS
" Currency Key
ANSAL
" Annual salary
LGA01
" Wage Type
BET01
" Wage Type Amount for Payments
ANZ01
" Number
LGA02
" Wage Type
BET02
" Wage Type Amount for Payments
ANZ02
" Number
LGA03
" Wage Type
BET03
" Wage Type Amount for Payments
ANZ03
" Number
FROM PA0008
INTO TABLE I_PA0008
WHERE PERNR IN S_PERNR
AND ENDDA GE SY-DATUM
AND BEGDA LE SY-DATUM.
SELECT PERNR
" Personnel number
ZLSCH
" Payment Method
BANKS
" Bank country key
BANKL
" Bank Keys
BANKN
" Bank account number
BKONT
" Bank Control Key
FROM PA0009
INTO TABLE I_PA0009
WHERE PERNR IN S_PERNR
AND ENDDA GE SY-DATUM
AND BEGDA LE SY-DATUM.
SORT: I_PA0000 BY PERNR,
I_PA0001 BY PERNR,
I_PA0002 BY PERNR,
I_PA0007 BY PERNR,
I_PA0008 BY PERNR.
REFRESH T_EMPLOYEE.
LOOP AT I_PA0000.
CLEAR FS_EMPLOYEE.
FS_EMPLOYEE-PERSONNEL_NUMBER
=
I_PA0000PERNR.
FS_EMPLOYEE-ACTION_TYPE = I_PA0000-MASSN.
READ TABLE I_PA0001 WITH KEY PERNR = I_PA0000PERNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
FS_EMPLOYEE-EMP_GROUP = I_PA0001-PERSG.
FS_EMPLOYEE-EMP_SUBGROUP = I_PA0001-PERSK.
FS_EMPLOYEE-PERSONNEL_SUBAREA
=
I_PA0001BTRTL.
FS_EMPLOYEE-PAYROLL_AREA = I_PA0001-ABKRS.
FS_EMPLOYEE-COST_CENTER = I_PA0001-KOSTL.
FS_EMPLOYEE-ORGANIZATIONAL_UNIT = I_PA0001ORGEH.
FS_EMPLOYEE-POSITION = I_PA0001-PLANS.
ENDIF.
READ TABLE I_PA0002 WITH KEY PERNR = I_PA0000PERNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
FS_EMPLOYEE-LASTNAME = I_PA0002-NACHN.
FS_EMPLOYEE-FIRST_NAME = I_PA0002-VORNA.
FS_EMPLOYEE-GENDER = I_PA0002-GESCH.
FS_EMPLOYEE-DOB = I_PA0002-GBDAT.
ENDIF.
READ TABLE I_PA0007 WITH KEY PERNR = I_PA0000PERNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
FS_EMPLOYEE-WORK_SCHEDULE_RULE = I_PA0007SCHKZ.
FS_EMPLOYEE-DAILY_WORKING_HOURS = I_PA0007ARBST.
ENDIF.
READ TABLE I_PA0008 WITH KEY PERNR = I_PA0000PERNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
FS_EMPLOYEE-PAY_SCALE_TYPE = I_PA0008-TRFAR.
FS_EMPLOYEE-PAY_SCALE_AREA = I_PA0008-TRFGB.
FS_EMPLOYEE-PAY_SCALE_GROUP = I_PA0008-TRFGR.
FS_EMPLOYEE-PAY_SCALE_LEVEL = I_PA0008-TRFST.
FS_EMPLOYEE-INCREASE_DATE = I_PA0008-STVOR.
FS_EMPLOYEE-CURRENCY = I_PA0008-WAERS.
FS_EMPLOYEE-ANNUAL_SALARY = I_PA0008-ANSAL.
FS_EMPLOYEE-WAGE_TYPE1 = I_PA0008-LGA01.
FS_EMPLOYEE-AMOUNT1 = I_PA0008-BET01.
FS_EMPLOYEE-NUMBER1 = I_PA0008-ANZ01.
FS_EMPLOYEE-WAGE_TYPE2 = I_PA0008-LGA02.
FS_EMPLOYEE-AMOUNT2 = I_PA0008-BET02.
FS_EMPLOYEE-NUMBER2 = I_PA0008-ANZ02.
FS_EMPLOYEE-WAGE_TYPE3 = I_PA0008-LGA03.
FS_EMPLOYEE-AMOUNT3 = I_PA0008-BET03.
FS_EMPLOYEE-NUMBER3 = I_PA0008-ANZ03.
ENDIF.
READ TABLE I_PA0009 WITH KEY PERNR = I_PA0000PERNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
FS_EMPLOYEE-PAYMENT_METHOD = I_PA0009-ZLSCH.
FS_EMPLOYEE-BANK_COUNTRY = I_PA0009-BANKS.
FS_EMPLOYEE-BANK_KEYS = I_PA0009-BANKL.
FS_EMPLOYEE-BANK_ACCOUNT_NUMBER = I_PA0009BANKN.
FS_EMPLOYEE-BANK_CONTROL_KEY
=
I_PA0009BKONT.
ENDIF.
APPEND FS_EMPLOYEE TO T_EMPLOYEE.
ENDLOOP.
TRY.
FS_EMPLOYEE_MT-MT_EMPDET_OB-EMPLOYEE
=
T_EMPLOYEE.
CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
EXPORTING
OUTPUT = FS_EMPLOYEE_MT.
COMMIT WORK
.
CATCH CX_AI_SYSTEM_FAULT .
DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
CREATE OBJECT FAULT.
WRITE :/ FAULT->ERRORTEXT.
ENDTRY.
When this report is executed, we can see the file in the FTP
server
with the employee details.
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:MT_Empdet_ib
xmlns:ns0="http://yashclientproxies">
- <Employee>
<Personnel_number>00001002</Personnel_number>
<Action_Type>52</Action_Type>
<Emp_Group>1</Emp_Group>
<Emp_Subgroup>DT</Emp_Subgroup>
<Personnel_Subarea />
<Payroll_Area>D2</Payroll_Area>
<Cost_Center>0000002100</Cost_Center>
<Organizational_Unit>50000563</Organizational_Unit>
<Position>50000083</Position>
<Name>Ulrike Zaucker</Name>
<Gender>2</Gender>
<DOB>19600905</DOB>
<Work_Schedule_Rule>FLEX</Work_Schedule_Rule>
<Daily_Working_Hours>7.50</Daily_Working_Hours>
<Pay_scale_type>40</Pay_scale_type>
<Pay_Scale_Area>02</Pay_Scale_Area>
<Pay_Scale_Group>AT</Pay_Scale_Group>
<Pay_Scale_Level />
<Increase_date>00000000</Increase_date>
<Currency>EUR</Currency>
<Monthly_salary>0</Monthly_salary>
<Wage_Type1>MA90</Wage_Type1>
<Amount1>4601.63</Amount1>
<Number1>0.00</Number1>
<Wage_Type2 />
<Amount2>0.00</Amount2>
<Number2>0.00</Number2>
<Wage_Type3 />
<Amount3>0.00</Amount3>
<Number3>0.00</Number3>
<Payment_Method>U</Payment_Method>
<Bank_country>DE</Bank_country>
<Bank_Keys>23984899</Bank_Keys>
<Bank_account_number>253571587</Bank_account_numb
er>
<Bank_Control_Key />
</Employee>
</ns0:MT_Empdet_ib>
Understanding and working with ABAP Mapping
This document gives you clear understanding of ABAP
Mapping, how to enable the option to use ABAP Mapping
class in XI Interface Mappings, how to parse and read the
input XML source structure and build the output XML target
structure.
Open
http://<host>:<port>/exchangeProfile/index.html
Choose
IntegrationBuilder
>IntegrationBuilder.Repository
->
com.sap.aii.repository.mapping.additionaltypes
Maintain
the
Entry
R3_ABAP|Abapclass;R3_XSLT|XSL
(ABAPEngine)
Open
http://<host>:<port>/rep/support/admin/index.html
Choose Administration of Properties -> All
Properties . If the value associated to parameter
com.sap.aii.repository.mapping.additionaltypes
xstring,
which
will
be
used
for
the
Here
structure:
is
the
source
XML
Here
is
the
target
XML
structure:
DATA TYPES
DT_Emp_Det
DT_Employees
MESSAGE TYPE
MT_Emp_Det
MT_Employees
MESSAGE INTERFACES
MI_Emp_Det_OB
MI_Employees_IB
MESSAGE MAPPING
INTERFACE MAPPING
IM_MI_Emp_Det_OB_MI_Employees_IB
Communication Channels
CC_XML_Sender_FIle
CC_XML_Receiver_FIle
Receiver
Agreement
Sender
Agreement
Interface
Determination
Receiver
Determination
iparser->parse( ).
ixml_factory-
if_ixml_node
if_ixml_node_list
is
of
emp_node_collection-
WHERE emp_node_iterator
IF_IXML_NODE_ITERATOR
is of
type
emp_node_list
emp_subnode_list-
DO emp_subnode_list_length TIMES.
w_index = sy-index - 1.
w_node = emp_subnode_list->get_item(
w_index ).
w_node_name = w_node->get_name( ).
w_node_value = w_node->get_value( ).
Create renderer
*
create
renderer
data:
renderer
type
ref
to
if_ixml_renderer.
renderer = ixml_factory->create_renderer( ostream =
ostream
document
=
odocument
).
renderer->render( ).
This would complete the mapping.
w_tablename
type string,
w_index
type i,
w_node
type ref to if_ixml_node.
data:
odocument
type ref to if_ixml_document,
fs_output
type string,
employee_node type ref to if_ixml_node,
personal_node type ref to if_ixml_node,
job_node
type ref to if_ixml_node,
rnode
type ref to if_ixml_node.
data:
begin of fs_job,
empid
type string,
company
type string,
department type string,
designation type string,
begindate type string,
enddate
type string,
salary
type string,
end of fs_job,
begin of fs_personal,
empid
type string,
firstname type string,
middlename type string,
lastname type string,
age
type i,
gender type string,
end of fs_personal,
t_personal like standard table of fs_personal,
t_job
like standard table of fs_job.
field-symbols:
<fs> type any,
<fs_table> type table.
* Initialize iXML
type-pools ixml.
emp_subnode = emp_node_list_iterator->get_next( ).
emp_subnode_name = emp_subnode->get_name( ).
emp_subnode_list = emp_subnode->get_children( ).
emp_subnode_list_length
=
emp_subnode_list>get_length( ).
DO emp_subnode_list_length TIMES.
w_index = sy-index - 1.
w_node = emp_subnode_list->get_item( w_index ).
w_node_name = w_node->get_name( ).
w_node_value = w_node->get_value( ).
concatenate 'fs_' emp_subnode_name '-' w_node_name
into w_fieldname.
assign (w_fieldname) to <fs>.
if sy-subrc eq 0.
move w_node_value to <fs>.
endif.
ENDDO.
concatenate 'fs_' emp_subnode_name into w_fieldname.
assign (w_fieldname) to <fs>.
check sy-subrc eq 0.
concatenate 't_' emp_subnode_name into w_tablename.
assign (w_tablename) to <fs_table>.
if sy-subrc eq 0.
move fs_personal-empid to fs_job-empid.
append <fs> to <fs_table>.
endif.
ENDDO.
ENDDO.
odocument = ixml_factory->create_document( ).
CALL
METHOD
ODOCUMENT>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'EMPLOYEES'
PARENT = ODOCUMENT
*
PREFIX = ''
*
*
URI = ''
VALUE = ''
RECEIVING
RVAL = EMPLOYEE_NODE
.
loop at t_personal into fs_personal.
clear fs_output.
CALL
METHOD
>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'PERSONAL'
PARENT = EMPLOYEE_NODE
*
PREFIX = ''
*
URI = ''
VALUE = fs_output
RECEIVING
RVAL = PERSONAL_NODE
.
concatenate fs_personal-firstname
fs_personal-middlename
fs_personal-lastname
into fs_output.
CALL
METHOD
>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'FULLNAME'
PARENT = personal_node
*
PREFIX = ''
*
URI = ''
VALUE = fs_output
RECEIVING
RVAL = RNODE
.
move fs_personal-age to fs_output.
ODOCUMENT-
ODOCUMENT-
CALL
METHOD
ODOCUMENT>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'AGE'
PARENT = personal_node
*
PREFIX = ''
*
URI = ''
VALUE = fs_output
RECEIVING
RVAL = RNODE
.
CALL
METHOD
ODOCUMENT>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'GENDER'
PARENT = personal_node
*
PREFIX = ''
*
URI = ''
VALUE = fs_personal-gender
RECEIVING
RVAL = RNODE.
loop at t_job into fs_job where empid = fs_personalempid.
AT NEW EMPID.
CALL
METHOD
ODOCUMENT>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'JOB'
PARENT = EMPLOYEE_NODE
*
PREFIX = ''
*
URI = ''
*
VALUE = ''
RECEIVING
RVAL = JOB_NODE.
ENDAT.
concatenate fs_job-company
fs_job-department
fs_job-designation
fs_job-begindate
fs_job-enddate
fs_job-salary
into fs_output
separated by '*'.
CALL
METHOD
ODOCUMENT>CREATE_SIMPLE_ELEMENT_NS
EXPORTING
NAME = 'COMPANYDATA'
PARENT = JOB_NODE
*
PREFIX = ''
*
URI = ''
VALUE = fs_output
RECEIVING
RVAL = RNODE.
endloop.
endloop.
* create output stream
data ostream type ref to if_ixml_ostream.
ostream = stream_factory->create_ostream_xstring( result
).
* create renderer
data renderer type ref to if_ixml_renderer.
renderer = ixml_factory->create_renderer( ostream =
ostream
document = odocument ).
* implements DOM based interface to the renderer.
renderer->render( ).
endmethod.
<MIDDLENAME>Krishna</MIDDLENAME>
<LASTNAME>Reddy</LASTNAME>
<AGE>25</AGE>
<GENDER>M</GENDER>
</PERSONAL>
- <JOB>
<COMPANY>XYZ</COMPANY>
<DEPARTMENT>SAP</DEPARTMENT>
<DESIGNATION>Consultant</DESIGNATION>
<BEGINDATE>20050606</BEGINDATE>
<ENDDATE>20061206</ENDDATE>
<SALARY>600000</SALARY>
</JOB>
- <JOB>
<COMPANY>XYZ</COMPANY>
<DEPARTMENT>SAP</DEPARTMENT>
<DESIGNATION>Consultant</DESIGNATION>
<BEGINDATE>20070106</BEGINDATE>
<ENDDATE />
<SALARY>800000</SALARY>
</JOB>
</EMPLOYEE>
</ns0:MT_Emp_Det>
<COMPANYDATA>XYZ*SAP*Consultant*20050606**60000
0</COMPANYDATA>
</JOB>
- <PERSONAL>
<FULLNAME>BalaKrishnaReddy</FULLNAME>
<AGE>25</AGE>
<GENDER>M</GENDER>
</PERSONAL>
- <JOB>
<COMPANYDATA>XYZ*SAP*Consultant*20050606*200612
06*600000</COMPANYDATA>
<COMPANYDATA>XYZ*SAP*Consultant*20070106**80000
0</COMPANYDATA>
</JOB>
</EMPLOYEES>
ABAP Proxy communication (Server Proxy)
Proxy
objects
implement
message
interfaces
from
converts
non-language-specific
interface
Service
Description
Language)
description
of
Proxy Generation:
As part of SAP Web AS 6.40
The
prerequisites
to
configure
ABAP
Proxy
include:
(landscape dependent)
1. The business systems should be based on SAP Web AS
6.20 and SAP Web AS 6.20 kernel patch level above
1253
2. You have installed the XI Add-On in each of these
business systems as described in the Installation
Guide SAP Exchange Infrastructure 3.0
Technical Setting:
Connection Type: H
Logon Security
On the Logon/Security tab page, enter the following logon
data:
2.
Go to Transaction SXMB_ADM
2.
3.
4.
5.
3.
4.
LCRSAPRFC
5.
and
SAPSLDAPI
in
SAP
J2EE
engine
SLDAPICUST
Demo Scenario
Finally
we
encapsulate
require
the
a message
message
interface, which
mapping
between
will
source
Before
completing
the
configuration
in
Integration
method
EXECUTE_ASYNCHRONOUS.
This
is
default
XI environment,
communication.
hence
we
say
it
is
adapter
less
The record that got posted is related to SSN 999 that can
be viewed in the database.