How to add 16 bit message sequential number to the byte array

hi
iam trying to implement socket programming over UDP. Iam writing for the server side now.I need to send an image file from server to a client via a gateway so basically ive to do hand-shaking with the gateway first and then ive to send image data in a sequence of small messages with a payload of 1 KB.The data message should also include a header of 16 bit sequential number and a bit to indicate end of file.
Iam able to complete registration process(Iam not sure yet).I dnt know how to include sequential number and a bit to indicate end of file.
I would like to have your valuable ideas about how to proceed further
package udp;
import java.io.*;
import java.net.*;
import java.util.*;
public class Sender  {
    protected BufferedReader in = null;
    protected FileInputStream image=null;
    protected static boolean end_of_file=true;
/** pass arguments hostname,port,filename
* @param args
* @throws IOException
   public static void main(String[] args) throws IOException{
        DatagramSocket socket = new DatagramSocket(Integer.parseInt(args[1]));
        boolean more_messages = true;
          String str1=null;
            * gateway registration
            try{
                 //send string to emulator
                String str="%%%GatewayRegistration SENDER test delay 10 drop 0 dupl 0 bandwidth 1000000";
                byte[] buff=str.getBytes();
                InetAddress emulator_address = InetAddress.getByName(args[0]);
                DatagramPacket packet = new DatagramPacket(buff, buff.length,emulator_address,Integer.parseInt(args[0]));
                socket.send(packet);
                    // figure out response
                byte[] buf = new byte[1024];
                DatagramPacket recpack=new DatagramPacket(buf,buf.length);
                socket.receive(recpack);
               // socket.setSoTimeout(10000);
                String str2=str1.valueOf(new String(recpack.getData()));
                if(socket.equals(null))
                     System.out.println("no acknowledgement from the emulator");
                    socket.close();
                else if(str2=="%%%GatewayConfirmation")
                //     String str1=null;
                     System.out.println("rec message"+str2);
                else
                     System.out.println("not a valid message from emulator");
                     socket.close();
            catch (IOException e) {
                e.printStackTrace();
                  end_of_file = false;
     /**create a packet with a payload of 1     KB and header of 16 bit sequential number and a bit to indicate end of file
  while(end_of_file!=false)
      String ack="y";
      String seqnum=
       File file = new File(args[2]);                               
                InputStream is = new FileInputStream(file);                 
        socket.close();
  private byte[] byteArray(InputStream in) throws IOException {
         byte[] readBytes = new byte[1024]; // make a byte array with a length equal to the number of bytes in the stream
      try{
         in.read(readBytes);  // dump all the bytes in the stream into the array
        catch(IOException e)
             e.printStackTrace();
        return readBytes;
  

HI Rolf.k.
Thank you for the small program it was helpfull.
You got right about that proberly there  will be conflict with some spurios data, I can already detect that when writing the data to a spreadsheet file.
I writes the data in such a way, that in each line there will be a date, a timestamp, a tab and a timestamp at the end. That means two columns.
When i set given samplerate up, that controls the rate of the data outflow from the device, (1,56 Hz - 200 Hz),   the data file that i write to , looks unorderet.
 i get more than one timestamp and severel datavalues in every line and so on down the spreadsheet file.
Now the question is: Could it be that the function that writes the data to the file,  can't handle the speed of the dataflow in such a way that the time stamp cant follow with the data flowspeed. so i'm trying to set the timestamp to be  with fractions of the seconds by adding the unit (<digit>) in the timestamp icon but its not working. Meaby when i take the fractions off a second within the timestamp i can get every timestamp with its right data value. Am i in deeb water or what do You mean!??
AAttached Pics part of program and a logfile over data written to file
regards
Zamzam
HFZ
Attachments:
DataFlowWR.JPG ‏159 KB
Datalogfile.JPG ‏386 KB

Similar Messages

  • How to add a new column (Project Number) in the action items table under NPD Module?

    There are two projects with same name and created by same person in NPD.
    So when it is displayed in "Action Items" table, It looks similar.
    To avoid this, I need one more column (Project Number) to be added in the "Action Items" table and " Strategic briefs and projects" table.
    So, How to add a new column (Project Number) in the "Action Items" table and " Strategic briefs and projects" table under NPD Module?
    Please do the needful.

    There is no out of the box configuration available to add columns to NPD action items.   As always we welcome enhancement requests. 
    Thanks
    Kelly

  • How to add more than one phone number in imessage?

    How to add more than one phone number in imessage?

    If you mean sending to multiple phone numbers, place a comma between the numbers in the "To" box, or select the "+" to use numbers in your Contacts

  • How do I save "Sent" messages when sending from the ipad

    How do I save "Sent" messages when sending from the ipad2?

    By default sent items should be saved in your Sent folder. For IMAP type accounts you should be able to change that by selecting the account in Settings > Mail, Contacts, Calendars , then selecting 'Account' on the popup for it and then 'Advanced' at the bottom of the next popup

  • How to add more than one input arguments to the tpcall

    Hi
    Can any one know how to add more than one input arguments in the tpcall using WTC (Jatmi)?
    Par example, I have un service Tuxedo getConsoClient(char* cli_id, char* type)
    To call this service, I'm using tpcall("getConsoClient", dataIn, 0);
    here, I did't know how to add two parameters in the TypedBuffer object. I'm new to WTC.
    Any hints will be greatly appreaciated.
    Advanced thanks

    Thanks for you help. But in java Jatmi, I have lot of problem to convert array into TypedBuffer or TypedString. See below code, I'm tried using vector or tableau etc..
    But I have always same erreur. :(
    public void getClientInfo() {
         Context ctx;
         TuxedoConnection myTux;
         TypedString numinst = new TypedString("1");
         TypedString idClient = new TypedString("1003");
         TypedString[] dataIn = {numinst,idClient};
         //TypedString dataIn = new TypedString(numinst+"\0"+idClient+"\0");
         Vector input = new Vector();
         input.add(0,numinst);
         input.add(1,idClient);
         Reply rpy = null;
         try{          
              System.out.println("getClientInfo called : " + dataIn);
              TuxedoConnectionFactory tcf;               
              ctx = new InitialContext();
              tcf = (TuxedoConnectionFactory) ctx.lookup("tuxedo.services.TuxedoConnection");
              myTux = tcf.getTuxedoConnection();          
              System.out.println("About to call tpcall cnx = "+myTux);
              rpy = myTux.tpcall("LireInfoCli_SE",(TypedBuffer)dataIn, 0);          
              System.out.println("tpcall successfull!");
              TypedFML32 typ = (TypedFML32) rpy.getReplyBuffer();
              System.out.println("Reply Type = "+rpy.getReplyBuffer().getType());
              System.out.println("Reply toString = "+typ.toString());
              while(typ.Fiterator().hasNext()){
                   System.out.println("Reply toString = "+typ.Fiterator().next().toString());               
              myTux.tpterm(); // Closing the association with Tuxedo
         }catch (TPReplyException tpx) {
              // Could not get the tuxedo object, throw TPENOENT
              System.out.println("TPReplyException perrno = " + tpx.gettperrno()+" DETAILS "+tpx.gettperrordetail()+" getLocalizedMessage "+tpx.getLocalizedMessage()+" "+tpx.getCause());
              tpx.printStackTrace();
         }catch (TPException tpx1) {
              // Could not get the tuxedo object, throw TPENOENT
              System.out.println("TPReplyException perrno = " + tpx1.gettperrno()+" DETAILS "+tpx1.gettperrordetail()+" getLocalizedMessage "+tpx1.getLocalizedMessage()+" "+tpx1.getCause());
              tpx1.printStackTrace();
         }catch (NamingException ne) {
                   // Could not get the tuxedo object, throw TPENOENT
                   System.out.println("Could not get TuxedoConnectionFactory : " + ne.getMessage());
                   ne.printStackTrace();
         }catch(Exception e){
                   System.out.println("Exception in getClientInfo ->"+e.getMessage());
                   e.printStackTrace();
         return;
    }

  • How to recover my viber messages? without replacing the other application when i will restore my last backup.

    how to recover my viber messages? without replacing the other application when i will restore my last backup.

    Maybe from the restored iPod via How to perform iPad recovery for photos, videos
    Wondershare Dr.Fone for iOS: iPhone Data Recovery - Wondershare Official     
    http://www.amacsoft.com/ipod-data-recovery.html
    iPod recovery software to restore lost music files      
    http://www.pcrecoverytools.com/ipod-data-recovery.html
    Yu also said:
    I think this is because
    I backed up a long time ago, and the iTunes update may have erased the back up?
    No, updating iTunes does not delete any iOS device backups.

  • How to get password as string back from encrypted password byte array.

    Hi All,
    I am storing encrypted password and enc key in the database.(Code included encryptPassword method for encryption and validatePassword method for validating of password). Problem is that for some reason i need to show user's password to the user as a string as he/she entered. But i am not able to convert the encrypted password from D/B to original String.
    Tell me if any body know how to get the string password back from the encrypted password byte array after seeing my existing encryption code.
    //********* Code
    private Vector encryptPassword(byte[] arrPwd)
    try
    // parameter arrPwd is the password as entered by the user and to be encrypted.
    byte[] encPwd = null;
    byte[] key = null;
    /* Generate a key pair */
    KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN");
    SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
    keyGen.initialize(1024, random);
    KeyPair pair = keyGen.generateKeyPair();
    PrivateKey priv = pair.getPrivate();
    PublicKey pub = pair.getPublic();
    /* Create a Signature object and initialize it with the private key */
    Signature dsa = Signature.getInstance("SHA1withDSA", "SUN");
    dsa.initSign(priv);
    /* Update and sign the data */
    dsa.update(arrPwd, 0, 12);
    /* Now that all the data to be signed has been read in, generate a signature for it */
    encPwd = dsa.sign();
    /* Now realSig has the signed password*/
    key = pub.getEncoded();
    Vector vtrPwd = new Vector(2);
    vtrPwd.add(encPwd);
    vtrPwd.add(key);
    return vtrPwd;
    catch (Exception e)
    private boolean validatePassword(byte[] arrPwd,byte[] encPwd,byte[] key) throws RemoteException
    try
    // arrPwd is the byte array of password entered by user.
    // encPwd is the encrypted password retreived from D/B
    // key is the array of key through which the password was encrypted and stored.
    X509EncodedKeySpec KeySpec = new X509EncodedKeySpec(key);
    KeyFactory keyFactory = KeyFactory.getInstance("DSA", "SUN");
    PublicKey pubKey = keyFactory.generatePublic(KeySpec);
    /* Encrypt the user-entered password using the key*/
    Signature sig = Signature.getInstance("SHA1withDSA", "SUN");
    sig.initVerify(pubKey);
    /* Update and sign the password*/
    sig.update(arrPwd, 0, 12);
    return sig.verify(encPwd);
    catch (Exception e)
    Help upto any extent would be appreciated.
    Thanx
    Moti Singh

