Delete  follow up  document recursive

Hi folks,
I' writing a report in order to delete orders but before deleteing these orders i have to delete the follow-up documents. in some cases follow-up document also have another follow up, so before delete the first on i have to delete the last one and the the Order. i wrote loop at lt_doc_flow into ls_doc_flow.
lv_objects_to_delete = ls_doc_flow-REF_GUID.
insert ls_doc_flow-REF_GUID into table lt_objects_to_delete.
endloop.
and the call function'crm-order_delete.
in order to delte all  docflow, but it doesn't work.
do u have any idea , how i can delete it recursive?
thanks .

Hello Liliane
You have to define a recursive function in order to delete your documents.
The following sample reports shows how to do that:
*& Report  ZUS_SDN_RECURSIVE_CALLS
REPORT  zus_sdn_recursive_calls.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_doc.
TYPES:   guid(3)        TYPE n.
TYPES:   ref_guid(3)    TYPE n.
TYPES:   text(50)       TYPE c.
TYPES:   deleted        TYPE abap_bool.
TYPES: END OF ty_s_doc.
TYPES: ty_t_doc    TYPE STANDARD TABLE OF ty_s_doc
                   WITH DEFAULT KEY.
DATA:
  gs_doc    TYPE ty_s_doc,
  gt_doc    TYPE ty_t_doc.
START-OF-SELECTION.
  PERFORM fill_docs.
  SORT gt_doc BY guid ref_guid.
  WRITE: / 'Flow of Documents:'.
  PERFORM write_docs.
  WRITE: / 'Deleted Documents:'.
  LOOP AT gt_doc INTO gs_doc
                 WHERE ( deleted = abap_false ).
    PERFORM delete_doc
                   USING gs_doc.
  ENDLOOP.
  write: / syst-uline.
  SKIP 2.
  " Reset delete flag
  gs_doc-deleted = abap_false.
  MODIFY gt_doc FROM gs_doc
      TRANSPORTING deleted
    WHERE ( deleted = abap_true ).
  " Change sorting
  SORT gt_doc BY ref_guid.
  WRITE: / 'Flow of Documents:'.
  PERFORM write_docs.
  WRITE: / 'Deleted Documents:'.
  LOOP AT gt_doc INTO gs_doc
                 WHERE ( deleted = abap_false ).
    PERFORM delete_doc
                   USING gs_doc.
  ENDLOOP.
END-OF-SELECTION.
*&      Form  FILL_DOCS
*       text
*  -->  p1        text
*  <--  p2        text
FORM fill_docs .
* define local data
  DATA:
    ls_doc    TYPE ty_s_doc.
  " Example: Doc_001 -> referenced by Doc_011 -> referenced by Doc_101
  "          Doc_002 -> Doc_012, Doc_013      -> Doc_112, Doc_113
  "          Doc_003 -> not referenced
  CLEAR: ls_doc.
  ls_doc-guid     = '001'.
  ls_doc-ref_guid = '000'. " no reference to other document
  ls_doc-text     = 'Document 001'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '011'.
  ls_doc-ref_guid = '001'.
  ls_doc-text     = 'Document 011'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '101'.
  ls_doc-ref_guid = '011'.
  ls_doc-text     = 'Document 101'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '002'.
  ls_doc-ref_guid = '000'. " no reference to other document
  ls_doc-text     = 'Document 002'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '012'.
  ls_doc-ref_guid = '002'.
  ls_doc-text     = 'Document 012'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '013'.
  ls_doc-ref_guid = '002'.
  ls_doc-text     = 'Document 013'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '112'.
  ls_doc-ref_guid = '012'.
  ls_doc-text     = 'Document 112'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '113'.
  ls_doc-ref_guid = '013'.
  ls_doc-text     = 'Document 113'.
  APPEND ls_doc TO gt_doc.
  CLEAR: ls_doc.
  ls_doc-guid     = '004'.
  ls_doc-ref_guid = '000'.  " no reference to other document
  ls_doc-text     = 'Document 004'.
  APPEND ls_doc TO gt_doc.
