Avoid Duplicate IDOC :

Hi All,
I need to code for avoid duplicate IDOC when my program convert one idoc to another IDOC. The Code is written below..
  LOOP  AT  t_seldoc.
    SELECT SINGLE * FROM  edidc
          WHERE docnum  EQ t_seldoc-idoc.
    REFRESH: t_idocst,
             t_edidd.
    IF edidc-mestyp = c_msg_type.
      MOVE:  c_new_type     TO  edidc-mestyp,
             c_st69         TO  edidc-status,
             c_st69         TO  t_seldoc-status,
             t_seldoc-idoc  TO  t_idocst-docnum.
    ELSE.
      MOVE:  'Z_NGI_SBT_TICKET'     TO  edidc-mestyp,
             c_st69         TO  edidc-status,
             c_377          TO  edidc-stdmes, "Add the stdmes for acks
             c_st69         TO  t_seldoc-status,
             t_seldoc-idoc  TO  t_idocst-docnum.
    ENDIF.
    APPEND  t_idocst  TO  t_idocst.
    PERFORM  update_idoc.
    READ TABLE t_output  WITH KEY idoc = t_seldoc-idoc.
    MOVE  sy-tabix  TO  l_tabix.
    MOVE c_upd_idoc TO  t_output-status.
    MODIFY t_output INDEX  l_tabix.
    MODIFY t_seldoc.
  ENDLOOP.
Line: -
This is the perform statement.
CHANGE BY Swati Namdev 28042009
types : begin of ty_vbak,
      vbeln    type   vbak-vbeln,
end of ty_vbak.
Data : LT_dup_check type standard table of Z1NG_SBTTICKETHD,
       it_vbak      type standard table of ty_vbak.
End Here  Swati Namdev 28042009
  CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
    EXPORTING
      document_number                     = t_seldoc-idoc
     ALREADY_OPEN                        = 'N'
   IMPORTING
     IDOC_CONTROL                        =
    TABLES
      idoc_data                           =  t_edidd
    EXCEPTIONS
      document_foreign_lock               = 1
      document_not_exist                  = 2
      document_not_open                   = 3
      status_is_unable_for_changing       = 4
      OTHERS                              = 5.
  IF sy-subrc  NE 0.
    MESSAGE ID     sy-msgid
            TYPE   sy-msgty
            NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.
  LOOP AT t_edidd  WHERE segnam  EQ  c_tickey_hdr.
    MOVE  t_edidd-sdata  TO  z1tickethd.
    IF  z1tickethd-tkt_type  EQ  '0'.
      MOVE  '3'  TO  z1tickethd-tkt_type.
    ELSEIF
        z1tickethd-tkt_type  EQ  '1'.
      MOVE  '4'  TO  z1tickethd-tkt_type.
    ENDIF.
    MOVE  z1tickethd   TO  t_edidd-sdata.
    MODIFY  t_edidd.
  ENDLOOP.
  DATA: z1ng_sbttickethd LIKE z1ng_sbttickethd,
        z1ng_sbtticketdt LIKE z1ng_sbtticketdt,
        z1ng_ticketdt LIKE z1ng_ticketdt.
  LOOP AT t_edidd  WHERE segnam  EQ  'Z1NG_TICKETDT'.
    MOVE  t_edidd-sdata  TO  z1ng_ticketdt.
    CLEAR: z1ng_sbtticketdt.
    MOVE-CORRESPONDING z1ng_ticketdt TO z1ng_sbtticketdt.
    MOVE  z1ng_sbtticketdt  TO  t_edidd-sdata.
    t_edidd-segnam = 'Z1NG_SBTTICKETDT'.
    MODIFY  t_edidd.
    CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENT'
         EXPORTING
              idoc_changed_data_record = t_edidd
         EXCEPTIONS
              idoc_not_open            = 1
              data_record_not_exist    = 2
              OTHERS                   = 3.
  ENDLOOP.
  LOOP AT t_edidd  WHERE segnam  EQ  'Z1NG_TICKETHD'.
    MOVE  t_edidd-sdata  TO  z1ng_tickethd.
    CLEAR: z1ng_sbttickethd.
    MOVE-CORRESPONDING z1ng_tickethd TO z1ng_sbttickethd.
    MOVE  z1ng_sbttickethd  TO  t_edidd-sdata.
    t_edidd-segnam = 'Z1NG_SBTTICKETHD'.
    MODIFY  t_edidd.
