Problem in  communication IDOCS

Hi all,
I am facing a problm in setting up of communication IDOC while sending a material from 1 system to the other . I checked all the configuration settings in setting the  RFC, creating ports , and distribution model and so on....
After creating a partner profile and distribute the model  i am checking in bd10
it is giving me the status as 1 master idoc has been created and 0 communication idocs has been generated .
Can any one of  please suggest me where I am going wrong ?
points rewarded

Hi,
check the below settings for distributing material master data..check if u have done all these steps..
For distributing master data like material master, vendor master, customer master we have standard transaction codes that are provided by sap.
Bd10(send material master)
Bd12(send customer master)
Bd14(send vendor master)
Bd30(bom’s)
The order of Tcodes are:
           Bd54 (creating logical systems)
           Scc4 (assigning logical systems )
           Sm59 (rfc destination)
           We81 ( message type)                      
           We30 ( idoc type)
           We31 ( segment type)
           We82 (linking message type and idoc type)
           We21 (creating port)
           We20 (partner profiles)
           Bd64 (Distribution model)
           Bd10 (material master)
Ex: material master.
     Message type: matmas.
     Idoc type: matmas05.
Regards,
Nagaraj

Similar Messages

  • Problem in the formation of communication idoc

    Transfering master data from our system to the client system.
    After doin all the outbound configurations from BD10 im sending the materials.
    ALL the master idoc are created but only 0 communication idoc is created. how can i solve the problem.

    Hi,
    Since you are transferring the data through ALE, you need to make settings in BD64 (distribution model) and also WE20 paretner profile.
    How to maintain:
    BD64:
    Go to Edit mode and click on button 'Create model view' and fill the popup inputs 'Short text, Technical name, start date and enddate'.
    Now click on button 'Add message type' and give 'Model view, Sendor, Receiver and message type'.
    These should be same as that of WE20.
    Save it and then try once again. now issue will be resolved.
    Please reward if useful.
    Regards,
    Ramesh

  • Problems with sending IDOC via RFC from Unicode to NonUnic

    Hello
    I have following problem, sending an IDOC via RFC from Unicode to Non Unicode System. IDoc is not sent with error: codepage of receiver system cant determined. receiver destination was: Message no. B1999
    I have tried different options in sm59, but it didnt help.
    Any ideas? The recipient system is rather old, version 4.0

    hey,
    I had a similar experience. I was interfacing between 4.6 (RFC), PI and ECC 6.0 (ABAP Proxy). When data was passed from ECC to 4.6, RFC received them incorrectly. So i had to send trimmed strings from ECC and receive them as strings in RFC (esp for CURR and QUAN fields). Also the receiver communication channel in PI (between PI and  RFC) had to be set as Non unicode. This helped a bit. But still I am getting 2 issues, truncation of values and some additional digits !! But the above changes resolved unwanted characters problem like "<" and "#". You can find a related post in my id. Hope this info helps..

  • No Communication IDOC generating for MATMAS --- Urgent

    Hi,
    I have two systems in the Landscape; one is DA1 and other is DA3. Both systems are exactly identical.
    When I am triggering idoc of message type MATMAS from bd10 in DA1 systems, it successfully generating MATMAS idoc and I am able to see that idoc in we02 but when I am triggering MATMAS idoc in DA3 system; it is generating Master IDOC but it is not generating Communication idoc for Message type MATMAS and in we02 as well I am not able to see any such idoc.
    Both the Systems are exactly same and I have checked ALE configurations in both the systems, they are same.
    Can anyone suggest, what could be the problem.
    Regards,
    Varun

    hi,
    As Bineah mentioned check the distribution model, distribute it and generate partner profile.  verify all the configurations once again i hope it will do.
    if any queries let me know .
    ~linganna

  • Difference between Master Idoc and Communication Idoc.

    Can anyone list out the difference between Master Idoc and Communication Idoc?

    IDoc (for intermediate document) is a standard data structure for electronic data interchange (EDI) between application programs written for the popular SAP business system or between an SAP application and an external program. IDocs serve as the vehicle for data transfer in SAP's Application Link Enabling (ALE) system. IDocs are used for asynchronous transactions: each IDoc generated exists as a self-contained text file that can then be transmitted to the requesting workstation without connecting to the central database. Another SAP mechanism, the Business Application Programming Interface (BAPI) is used for synchronous transactions.
    Form and content: IDoc terminology
    As is often the case with proprietary technologies, SAP assigns specific, object-oriented meanings to familiar terms. When referring to IDocs, the term document refers to a set of data comprising a functional group of records with a business identity. (For example, all the data in a purchase order, or all the profile information of a supplier in a supplier master record.)
    A message refers to the contents of a specific implementation of an IDoc; it’s a logical reference. This differs from a reference to the IDoc itself, which specifies the message’s physical representation. Think of it this way: If you’re watching a parade pass by, the mayor waving to the crowd from his limousine is the message, and the mayor’s limousine (which is specific to the mayor) is the IDoc. You’re building a logical object, and the IDoc is both its container and the vehicle that moves it.
    The IDoc control record
    Each IDoc has a single control record, always the first record in the set. The structure of this record describes the content of the data records that will follow and provides administrative information, such as the IDoc’s functional category (Message Type/IDoc Type), as well as its origin (Sender) and destination (Receiver) as in conventional EDI
    Layout of an IDoc control record
    This “cover slip” format informs the receiving system of the IDoc’s purpose, and the receiving system uses it to determine the correct processing algorithm for handling the arriving IDoc.
    Data records
    The data records following the control record are structured alike, including two sections: a segment information section and a data section.
    In the first part of a data record, the segment information section describes the structure of the data that follows, for the benefit of the IDoc processor. There is a segment name (like an EDI segment identifier) that corresponds to a data dictionary structure to which the IDoc processor has access. The remaining information is useful for foreign systems, such as a partner company’s Oracle system, which has no such data dictionary.
    The second part of the record is the data itself, a storage area of 1,000 characters.
    Status records
    If you’ve ever ordered a package from a faraway location and tracked its progress using the Internet-based tracking utilities now provided by most major parcel carriers, you’re familiar with the list of stops and transfer points through which a package passes on its way to you.
    This collection of records is exactly what you’ll see in an IDoc that has begun its work. Following the data records in an IDoc, status records accumulate as an IDoc makes its way from one point in a process to another.
    Typically, an IDoc will acquire several of these records as its does its job. They are simple records, consisting of a status code (there are more than 70 codes, covering a broad range of conditions and errors), a date/time stamp, and some additional status information fields for system audit purposes. In addition, as errors occur in the processing of an IDoc, status records are used to record these errors and the date/time of their occurrence.
    IDoc Base
    IDocs, as data formatting tools, enable the easy sharing of data between databases and applications within a company as well as being an efficient data courier between companies. Typically in SAP, a database of IDoc definitions exists, to which any application may have access.
    This “IDoc Base” gives all the applications and processes in your company domain the capacity to send, receive, and process a document in a contextually appropriate way, without doing anything to the data. For example, a purchase order IDoc can filter through every process it touches, passing from system to system, accumulating status records to track its progress.
    Every department using the data can use it appropriately without any cumbersome intermediate processes, because each department draws its key to interpreting the IDoc from the same source.
    Multiple messages
    One cumbersome feature of conventional EDI is the embedding of more than one functional record type in a document. The unwieldy X-12 888 Item Maintenance transaction set is an example: It purports to handle so many different configurations of product master data that it is horrifically difficult to integrate into an existing system.
    IDocs, on the other hand, handle multiple messages with ease. Given the centralized IDoc interpretation that SAP provides to all its parts, it’s no problem to define an IDoc that will contain more than one message, that is, more than one data record type.
    A customer master IDoc, for example, may contain customer profile information records for a customer with many locations. But it may also contain location-specific pricing information records for that customer in the same document. This is an incredibly efficient way of bundling related records, particularly when passing large amounts of complex information from system to system Records in a multiple-message IDoc

  • Creation of communication IDOC's from BD12

    Hi All,
    I am triggering BD12 transaction for few customers.
    For some set of customers i am able to create both Master IDOC & Communication IDOC.
    Ex: For the customers whose Account Group is : 0001
    For other set of customers i am able to create Master IDOC but Communication IDOC i am not able to create.
    Ex: For the customers whose Account Group is: ZCRD
    Customer in account group ZCRD do not have sales area data maintained, where in there is no information maintained for sales, billing, shipping & Partner functions.
    Where as customers in account group 0001 have the sales area data maintained.
    This is the functional analysis of both the Account Groups.
    Can anybody tell the reason why Communication IDOC's are not created for Account Group-ZCRD customers & For Account Group-0001 communication IDOC's are created!
    Can anybody solve this issue!
    I have debugged this issue step-by-step for both Account Group's [ZCRD, 0001] related customers, There is no check in code for Account Group-ZCRD so that communication IDOC's does not get created.
    Also both Account Group's customers went through same piece of code, Only at in F.M call to MASTERIDOC_CREATE_REQ_DEBMAS
    the returned parameter CREATED_COMM_IDOCS is 0 for Account group-ZCRD related customer where as it is 1 for ACcount Group-0001 related customer.
    Can anybody resolve this issue so that Communication IDOC's will also be created for Account Group-ZCRD related customers!
    Thanks in advance.
    Thanks,
    Deep.

    Hi Naveen,
    Thank you for the reply.
    In BD64 i have checked the details.
    There is no checks/filteration against Account Groups-ZCRD/0001.
    One more thing is the customers for Account Group-ZCRD are
    Credit Master accounts.
    Is there any way i can find the resolution for the same!
    Thanks for the reply.
    Thanks,
    Deep.

  • Design problem: RS232 communication

    Hi,
    I have a design problem for communication with a device via RS232. Since I'm normally a C++ programmer I might just look at the problem from a wrong angle and hope for some hints how to do it in LabVIEW.
    The scenario:
    A device is communicating with the PC via RS232. The device permanently sends data packets. At the same time, commands can be sent to the device and it returns replies. Data packets and reply packets are arbitrarily mixed, i.e. after sending a command there could be a couple of date packets before the reply comes back but the packets can be distinguished by an identifier.
    At least one, ideally several VIs should communicate with the device. Commands should be sent by pressing buttons and the incoming data should be parsed (the packets contain mutliple data streams) and shown on graphs or saved to files.
    My initial idea:
    Coming from C++ I wanted to build a class for the communication that permanently reads the incoming data and splits it to reply and data packets. This class would then have a function to send out a command and would return the reply or a timeout and it would be possible to register and unregister listeners (I wanted to use queues for this) for the various data streams.
    The problems I ran into:
    There were a couple but the two most pressing problems were: how could I communicate with the constantly running sample VI (e.g. to stop sampling) and how could I propagate changes to the class to it (e.g. new listeners). Since it is not returning I don't see a good way to implement it as in instance funcion (i.e. pass it the object). I could probably not let the sample function run continously but call it periodically from outside. However I planned to implement the class as a singleton, so it could be used parallely from different VIs.
    Is there a best practice for a case like this?
    I'm glad about any hints or ideas.
    Thanks,
    Tobias

    tfritz wrote:
    Hi,
    thanks. Since almost the same thing was suggested to me in a German forum I guess this is really common practice (using one VI with different methods controlled by a queue). It still seems a little "unnatural" for me but my biggest concern (bad interface description) was shattered by the suggestion in the link you sent me to wrap these functions with wrapper VIs, thus caller VIs won't have to deal with the call-by-queue-mechanism. This might also be easier to port to a different implementation later. However I still see the danger that the continously running VI could easily become bloated. 
    It also requires me to change the way I have looked at VIs until now. In our course they told us that VIs are basically functions. Using this design patterns, the VI becomes more of a module, really (Like a C module implemented in a C-Source file). But I will try it. It sounds as if it could work.
    I will still look into the OOP solutions a little more, though. Do I understand you correctly that you wouldn't recommend using LVOOP because it's still buggy? What about dqGOOP for example? This sounds like it could do what I need (however it doesn't seem to implement things like polymorphism, late binding and inheritance so I don't quite see what's so OOP about it. It seems more like programming with structures in C.)
    I don't know if LVOOP is buggy or not.  I think early on it was buggy and things have improved in recent versions. I have read that it doesn't have all the features that you would have in OOP like C.  I wouldn't recommend it only because I'm not familiar with it at all.  I can't recommend something that I'm not comfortable with.  If you go that route, plan on spending time in these forums and in LAVA to reading up on what others have done.  I haven't hard of dqGOOP.
    But back to your suggestion. I still have a couple of questions:
    - How do you return values from the module? Would you use a queue for that as well?
    - Where would the parameter queue be held (created and passed to the VI)
     I would store all of these in a functional global variable.  This is the VI that stores data in shift registers.  Ben's action engine nugget is an advancement on that.  This allows for both the calling VI and the parallel running subVI to get and set the data as needed.  It runs quickly so neither process should be forced to wait while the other  VI is doing its thing.
    - My VI has to be constantly sampling and this shouldn't be interrupted too long by other functions as adding a listener. However both functionalities have to access the same kind of data. Is there an easy way to parallelize this? Would the sampling be a case in the case diagram that's always used if no command was sent to the VI or would it somehow run parallely?   Yes.  There are a couple of ways of doing this.  One would be for the dequeue to have a timeout function.  In the event the dequeue times out, you run the code that is doing the acquisition.  I think a better method is that the code that does the acquisition enqueues its own command again to the end of the queue.  Let's say that is command A.  So when case A finishes, it enqueues A, which seeds itself to run again.  So if nothing else comes into the queue, it just executes A , A, A, A.  But let's say another section of code needs to do something such as command B.  It will slip B into the queue while A is executing.  So you would A, B, then A again, because A would get slipped back into the queue when the first A finishes, but B has already been put in while the first A was running.
    - Would it be possible to make the VI reentrant and in this way use it simultaneously on different COM ports (using different parameter queues as well)? I'm not sure if I will need this but it would be neat if it could work.
    I think you could do this.  It may be a case where the VI is saved as a template  (.vit) and you initiate it multiple times.  I haven't needed to do this before, so I'm afraid I can't provide any details or useful tips. 
    Well, I will fool around some more. Thanks so much for your help. This is kind of exciting since the concepts are quite new for me. Btw, is there something like an academic theory (computer science) for LabVIEW? I came across functional languages in university but data flow languages are still a new concept for me.
    Tobias
    tfritz wrote:
    Another question about the "dynamically starting" of the VI:
    How is the path handled? Is it guaranteed that it always takes the VI from the project or does it just search for the first VI by that name it finds in the file structure? Does this still work when building an .exe from the project? What happens if the VI is already running? Can you test for this?
    While I'm at it: is there a way to stop LabVIEW from searching for subVIs it can't find when openin a VI? This resulted in very unexpected behaviour sometimes where it would find the VI somewhere else (with the same name but maybe an older version).
    In my case, I just had the path hardcoded.  It is my only instance, I'm not planning on moving the VI's.  If you don't have the path, it will take a VI by that name if it's in memory.  If it isn't in memory, it starts searching relative to the calling VI's path.  One thing I know, if you are dealing with relative paths, a subVI has a different relative path in an .exe as opposed to the development environment.  The name of the .exe becomes a folder.  So in development, if your sub VI is mySubVI.vi.  In an executable, its path is MyExe.exe\MySubVI.vi
    For all of this, I recommend searching the forums to get more details.
    If it is searching for a VI, you can hit ignore.  But of course you'd have to do it before it finds it.  When you are dealing with versioning issues, I recommend making a backup copy of the entire directory structure elsewhere.  Some location where it shouldn't stumble across it.

  • Regarding generating Master/Communication IDOCS's from BD12 forfewcustomers

    Hi All,
    I have one issue when i am using BD12.
    I am inputting some customers and output type/message type and executing the transaction for some customers it is generating both Master & Communication IDOCs, But for some customers it is generating only Master IDOC's but not Communication IDOC's.
    These kind of cases are coming for particular Account Group [Ex: ZCRD etc..],
    Can anybody tell me what is the relation between Account Grooup & Customer & why it is stopping generation of Communication IDOC's for particular Account group related customers.
    How can i solve this issue!
    Can anybody solve this issue!
    Thanks in advance.
    Thanks,
    Deep.

    Hi All,
    Any inputs/Solution for the above posted issue!
    Resolution in this regard will be appreciated.
    Thanks,
    Deep.

  • PROBLEM IN CUSTOM IDOC CREATION

    Hi Friends,
                    I'm facing a problem in custom idoc creation plz try to assist me
    1.As per the information i have  i'm creating segment in we31
    for cremas01 idoc.But when i enter the name for segment i'm getting message "Name range Voilation particular name which i had given is not permitted in customer system?
    Plz clarify this,and are there any formalities which i should look for before creating custom idoc?
    Good answers will be rewarded.
                                                                              Regards,
                                                                               Vinod.

    The Problem might be.... with the naming of the segment.
    Standard segments should be created with 'E1' and all the custom segments are created using 'Z1' and the name with 8 characters long only is permitted.
    Reward Points if useful.

  • XI Problem: File to Idoc Scenario - IDOC_INBOUND_ASYNCHRONOUS

    Hi,
       I'm having problems with inbound IDOCS in R/3. The idocs from XI are sent as tRFC using the FM IDOC_INBOUND_ASYNCHRONOUS and this is a problem because i have like 200 or 300 idocs to be sent at the same time and each IDOC takes like 5 minutes to process, hence the system crash due the amount of simultaneous logins (error message ThISend: ThRollout ).
    I need to fix this problem using some kind of serialization and the use of the function module IDOC_INBOUND_IN_QUEUE.
    Does anyone know how to achieve this?.
    The scenario configuration in XI and R/3 is as follows:  (PI 7.0 SP15) - (R/3 SAP ECC 6.0)
    File to Idoc.
    Sender CC->
    File content conversion
    Exactly once in order
    Receiver CC->
    IDOC protocol
    Queue Processing
    R/3 Partner profile config.
    Message type BOMMAT
    Trigger immediately
    Thanks.

    Hi,
    You have to split the messages in the sender file adapter, by using the parameter "Recordsets per Message".
    I hope that it will solve your problem. Please see the below link, it might be useful to you.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Regards,
    Rajesh

  • O Communication Idocs

    Hi
    I have an error. In QAS, I have an Idoc to File scenario. I triggered an idoc from WE19 by adding data manually and it reached XI. I went to BD10 and then tried to trigger from there. I got an error like this
    1 Master Idoc set up for message type
    0 communication IDoc(s) generated for message type
    Any clue why I get this error ?
    Midhun

    Sandeep
    I created a Model View. Now, I don't see nodes under that as I see under other scenarios. I only see the Model View that I created ECC_XI_File. How do I get nodes? I just have one line there. I saved it. Should I add more details ?
    I have only entered the four fields
    Where do I enter the Logical System Names of both Source and Target ?
    Midhun

  • Problem of communication with compactrio

    Hello,
    I am working with a compactrio 9014 and labview 8.5
    I have a problem of communication with my compactrio. I acquire sound with NI 9215 and transmit points from the fpga VI to the VI on the real time target at a rate of 10Khz. On the VI on the RT I have two loops, one determinisic running at a speed of 10Khz (0.1ms) (in this loop I will do my signal processing) and one non-deterministic running much slower (20ms) to communicate data to my computer. To communicate data to my PC, I used shared variable.
    The problem is that if I run the VI_RT, I loose immidiately the connection. I think that is because the VI is taking up all of the execution time of the
    processor and is starving out the communication loop that is used to
    send data back to my PC.
    Because of this problem, I try to configure my compactrio to automatically run on startup of my cRIO. So I follow the steps I have read in another message in the forum posted by MattP
    To make your application (RT host VI and FPGA VI) run automatically on startup of your cRIO, you will need to do the following:
    1.  Download the FPGA VI to the flash memory on your cRIO.  If
    using LabVIEW 8, right-click on the VI in the Project Explorer Window
    and select Download VI or Attributes to Flash Memory...
    2.  Build an executable out of the RT VI.  Under your RT target 
    in the Project Explorer, right-click on Build Specifications and select
    New>>Real-Time Application.  Select the source files necessary
    for your application and any support files to be included.  Click Build.
    3.. After building the RT Application, you will find its entry
    under the Build Specifications folder in your project.  Right-click on
    the application and choose Set as startup.  Right-click again and
    choose Deploy, which will download the application to your cRIO.
    With  this procedure, I thougt that I can  run my  loop faster  because I  don't have the RT VI open on my desktop  (PC), so the PC don't have to synchronise the VI. But when I startup my compactrio, I loose connection with the target...
    So, what is wrong with my project?  Is it possible to run a loop at 10kHz on the real time processor and communicate in the same time (but every 20ms) data to my PC. Can someone explain me the right procedure to do that at this frequencies?
    I have attached my project and hope that someone can help me.
    Attachments:
    Communication.zip ‏658 KB

    Hello,
    The method you use in your application to transfer the data from the FPGA to
    the RT Host use the Front Panel Interactive Communication that write/read the
    control/indicators of the FPGA VI. This method provides also risk of Race
    Condition and use uP resources.
    To avoid errors in data caused by race conditions and use less processor resources, 
    I suggest you to rewrite this part of your application with the method 
    DMA transfer from FPGA to Host.
    You will find some good tutorial at the following address.
    What
    is the Best Method For Synchronizing a LabVIEW FPGA and a Host Interface VI?
    Best Regards,
    Nick_CH

  • Problem with HRMD_A06 idoc

    Dear All,
    I am using the IDOC HRMD_A06 for carrying out various operation on the available HR infotypes.Kindly go thru the below mentioned details for further insight of the problem
    1.Scenario:
    a.An interface to SAP HR system needs to be built
    b.The interface will supply incremental master-data in 
      form of flat-files
    c.An integration broker ,SAP XI will then convert the
      flat-files to I-Docs and send I-Docs to SAP HR system
    d.The I-Doc chosen for this purpose is HRMD_A.HRMD_A06
    e.However this I-Doc is not supporting different
      operations on incremental data like modify, delete etc
    f.Further validations are also not being supported
    g.Also segments for certain info-type records are missing
    Example for Delete Operation mode:
    <b>Operation Delete</b>: Delete existing infotype record
    <b>Expected Result</b>: Only the particular info-type record, as supplied in the I-Doc should be deleted and not the entire personal number with all the info-types
    <b>Actual Result</b>: The entire personal Number is deleted.
    Is it that the Idoc behaves in this fashion or there is some other flag apart from OPERATION, which needs to be set.
    Regards
    Vinay

    Hi Vinay,
    Have you found a solution ?
    Because I'm a similar problem by using IDoc HRMD_A06. I have not a segment E1P0021 when I delete the infotype 0021 on an employee. I have only its segment E1PITYP.
    Regards
    Mickael

  • Problem in Communication channel monitoring..

    Dear friends,
    I am facing a problem in Communication channel monitoring.
    Problem:
    I have designed several communication channels in the Integration directory.
    To check the status of channel i will go to RWB->Component Monitoring->Adapter Engine->Communication channel monitoring, then we have a selection screen to filter out the channel, adapter,etc..
    Here i am NOT seen any channels to filter out. I.e. Channels in the Integration directory are not reflecting here.
    Can you please help out on this?

    HI,
    Do the CPACache refresh .
    ALso check this SAP Note- 937382
    Regards,
    Moorthy

  • Problem in receving IDOCS

    I have a problem receving an IDOC. I checked the SM58 Xn and it says " Error when opening RFC connection "
    So I reprocessed the IDOC by transaction WE19 and then BD87 where SAP says it has sent the IDOC and staus is set to 03.
    However I again checked SM58 this time it says " RfcAbort : Cannot lock transaction " ........
    any idea or pointers as what the problem is or might be?
    Below is the RFC Server code which i am using......it is the sample code that comes along with the  sapjco.jar
    Thanks a lot
    package milestone.ups;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.Hashtable;
    import java.util.Map;
    import java.util.Properties;
    import com.sap.conn.jco.JCoException;
    import com.sap.conn.jco.JCoFunction;
    import com.sap.conn.jco.ext.DestinationDataProvider;
    import com.sap.conn.jco.ext.ServerDataProvider;
    import com.sap.conn.jco.server.DefaultServerHandlerFactory;
    import com.sap.conn.jco.server.JCoServer;
    import com.sap.conn.jco.server.JCoServerContext;
    import com.sap.conn.jco.server.JCoServerContextInfo;
    import com.sap.conn.jco.server.JCoServerErrorListener;
    import com.sap.conn.jco.server.JCoServerExceptionListener;
    import com.sap.conn.jco.server.JCoServerFactory;
    import com.sap.conn.jco.server.JCoServerFunctionHandler;
    import com.sap.conn.jco.server.JCoServerState;
    import com.sap.conn.jco.server.JCoServerStateChangedListener;
    import com.sap.conn.jco.server.JCoServerTIDHandler;
    public class StepByStepServer
        static String SERVER_NAME1 = "SERVER";
        static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
        static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
        static MyTIDHandler myTIDHandler = null;
        static
            Properties connectProperties = new Properties();
            connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, " PRIVATE_IP ");
            connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "01");
            connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "001");
            connectProperties.setProperty(DestinationDataProvider.JCO_USER, " usr");
            connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "pwd ");
            connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
            createDataFile(DESTINATION_NAME1, "jcoDestination", connectProperties);
            connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
            connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");
            createDataFile(DESTINATION_NAME2, "jcoDestination", connectProperties);
            Properties servertProperties = new Properties();
            servertProperties.setProperty(ServerDataProvider.JCO_GWHOST, " PRIVATE_IP ");
            servertProperties.setProperty(ServerDataProvider.JCO_GWSERV, "sapgw01");
            servertProperties.setProperty(ServerDataProvider.JCO_PROGID, "JCO_SERVER");
            servertProperties.setProperty(ServerDataProvider.JCO_REP_DEST, "ABAP_AS_WITH_POOL");
            servertProperties.setProperty(ServerDataProvider.JCO_CONNECTION_COUNT, "2");
            createDataFile(SERVER_NAME1, "jcoServer", servertProperties);
        static void createDataFile(String name, String suffix, Properties properties)
            File cfg = new File(name + "." + suffix);
            if(!cfg.exists())
                try
                    FileOutputStream fos = new FileOutputStream(cfg, false);
                    properties.store(fos, "for tests only !");
                    fos.close();
                catch(Exception e)
                    throw new RuntimeException("Unable to create the destination file " + cfg.getName(), e);
        static class StfcConnectionHandler implements JCoServerFunctionHandler
            public void handleRequest(JCoServerContext serverCtx, JCoFunction function)
                System.out.println("----
                System.out.println("call              : " + function.getName());
                System.out.println("ConnectionId      : " + serverCtx.getConnectionID());
                System.out.println("SessionId         : " + serverCtx.getSessionID());
                System.out.println("TID               : " + serverCtx.getTID());
                System.out.println("repository name   : " + serverCtx.getRepository().getName());
                System.out.println("is in transaction : " + serverCtx.isInTransaction());
                System.out.println("is stateful       : " + serverCtx.isStatefulSession());
                System.out.println("----
                System.out.println("gwhost: " + serverCtx.getServer().getGatewayHost());
                System.out.println("gwserv: " + serverCtx.getServer().getGatewayService());
                System.out.println("progid: " + serverCtx.getServer().getProgramID());
                System.out.println("----
                System.out.println("attributes  : ");
                System.out.println(serverCtx.getConnectionAttributes().toString());
                System.out.println("----
                System.out.println("CPIC conversation ID: " + serverCtx.getConnectionAttributes().getCPICConversationID());
                System.out.println("----
                System.out.println("req text: " + function.getImportParameterList().getString("REQUTEXT"));
                function.getExportParameterList().setValue("ECHOTEXT", function.getImportParameterList().getString("REQUTEXT"));
                function.getExportParameterList().setValue("RESPTEXT", "Hello World");
                // In sample 3 (tRFC Server) we also set the status to executed:
                if(myTIDHandler != null)
                    myTIDHandler.execute(serverCtx);
        static class MyThrowableListener implements JCoServerErrorListener, JCoServerExceptionListener
            public void serverErrorOccurred(JCoServer jcoServer, String connectionId, JCoServerContextInfo serverCtx, Error error)
                System.out.println(">>> Error occured on " + jcoServer.getProgramID() + " connection " + connectionId);
                error.printStackTrace();
            public void serverExceptionOccurred(JCoServer jcoServer, String connectionId, JCoServerContextInfo serverCtx, Exception error)
                System.out.println(">>> Error occured on " + jcoServer.getProgramID() + " connection " + connectionId);
                error.printStackTrace();
        static class MyStateChangedListener implements JCoServerStateChangedListener
            public void serverStateChangeOccurred(JCoServer server, JCoServerState oldState, JCoServerState newState)
                // Defined states are: STARTED, DEAD, ALIVE, STOPPED;
                // see JCoServerState class for details.
                // Details for connections managed by a server instance
                // are available via JCoServerMonitor
                System.out.println("Server state changed from " + oldState.toString() + " to " + newState.toString() + " on server with program id "
                        + server.getProgramID());
        static void step2SimpleServer()
            JCoServer server;
            try
                server = JCoServerFactory.getServer(SERVER_NAME1);
            catch(JCoException ex)
                throw new RuntimeException("Unable to create the server " + SERVER_NAME1 + ", because of " + ex.getMessage(), ex);
            JCoServerFunctionHandler stfcConnectionHandler = new StfcConnectionHandler();
            DefaultServerHandlerFactory.FunctionHandlerFactory factory = new DefaultServerHandlerFactory.FunctionHandlerFactory();
            factory.registerHandler("STFC_CONNECTION", stfcConnectionHandler);
            server.setCallHandlerFactory(factory);
            // additionally to step 1
            MyThrowableListener eListener = new MyThrowableListener();
            server.addServerErrorListener(eListener);
            server.addServerExceptionListener(eListener);
            MyStateChangedListener slistener = new MyStateChangedListener();
            server.addServerStateChangedListener(slistener);
            server.start();
            System.out.println("The program can be stoped using <ctrl>+<c>");
        static class MyTIDHandler implements JCoServerTIDHandler
            Map<String, TIDState> availableTIDs = new Hashtable<String, TIDState>();
            public boolean checkTID(JCoServerContext serverCtx, String tid)
                // This example uses a Hashtable to store status information. But usually
                // you would use a database. If the DB is down, throw a RuntimeException at
                // this point. JCo will then abort the tRFC and the R/3 backend will try
                // again later.
                System.out.println("TID Handler: checkTID for " + tid);
                TIDState state = availableTIDs.get(tid);
                if(state == null)
                    availableTIDs.put(tid, TIDState.CREATED);
                    return true;
                if(state == TIDState.CREATED || state == TIDState.ROLLED_BACK)
                    return true;
                return false;
                // "true" means that JCo will now execute the transaction, "false" means
                // that we have already executed this transaction previously, so JCo will
                // skip the handleRequest() step and will immediately return an OK code to R/3.
            public void commit(JCoServerContext serverCtx, String tid)
                System.out.println("TID Handler: commit for " + tid);
                // react on commit e.g. commit on the database
                // if necessary throw a RuntimeException, if the commit was not
                // possible
                availableTIDs.put(tid, TIDState.COMMITTED);
            public void rollback(JCoServerContext serverCtx, String tid)
                System.out.println("TID Handler: rollback for " + tid);
                availableTIDs.put(tid, TIDState.ROLLED_BACK);
                // react on rollback e.g. rollback on the database
            public void confirmTID(JCoServerContext serverCtx, String tid)
                System.out.println("TID Handler: confirmTID for " + tid);
                try
                    // clean up the resources
                // catch(Throwable t) {} //partner wont react on an exception at
                // this point
                finally
                    availableTIDs.remove(tid);
            public void execute(JCoServerContext serverCtx)
                String tid = serverCtx.getTID();
                if(tid != null)
                    System.out.println("TID Handler: execute for " + tid);
                    availableTIDs.put(tid, TIDState.EXECUTED);
            private enum TIDState
                CREATED, EXECUTED, COMMITTED, ROLLED_BACK, CONFIRMED;
        public static void main(String[] a)
            // step1SimpleServer();
            step2SimpleServer();
            // step3SimpleTRfcServer();

    thx sameer.
    I am sending IDOCs when delivery is created i.e through transaction VL01N /VL02N.
    I dont know for some reason i dont have mw ppackage in my sapjco.jar. I got from the sap market place.
    I modified the code to handle IDOC request as u sugguested. I have put system.out in the code to check whether handler is being invovked? But it didnt when I run the code.
    I tried to reprocess the IDOC through we19....but they failed(as shown in sm58).
    Here is the modified code....
    package milestone.ups;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.util.Hashtable;
    import java.util.Map;
    import java.util.Properties;
    import com.sap.conn.idoc.IDocDocumentList;
    import com.sap.conn.idoc.IDocXMLProcessor;
    import com.sap.conn.idoc.jco.JCoIDoc;
    import com.sap.conn.idoc.jco.JCoIDocHandler;
    import com.sap.conn.idoc.jco.JCoIDocHandlerFactory;
    import com.sap.conn.idoc.jco.JCoIDocServerContext;
    import com.sap.conn.jco.JCoException;
    import com.sap.conn.jco.ext.DestinationDataProvider;
    import com.sap.conn.jco.ext.ServerDataProvider;
    import com.sap.conn.jco.server.JCoServer;
    import com.sap.conn.jco.server.JCoServerContext;
    import com.sap.conn.jco.server.JCoServerContextInfo;
    import com.sap.conn.jco.server.JCoServerErrorListener;
    import com.sap.conn.jco.server.JCoServerExceptionListener;
    import com.sap.conn.jco.server.JCoServerState;
    import com.sap.conn.jco.server.JCoServerStateChangedListener;
    import com.sap.conn.jco.server.JCoServerTIDHandler;
    import com.sap.conn.idoc.jco.*;
    public class StepByStepServer
        static String SERVER_NAME1 = "SERVER";
        static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
        static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
        static MyTIDHandler myTIDHandler = null;
        static
            Properties connectProperties = new Properties();
            connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "172.31.64.74");
            connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "01");
            connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "001");
            connectProperties.setProperty(DestinationDataProvider.JCO_USER, "US9904");
            connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "us9904");
            connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
            createDataFile(DESTINATION_NAME1, "jcoDestination", connectProperties);
            connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
            connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");
            createDataFile(DESTINATION_NAME2, "jcoDestination", connectProperties);
            Properties servertProperties = new Properties();
            servertProperties.setProperty(ServerDataProvider.JCO_GWHOST, "172.31.64.74");
            servertProperties.setProperty(ServerDataProvider.JCO_GWSERV, "sapgw01");
            servertProperties.setProperty(ServerDataProvider.JCO_PROGID, "JCO_SERVER");
            servertProperties.setProperty(ServerDataProvider.JCO_REP_DEST, "ABAP_AS_WITH_POOL");
            servertProperties.setProperty(ServerDataProvider.JCO_CONNECTION_COUNT, "2");
            createDataFile(SERVER_NAME1, "jcoServer", servertProperties);
        static void createDataFile(String name, String suffix, Properties properties)
            File cfg = new File(name + "." + suffix);
            if(!cfg.exists())
                try
                    FileOutputStream fos = new FileOutputStream(cfg, false);
                    properties.store(fos, "for tests only !");
                    fos.close();
                catch(Exception e)
                    throw new RuntimeException("Unable to create the destination file " + cfg.getName(), e);
        static class MyIDocHandler implements JCoIDocHandler
            public void handleRequest(JCoServerContext serverCtx, IDocDocumentList idocList)
                 System.out.println("IN Handler");   - THIS DIDNT PRINT on the CONSOLE             FileOutputStream fos=null;
                OutputStreamWriter osw=null;
                  try
                       IDocXMLProcessor xmlProcessor =
                            JCoIDoc.getIDocFactory().getIDocXMLProcessor();
                    fos=new FileOutputStream(serverCtx.getTID()+"_idoc.xml");
                    osw=new OutputStreamWriter(fos, "UTF8");
                       xmlProcessor.render(idocList, osw,
                                 IDocXMLProcessor.RENDER_WITH_TABS_AND_CRLF);               
                       osw.flush();
                  catch (Throwable thr)
                       thr.printStackTrace();
                finally
                    try
                        if (osw!=null)
                            osw.close();
                        if (fos!=null)
                            fos.close();
                    catch (IOException e)
                        e.printStackTrace();
        static class MyIDocHandlerFactory implements JCoIDocHandlerFactory
             private JCoIDocHandler handler = new MyIDocHandler();
             public JCoIDocHandler getIDocHandler(JCoIDocServerContext serverCtx)
                  System.out.println("Handler Object created and invoked");
                  return handler;
        static class MyThrowableListener implements JCoServerErrorListener, JCoServerExceptionListener
            public void serverErrorOccurred(JCoServer jcoServer, String connectionId, JCoServerContextInfo serverCtx, Error error)
                System.out.println(">>> Error occured on " + jcoServer.getProgramID() + " connection " + connectionId);
                error.printStackTrace();
            public void serverExceptionOccurred(JCoServer jcoServer, String connectionId, JCoServerContextInfo serverCtx, Exception error)
                System.out.println(">>> Error occured on " + jcoServer.getProgramID() + " connection " + connectionId);
                error.printStackTrace();
        static class MyStateChangedListener implements JCoServerStateChangedListener
            public void serverStateChangeOccurred(JCoServer server, JCoServerState oldState, JCoServerState newState)
                // Defined states are: STARTED, DEAD, ALIVE, STOPPED;
                // see JCoServerState class for details.
                // Details for connections managed by a server instance
                // are available via JCoServerMonitor
                System.out.println("Server state changed from " + oldState.toString() + " to " + newState.toString() + " on server with program id "
                        + server.getProgramID());
        static void step2SimpleServer()
             JCoIDocServer server;
            try
                server = JCoIDoc.getServer(SERVER_NAME1);
            catch(JCoException ex)
                throw new RuntimeException("Unable to create the server " + SERVER_NAME1 + ", because of " + ex.getMessage(), ex);
            //JCoServerFunctionHandler stfcConnectionHandler = new StfcConnectionHandler();
            server.setIDocHandlerFactory(new MyIDocHandlerFactory());
            //factory.registerHandler("STFC_CONNECTION", stfcConnectionHandler);
            // additionally to step 1
            MyThrowableListener eListener = new MyThrowableListener();
            server.addServerErrorListener(eListener);
            server.addServerExceptionListener(eListener);
            MyStateChangedListener slistener = new MyStateChangedListener();
            server.addServerStateChangedListener(slistener);
            server.start();
            System.out.println("Server Started");
            System.out.println("The program can be stoped using <ctrl>+<c>");
        static class MyTIDHandler implements JCoServerTIDHandler
            Map<String, TIDState> availableTIDs = new Hashtable<String, TIDState>();
            public boolean checkTID(JCoServerContext serverCtx, String tid)
                // This example uses a Hashtable to store status information. But usually
                // you would use a database. If the DB is down, throw a RuntimeException at
                // this point. JCo will then abort the tRFC and the R/3 backend will try
                // again later.
                System.out.println("TID Handler: checkTID for " + tid);
                TIDState state = availableTIDs.get(tid);
                if(state == null)
                    availableTIDs.put(tid, TIDState.CREATED);
                    return true;
                if(state == TIDState.CREATED || state == TIDState.ROLLED_BACK)
                    return true;
                return false;
                // "true" means that JCo will now execute the transaction, "false" means
                // that we have already executed this transaction previously, so JCo will
                // skip the handleRequest() step and will immediately return an OK code to R/3.
            public void commit(JCoServerContext serverCtx, String tid)
                System.out.println("TID Handler: commit for " + tid);
                // react on commit e.g. commit on the database
                // if necessary throw a RuntimeException, if the commit was not
                // possible
                availableTIDs.put(tid, TIDState.COMMITTED);
            public void rollback(JCoServerContext serverCtx, String tid)
                System.out.println("TID Handler: rollback for " + tid);
                availableTIDs.put(tid, TIDState.ROLLED_BACK);
                // react on rollback e.g. rollback on the database
            public void confirmTID(JCoServerContext serverCtx, String tid)
                System.out.println("TID Handler: confirmTID for " + tid);
                try
                    // clean up the resources
                // catch(Throwable t) {} //partner wont react on an exception at
                // this point
                finally
                    availableTIDs.remove(tid);
            public void execute(JCoServerContext serverCtx)
                String tid = serverCtx.getTID();
                if(tid != null)
                    System.out.println("TID Handler: execute for " + tid);
                    availableTIDs.put(tid, TIDState.EXECUTED);
            private enum TIDState
                CREATED, EXECUTED, COMMITTED, ROLLED_BACK, CONFIRMED;
        public static void main(String[] a)
            // step1SimpleServer();
            step2SimpleServer();
            // step3SimpleTRfcServer();

Maybe you are looking for

  • Why does iPhoto 9.5.1 not export slideshows?

    Why does iPhoto 9.5.1 stall when I try to export a slideshow, using OS 10.9.3? All steps have been completed, and the preview works fine, but the system hangs up at the "Exporting Slideshow" progress window. The bar never fills. Nada!

  • Multiple RTP streams + local video Player - S.O.S.

    Hi guys, I ran out of ideas, so I need your help now. It's gonna be a long one... Given: MediaLocator(vfw://0) --> DataSource(video) --> Processor(video) Then I send processor's output (videoProcessor.getDataOutput()) over RTP to multiple destination

  • How do I get firefox to save my tabs?

    When firefox used to close unexpectedly, it would save my tabs so the next time I opened it, it would restore the session. I just got a new computer with a new operating system (Windows 7) and also updated firefox and so I'm not sure which has change

  • Subnet/wildcard masks in ACS 5.1

    We are trying to migrating from ACS 4.2 to 5.1. Abandoned trying to use the migrate utility when we ran into errors trying to use it and TAC said it was an unsupported utility.  Amazing that no where in the manual did I see "Unsupported" mentioned. O

  • IPhone app for MacBook Pro?

    I downloaded the IBook app for my Iphone and am enjoying reading books. I see that when I sync my phone, the books from it are moved into ITunes and show up there, but they cannot be read on the MacBook Pro. Is there a version of the IBook reader sof