ENDFORM.                    " FILL_DOCS
*&      Form  delete_doc
*       text
*      -->P_GS_DOC_GUID  text
FORM delete_doc
            USING
               value(us_doc)  TYPE ty_s_doc.
* define local data
  DATA:
    ls_doc    TYPE ty_s_doc.
  LOOP AT gt_doc INTO ls_doc
                 WHERE ( ref_guid = us_doc-guid )
                 AND   ( deleted = abap_false ).
    PERFORM delete_doc
                   USING ls_doc.
  ENDLOOP.
  IF ( syst-subrc NE 0 ).
    us_doc-deleted = abap_true.
    MODIFY gt_doc FROM us_doc
        TRANSPORTING deleted
      WHERE ( guid = us_doc-guid ).
    WRITE: / us_doc-guid, us_doc-text+0(15), us_doc-ref_guid.
  ENDIF.
ENDFORM.                    " delete_doc
*&      Form  WRITE_DOCS
*       text
*  -->  p1        text
*  <--  p2        text
FORM write_docs .
* define local data
  DATA:
    ls_doc    TYPE ty_s_doc.
  LOOP AT gt_doc INTO ls_doc.
    WRITE: / ls_doc-guid, ls_doc-text+0(15), ls_doc-ref_guid.
  ENDLOOP.
  SKIP.
ENDFORM.                    " WRITE_DOCS
Regards
  Uwe

