Step1: create logical systems BD54 (Logical System naming convention is <SID>CLNT<NNN>)
Step2: Assign logical system SCC4
Step3: create RFC connections. SM59
Step4: Create RFC PORT WE21
Step5:
Repeat the same above process
in other client. By using opposite client instead of 110 specify 200.
Client 110:
Se11->
create a table and maintain values (Delivery Maintenance allowed)
Step6:
Create IDOC segments – WE31
After
creating the IDOC segment EDIT->release will release the segment.
Step7: Create
Basic IDOC type WE30
After
creating the IDOC Type EDIT->release will release the IDOCType.
Step8:
Creating the message type (WE81)
Save it.
The name of message type should be same in both the systems
Step9: Assign
message type to basic IDOC type WE 82
Step10: Creating
Distribution Model (ALE Distribution Model) BD64
Save it.
Click on
execute.
WE20:
Step11: create SE38 program.
*&---------------------------------------------------------------------*
*& Report ZIT_EMPLOYEE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zit_employee.
tables: zit_employee.
data : gs_ctrl_rec like edidc, "Idoc Control Record
gs_seg_employee like zseg_employee. "CUSTOMER Header Data
data : gt_employee like zit_employee occurs 0 with header line.
data : gt_edidd like edidd occurs 0 with header line. "Data Records
data : gt_comm_idoc like edidc occurs 0 with header line. "Generated Communication IDOc
constants: gc_seg_employee like edidd-segnam value 'ZSEG_EMPLOYEE'.
constants: gc_idoctp like edidc-idoctp value 'ZIT_EMPLOYEE'.
*** Selection Screen
select-options : s_empid for zit_employee-empid obligatory.
parameters : c_mestyp like edidc-mestyp default 'ZMT_EMPLOYEE', "Message Type
c_rcvprt like edidc-rcvprt default 'LS', "Partner type of receiver
c_logsys like edidc-rcvprn default 'ECQCLNT110',
c_rcvpor like edidc-rcvpor default 'A000000015',
c_sndprn like edidc-sndprn default 'ECQCLNT200',
c_sndprt like edidc-sndprt default 'LS'. "Destination System
***START-OF-SELECTION
start-of-selection.
perform generate_data_records.
perform generate_control_record.
perform send_idoc.
*&---------------------------------------------------------------------*
*& Form GENERATE_DATA_RECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form generate_data_records .
select * from zit_employee
into table gt_employee
where empid in s_empid.
if sy-subrc ne 0.
message e398(00) with 'No Employee Found'.
endif.
perform arrange_data_records.
endform. " GENERATE_DATA_RECORDS
*&---------------------------------------------------------------------*
*& Form GENERATE_CONTROL_RECORD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form generate_control_record .
gs_ctrl_rec-rcvpor = c_rcvpor. "Receiver Port
gs_ctrl_rec-mestyp = c_mestyp. "Message type
gs_ctrl_rec-idoctp = gc_idoctp. "Basic IDOC type
gs_ctrl_rec-rcvprt = c_rcvprt. "Partner type of receiver
gs_ctrl_rec-rcvprn = c_logsys. "Partner number of receiver
gs_ctrl_rec-sndprt = c_sndprt. "Sender Partner type
gs_ctrl_rec-sndprn = c_sndprn. "Sender Partner Number
endform. " GENERATE_CONTROL_RECORD
*&---------------------------------------------------------------------*
*& Form SEND_IDOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form send_idoc .
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = gs_ctrl_rec
* OBJ_TYPE = ''
* CHNUM = ''
tables
communication_idoc_control = gt_comm_idoc
master_idoc_data = gt_edidd
exceptions
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
call function 'DEQUEUE_ALL'.
commit work.
loop at gt_comm_idoc.
write:/ 'IDoc Generated - ', gt_comm_idoc-docnum.
endloop.
endif.
endform. " SEND_IDOC
*&---------------------------------------------------------------------*
*& Form ARRANGE_DATA_RECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form arrange_data_records .
data: w_index1 like sy-tabix,
w_index2 like sy-tabix.
sort gt_employee by empid.
loop at gt_employee.
move-corresponding gt_employee to gs_seg_employee.
gt_edidd-segnam = gc_seg_employee.
gt_edidd-sdata = gs_seg_employee.
append gt_edidd.
clear gt_edidd.
endloop.
endform. " ARRANGE_DATA_RECORDS
*& Report ZIT_EMPLOYEE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zit_employee.
tables: zit_employee.
data : gs_ctrl_rec like edidc, "Idoc Control Record
gs_seg_employee like zseg_employee. "CUSTOMER Header Data
data : gt_employee like zit_employee occurs 0 with header line.
data : gt_edidd like edidd occurs 0 with header line. "Data Records
data : gt_comm_idoc like edidc occurs 0 with header line. "Generated Communication IDOc
constants: gc_seg_employee like edidd-segnam value 'ZSEG_EMPLOYEE'.
constants: gc_idoctp like edidc-idoctp value 'ZIT_EMPLOYEE'.
*** Selection Screen
select-options : s_empid for zit_employee-empid obligatory.
parameters : c_mestyp like edidc-mestyp default 'ZMT_EMPLOYEE', "Message Type
c_rcvprt like edidc-rcvprt default 'LS', "Partner type of receiver
c_logsys like edidc-rcvprn default 'ECQCLNT110',
c_rcvpor like edidc-rcvpor default 'A000000015',
c_sndprn like edidc-sndprn default 'ECQCLNT200',
c_sndprt like edidc-sndprt default 'LS'. "Destination System
***START-OF-SELECTION
start-of-selection.
perform generate_data_records.
perform generate_control_record.
perform send_idoc.
*&---------------------------------------------------------------------*
*& Form GENERATE_DATA_RECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form generate_data_records .
select * from zit_employee
into table gt_employee
where empid in s_empid.
if sy-subrc ne 0.
message e398(00) with 'No Employee Found'.
endif.
perform arrange_data_records.
endform. " GENERATE_DATA_RECORDS
*&---------------------------------------------------------------------*
*& Form GENERATE_CONTROL_RECORD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form generate_control_record .
gs_ctrl_rec-rcvpor = c_rcvpor. "Receiver Port
gs_ctrl_rec-mestyp = c_mestyp. "Message type
gs_ctrl_rec-idoctp = gc_idoctp. "Basic IDOC type
gs_ctrl_rec-rcvprt = c_rcvprt. "Partner type of receiver
gs_ctrl_rec-rcvprn = c_logsys. "Partner number of receiver
gs_ctrl_rec-sndprt = c_sndprt. "Sender Partner type
gs_ctrl_rec-sndprn = c_sndprn. "Sender Partner Number
endform. " GENERATE_CONTROL_RECORD
*&---------------------------------------------------------------------*
*& Form SEND_IDOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form send_idoc .
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = gs_ctrl_rec
* OBJ_TYPE = ''
* CHNUM = ''
tables
communication_idoc_control = gt_comm_idoc
master_idoc_data = gt_edidd
exceptions
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
call function 'DEQUEUE_ALL'.
commit work.
loop at gt_comm_idoc.
write:/ 'IDoc Generated - ', gt_comm_idoc-docnum.
endloop.
endif.
endform. " SEND_IDOC
*&---------------------------------------------------------------------*
*& Form ARRANGE_DATA_RECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form arrange_data_records .
data: w_index1 like sy-tabix,
w_index2 like sy-tabix.
sort gt_employee by empid.
loop at gt_employee.
move-corresponding gt_employee to gs_seg_employee.
gt_edidd-segnam = gc_seg_employee.
gt_edidd-sdata = gs_seg_employee.
append gt_edidd.
clear gt_edidd.
endloop.
endform. " ARRANGE_DATA_RECORDS
Execute the
program.
Step12:
WE02- check the generated IDOC control records.
In client
110 follow these steps:
Step13:
Create a Function Module to update the table from the IDOC
segments
Go to SE37
function zidoc_ib_employee.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" REFERENCE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" REFERENCE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" REFERENCE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" REFERENCE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" REFERENCE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*"--------------------------------------------------------------------
* Include File containing ALE constants
include mbdconwf.
tables : zit_employee.
data : gs_seg_employee like zseg_employee.
data : gt_employee like zit_employee occurs 0 with header line.
workflow_result = c_wf_result_ok.
loop at idoc_contrl.
if idoc_contrl-mestyp ne 'ZMT_EMPLOYEE'.
raise wrong_function_called.
endif.
* Before reading a new entry, clear application buffer
loop at idoc_data where docnum eq idoc_contrl-docnum.
gs_seg_employee = idoc_data-sdata.
move-corresponding gs_seg_employee to gt_employee.
insert into zit_employee values gt_employee.
endloop.
update zit_employee from gt_employee.
if sy-subrc eq 0.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
idoc_status-msgty = 'I'.
idoc_status-msgid = 'YM'.
idoc_status-msgno = '004'.
idoc_status-msgv1 = gt_employee-empid.
append idoc_status.
clear idoc_status.
else.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '51'.
idoc_status-msgty = 'E'.
idoc_status-msgid = 'YM'.
idoc_status-msgno = '005'.
idoc_status-msgv1 = gt_employee-empid.
append idoc_status.
clear idoc_status.
workflow_result = c_wf_result_error.
return_variables-wf_param = 'Error_Idocs'.
return_variables-doc_number = idoc_contrl-docnum.
append return_variables.
clear return_variables.
endif.
endloop.
endfunction.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" REFERENCE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" REFERENCE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" REFERENCE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" REFERENCE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" REFERENCE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*"--------------------------------------------------------------------
* Include File containing ALE constants
include mbdconwf.
tables : zit_employee.
data : gs_seg_employee like zseg_employee.
data : gt_employee like zit_employee occurs 0 with header line.
workflow_result = c_wf_result_ok.
loop at idoc_contrl.
if idoc_contrl-mestyp ne 'ZMT_EMPLOYEE'.
raise wrong_function_called.
endif.
* Before reading a new entry, clear application buffer
loop at idoc_data where docnum eq idoc_contrl-docnum.
gs_seg_employee = idoc_data-sdata.
move-corresponding gs_seg_employee to gt_employee.
insert into zit_employee values gt_employee.
endloop.
update zit_employee from gt_employee.
if sy-subrc eq 0.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
idoc_status-msgty = 'I'.
idoc_status-msgid = 'YM'.
idoc_status-msgno = '004'.
idoc_status-msgv1 = gt_employee-empid.
append idoc_status.
clear idoc_status.
else.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '51'.
idoc_status-msgty = 'E'.
idoc_status-msgid = 'YM'.
idoc_status-msgno = '005'.
idoc_status-msgv1 = gt_employee-empid.
append idoc_status.
clear idoc_status.
workflow_result = c_wf_result_error.
return_variables-wf_param = 'Error_Idocs'.
return_variables-doc_number = idoc_contrl-docnum.
append return_variables.
clear return_variables.
endif.
endloop.
endfunction.
Step14:
Assign FM to logical message: WE57
Step15: Define
input method for Inbound FM (BD51).
Step16:
Creating process code WE42(client -110)
Create the
message type
Step17:
Generate the partner profile (BD64)(client 110)
Transferring the IDOC control records from
Client 200 to 110:
In source system, go to TCODE SE38.
Execute the Report program which you created.
Execute the
program.