Beruflich Dokumente
Kultur Dokumente
Requirement: All the students data will be created in 800 client and same will be send to 810 client using IDOCS.
Steps to be done in 800 client
Login to 800 client and do following.
Just click enter if you find any information message and add fields as below.
Save it in a local object.
Step3: Create IDOC type.
Go to WE30, provide name as ZSTUDENT and click on create.
Provide a segment name (which we have created in step2), maximum and minimum numbers and enter.
Save it in a local object.
Step4: Create a message type.
Go to t-code WE81 and click on change icon.
Check for logical system existance(which we get from 810 client) if it is there, no need to add, if it is not there add
it.
Step7: Assign logical system to client.
For now skip this.
Create RFC destination .
Go to T-code SM59, select ABAP connections and click on create.
Save.
Step10: Check partner profiles in WE20.
Go to WE20, expand partner type logical system and search for logical system (Get logical system from t-code
SALE ->Basic Settings ->Logical Systems -> assign logical system to client -> 810 (double click and copy logical
system)).
If logical system is already available in partner profiles in WE20, we don`t need to create partner profile again
instead we will add message type at out bound parameters level. In my case, logical system is already available in
partner profiles so I will add ZSTUDENT message type to it. To add message type, select logical system, click on
add icon (see below image).
Provide message type, receiver port (which we have created in step9), select transfer IDOC immediately, basic type
and save.
If logical system is not available in partner profile in WE20, select partner type logical system and click on c reate.
Provide partner no as T90CLNT810 (Get logical system from t-code SALE ->Basic Settings ->Logical Systems ->
assign logical system to client -> 810 (double click and copy logical system). Save and add message type at out
bound partner level.
Step3:Add your own code in function module. Go to Se37, provide name as ZSAPN_IDOC_INPUT_STUDENT,
click on change. Remove all code and add below code.
FUNCTION ZSAPN_IDOC_INPUT_STUDENT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" EXPORTING
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*"----------------------------------------------------------------------
CLEAR W_EDIDC.
W_EDIDC = IDOC_CONTRL.
READ TABLE IDOC_DATA INTO W_IDOC_DATA WITH KEY DOCNUM = IDOC_CONTRL-DOCNUM BINARY SEA
RCH.
IF SY-SUBRC = 0.
L_INDX = SY-TABIX.
ELSE.
RETURN.
ENDIF.
ENDLOOP.
ELSE.
CONTINUE.
ENDIF.
SORT T_EDIDD.
CLEAR W_EDIDD.
IF W_EDIDD-SEGNAM = 'ZSTUDENT'.
CLEAR WA_STUDENT.
WA_STUDENT = W_EDIDD-SDATA.
CONTINUE.
ENDIF.
ENDLOOP.
ERROR_FLG = 'X'.
ERROR_MESSAGE = 'Error occured in updating ZSTUDENT table'.
ENDIF.
ENDLOOP.
ENDIF.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-DOCNUM = W_EDIDC-DOCNUM.
IDOC_STATUS-MSGTY = 'E'.
IDOC_STATUS-MSGID = '00'.
IDOC_STATUS-MSGNO = '398'.
IDOC_STATUS-MSGV3 = ERROR_MESSAGE+50(25).
IDOC_STATUS-MSGV4 = ERROR_MESSAGE+75(25).
CLEAR ERROR_MESSAGE.
IDOC_STATUS-DOCNUM = W_EDIDC-DOCNUM.
ENDIF.
ENDLOOP.
ENDFUNCTION.
REPORT ZSEND_STUDENTS.
START-OF-SELECTION.
TABLES
COMMUNICATION_IDOC_CONTROL = T_EDIDC "<<<<<
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5.
COMMIT WORK.
CLEAR : WA_STUDENTS, ZSTUDENT.
REFRESH : T_EDIDD.
ENDLOOP.