Similar Messages

  • CRM_ORDER_DELETE does not delete salesorders with follow-up documents

    Hi All,
    in my CRM 5.2 i have to delte many sales orders exchanged in past from R/3 to CRM via middleware.
    There is report CRM_ORDER_DELETE to delete sales document filtering with transacion type and sales order code, and it is ok;
    but the problem is all the sales orders that have one or more follow-up documents (visbile in CRMD_ORDER transaction) are not deleted by the program and the message is as follow:
    The following document could not be deleted:                 8101167607
    Object ORDERADM_I cannot be deleted
    Number of documents deleted:                                      0
    Number of documents not deleted:                                1
    How can I delete them ?
    Thanks and Regards,

    Hi
    you should in first iteration delete last documents from documents' flows,
    and later your sales orders.
    You cannot delete documents that are in the middle or beginning of doc flow.
    Regards
    Radek

  • Deleting Limit Items on PO even though follow on documents exist

    Dear SRM Experts
    I am hoping someone can explain the below behaviour:
    Where PO's have follows on documents i.e. confirmation and /or invoice you cannot delete PO's items on a PO. This makes sense.
    However we also have PO's with Limit items(created via limit type shopping carts) and even though the PO's have been confirmed and invoiced we can still delete the items on the PO. Is this standard behavior or a bug?
    Why then can you not delete normal items but can delete limit type items where follow on documents have been posted for a PO?
    Thanks
    Nishad.

    Hi
    Which SRM version are you using ?
    Incase of Limit Items, it is a bug.
    We have raised a similar issue with SAP some time back and still waiting for SAP to get back on this.
    Hope this will help.
    Please reward suitable points.
    Regards
    - Atul

  • Delete SC line item when a follow-on document is created

    Hi
    We are working in a classic scenario.
    When a shopping cart is created from a catalog, it automatically creates a Purchase order in ECC.
    However, users are able to delete the line items of the cart when a follow-on document is created and vendor is ready to supply the material.
    How to restrict the users deleting the SC line items?
    PV.

    Hi Azad,
    Thanks for your quick reply.
    We are on to SRM5.0 (SRMSERVER 550 SP11).
    Even though it is standard functionality, still it is behaving the way explained.
    Tried to look for OSS notes and could not find one for my version. We may take up with SAP.
    Meanwhile, as this is causing lot of problem to business, I may have to achieve this by any means.
    Please throw your tips.
    pv

  • Shoping cart deletion when follow-on document deleted

    Hi Experts,
    it is not possible to delete a SC when the follow-on is deleted - the deletion button is deactivated. The SC is in status I1115 Follow-on Document Deleted, is there any way we can delete the SC?
    Thanks for your help.
    Tomas

    It should be not possible to delete SC when there was a follow on
    document was created in the backend, even if the PO was deleted.
    Because of  performance reasons and because the items on one SC can
    result in different backend purchase orders this is standard behavior.
    Is possible that when you delete the follow on document the SC goes to
    the sourcing.
    You should be able to delete a SC where no follow on object was created
    in the backend.

  • SC not  in the sourcing cockpit after the follow-on document is deleted

    HI,
        In  sourcing cockpit ,  I created a contract by SC , but  I  deleted the contract , the SC didn't appear in sourcing cockpit.  the SOURCE_REL_IND  still is 'Y',    I have no way to create new contract by the SC .
       I don't know if it is the standard functionatity,  It seem to be not reasonable.
      Please tell me the solution  that SC can be back to sourcing cockpit  automatiocally.
      even if I  carry out the BBP_GET_STATUS_2.  it  still don't  work.
       Thanks a lot.
      Jesse

    Hi
    the rule is below
    sc created 2 qty  -- PO created 2 qty -PO deleted - now order quantity and PO quantity difference is there so now SC comes to cockpit and this shopping cart item  needs to sourced and PO needs be created.
    i did not test below scenario.
    SC CREATED - contract or Bid invitation  created and now Contract / bid invitation deleted and now you are expecting this sc item comes to cockpit.
    Note 1068497 - BBPSC04: Incorrect status for items completed in sourcing
    Symptom
    You create a shopping cart which is sent to sourcing cockpit. You create a follow-on document. For eg: Bid invitation. You delete the same and complete the item in sourcing. The status of the item in check status is shown as 'Approved' instead of 'Cannot be ordered'.
    As per the above note sap rule, even though Bid Invitation deleted and reference shopping cart must venture to cockpit to create another follow on document.in your case SOURCE_REL_IND = Y instead of X. What is the item status of  sc after contract / po deleted?

  • Follow on Document details not correct

    Hello Experts,
    We are in SRM 4.0 Classic
    One Shopping Cart has been created with 1Goods and 7 Service line items....
    PR has been created in backend...... (we see generally SC line item 1,2,3.... follow sequece 10,20,30 in PR, But here this order is shuffled.... though all the SC and PR line item details are correct)
    Now for SC line item 2, 'follow on document' tab  shows details of PR line item 40 and vice versa.... which is incorrect....
    Except these two SC line items, all other SC items shows correct PR line item details in follow on document
    Can anyone advise on such system behaviour?  Is thr any way to fix this?
    Thanks,
    Dhananjay

    Hi,
    Did you delete some line items and again added them in your SC? Are you using cost distribution in your SC?
    Regards,
    Nikhil

  • I can't delete a word document by dragging into trash ca.

    I cannot delete a word document by dragging the document into the trash can. No error message pops up.

    Open a terminal window, the type the following 'sudo rm -rf ' and then drop the offending file onto the terminal window. This will place the correct full path to the file into the terminal command. Hit return, type your admin password and the file should delete.

  • I deleted a pages document from iCloud.  how do I get it back?

    How do I recover a pages document that was deleted from icloud?  I don't see a 'trash' folder. I was over eager in deleting my icloud documents to comply with storage. 

    There is no trash folder on icloud.  On the mac, copies of icloud files are stored in the following folder(s)
    ~/Library/Mobile Documents
    Note that Library in the user's home folder is now hidden, so you'll have to set Finder to view hidden files.
    The Mobile Documents folder has subfolders where copies of the doc/data files are stored.
    Now use Time Machine to find versions of the missing file(s).

  • 'Some images are missing because they were deleted from the document'

    Hi,
    I created a document in Pages v5.2 last week and have just opened it and received the following message:
    'Some images are missing because they were deleted from the document'
    When I try and replace the missing images I get the following message:
    'The image "filename" couldn't be inserted.'
    When I try and reimport the original image I get the following message:
    'The image "filename" couldn't be inserted. This image is of an unsupported type.'
    If I try and insert an image that was not in the document before, in the same file format, it goes in fine.
    If I insert the original image into a blank Pages document it goes in no problem.
    I would also like to point out that the data folder still contains lots of versions of images in the document, but does not seem to have any of the ones I am actually using, which I guess is where the problem is. However I have no idea how or why these specific images have been deleted.
    Any light on how this problem has come about, and the best possible way to fix it would be greatly appreciated.
    Alex

    I have Pages v5.2.2 on OS X 10.9.4. I can not reproduce your stated issues with images in this version of Pages. I don't have a solution for you. See my test in the third paragraph. If I were experiencing this behavior, I would perform a Safe Boot to clear out System caches, and try again, before kicking Pages v5+ to the curb.
    The Safe Boot would be pressing and holding the shift key at boot chime, and until a horizontal progress bar shows on the screen. At the eventual login screen, after you type your password — press and hold the shift key — press the right arrow to login, and release the shift key after the Finder menu bar appears. Then reboot normally.
    I have created a new document. Dragged and dropped an image into it and saved. Exited Pages. Reopening worked fine. Deleted the image, and proceeded through the following steps, punctuated by save, exit, reopen, and deliberate image removal. Different .jpg image each time. About mid-way through the following item list, I rebooted the MBA just to throw some "spin" into the process. I did not perform a Safe Boot prior to this series of tests.
    Toolbar > Media insert
    Insert > Choose jpg into document
    Text Box image fill
    Shape image fill

  • Item in Transfer Process  - Follow on documents status not displayed

    Hello experts,
    User created a shopping cart of 12 line items (out of that no 3rd is deleted) and PO is created in backend r/3 system.
    Now when i see the status of my last item ie 12th line item is "Item in Transfer Process". and for 3rd item which is deleted for that also Status shown PO NO (I1113)  i can see that PO no is there when i check follow on document.Problem is i want to change the status of 12th line item with its respective PO no .
    Activity done by me to solve
    If i manually update the status in the table CRM_JEST then the status will get changed but the follow on document is not displayed evenafter  run reports like CLEAN_REQREQ_UP and Get status2. i am trying to run a report BBP_ALERT_SB_NOTTRANSFERED but it got cancelled. even i tried to run a function module BBP_PD_SC_RESUBMIT but short dump will come. i have implemeted a suggested SAP note 729967 but still problem persist.
    In BBP_PD and in table BBP_PDBEI field ( BE_OBJECT_ID ) in this field Ponumber is there against that line item.
    Thanks
    Sunny Sharma

    Hi Sunny,
    the manual action taken on the transfer is dangerous and can cause even more inconsistency.
    Hence you may have changed some tables of the SC manually, I would suggest rather to delete SC items, and create a new SC for them.
    Regards,
    Peter

  • Deleting a recurring document

    I have a recurring document created in the year 2005 which expires in 2008. However, I want to delete this now. I tried it with the Tcode F.56 in the Test Run mode, but it doesnt pick this document up! I read the info on this transaction adn it says, only documents that have the Deletion flag in the Header can be pciked. Where do I check this deletion flag or simply put, how do I delete this document?
    Thanks,
    Tejas

    Hi Tejas...
    You can only delete recurring entry documents that are flagged for deletion. The recurring entry program automatically flags recurring entry documents for deletion if the next run date determined by the program is after the last scheduled run date. The system thereby indicates that the recurring entry document is not to be used again. You can also set the deletion flag yourself in the recurring entry document.
    When you use a run schedule, the program flags a recurring document for deletion if there is no run date in the schedule which is later than the current run date. In this case the program tells you which recurring document has been flagged for deletion. You can remove the deletion indicator from the document if necessary. This may be the case for example, if you have not yet entered all run dates. Make sure you then complete the run schedule.
    Recurring entry documents which are marked for deletion are no longer used by the recurring entry program.
    And the procedure will be as follow....
    To delete recurring entry documents, proceed as follows:
    Select Document -
    > Reference documents -
    > Recurring document ---> Delete from the General Ledger menu.
    Enter the program specifications.
    If required, you can carry out a test run to give you a list of the documents which can be deleted. You can also print the resulting list. Select the Test run field.
    Once you are sure that you want to delete the selected recurring entry documents, deselect the Test run field.
    Select Program -
    > Execute.
    If u satisfied, assing me points...
    Tahnk you
    Dasharathi

  • Shopping cart changeable after follow-on document is created

    Hi,
    Something strange in the production env. I'm on SRM 7.
    I create a shopping cart. It gets automatically approved and creates a PO in the backend.
    After this when i open the shopping cart and click on the 'Edit' button, the system opens the shopping cart in edit mode
    I'm able to save new line items. New lines items are displayed with 'Approved' status
    This is not the right behaviour. Strangely this does not happen in our development system
    Any solution /  notes ?
    Rgds
    Venkat

    Hi
    I think whatever role it may be but system should not allow to edit the shopping cart ITEM after creating follow on docuement.
    What is the item status of shopping cart . Is it follow on document deleted? OR Error in process?
    Muthu
    Edited by: Muthuraman Govindasamy on Dec 31, 2010 6:24 AM

  • Details of Follow-up documents at Table level

    Dear All,
    I want to know if there is any table(s) which contains the follow-up documents numbers that gets generated in CRM.
    For example,
    1. first IC ticket will be generated,
    2. then product complaint will be generated as a follow up transaction of IC ticket.
    3. Compensation request transaction will be generated as a follow up of product complaint.
    I am already able to get this follow up using BAPI but I want to know how to get this at Database level so as to make report to perform faster.
    regards,
    Amey Mogare

    Hi Amey,
    one possibility is to read doc flow using FM 'CRM_DOC_FLOW_READ_DB'.
    If you really want to use the tables, here's the description:
    1. Table 'SRRELROLES' with OBJKEY = GUID of order --> get the ROLE_ID
    2. With ROLE_ID go to table 'CRMD_BINREL' field ROLE_A / B (depends on predecessor / successor)
    3. With the other role ( ROLE_A / B) you can go back to table 'SRRELROLES' and get the GUID by the OBJKEY.
    Hope, this is useful.
    Best regards,
    Claudia

  • Follow-up document in PCUI

    Hi,
    Is it possible to have follow-up document in PCUI?
    We have configured follow-up document for a contract this is not visible in PCUI.
    Is there any config required?
    Thanks
    Kamal

    Hi Kamal
    In some cases like ;; from Lead to Opportunity , you will see create opportunity on the toolbar. but, some cases like custom made transactions you  wont have visibility of these transactions as a follow-up
    for this you will have to add a button to toolbar button, and also the logic behind it. Most of the cases portal guys will do this
    reward points if this works