    Hi All,
    I am storing encrypted password and enc key in the
    database.(Code included encryptPassword method for
    encryption and validatePassword method for validating
    of password). Problem is that for some reason i need
    to show user's password to the user as a string as
    he/she entered. But i am not able to convert the
    encrypted password from D/B to original String.No, you are not encrypting the password in your code, you are merely signing it.
    Tell me if any body know how to get the string
    password back from the encrypted password byte array
    after seeing my existing encryption code.It is impossible to retrieve the original text out of a signature.
    You should read up on some encryption basics in order to understand the difference between signing and encrypting. Then you can find examples of how to encrypt something here: http://java.sun.com/j2se/1.4/docs/guide/security/jce/JCERefGuide.html.
    Actually there is one class specifically for keeping keys secure, KeyStore http://java.sun.com/j2se/1.4/docs/api/java/security/KeyStore.html
    - Daniel

  • How to add an error message to an Output Type.

    Hello SAPients,
    Using a User Exit I'm modifying the segments of an outbound IDoc. When certain conditions apply I trigger an exception 
    RAISE DATA_NOT_RELEVANT_FOR_SENDING.
    It's ok because the IDoc is not generated and the Output Type is set to "Incorrectly Processed" status.
    But, when the user clicks the "Processing Log" button there is no informatio of the error occurred. How can I add an error message to the Processing Log of the Output Type?
    Thanks in advance for your kind help.