CHANGE BY Swati Namdev 28042009
   MOVE-CORRESPONDING z1ng_sbttickethd TO LT_dup_check.
    append  z1ng_sbttickethd to LT_dup_check.
End here Swati Namdev 28042009
  ENDLOOP.
CHANGE BY Swati Namdev 28042009
  refresh it_vbak. clear it_vbak.
  if lt_dup_check[] is not initial.
     Select vbeln from vbak into table it_vbak for all entries in
                        lt_dup_check where KUNNR = lt_dup_check-CUST
                        and  ZZTKT_NBR = lt_dup_check-TKT_NBR.
    if it_vbak[] is not initial.
        Message text-002  type 'E'.
    endif.
  endif.
End here Swati Namdev 28042009
  CALL FUNCTION 'EDI_CHANGE_CONTROL_RECORD'
       EXPORTING
            idoc_changed_control         = edidc
       EXCEPTIONS
            idoc_not_open                = 1
            direction_change_not_allowed = 2
            OTHERS                       = 3.
  IF  sy-subrc NE  0.
    MESSAGE ID     sy-msgid
            TYPE   sy-msgty
            NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.
  CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENT'
       EXPORTING
            idoc_changed_data_record = t_edidd
       EXCEPTIONS
            idoc_not_open            = 1
            data_record_not_exist    = 2
            OTHERS                   = 3.
  IF sy-subrc <> 0.
    MESSAGE ID     sy-msgid
            TYPE   sy-msgty
            NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.
  CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
     EXPORTING
        document_number        = t_seldoc-idoc
        do_commit              = c_yes
        do_update              = c_yes
           WRITE_ALL_STATUS       = 'X'
     TABLES
            STATUS_RECORDS     =  T_EDI_DS40
     EXCEPTIONS
        idoc_not_open          = 1
        db_error               = 2
        OTHERS                 = 3.
  IF sy-subrc <> 0.
    MESSAGE ID     sy-msgid
            TYPE   sy-msgty
            NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.
  CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE'
       EXPORTING
            idoc_number = t_seldoc-idoc
       TABLES
            idoc_status = t_idocst.
  COMMIT WORK.
  CALL FUNCTION 'EDI_DOCUMENT_DEQUEUE_LATER'
       EXPORTING
            docnum = t_seldoc-idoc.
  COMMIT WORK.
ENDFORM.                    " UPDATE_IDOC
AT  present I am checking if IDOC is Duplicate giving error message but now I have to set status as 51 and for duplicate idoc and run for remaining.
Please provide the solution.
regards
Swati
Edited by: Swati Namdev on May 5, 2009 11:26 AM
Edited by: Swati Namdev on May 5, 2009 11:28 AM
Edited by: Swati Namdev on May 5, 2009 11:28 AM
Edited by: Swati Namdev on May 5, 2009 11:29 AM
Edited by: Swati Namdev on May 5, 2009 11:32 AM

Hi all
  any inputs on this pl...?
  Q: If the same idoc is received second time then how to stop the processing
       the duplicate idoc ?
       (I understood the question this way )
regards