Maybe you are looking for

  • WebSphere Portal 6.1 SSO problem with Business Objects Release 3 server.

    Have anybody successfully integrated SSO between WebSphere Portal 6.1 BO portlet with Business Object release 3 server ?? If so please help. I have followed the steps in BO documentation (Portal Integration Kit for WebSphere) but when I logged on to

  • Video lagg issues

    I'm not really an expert with after effects. I was able to make my video and render though. Im having lagg issues in cs6 and in my rendered video file. To test if it was the video I used the same footage in iMovie and it worked fine (Mac OS X 10.6.8)

  • SM30 view with join

    Hello. I'm new in this part of abap and would like to know how to do the following: Table 1: Profiles Primary Key: Profile_ID type Profile_ID Datafield: Profile Name Type Char length 50. Table 2: Prof_entries. Primary Key: Entry_ID type NUMC length 5

  • Single Page Continuous Setting

        How do you save this as a permanent setting so that you can scroll quickly as opposed to the slow scrolling which appears to be the default setting?  I am using Acrobay Pro 9.5.5. Every time I select it under View - Page Display it resets when I

  • No forum for iOS SDK accounts. Microsoft Azure found for Blackberry smartphone 03/02/2015

    Edit Does anyone use the Blackberry Link software 1.2.3.48 in any of the Microsoft XP platforms or greater? Looking for iOS application software when the Windows 8 phone is needed. Alas I only have 28 days to find such a telephone as the activation r