    Hi,
    Try this statement..
          MESSAGE ID      sy-msgid << Your msg class
                  TYPE    sy-msgty << Your message type
                  NUMBER  sy-msgno << Your msg no.
                  WITH    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 << Other info
                  RAISING data_not_relevant_for_sending.
    Regards,
    Joy.

  • How to add 15 bit can crc calculation to labview polynom is x15 + x14 + x10 + x8 + x7 + x4 + x3 + 1 .

    how to add can crc calculation to labview polynom is x15 + x14 + x10 + x8 + x7 + x4 + x3 + 1
    for 15 bit calulation
    thanks for any assistance

    Hi there,
    Here you can find the explanation of how the CRC calculation is done (see page 15). Now, if you are planing to do this with NI hardware/software it does not make sense since the calculation it is already taken care by the driver. In case you want to do this on your own using digital lines be careful with impedances and any other electrical consideration.
    I hope this helps
    Alejandro | Academic Program Engineer | National Instruments

  • How to add OS X Messages app

    how to add yahoo messenger to OS X Messages app

    HI,
    I used to have Yahoo Messenger  as well as setting up the Yahoo Account in iChat 6 (and then updating the OS/App since to Messages 8 in Yosemite)
    I never used the Yahoo app to access mail from Yahoo.
    The version I have in Snow Leopard opens my Browser to login to web mail.
    As the Error messages said the Messaging side the app did do does not work in OS X 10.10.x
    It only lists setting the account up in Messages.
    In System Preferences > Internet Accounts enabling it there for Mail will add an Account to the Mail app.
    9:28 pm      Wednesday; April 22, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • How to add an Alert Message

