Custom IDoc program to send PO ?
Hai,
Can any one send the complete program, on how to send PO (Purchase Oeder) through custom IDoc .
Please send code for both outbound and inbound process ?
Hi Vamsi,
Here i am sending sample codes for Inbound and Outbound Processes..
IN OUTBOUND SIDE :
REPORT ZSTAND_PROGRAM.
*1. Create parameters/select-options for input data. i.e., empno, message type, logical system.
PARAMETERS : P_SNO LIKE ZSAMP1-SNO OBLIGATORY,
P_MESTYP LIKE EDMSG-MSGTYP DEFAULT 'ZMSG1',
P_LOGSYS LIKE TBDLST-LOGSYS OBLIGATORY.
*2. Create Data objects for control record, data record and database table.
DATA : C_SEGMENT LIKE EDIDD-SEGNAM VALUE 'ZSEG1',
C_IDOCTP LIKE EDIDC-IDOCTP VALUE 'ZIDOC1'.
DATA : BEGIN OF IT_ZSAMP1,
SNO LIKE ZSAMP1-SNO,
SNAME LIKE ZSAMP1-SNAME,
END OF IT_ZSAMP1.
DATA : INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
DATA : INT_CONTROL_RECORD LIKE EDIDC.
DATA : INT_COMM_IDOC LIKE EDIDC OCCURS 0 WITH HEADER LINE.
*3. Select the data from corresponding tables into internal table for a defined condition.
SELECT SINGLE SNO SNAME FROM ZSAMP1 INTO CORRESPONDING FIELDS OF IT_ZSAMP1 WHERE SNO = P_SNO.
*4. create control record into internal table.
INT_CONTROL_RECORD-MESTYP = P_MESTYP.
INT_CONTROL_RECORD-IDOCTP = C_IDOCTP.
INT_CONTROL_RECORD-RCVPRT = 'LS'.
INT_CONTROL_RECORD-RCVPRN = P_LOGSYS.
*5. create data record into internal table.
INT_EDIDD-SEGNAM = C_SEGMENT.
INT_EDIDD-SDATA = IT_ZSAMP1.
APPEND INT_EDIDD.
*6. Process ALE Service Layer using the function module MASTER_IDOC_DISTRIBUTE.
It returns the corresponding IDoc No.s.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = INT_CONTROL_RECORD
tables
communication_idoc_control = INT_COMM_IDOC
master_idoc_data = INT_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.
ENDIF.
*7. Display Communication IDocs.
LOOP AT INT_COMM_IDOC.
WRITE : / 'Communication IDoc No. is : ', INT_COMM_IDOC-DOCNUM.
ENDLOOP.
*8. Commit Work.
COMMIT WORK.
IN INBOUND SIDE :
FUNCTION ZL_IDOC_INPUT_MATMAS_MDM.
""Local interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(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
*" OTHER_EXC
*1. Call workflow include program MBDCONWF.
INCLUDE MBDCONWF.
*2. Create Data Objects for segment(s) and DB Table.
TABLES : ZSAMP1.
DATA : FS_SHDR_DATA LIKE ZSEG1.
DATA : FS_APP_SDET LIKE ZSAMP1.
*3. Raise the exception if the message type is not ZMSG1.
IF IDOC_CONTRL-MESTYP NE 'ZMSG1'.
RAISE WRONG_FUNCTION_CALLED.
CLEAR FS_APP_SDET.
ENDIF.
*4. Process Each segment in the IDoc.
LOOP AT IDOC_CONTRL.
LOOP AT IDOC_DATA WHERE DOCNUM EQ IDOC_CONTRL-DOCNUM.
CASE IDOC_DATA-SEGNAM.
WHEN 'ZSEG1'.
FS_SHDR_DATA = IDOC_DATA-SDATA.
MOVE-CORRESPONDING FS_SHDR_DATA TO FS_APP_SDET.
FS_APP_SDET-mandt = '000'.
FS_APP_SDET-sno = FS_SHDR_DATA-zsno.
FS_APP_SDET-sname = FS_SHDR_DATA-zsname.
ENDCASE.
ENDLOOP.
5. If the data already exists update the data or else insert the data.
SELECT SINGLE * FROM ZSAMP1 WHERE SNO EQ FS_APP_SDET-SNO.
IF SY-SUBRC NE 0.
INSERT INTO ZSAMP1 VALUES FS_APP_SDET.
ELSE.
UPDATE ZSAMP1 FROM FS_APP_SDET.
ENDIF.
*6. If the data successfully posted maintain status as 53 or if unsuccessful give status as 51.
IF SY-SUBRC EQ 0 .
POPULATE RETURN VARIABLES FOR SUCCESS.
RETURN_VARIABLES-WF_PARAM = 'PROCESSED_IDOCS'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ADD STATUS RECORD INDICATES SUCCESS.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '53'.
IDOC_STATUS-MSGTY = 'I'.
IDOC_STATUS-MSGID = 'ZM'.
IDOC_STATUS-MSGNO = '006'.
IDOC_STATUS-MSGV1 = FS_APP_SDET-SNO.
APPEND IDOC_STATUS.
ELSE.
POPULATE RETURN VARIABLES FOR ERROR.
RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ADD STATUS RECORD INDICATES ERROR.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-MSGTY = 'E'.
IDOC_STATUS-MSGID = 'ZM'.
IDOC_STATUS-MSGNO = '007'.
IDOC_STATUS-MSGV1 = FS_APP_SDET-SNO.
APPEND IDOC_STATUS.
ENDIF.
ENDLOOP.
ENDFUNCTION.
These are sample code for custom idoc...i did this for customized tables..change this according to your requirement.
Reward if it useful..
Lakshmi.
Edited by: lakshmi matti on May 26, 2008 11:05 AM
Similar Messages
-
Standard IDOCS, Programs for posting FI & bank related data.
Hi,
(1)Are there any idocs available for posting FI documents, Vendor master?
(2)Are there any outbound idocs, programs for sending data to banks. EG:positive pay etc?
Kindly reply to these questions. Correct answer will be awarded points.
Regards,
Akshaya.Hi,
There is message type BANK_CREATE for posting the FI related Bank details. Using the change pointers you can trigger the idocs for posting the bank related data.
Regards,
Uday -
INBOUND program For custom IDOC
Hi ,
i have a one senario on creation of IDOC,that is interface for the transmission of the Acknowledgement of check Remittance and Supplemental interface,once the message is received Successfully through OUTBOUND program it triges the Acknowledge other wise it send one mail to respective team for that i need to create a one inbound program please explain me i am new in the area of ALE/ IDOC please give in deatials.
Thanks,
HarinathHi Harinath,
In your case SAP is sending <b>Check Remittance and Supplemental</b> data to legacy system which in turn need to send acknowledgement for that. And its going to be in form of an idoc. for this we dont have an idoc you need to create one from scratch. please find the steps to be followed to create a custom idoc.
1) Create Z segment with required fields(fields coming towards you) using WE31
2) Create Z idoc using segment created in step 1 using WE30.
3) Create Z message type using WE81.
4) Link idoc created in step 2 with message type created in step 3 in WE82.
5) Create Z function module to post the idoc in SE37. Include all validations, updations to tables, Error handling in source code tab of this FM.
6) Maintain Inbound process code using the FM in WE42
Coming to sending a mail, It can only be done using workflow. But i think in your case it is not required. so it need to be done manually.
Get back if you have any doubts.
Regards,
Younus
<b>Reward Helpful Answers!!!</b> -
Problem with Custom idoc sending
Hi Experts,
We have created partner profile and port for receiver system, our idoc is Z (custom) idoc.
but the problem is here, when we are sending that idoc from R/3 system, it is in Yellow position with message number 30. How we can solve this problem.
Is there any other configuration required for Z (Custom) idoc.
Please help,
Regards,
Study SAPhi check this...
http://www.****************/Tutorials/ALE/CustomIDOC/Create.htm
check the process followed or not if u miss any steps then it will give warning....that is not a problem..see one thing after creating the idoc u need to give the status back to the idoc_status. otherwise it will not show the green message 51...we have to do it if this is the custom idoc ...otherwise if it is a standard one there is nothing to do it will automatically catch the message back. -
IDOC :: how to send data from Custom Infotype in SAP HR to third party
Hi,
I have created one custom Infotype by number 9020. How to send data from this infotype to third party system and also change pointers need to trigger for this infotype.
Please help me in doing it.
I am using one Custom Message type ZTALENT and Custom Idoc Type ZTALENT.
ZTALENT Talent Management
5 E1PLOGI Header for an HR Object (Master Data or Organizational Data)
5 E1PITYP HR: Transported Infotypes and Subtypes for an Object
ZPUSER User base Data File
ZPERSON Personal Information File Segment
ZPOST Position File
ZOPE Overall Performance
ZPWORK Outside Work Experience
ZPEDUC Education Details of Employee
E1P0000 HR: HR Master Record Infotype 0000 (Actions)
E1P0001 HR: HR Master Record Infotype 0001 (Org. Assignment)
E1P0002 HR: HR Master Record Infotype 0002 (Personal Data)
E1P0016 HR Master Record: Infotype 0016 (Contract Elements)
E1P0022 HR Master Record: Infotype 0022 (Education)
E1P0023 HR Master Record: Infotype 0023 (Other/Previous Employers)
E1P0041 HR Master Record: Infotype 0041 (Date Specifications)
E1P0105 HR: HR Master Record Infotype 0105 (Communications)
ZE1P9020
ZPLANG Language Details
ZACTION Actions Changes
Regards,
KrishnaHello Shankar,
Technically TEMSE files are read by calling the following 3 function modules in sequence,
1) RSTS_OPEN_RLC or RP_TS_OPEN: open the temse object
2) RSTS_READ : read the object
3) RSTS_CLOSE: close the object
Regards,
Rajesh -
Which program can send SYSTAT01 idoc?
Hi gurus,
Our scenario is SOAP to IDOC(async interface to async interface), and after the inbound processing of R3 side, we want send the processing status back to outer system via PI. It seems ALEAUDIT is not enough for our requirement, because sometimes the key value the outer system sent doesn't appear in the ALEAUDIT01 idoc, so in this case the acknowledment is useless to the outer system. Or I get it wrong? Can we find some user exits in program RBDSTATE?
Then we go to SYSTAT01.It was said this idoc was used in EDI cases, but I don't know which program to send it on the R3 side just like RBDSTATE can send ALEAUDIT01 idoc?
Any help will be appreciated.Hi,
Why cant u make another interface and use this idoc SYSTAT01 -
Hi friends,
I am asked to write a custom executable program (not a function module) to create outbound idocs with some data from the database tables as for the selection screen data the user entered. How do I do this and how to trigger these outbound idocs? Can you please give me a sample code for this or your valuable suggestions?
Thanks for the help.Here is the sample code which triggers the IDoc (Outbound)..I also added comments
report z_idoc_creat_tr .
tables : ekpo,
edidd, " Data record (IDoc)
tbdlst, " Text for logical system
edmsg . "Logical message types
* Selection screen
parameters: p_ebeln like ekpo-ebeln.
data : c_seg1 like edidd-segnam value 'ZSEG1_TR',
c_seg2 like edidd-segnam value 'ZSEG2_TR',
itab_comm_idocs like edidc occurs 0 with header line ,
control_record like edidc.
*Internal Tables
data :
itab_edidd like edidd occurs 0 with header line, "Data record(IDoc)
itab_seg2 like zseg2_tr occurs 0 with header line .
* zseg2_tr structure generated when you define the Segments in WE31
* Work Area
data : seg1 like zseg1_tr, " Segments Header Data
seg2 like zseg2_tr. " Segments
select single * from ekpo where ebeln = p_ebeln.
*Build Control Data
control_record-mestyp = 'Z_EKPO' . "Message Type.
control_record-idoctp = 'ZIDOC_TR' ." IDoc Type
control_record-sndprt = 'LS'.
control_record-sndprn = 'LOGSYS0100' . " Logical system
control_record-sndpor = 'SAPLT1'. "SEnder Port
control_record-rcvprt = 'LS'.
control_record-rcvprn = 'SEND' ." Reveiver Logical system
control_record-rcvpor = 'A000000171'." Receiver Port
*Filling the Segment 1 ie.,Purchasing Document Number .
move-corresponding ekpo to seg1.
itab_edidd-segnam = 'ZSEG1_TR'." Segment Name
itab_edidd-sdata = seg1. " Value for the Segment1. "Segment value
append itab_edidd .
clear itab_edidd.
*Filling the Segment 2 ie.,Item Number of Purchasing Document.
select * from ekpo into corresponding fields of table itab_seg2 where
ebeln = p_ebeln .
loop at itab_seg2 .
move-corresponding itab_seg2 to seg2.
itab_edidd-segnam = 'ZSEG2_TR'.
itab_edidd-sdata = seg2.
append itab_edidd.
clear itab_edidd.
endloop.
* FM to trigger the Outbound Idoc
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = control_record
tables
communication_idoc_control = itab_comm_idocs
master_idoc_data = itab_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.
endif.
loop at itab_comm_idocs.
write:/2 'Docs generated', itab_comm_idocs-docnum.
endloop.
<i>* Reward each useful answer</i>
Raja T
Message was edited by:
Raja Thangamani -
Hi,
I have custom IDoc , that i am sending to 4 different destinations (systems). My requirement is i need to send for 4 th destinations only header segment.
How do i filter this on the basis of partner profile number
Please don't suggest to change the code. I am looking for this can done without change function module or triggering program.
a®Hi,
You can use segment filtering (transaction BD56).
Here you can suppress a whole segment irrespective of data inside it .
You have to give Message Type/Sender Partner/Receiver Partner.
Regards,
Ferry Lianto -
hi all
I am XI consultant
i want to send IDOC to XI server using ALE..but the IDOC is not present ....the master data is stored in standard sap tables but for them idoc is not present ...so i want to create custom idoc and using change pointer i can send it across ...is this a write approach...? Also please give me the procedure for the above approach as i dont have idea about how to create custome idoc and send it using change pointer
thanks
SheetalHi
Data Creation in Idoc
IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system. Instead of calling a program in the destination system directly, the data is first packed into an IDoc and then sent to the receiving system, where it is analyzed and properly processed. Therefore an IDoc data exchange is always an
asynchronous process. The significant difference between simple RFC-calls and IDoc data exchange is the fact, that every action performed on IDocs are protocolled by R/3 and IDocs can be reprocessed if an error occurred in one of the message steps.
While IDocs have to be understood as a data exchange protocol, EDI and ALE are typical use cases for IDocs. R/3 uses IDocs for both EDI and ALE to deliver data to the receiving system. ALE is basically the scheduling mechanism that defines when and between which partners and what kind of data will be exchanged on a regular or event triggered basis. Such a set-up is called an ALE-scenario.
IDoc is a intermediate document to exchange data between two SAP Systems.
*IDocs are structured ASCII files (or a virtual equivalent).
*Electronic Interchange Document
*They are the file format used by SAP R/3 to exchange data with foreign systems.
*Data Is transmitted in ASCII format, i.e. human readable form
*IDocs exchange messages
*IDocs are used like classical interface files
IDOC types are templates for specific message types depending on what is the business document, you want to exchange.
WE30 - you can create a IDOC type.
An IDOC with data, will have to be triggered by the application that is trying to send out the data.
FOr testing you can use WE19.
How to create idoc?
*WE30 - you can create a IDOC type
For more information in details on the same along with the examples can be viewed on:
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm#_Toc8400404
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a6620507d11d18ee90000e8366fc2/frameset.htm
http://www.sappoint.com/presentation.html
http://www.allsaplinks.com/idoc_search.html
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://www.erpgenie.com/sapedi/idoc_abap.htm
To Create Idoc we need to follow these steps:
Create Segment ( WE31)
Create Idoc Type ( WE30 )
Create Message Type ( WE81 )
Assign Idoc Type to Message Type ( WE82 )
Creating a Segment
Go to transaction code WE31
Enter the name for your segment type and click on the Create icon
Type the short text
Enter the variable names and data elements
Save it and go back
Go to Edit -> Set Release
Follow steps to create more number of segments
Create IDOC Type
Go to transaction code WE30
Enter the Object Name, select Basic type and click Create icon
Select the create new option and enter a description for your basic IDOC type and press enter
Select the IDOC Name and click Create icon
The system prompts us to enter a segment type and its attributes
Choose the appropriate values and press Enter
The system transfers the name of the segment type to the IDOC editor.
Follow these steps to add more number of segments to Parent or as Parent-child relation
Save it and go back
Go to Edit -> Set release
Create Message Type
Go to transaction code WE81
Change the details from Display mode to Change mode
After selection, the system will give this message The table is cross-client (see Help for further info). Press Enter
Click New Entries to create new Message Type
Fill details
Save it and go back
Assign Message Type to IDoc Type
Go to transaction code WE82
Change the details from Display mode to Change mode
After selection, the system will give this message The table is cross-client (see Help for further info). Press Enter.
Click New Entries to create new Message Type.
Fill details
Save it and go back
Check these out..
Re: How to create IDOC
Check below link. It will give the step by step procedure for IDOC creation.
http://www.supinfo-projects.com/cn/2005/idocs_en/2/
ALE/ IDOC
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sappoint.com/abap.html
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.docs
go trough these links.
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sappoint.com/abap.html
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.allsaplinks.com/idoc_sample.html
http://http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
An IDoc is simply a data container that is used to exchange information between any two processes that can understand the syntax and semantics of the data...
1.IDOCs are stored in the database. In the SAP system, IDOCs are stored in database tables.
2.IDOCs are independent of the sending and receiving systems.
3.IDOCs are independent of the direction of data exchange.
The two available process for IDOCs are
Outbound Process
Inbound Process
AND There are basically two types of IDOCs.
Basic IDOCs
Basic IDOC type defines the structure and format of the business document that is to be exchanged between two systems.
Extended IDOCs
Extending the functionality by adding more segments to existing Basic IDOCs.
To Create Idoc we need to follow these steps:
Create Segment ( WE31)
Create Idoc Type ( WE30)
Create Message Type ( WE81)
Assign Idoc Type to Message Type ( WE82)
imp links
http://www.allsaplinks.com/idoc_sample.html
http://www.sapgenie.com/sapedi/idoc_abap.htm
www.sappoint.com
--here u can find the ppts and basic seetings for ALE
http://sappoint.com/presentation.html
www.sapgenie.com
http://www.sapgenie.com/ale/index.htm
Reward points if useful
Regards
Anji -
Hello,
In XI Interface File Adapter pick the data and it needs to sent to SAP R/3 to create Measurement Document.
Should I create Custom IDOC import into XI and by using IDOC Receiver Adapter send data to SAP R/3 and through Posting Program create Measurement Document.
Should I create Rempte Enabled RFC and use RFC receiver Adapter and through Function Module create Measurement Document.
Pls suggestHi henry,
there are various ways;
1. IR or ID Goto Menu -> Help -> INformation
2. XI start page -> Administration -> Software Build Information
and regarding RFC and Idoc we have already answered u!!!
now check ur WAS version...if its >=6.2 use proxy if not use RFC.....
ok see here...
Advantage of Proxy over RFC, IDOC
/people/ravikumar.allampallam/blog/2005/08/14/choose-the-right-adapter-to-integrate-with-sap-systems
Regards
BILL
Use a Good Subject Line, One Question Per Posting - Award Points
Message was edited by:
biplab das -
HI ALL,
I WANT TO SEND A CUSTOM IDOC FROM ONE SYSTEM [ONE SERVER ] TO ANOTHER [ANOTHER SERVER ]. GIVE THE PROCEDURE.
ANY HELP WILL BE HIGHLY APPRECIATED.
WITH REGARDS,
SURESH.AHi,
this is one way comunication..
create rfc destination ,from A to B in sm59,
create port this rfc.
ALE IDOC
Sending System(Outbound ALE Process)
Tcode SALE ? for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 ? Create Model View
Tcode BD82 ? Generate partner Profiles & Create Ports
Tcode BD64 ? Distribute the Model view
Message Type MATMAS
Tcode BD10 ? Send Material Data
Tcode WE05 ? Idoc List for watching any Errors
Receiving System(Inbound ALE )
Tcode SALE ? for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 ? Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 ? Idoc List for inbound status codes
ALE IDOC Steps
Sending System(Outbound ALE Process)
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 !V Create Model View
Tcode BD82 !V Generate partner Profiles & Create Ports
Tcode BD64 !V Distribute the Model view
This is Receiving system Settings
Receiving System(Inbound ALE )
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 !V Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 !V Idoc List for inbound status codes
Message Type MATMAS
Tcode BD10 !V Send Material Data
Tcode WE05 !V Idoc List for watching any Errors
1)a Goto Tcode SALE
Click on Sending & Receiving Systems-->Select Logical Systems
Here Define Logical Systems---> Click on Execute Button
go for new entries
1) System Name : ERP000
Description : Sending System
2) System Name : ERP800
Description : Receiving System
press Enter & Save
it will ask Request
if you want new request create new Request orpress continue for transfering the objects
B) goto Tcode SALE
Select Assign Client to Logical Systems-->Execute
000--> Double click on this
Give the following Information
Client : ERP 000
City :
Logical System
Currency
Client role
Save this Data
Step 2) For RFC Creation
Goto Tcode SM59-->Select R/3 Connects
Click on Create Button
RFC Destination Name should be same as partner's logical system name and case sensitive to create the ports automatically while generating the partner profiles
give the information for required fields
RFC Destination : ERP800
Connection type: 3
Description
Target Host : ERP000
System No:000
lan : EN
Client : 800
User : Login User Name
Password:
save this & Test it & RemortLogin
3)
Goto Tcode BD64 -- click on Change mode button
click on create moduleview
short text : xxxxxxxxxxxxxx
Technical Neme : MODEL_ALV
save this & Press ok
select your just created modelview Name :'MODEL_ALV'.
goto add message type
Model Name : MODEL_ALV
sender : ERP000
Receiver : ERP800
Message type :MATMAS
save & Press Enter
4) Goto Tcode BD82
Give Model View : MODEL_ALV
Partner system : ERP800
execute this by press F8 Button
it will gives you sending system port No :A000000015(Like)
5) Goto Tcode BD64
seelct the modelview
goto >edit>modelview-->distribute
press ok & Press enter
6)goto Tcode : BD10 for Material sending
Material : mat_001
Message Type : MATMAS
Logical System : ERP800
and Execute
7)goto Tcode : BD11 for Material Receiving
Material : mat_001
Message Type : MATMAS
and Execute --> 1 request idoc created for message type Matmas
press enter
Here Master Idoc set for Messge type MATMAS-->press Enter
1 Communication Idoc generated for Message Type
this is your IDOC
Change Pointers
I know how to change the description of a material using ALE Change Pointers.
I will give the following few steps
1) Tcode BD61---> check the change pointers activated check box
save and goback.
2) Tcode BD50---> check the MATMAS check box save and comeback.
3) Tcode BD51---> goto IDOC_INPUT_MATMAS01 select the checkbox save and comeback.
4) Tcode BD52---> give message type : matmas press ok button.
select all what ever you want and delete remaining fields.
save & come back.
5) 5) go to Tcode MM02 select one material and try to change the description and save it
it will effects the target systems material desciption will also changes
6) goto Tcode SE38 give program Name is : RBDMIDOC and Execute
give Message type : MATMAS and Executte
ALE/IDOC Status Codes/Messages
01 Error --> Idoc Added
30 Error --> Idoc ready for dispatch(ALE Service)
then goto SE38 --> Execute the Program RBDMIDOC
29 Error --> ALE Service Layer
then goto SE38 --> Execute the Program RSEOUT00
03 Error --> Data Passed to Port ok
then goto SE38 --> Execute the Program RBDMOIND
12 Error --> Dispatch ok
Inbound Status Codes
50 Error --> It will go for ALE Service Layer
56 Error --> Idoc with Errors added
51 Error --> Application Document not posted
65 Error --> Error in ALE Service Layer
for 51 or 56 Errors do the following steps
goto WE19 > give the IDOC Number and Execute>
Press on Inbound function Module
for 65 Error --> goto SE38 --> Execute the Program RBDAPP01 then your getting 51 Error
<b>Reward points</b>
Regards -
Hi,
I have created a customized IDoc by a customized function module MASTER_IDOC_CREATE using the standard function module MASTER_IDOC_DISTRIBUTE to create and send the IDoc to my SAP system at an XML port without a message control because I put the function module call in an existing program that contains data for the IDoc data segments; now I have an ALE service error in the status record because the sender and receiver systems are the same, how I can resolve my problem to map the IDoc into an XML file stored in a local path. please help meHi,
thank you for your answers maybe I didn't explain my problem very well; for this reason I post my MASTER_IDOC_CREATE function:
FUNCTION master_idoc_create_zord.
""Interfaccia locale:
*" IMPORTING
*" VALUE(APPL_HEADER) LIKE ZCARTSEG STRUCTURE ZCARTSEG
*" TABLES
*" APPL_ITEM STRUCTURE ZCARTSEGPOS
*" EXCEPTIONS
*" NOT_CREATE
*variables·of·general·interest
DATA:
*·······control·record·for·the·IDoc
idoc_control LIKE edidc,
*·······data·records·for·the·IDoc
t_idoc_data LIKE edidd OCCURS 0 WITH HEADER LINE,
*·······table·for·the·IDocs·created·by·MASTER_IDOC_CONTROL
t_comm_control LIKE edidc OCCURS 0 WITH HEADER LINE,
*·······partner·type·for·logical·system
c_partner_type_logical_system LIKE edidc-rcvprt VALUE 'LS',
*·······help·variable·for·the·check·if·an·IDoc·has·to·be·created
h_create_idoc,
c_partner_num_logical_system LIKE edidc-rcvprn VALUE 'WIN',
porta type edipox.
*·variables·specific·for·this·example
DATA:
*·······field·strings·with·IDoc·segment·structure
e1xhead LIKE zseg,
e1xitem LIKE zsegpos occurs 10 with header line,
*·······data·to·be·put·to·the·control·record
c_message_type LIKE edidc-mestyp VALUE 'ZORD',
c_base_idoc_type LIKE edidc-idoctp VALUE 'ZIDOCCAR',
*·······segment·types·to·be·put·to·the·data·record·table
c_header_segtyp LIKE edidd-segnam VALUE 'ZSEG',
c_item_segtyp LIKE edidd-segnam VALUE 'ZSEGPOS',
c_porta like edidc-rcvpor value 'zxml'.
clear idoc_control.
MOVE c_base_idoc_type TO idoc_control-doctyp.
MOVE c_message_type TO idoc_control-mestyp.
MOVE c_partner_type_logical_system TO idoc_control-rcvprt.
MOVE c_partner_num_logical_system TO idoc_control-rcvprn.
idoc_control-rcvpfc = 'LS'.
move c_porta to idoc_control-rcvpor.
*·put·the·application·header·record·to·the·IDoc
MOVE-CORRESPONDING appl_header TO e1xhead.
*·append·record·to·IDoc·data·table
t_idoc_data-segnam = c_header_segtyp.
t_idoc_data-sdata = e1xhead.
APPEND t_idoc_data.
clear t_idoc_data.
LOOP AT appl_item.
*···put·the·application·item·record·to·the·IDoc·segment
MOVE appl_item TO e1xitem.
append e1xitem.
*···append·record·to·IDoc·data·table
t_idoc_data-segnam = c_item_segtyp.
t_idoc_data-sdata = e1xitem.
APPEND t_idoc_data.
clear t_idoc_data.
clear e1xitem.
ENDLOOP.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
*·in·update·task···"if·application·document·is·posted·in·update·task
EXPORTING
master_idoc_control = idoc_control
TABLES
communication_idoc_control = t_comm_control
master_idoc_data = t_idoc_data
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 e007(z0) with sy-subrc.
endif.
*·A·commit·work·has·to·be·done.·It·could·also·be·done·in·the·calling
*·application.
COMMIT WORK.
READ TABLE t_comm_control INDEX 1.
IF sy-subrc <> 0.
MESSAGE e004(z0).
RAISE not_create.
ENDIF.
Note that parameters appl_item and appl_header are filled by calling custom ABAP program. What I have to do now to create XML file from IDoc? Please help me. -
Hi Friend,
plz help me about Custom IDoc and how to configure ?
Thanking you.
SubashHi Subash,
Aim: Transfer the data from one system to another using user customized IDOC.
Sender System:
Server: 172.25.8.185
Client: 200
Data from Z table: zsach1
ReceiverSystem:
Server: 172.25.9.198
Client: 800
Data from Z table: zsach1
Data is fetched from Z table on the sender system and inserted it in the Z table of Receiver system using ALE/IDOC.
Settings on the Sender End
Table Creation T Code SE11. The table contains data that is to be sent to Receiver.
ALE Configuration
T-Code SALE
Defining Logical System
200 is our sender
800 is our receiver
Assigning Client to Logical System
200 is our sender
800 is our receiver
Defining Target System for RFC Calls (Tcode SM59)
Click on R/3 Connections and then Create TAB
Step 1
Step 2
Save and test the connection.
Defining Port
The sender system is connected to the receiver system through this Port.
Defining Partner Profiles
The partner for client 200(Sender) is the client 800 (Receiver)
Since this is a sender we have to define only Outbound Parameters in this case.
Here you can see the Message type is Z message type.
2. Maintaining Distribution Model ( TCode BD64 )
Create new Distribution Model
Add Message Type
Now Distribute this Model View
Distribute it from Edit  Model View  Distribute
Defining the Z Segment type
Tcode WE31
Defining the Basic Type
T Code WE30
Click on New
This will take you to next screen as follows
Here you have connected the basic type to the segment type.
Enter again and this will take you to screen as follows
This shows the relation between the basic and the segment types.
Next you need to make the entry of the segment in the system table.
Tcode : WE81
Next is the following entry which is required.
Here you are specifying the message type and the basic type and the release version.
This is all about the configuration you need to do on the sender side.
Now on the sender side you also need a program that will fetch the required data, couple it in the IDOC format and post it.
Here is a small piece of code that could be useful.
*& Report ZSACH_CUST_IDOC *
report zsach_cust_idoc .
parameters : p_logsys like tbdlst-logsys.
data : gen_segment like edidd-segnam value 'ZSACH'.
data : control_dat like edidc,
gen_data like z1hdr .
tables :zsach1.
data: begin of inttab occurs 0,
lname type z1hdr-lname,
fname type z1hdr-fname,
end of inttab.
data :
int_edidd like edidd occurs 0 with header line,
int_edidc like edidc occurs 0 with header line.
select * from zsach1 into corresponding fields of table inttab.
if sy-subrc ne 0.
message 'no data' type 'I'.
exit.
endif.
control_dat-mestyp = 'ZSACH'.
control_dat-idoctp = 'ZSACH'.
control_dat-rcvprt = 'LS'.
control_dat-rcvprn = p_logsys.
loop at inttab.
gen_data-lname = inttab-lname.
gen_data-fname = inttab-fname.
GEN_DATA-SSN = INTTAB-SSN.
GEN_DATA-DOB = INTTAB-DOB.
int_edidd-segnam = gen_segment.
int_edidd-sdata = gen_data.
append int_edidd.
endloop.
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = control_dat
OBJ_TYPE = ''
CHNUM = ''
tables
communication_idoc_control = int_edidc
master_idoc_data = int_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.
else.
loop at int_edidc.
write :/ 'IDOC GENERATED',int_edidc-docnum.
endloop.
commit work.
endif.
Settings on the receiver side.
The ALE configuration is same as we did it on the sender side. Please refer to earlier pages.
The receiver specific differences are mentioned below.
T-Code SALE
200 is our sender
800 is our receiver
Steps
Defining Logical System (Same as sender)
Assigning Client to Logical System (Same as sender)
Defining Target System for RFC Calls (Tcode SM59) (Same as sender)
Defining Port(Same as sender)
Defining Partner Profiles Here we are accepting the data from Sender system. Hence we need to configure it as Inbound.
Click on the sign above to go to next screen.
Here the message type is to be created again as it was created on the sender side.
The following steps are repeated, as done on the sender side, on the receiver end
Tcode WE30
Tcode WE31
Tcode WE82
Tcode WE81
Here on the receiver end, we need to specify a process code at the time of defining the partner profile.
Process code is something that has the logic defined about what to be done after receiving the IDOC.
In our case, on receipt of the IDOC, we are updating the Z Table. i.e Inserting the data from the IDOC into the Z Table.
Creating a Process Code
Tcode WE42
The logic associated is coded in the Function Module which is specified in the Identification Field above.
Also the processing type is selected as Processing by Function Module as above.
The function Module is specified in the following screen.
To have your function Module in the above drop down list, the entry is to be made using the following transaction
TCode BD51
Once the entry is done here, the function module appears in the drop down list in the previous stage.
Also it is important to make the following entry
Tcode WE57
Function Module will look something as below:
Source Code
function z_idoc_input_sach .
""Local interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" VALUE(NO_APPLICATION_LOG) LIKE SY-DATAR OPTIONAL
*" VALUE(MASSSAVEINFOS) LIKE MASSSAVINF STRUCTURE MASSSAVINF
*" OPTIONAL
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(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 mbdconwf.
data : it_emp_data like zsach1 occurs 0 with header line.
data : gen_data like zsach1 .
workflow_result = c_wf_result_ok.
data : counter type int4.
select count( * ) from zsach1 into counter.
counter = counter + 1.
loop at idoc_contrl.
if idoc_contrl-mestyp ne 'ZSACH'.
raise wrong_function_called.
endif.
clear gen_data.
refresh it_emp_data.
loop at idoc_data where docnum eq idoc_contrl-docnum.
if idoc_data-segnam = 'ZSACH'.
gen_data = idoc_data-sdata.
it_emp_data-mandt = counter.
it_emp_data-lname = gen_data-lname.
it_emp_data-fname = gen_data-fname.
counter = counter + 1.
append it_emp_data.
else.
message 'ERROR' type 'I'.
endif.
endloop.
endloop.
insert zsach1 from table it_emp_data.
call function 'EDI_DOCUMENT_OPEN_FOR_EDIT'
exporting
document_number = idoc_data-docnum
importing
idoc_control = idoc_contrl
tables
idoc_data = idoc_data
exceptions
document_foreign_lock = 1
document_not_exist = 2
document_not_open = 3
status_is_unable_for_changing = 4
others = 5.
call function 'EDI_CHANGE_DATA_SEGMENTS'
tables
idoc_changed_data_range = idoc_data
exceptions
idoc_not_open = 1
data_record_not_exist = 2
others = 3.
data t_itab_edids40 like edi_ds40 occurs 0 with header line.
clear t_itab_edids40.
t_itab_edids40-docnum = idoc_data-docnum.
t_itab_edids40-status = '51'.
t_itab_edids40-repid = sy-repid.
t_itab_edids40-tabnam = 'EDI_DS'.
t_itab_edids40-mandt = sy-mandt.
t_itab_edids40-stamqu = 'SAP'.
t_itab_edids40-stamid = 'B1'.
t_itab_edids40-stamno = '999'.
t_itab_edids40-stapa1 = 'Sold to changed to '.
*t_itab_edids40-stapa2 = t_new_kunnr.
t_itab_edids40-logdat = sy-datum.
t_itab_edids40-logtim = sy-uzeit.
append t_itab_edids40.
call function 'EDI_DOCUMENT_CLOSE_EDIT'
exporting
document_number = idoc_data-docnum
do_commit = 'X'
do_update = 'X'
write_all_status = 'X'
tables
status_records = t_itab_edids40
exceptions
idoc_not_open = 1
db_error = 2
others = 3.
endfunction.
Running the Application
Sender system
Execute the program we created earlier
Checking the IDOC
T Code WE02
Checking the data on the Receiver end
Tcode: WE02
The IDOC has arrived here
Checking the Data
Double click on the IDOC
Checking the Database
This way, the data has come to the receiver end successfully.
Thanks&Regards,
Phani.
CHECK URL:http://www.****************/Tutorials/ALE/DataDistributeCustomIDOC/page6.htm -
Hi All,
Can we go for approach of developing custom IDOC's? where in our scenarios are getting files from thrid party and updating data in file into ECC.
Approach towards Custom IDOC's is for error monitoring and recprocessing.
Would request your inputs and suggesions in this regard.
Is that good approach for going to custom idocs? if not why?
Thanks,
chandra.Hi,
SAP R/3 systems send out data through IDoc (Intermediate Document), which in internally has segments and fields containing the data. But sometimes, these fields are not sufficient for a specific end-to-end business scenario as far as data transfer is concerned. So in such scenario, either few fields are to be added or subtracted, or completely new structure- IDoc needs to be created.
At times because of the business scenario we do have to create Custom idocs .
Regards,
Bhanu -
Contents of a custom print program for a custom smartform
Hi...
Can you please tell me if we are writing a custom print program from scratch for a custom smartform for which there is no standard form available what are all the things that need to be coded in the print program..
My doubts on this are if we are configuring this form for output types of PO purchase order for mediums 1,2, 5 and 6 does any extra coding need to be done in the print program that is related to these mediums or is it just a configuration issue..
Apart from data retrieval part and call the function modules to send the data to smartforms what are the other things that we need to code in a custom smartform.. Anything that we need to code related to printing issues..
It would be great if someone can post a custom print program for any output type valid for mediums 1, 2, 5 and 6.
Also my last doubt is do we need to do anything in SE11 in designing a smartform and in what context do we need it...
Thanks and appreciate your help... Surely will reward for all the helpful answers..
Thanks again..
Kanthi..Hi,
yes you need to create your own print program. You need to catch printing information and to send data to your smartforms.
To send data to your smartforms you need to use structure describe in the data dictionnary.
This is a peace of code for sending information to a smartform that will be print used an external program (Esker)
DATA: it_data LIKE TABLE OF zssf_bl WITH HEADER LINE,
w_formname TYPE tdsfname ,
w_fm_name TYPE rs38l_fnam ,
is_output TYPE ssfcompop ,
is_control TYPE ssfctrlop ,
is_job_out TYPE ssfcresop .
* Récupère le nom du module fonction.
MOVE 'Z_BL_STT' TO w_formname.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_formname
IMPORTING
fm_name = w_fm_name
EXCEPTIONS
OTHERS = 3.
* Prépare les paramètres d'impression.
is_output-xsfcmode = 'X'.
is_output-xsf = 'X'.
is_output-xsfoutmode = 'S'.
is_output-xsfoutdev = 'DOCL'.
is_output-xsfformat = 'X'.
is_output-tdnoprev = 'X'.
is_output-tdnoprint = ' '.
is_output-tddest = 'DOCL'.
is_output-tdprinter = 'PLAIN'.
is_output-tdnewid = 'X'.
is_output-tdimmed = 'X'.
is_output-tddelete = 'X'.
is_control-no_dialog = 'X'.
is_control-preview = ' '.
is_control-no_open = 'X'.
is_control-no_close = ' '.
* Prepare le formulaire
CALL FUNCTION 'SSF_OPEN'
EXPORTING
user_settings = ' '
output_options = is_output
control_parameters = is_control
IMPORTING
job_output_options = is_job_out
EXCEPTIONS
OTHERS = 5.
* Appels du formulaire.
CALL FUNCTION w_fm_name
EXPORTING
control_parameters = is_control
output_options = is_output
is_bl = zbl_soustrait
TABLES
it_data = it_data
EXCEPTIONS
OTHERS = 5.
You need to catch information from the NAST table maybe
Rgd
Frédéric
Maybe you are looking for
-
What's the best app for push notifications?
I successfully set up my exchange server to push email to my iphone and my inbox and all subfolders show up fine. I have outlook rules set up with exchange that automatically put certain emails into specific sub folders, but I'm not getting alerts (
-
Mail crashing with EXC_BAD_ACCESS (SIGBUS)-ISync related
Hi, I am having a problem with Mail crashing with the (SIGBUS) error... I can stop this from happening by turning off sync in the Isync preferences. I was hoping that once MobileMe was fixed this problem would go away but no such luck... Unfortunatel
-
my ipad 3 is dissconnected how can i fix it if i dont have a computer
-
Numbered captions incorrect in Table of Contents
Hi, I am working on a book project and have a page – let's call it the "image page" – with eight images with manually typed descriptions below each. These descriptions sit in Static Captions. The captions also have a sequential numbering (1, 2, 3, 4,
-
Functional specification documents..
HI guys, I am new to SAP HCM.. i was wonderingg as to when is the need to write a Function spec document? It would be great if you could give an example.. Also, what is the difference between Functioal Spec doc and functioal design document?? Thanks