Similar Messages

  • How to stop the duplicate idoc processing ? whar need to done SAP R/3

    Hi All
    If the Same Idoc is processed to SAP R/3 then what to do for not processing
    the duplicate IDOC ?
    Or some thing like this...
    If by mistake same idoc processed then how to avoid to process the idoc?
    what i need to in SAP R/3 side?
    Regards
    Kiran lvs

    Hi
    some thing like this:Using T.code: we19 ...Idoc processed a day ago
                                           today by using the same t.code we19 ..processed the
                                           same  idoc, what  i sent a day ago.
                                           Here how to stop this duplicate processing ?
    I hope this is clear...else pl put a note
    regards
    Kiran lvs

  • Urgent: Duplicate Message and Duplicate idoc ..

    Hi  All,
    need help.
    I have   file(Asynchronous ) to Idoc  scenario.
    We are processing file and creating idoc.
    in file  adpater  :  we have confguration 
    1) Exactly once.
    2) File content conversion/
    3) Processing mode : Archive
    4) Add time stamp
    It was working fine  but for some file.  It is creating two message in  SXMB_MONI at same time and also  created two idoc in R/3.
    I checked all the configuration.All are  fine . this is configuration  is working for other file also. This issue happening randomly.
    Please help to know why it is showing two message in  Monitoring and  creating two idoc.
    Please help me to resolve this.

    Hi Bhavesh,
    We are using File Content Conversion(Asynchronous).
    File->>XI-->R/3
    Processing mode : Archive
    Add time stamp
    File Name : ab
    We put file in source folder  and XI pull the file and process. At Random  we see in sxmb_moni  that one message processed at same time. but having different payload.
    This thing is  fine but While processing after XI , It is creating  duplicate idoc at r/3 with same payload. It is not for all.  We process other files also. Which is fine. This is Running system And we see this problem first time.
    Every thing is fine at  configurationin design and  nothing is changed. It is unexpectd behaviour  we see of XI.
    I am not able to understand, Where I can find the root cause  and how can we avoid this in future. We are using sp14.
    Thanks in Advance.

  • Avoid duplicate batch (batch managment)

    dear all,
    We are facing problem related to batch managment .we are using manual batch entry .we don't want to make duplicate entry of same batch (which have already assign to material) against any material.what is solution to avoid duplicate batch entry.
    can u tell me the settings and any user exit in which we can avoid the duplicate batch.
    regards

    Hi hema,
                   in our scenario user  manually enter  batch of raw material in MIGO when we do good recipte in MIGO againts purchase order we enter batch manually.but we need that a batch which has already assign to raw material can not be assign again .if user enter the previous batch then system gives a error that batch has already exist.
    may be u know the prob

  • How to avoid duplicate posting of noted items for advance payment requests?

    How to avoid duplicate posting of noted items for advace payments request?

    Puttasiddappa,
    In the PS module, we allow the deletion of a component pruchase requisition allthough a purchase order exists. The system will send message CN707 "<i>A purchase order already exists for purchase requisition &</i>" as an Iinformation message by design to allow flexible project management.
    If you, however, desire the message CN707 to be of type E you have to
    modify the standard coding. Doing so, using SE91, you can invoke the
    where-used-list of message 707 in message class CN, and to change the
      i707(cn)
    to
      e707(cn)
    where desired.
    Also, user exit CNEX0039 provides the possibility to reject the
    deletion of a component according to customers needs e. g. you may
    check here whether a purchase order exists and reject the deletion.
    Hope this helps!
    Best regards
    Martina Modolell

  • How to avoid duplicate BOM Item Numbers?

    Hello,
    is there a way to avoid duplicate BOM Item Numbers (STPO-POSNR) within one BOM?
    For Routings I could avoid duplicate Operation/Activity Numbers with transaction OP46 by setting T412-FLG_CHK = 'X' for Task List Check. Is there an aquivalent for BOMs?
    Regards,
    Helmut Gante

    Hello,
    is there a way to avoid duplicate BOM Item Numbers (STPO-POSNR) within one BOM?
    For Routings I could avoid duplicate Operation/Activity Numbers with transaction OP46 by setting T412-FLG_CHK = 'X' for Task List Check. Is there an aquivalent for BOMs?
    Regards,
    Helmut Gante

  • #MULTIVALUE even affter checking avoid duplicate row agg.

    Hi experts
    I am getting multivalue error in few rows even after checking the option of avoid duplicate row  agg.
    any ideas
    regards

    Hi,
    #Multivalue :- this error will occur in 3ways
    1) #multivalue in aggregation -
      the o/p context not include i/p context its  situation this error occurs.
    2) #multivalue in breaks header or footer
    3) #multivalue in section level.
    Please provide us with the description of the issue u r facing.
    Regards,
    Chitha.

  • How can I avoid duplicates on contacts and how do I get contacts created on iPhone/ipad synchronized on my mac? so far it doesn't work correctly, just sometimes. same for icalendar

    how can I avoid duplicates on contacts and how do I get contacts created on iPhone/ipad synchronized on my mac? so far it doesn't work correctly, just sometimes. same for icalendar

    On your Mac, for duplicates, switching Contacts off then back on in System Preferences > iCloud may prevent duplicates.
    On the iPhone / iPad tap Settings > iCloud. Make sure Contacts and Calendars are swtiched on.
    Try restarting your Mac and your iOS devices when items won't sync as they should.
    To restart an iOS device:  Hold the On/Off Sleep/Wake button down until the red slider appears. Slide your finger across the slider to turn off iPhone. To turn iPhone back on, press and hold the On/Off Sleep/Wake button until the Apple logo appears.

  • How to avoid duplicate record in a file to file

    Hi Guys,
              Could you please provide a soultion
              in order  to avoid duplicate entries in a flat file based on key field.
              i request in terms of standard functions
             either at message mappingf level or by configuring the file adapter.
    warm regards
    mahesh.

    hi mahesh,
    write module processor for checking the duplicate record in file adapter
    or
    With a JAVA/ABAP mapping u can eliminate the duplicate records
    and check this links
    Re: How to Handle this "Duplicate Records"
    Duplicate records
    Ignoring Duplicate Records--urgent
    Re: Duplicate records frequently occurred
    Re: Reg ODS JUNK DATA
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d0/538f3b294a7f2de10000000a11402f/frameset.htm
    regards
    srinivas

  • Lookup transformation to avoid duplicate rows? - SSIS 2005

    Hi,
    I'm maintaning a SSIS 2005 pkg. I need to read a flat file to write on a SQL Server table, avoiding duplicates.
    I can have duplicates rows into the flat file to import and I need to prevent the insert of any rows already existing in the SQL Server table.
    So, I think to use a lookup transformation. I've created a flat file source, then I connect it to a lookup transformation and inside it I've specified as the reference table the SQL Server destination table. Then, I've checked the available lookup columns
    each adding as a new column: but the lookup task has arised an error and so I've specified as lookup operation the replacement. For each unmatching I need to write on the SQL Server table (the reference table in the lookup). For the lookup output error I've
    indicate to ignore failure. Other steps?
    However, when I run the pkg then inside the SQL Server destination table I can see only NULL values, but I want to see the rows don't already present in the table.
    Any suggests to me, please? Thanks

    Hi,
    I'm using SSIS 2005 as reported in the title of the post.
    I could have duplicates inside the source file and the existing table could haven't any rows.
    Thanks
    If you dont have any rows in existing table, then they will go through Error output in lookup task. For duplicates, lookup task will find matches and will go through lookup match output
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • To avoid duplicate entries in multi row

    Hi i need to avoid duplicate entries in multi record form.In the master block i have AGENCY CODE.These are the fields, RATING_CODE(composite primary key alng with AGENCY_CODE in the detail block,but set as hidden) and DESCRIPTION
    in the detail block.If AGENCY_CODE is CRISIL,then for that i should not enter duplicate RATING CODES.I have written
    DECLARE
         L_COUNT2 NUMBER;
         l_ret varchar2(20);
    BEGIN
         SELECT COUNT(*) INTO L_COUNT2 FROM CSTM_AGENCY_CODE_DETAIL
    WHERE AGENCY_CODE=:BLK_CSTM_AGENCY_CODE_DETAIL.AGENCY_CODE
    AND RATING_CODE=:BLK_CSTM_AGENCY_CODE_DETAIL.RATING_CODE;
    IF L_COUNT2 > 0 THEN
              l_ret := ovpkcs.fn_dispmsg('AGYCOD-03;',';',';');
    Raise Form_Trigger_Failure;
    END IF;
    END;
    in WHEN_VALIDATE_ITEM.
    Now when i press the TAB to move next time it gives the message,DUPLICATE RATING CODE.The
    problem is when i move back to the previous record by clicking mouse and change it to the already existing value,and while i save the validation is not happening and the message is not shown.Kindly tell me where i should code.
    Thank you

    hy,
    you can check whan commit( an save button)
    for i = 1 to n-1
    check condition (item = item +1)
    next_record
    end
    or by stored insert whit exception return to form program when duplicate key is found
    ...

  • SQVI - Quick Viewer - Avoid Duplicates

    Hi All,
    I am running a Quick Viewer and need to display the Count of records for each month.
    Now I have 2 records for each Employee.(Say 1 for dental  and 1 for medical)
    Say I have 5 employees,So I could display the Count as 10 records.
    But in Actual I need to display the count as 5 because there are 5 employees.
    Since in my dataset 2 records are fetched for each employee,Record count is many a times double the employee count .
    Is there anyway we could avoid duplicates in Quick viewer.
    Edited by: Kumar B on Nov 3, 2009 9:48 AM

    I am using a custom infotype table in HR similar to the IT0167 (health plans).
    Problem is few employees have medical and dental,Few have only medical and few Only dental.
    Thus making it difficult to get the actual count of employees.
    Thank you,
    Edited by: Kumar B on Nov 3, 2009 10:19 AM

  • Avoid Duplicate Tasks when Expanding Groups for Custom Task Process

    Is there a way to:
    Avoid Duplicate Tasks when Expanding Groups for Custom Task Process?
    I've got a people metadata column that I am planning on putting groups into.  I want the groups to expand and send a task for all users in the groups.  I also want to avoid creating multiple tasks if a user happens to be in two groups at the same
    time.
    I'm trying to work out a way to assign users a read task based on job training requirements.  Right now assigning groups and using a workflow task to confirm read is what I'm trying to accomplish.  I just end up getting two tasks for a user if
    their in multiple groups.
    David Jenkins

    Hi David,
    Please verify the followings:
    After Participants, select Parallel(all at a once)
    Expand Task Options, select ‘Assign a task to each member within groups’
    Open the action properties, make sure ExpandGroup is Yes
    Also in SharePoint Designer ,you can edit the property for the Start Approval Porcess to enable ExpandGroup:
    Reference:
    https://social.msdn.microsoft.com/Forums/office/en-US/d14da1c4-bd5a-459b-8698-3a89bb01e6ad/expand-groupnot-creating-tasks-for-users-issue-in-sharepoint-2013-designer-workflow?forum=sharepointgeneral
    https://social.technet.microsoft.com/Forums/office/en-US/ac245d45-ff66-4341-815c-79213efc4394/sharepoint-2010-designer-workflows-and-sharepoint-user-groups?forum=sharepointcustomizationprevious
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Avoid duplicates in datagrid

    There are 2 dataGrids: G1 and G2. Rows can be dragged and
    dropped from G1 into G2. There can be duplicate rows in G1, but we
    need to avoid duplicate rows in G2.
    Ideally there should be a STOP sign displayed when there is
    an attempt to drop a duplicate row into G2.
    How can this be done?
    Thanks.

    in your drag drop handler, get the dragged row(s), use the
    getItemIndex() method of the underlying dataProvider array
    collection to see if this row is already there, if so, just call
    the event.preventDefault() and set the feedback to stop.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1318924&highlight_key=y&keyword1=preventdefault
    ATTA

  • Avoiding duplicates in JTree

    I am trying to avoid duplicates in a JTree and don't think I should have to loop through all the objects and compare them for every new entry. I would like find a way to compare the label of an existing object with the one I'm about to add to the tree.
    I'm trying to use getIndexOfChild method instead of looping. The method as it is now is doesn't work. I've tried type casting and toString, but haven't found the correct combo.
    Thanks....
    public void refreshHostTree(JTree mytree, ArrayList myhostnodes) {
    // duplicates have already been accounted for
    // when the host list was built.
    DefaultTreeModel mymodel = (DefaultTreeModel)mytree.getModel();
    Object myroot = mymodel.getRoot();
    System.out.println("root is "+myroot);
                   for (int i=0; i < myhostnodes.size(); i++) {                      
    // update with new node
    DefaultMutableTreeNode curnode = new DefaultMutableTreeNode(myhostnodes.get(i));
    if((mymodel.getIndexOfChild(myroot,curnode) < 0 )) {
    System.out.println("object to add is "+curnode);
    mymodel.insertNodeInto(curnode,(DefaultMutableTreeNode)myroot,0);
    }

    I looked through many posts before posting this question. Could you send me a reference or what u searched on?
    As for your questions......
    1. Can unique nodes be duplicated in other nodes of the tree?
    - yes and no. No for the tree I'm working on now, yes for the tree on the next tabbedpane I'm populating.
    1.a If yes, can a node be a child of itself?
    - no. I don't want it to be at least...
    2. How many nodes total in the tree?
    - for my project, maximum of 500. Probably will put them in a paged scroll pane.
    3. How many average children does a node have?
    - depends on how young the sampled group started having children????
    3.a What is the maximum number of children a node can have?
    - I'm sure my 500 is below the limit, but only testing will tell.
    4. Once the tree is built is it static?
    - no. It doesn't have to be. There are good examples of this.
    5. How slow is too slow?
    - real time is a relative term! I'm trying to be more efficient with doing it this way instead of looping through all the nodes of the tree. I'm also hard headed and think that there should be an easy way to do this.
    Thanks

Maybe you are looking for