    Hi, what steps must I take to add an alert message that reminds the Adobe Reader end user to Print their form if they wish to keep a record of their form data.
    Also, where should such an alert appear, when and upon which event type?
    Harry

    Thanks Jimmy, unfortunately it doesn't work on my Submit button (which is where I do want it).. Here's what I have on the standard Submit button.
    ----- form1.SF_P8.SF_print-submit.EmailSubmitButton::click - (JavaScript, client) ------------------
    xfa.messageBox("Please ensure you also print a copy for your records", Warning, 1, 1);
    this makes my button do nothing at all, not even submit. I think it's because there are 2 events associated with it, the invisible "submit" and the new warning. Any suggestions?
    Harry

  • How to add an error message to script?

    Hi, every one
    I got this script
    function paste in place to next master
    I want to add an error message to it, if there was no such thing as master B, C,D,E,F,G
    instead of system error.
    Teetan
    var
      myDialog = app.dialogs.add({name:"Copy Selected item(s) to chosen Master",canCancel:true}),
      mStringList = ["Master A", "Master B","Master C", "Master D", "Master E","Master F", "Master G"];
    with(myDialog){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Select a Master you want to copy to"});
      with(dialogRows.add()){
      var mySelection = dropdowns.add({stringList:mStringList, selectedIndex:0});
    app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Paste in place");
    function main(){
      if (!app.documents.length || !app.selection.length)
      alert( "Nothing selected!" );
      exit();
      if (myDialog.show() == true)
      copy_to_next_master(); 
    function copy_to_next_master() { 
    var
      mChoice = mySelection.selectedIndex,
      mMsg = "Done.\rWhat you select is pasted in place to next documents - " + mStringList[mChoice],
      nSel = app.selection.length,
      mDone = false,
      i,n,nextDoc,curSel;   
    for ( i = 1; i < app.documents.length; i++) {   
      nextDoc = app.documents[i];   
      targetMaster = nextDoc.masterSpreads[mChoice];
      if (!targetMaster.isValid) {
      mMsg += "\rCan't detect " + mStringList[mChoice] + " in a doc: " + nextDoc.name;
      continue;
      mDone = true;
      for ( n = 0; n < nSel; n++ ) { 
      curSel = app.selection[n]; 
      curSel.duplicate( nextDoc.masterSpreads[mChoice] ); 
    mDone ? alert(mMsg) : alert("Nothing copied");

    Sorry Jarek
    I made a big mistake
    I want add an error message in to this:
    var curSel = app.selection[0]; 
    for ( var i = 1; i < app.documents.length; i++) { 
        var nextDoc = app.documents[i]; 
        if (!curSel) { alert( "Nothing selected!" ); exit(); } 
        curSel.duplicate( nextDoc.masterSpreads[1] ); 
    in case of I just want to paste in place to only on choice
    Teetan

  • How to chnage number of bits in every packet of a byte array

    Hi I have an array of byte array of 1 and 0s. I would like to make sure every pack of 1 or 0s contains 8 number
    I can use this example to explain it better. Lets say I have this array
    111111110000000111111100000000
    As can be first pack of 0s and the second pack of 1s contain 7 bits. I would like to programaticaaly change it to 8 so the result should be
    11111111000000001111111100000000 
    As can be seen now evey pack of 1s or 0s contains 8 element . Could you please help me on this.A sample code would be great
    Many thanks

    Reshape array is your friend.Nevermind.  I just realized what you were going for.  Will need to rethink...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    8x bits long.png ‏21 KB

  • How to add smiley in message in 5233 model

    Can any one help me to add smiley in message in 5233 model

    The 5233 is an s60 phone, and s60 phones do not have smileys inbuilt (except for the upcoming N8). You would have to install A-SMS or FUNSMS from Ovi Store to get smileys.
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

  • How to add a created Z function module to the existing list in WE21

    Hi all,
    There is some existing function modules ( like EDI_PATH_CREATE_CLIENT_DOCNUM ) in WE21 in the function module field.
    here, i need to create one Z function module as per user requirement & want to add to that list.  is it possible???
    actually, i want the file name format is like
       " Document Number_YYYYMMDDHHMMSS.xml  ". but existing function modules are not giving this format.do anybody give any idea.
    correct answers will be rewarded.
    Thanks & Regards

    HI Pabitra,
       Yes, can always change the existing fm and add it with message type as follows pls note step 7 and step 8. (for inbound it is we42 and for outbound it is we41 )
    Basic IDOCs have supplied by SAP with standard structure. (Segments). You can extend them with your own segments.
    IDOCs does have unique number. They contain control, data, and status records.
    Useful Transaction Codes:
    WEDI : IDoc Menu
    WE02 : IDoc List (can enter IDoc number to select on)
    WE05 : IDoc List
    WE19 : Transaction WE19 can be used to test the IDoc
    WE30 : IDoc Type Development: Initial Screen
    WE31: Development Segments: Initial Screen
    WE60 : Documentation for IDoc Types. This allows you to view the IDoc you have created.
    WE81 : Display View ‘EDI: Logical Message Types’: Overview
    WE82: Display View ‘Message Types and Assignment to IDoc Types’: Overview
    WE21 - Creation of POrt
    WE20 - Partner Profile creation
    SALE - ALE (Application Linking and Enabling) settings
    For Outbound ALE Configurations: (Example)
    IDoc definitions and necessary ALE configurations settings for the outbound .
    Create Idoc segments – Transaction WE31.
    Create Idoc type – Transaction WE30.
    Create Message Type – Transaction WE81.
    Assign Message Type to Idoc type – Transaction WE82.
    Create a distribution Model - Transaction BD64
    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.
    for creating a IDOC
    see the below steps for outbound processing IDOCS..
    2.1 Outbound Interface
    PROCESS DIAGRAM
    Outbound Interface
    1. Analyse Hierarchy Levels
    2. Create New segment
    3. Create New IDoc Type
    4. Create New Message Type
    5. Link Message with IDoc Type
    6. Create an entry in EDP13 via transactions WE20 and BD64
    7. Populate the Custom IDoc via ABAP Program
    7b Error Handling
    7c. Send Status Email
    8. Test the Population of the Custom IDoc
    Step 1 – Analyse Hierarchy Levels:
    Analyse the data relationships being processed in the interface. Define the appropriate hierarchical Parent-to-Child relationships.
    Navigate to transaction code WEDI
    Transaction WEDI displays the IDOC main menu. This allows navigation around the various development and control areas to create a customised IDOC.
    Step 2 – Create a new segment:
    via wedi : Development - IDOC Segments or Transaction code WE31.
    • Enter segment name and click on Create.
    The? name of the segment type must start with Z1 , and have a maximum of eight characters.
    • Enter description and enter the relevant field names and data elements.
    The segment should represent a structure in the program so for? each field in the segment a field name and a data element must be defined.
    • Save the segment and enter Person Responsible and Processing Person .
    • Go to Edit and Set Release.
    • Repeat this procedure for each new Segment in the IDOC.
    Step 3 – Create a new IDOC Type
    via wedi Development - IDOC Types or Transaction WE30.
    • Enter segment name (starting with Z), click on Basic Type and then Create.
    • Create as new, enter Person Responsible and Processing Person and enter description.
    • On ‘Create Basic Type’ screen decide where segments should be inserted and go to Edit/Create Segment.
    • Complete relevant fields in the Maintain Attributes screen:
    • From the relevant segments created in Step 2 enter the Segment type and if mandatory segment.
    • The Minimum and Maximum number of segments to be allowed in the sequence. (One minimum and one maximum if segment is mandatory).
    • The Parent Segment and Hierarchy Level will be automatically created depending on where in the IDOC tree you decided to create that particular segment.
    • Repeat this process for each segment needed in the IDOC type, deciding whether to add the next segments at the same level or as a ‘Child’.
    • When IDOC created return to initial screen. Go to Edit and Set Release.
    • Go to Transaction WE60 to view the IDoc Type you have created.
    Step 4 – Create new Message Type
    via wedi Development - Message Types or Transaction WE81.
    • Display/Change and click on New Entries
    • Create a new Message Type and Save.
    Step 5 – Link Message Type to IDOC Type
    via wedi Development - IDOC Type/Message or Transaction WE82.
    • Display/Change and then click on New Entries.
    • Enter Message Type, Basic Type (IDOC Type) and Release (46C) and Save.
    Step 6 – Create an entry in EDP13 via transactions WE20 and BD64.
    The partner profile for the Idoc must be set up and generated in the transaction BD64 and transaction WE20.
    • WE20 – Add Message Type to appropriate Partner Type, Enter Message Type, Receiver Port and Idoc Type and Save.
    • BD64 – Create a Model View, Enter Sender and Receiver Ports, Attach Message Type. Go to ‘Environment’ on Menu and click on Generate Partner Profiles and generate (not save) profile.
    Step 7 – Populate the custom IDOC via ABAP Program
    See Test Program ZOUTBD_IDOC_TEMPLATE, Appendix IV.
    • Create an Internal Table for each segment type, this should be exactly the same structure as the segment type.
    • The control record is filled into a structure like EDIDC. The message type and the Idoc type for the Idoc must be populated into the eddic structure.
    - PERFORM populate_Control_structure USING c_mestyp
    c_SEGMENT_type1.
    • The data segments are filled into a structure like edidd-sdata; sdata and the segment name are populated into the edidd structure.
    - PERFORM transfer_Parent_data_to_seg.
    • The standard SAP function module MASTER_IDOC_DISTRIBUTE is called to pass the populated IDOC to the ALE Layer.
    - PERFORM master_idoc_distribute.
    • NOTE: This function module is only called for stand alone programs and Shared Master Data programs (SMD). It is not called when using extensions or output determination.
    • The ALE Layer handles the sending of the IDOC to the receiving system.
    • Error Handling (see Step 7b).
    • Commit work.
    Project SpecificStep 7b – Error Handling
    • Analyse which fields in the interface are mandatory for the receiving system and who needs to receive error notification.
    • Declare a structure of type ‘MCMAILOBJ’ for sending instructions.
    • Enter values for the internal table based on structure ‘MCMAILOBJ’
    • For selection processes, on SY-SUBRC checks and where fields are mandatory for the receiving system; insert Function Module ‘MC_SEND_MAIL’.
    • Enter values in the following parameters: -
    MS_MAIL_SENDMODE = ‘B’ (Batch Mode)
    MS_MAIL_TITLE = 'Mail Title'
    MS_MAIL_DESCRIPTION = ‘Error description’ (e.g. MATNR not given)
    MS_MAIL_RECEIVER = ‘Name of Receiver’ (To be determined)
    MS_MAIL_EXPRESS = ‘E’ (Express Delivery)
    MS_MAIL_DLINAME = Leave Blank
    MS_MAIL_LANGU = 'E' (Language)
    MS_MAIL_FUNKOBJ_NAME = Leave Blank
    TABLES
    MS_MAIL_CONT = I_MCMAILOBJ
    Note:
    It has to be determined separately for each interface how these errors and mail notifications are to be grouped – dependant upon the number of errors that are potentially likely. One possible approach is to send an email for each reason for rejection and include all the records that failed for that reason in the mail notification. Another possible approach is to send an email for every failure.
    When error checking for mandatory fields it is common SAP practice to reject a record on its first failure (irrespective of subsequent errors in that record)
    <b>Step 7
    (Transaction WE57)
    Assign the custom function module to the IDoc type and the message type.
    Set function module to type ‘F’ and direction ‘2’ for inbound.
    Step 8
    (Transaction WE42)
    Create a new process code and assign it to the function module. The process code determines how the incoming IDoc is to be processed in SAP.</b>
    Step 9
    (Transaction BD67)
    Assign the function module to the process code created above. Got to ‘New Entries’ and enter the process code and the function module name.
    Step 10
    (Transaction WE20 and Transaction BD64)
    Create a partner profile for your message and ensure that in transaction WE20 the process code is the one that points to your function module. (See step 6 of creating Outbound Idocs).
    Step 11
    Ensure that error handling functionality is present.
    If u still have doubt, i can send u the print screen doc -  hope this helps u
    <b>Reward pts if found usefull :)</b>
    regards
    Sathish

Maybe you are looking for