Delete the attachments in Service orders

Hi Guys,
I am developing a report, which it needs to be delete the attachments from the CRM service order, could you please suggest, is any FM/BAPI for the same.
Thanks,
Gourisankar.

Hi,
User below code, it will work.
REPORT zcrm_service_order_delet_attch.
TABLES
TABLES:crmd_orderadm_h.
                           TYPES DECLARATION
TYPES: BEGIN OF t_crmd,
         guid TYPE crmt_object_guid,
         object_id TYPE crmt_object_id_db,
         date TYPE crmt_posting_date,
         object_type TYPE crmt_subobject_category_db,
       END OF t_crmd.
TYPES: BEGIN OF t_crmd_final,
         object_id TYPE crmt_object_id_db,
         date TYPE crmt_posting_date,
         sucess TYPE i,
         failure TYPE i,
         total TYPE i,
       END OF t_crmd_final.
                       Internal Tables                               *
DATA: i_crmd TYPE STANDARD TABLE OF t_crmd,
                w_crmd TYPE t_crmd,
      i_object_no TYPE STANDARD TABLE OF crmt_icss_object_guid,
               w_object_no TYPE crmt_icss_object_guid,
      i_attch TYPE STANDARD TABLE OF crmt_icss_att_info,
                w_attch TYPE crmt_icss_att_info,
      i_crmd_final TYPE STANDARD TABLE OF t_crmd_final,
                w_crmd_final TYPE t_crmd_final,
      ls_crmt_object_guid TYPE crmt_object_guid_tab,
      i_return_objects  TYPE crmt_return_objects.
DATA: lt_ios         TYPE skwf_ios.
DATA: ls_io          TYPE skwf_io.
DATA: l_docbusobj    TYPE sibflporb.
DATA: l_sucess       TYPE i.
DATA: l_failure      TYPE i.
DATA: l_tot_final    TYPE i.
DATA: l_lines        TYPE i.
                       CONSTANTS                                     *
CONSTANTS:
c_typeid(10)     TYPE c VALUE 'BUS2000116',
c_catid(2)       TYPE c VALUE 'BO',
c_object_type(1) TYPE c VALUE 'P'.
Selection-Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s01.
SELECT-OPTIONS: so_date FOR crmd_orderadm_h-posting_date OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
Start-of-selection
START-OF-SELECTION.
  PERFORM getdata.
  PERFORM delete_attach_save_order.
  PERFORM display_output.
write: u_line(100)
skip.
  WRITE: /05 'Total number of attachments deleted',
          75  l_tot_final.
*&      Form  getdata
FORM getdata .
  SELECT guid
         object_id
         posting_date
         object_type INTO TABLE i_crmd
                             FROM crmd_orderadm_h
                             WHERE posting_date IN so_date.
ENDFORM.                    " getdata
*&      Form  delete_attach_save_order
FORM delete_attach_save_order .
*Fetching the attachments for GUID.
  LOOP AT i_crmd INTO w_crmd.
    CLEAR: i_attch, i_object_no.
    MOVE: w_crmd-guid TO w_object_no-object_guid.
    APPEND w_object_no TO i_object_no.
    CALL FUNCTION 'CRM_ICSS_GET_ATTACHMENTS'
      TABLES
        it_object_guid     = i_object_no
        et_attachment_list = i_attch.
*Deleting the attachment for GUID.
    DESCRIBE TABLE i_attch LINES l_lines.
    LOOP AT i_attch INTO w_attch.
      l_docbusobj-instid = w_crmd-guid.
      l_docbusobj-typeid = c_typeid.              "'BUS2000116'.
      l_docbusobj-catid  = c_catid.                "'BO'.
      ls_io-objtype = c_object_type.              "'P'.
      ls_io-class   = w_attch-att_class.          "'CRM_P_ORD'.
      ls_io-objid   = w_attch-objkey.
      APPEND ls_io TO lt_ios.
      CALL METHOD cl_crm_documents=>delete
        EXPORTING
          business_object = l_docbusobj
          ios             = lt_ios.
      IF sy-subrc = 0.
        l_sucess = l_sucess + 1.
      ENDIF.
*Saved the service order after deleting the attachment.
      APPEND w_crmd-guid TO ls_crmt_object_guid.
      CALL FUNCTION 'CRM_ORDER_SAVE'
        EXPORTING
          it_objects_to_save   = ls_crmt_object_guid
          iv_update_task_local = 'X'
        IMPORTING
          et_saved_objects     = i_return_objects
        EXCEPTIONS
          document_not_saved   = 1
          OTHERS               = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDLOOP.
*Moving the data to inter table to display the output.
    IF l_lines EQ l_sucess.
      MOVE: w_crmd-object_id TO w_crmd_final-object_id.
      MOVE: w_crmd-date TO w_crmd_final-date.
      MOVE: l_sucess    TO w_crmd_final-sucess.
      MOVE: l_failure   TO w_crmd_final-failure.
      MOVE: l_sucess    TO w_crmd_final-total.
      APPEND w_crmd_final TO i_crmd_final.
*Clearing the internal tables and variables.
      CLEAR: i_attch,
             w_crmd,
             l_sucess,
             l_failure,
             ls_crmt_object_guid,
             l_docbusobj,
             lt_ios,
             i_object_no,
             l_lines.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " delete_attach_save_order
*&      Form  Display_output
FORM display_output .
  IF NOT i_crmd_final IS INITIAL.
    WRITE: /5 'Order Number',
           20 'Creation date',
           35 'success Records',
           55 'Fail Records',
           75 'Total Records'.
  ENDIF.
  LOOP AT i_crmd_final INTO w_crmd_final.
    WRITE: /5  w_crmd_final-object_id,
           20 w_crmd_final-date,
           35 w_crmd_final-sucess,
           55 w_crmd_final-failure,
           75 w_crmd_final-total.
    l_tot_final = l_tot_final + w_crmd_final-total.
  ENDLOOP.
  CLEAR : w_crmd_final.
ENDFORM.                    " Display_output

Similar Messages

  • Unable to delete the attachments from the order header or line

    Hi Friends,
    when i am saving any short text message through attachments either on sales order header or line, i am unable to delete the same again.
    i would like to know that is it a indented functionality of oracle or any setup needs to be done?
    Can anyone please look in to this?
    We are using 11.5.10.2

    If the order or line is closed, then you probably can not delete the attachments.
    But if the order line is still open, you should be able to delete attachments.
    If you cannot, it might be because your responsibility has a menu that excludes delete function. Try to use one of the seeded responsibilities (such as Order Management super user).
    Hope this answers your question
    Sandeep Gandhi
    Omkar Technologies Inc.
    Independent Techno-functional Consultant

  • How to delete the attachments of several ancient emails simultaneously?

    In order to diminish the space used by Thunderbird, I'd like to delete the attachments, without deleting the email. How to do this for 50 emails all together? I only found a way to do it one by one, email after email, which takes much time… Thank you!

    Thunderbirds add-ons are platform neutral, so of course it works on OSX. You may however have tried to install it in Firefox which tells you bad things about not installing.
    see http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html

  • I got a new wireless connection for my mac and cannot figure out how to delete the last connection service I had. Everytime I shut the computer, the network goes back to the other one. I cannot find the file ANYWHERE

    got a new wireless connection for my mac and cannot figure out how to delete the last connection service I had. Everytime I shut the computer, the network goes back to the other one. I cannot find the file ANYWHERE

    Under Network Preferences, select the WiFi
    click on "Advanced..." button
    Select the network you want to delete from the list and click on "-"
    Click "Ok"
    Click "Apply"
    Well done ;-)
    You may also want to delete the wireless key from Keychain.
    Open Keychain, seach for the old wifi network name, slect it and click delete

  • How to change the Partner in Service Order

    Dear Experts,
      I am working in SAP CRM 5.0.I want to change the Partners of Service Order Using the Function Module 'BAPI_ACTIVITYCRM_CHANGEMULTI'.Can anyone give me the Sample code for Changing the Partners.It is very Urgent Requirement.Please help me.
    Thanks & Regards,
    Ashok.

    Hi,
        Following is the code for changing partner: Please go through it:
    "fill the details of partner which is
              "to be added as main partner or in place of Interaction Agent
              wa_partner_new-ref_guid = w_guid_ref.
              wa_partner_new-ref_handle = '0000000000'.
              wa_partner_new-ref_kind = 'A'.
              wa_partner_new-kind_of_entry = wa_partner-kind_of_entry.
              wa_partner_new-ref_partner_handle = '0000'.
              wa_partner_new-ref_partner_fct = 'Z_IA'. "
              wa_partner_new-ref_partner_no = wa_partner-partner_no.
              wa_partner_new-ref_no_type = wa_partner-ref_no_type.
              wa_partner_new-ref_display_type = wa_partner-ref_display_type.
              wa_partner_new-display_type = 'BP'.
              wa_partner_new-no_type = 'BP'.
              wa_partner_new-partner_fct = 'Z_IA'.
              wa_partner_new-partner_no = w_partner_no.
              wa_partner_new-mainpartner = 'X'.
              INSERT wa_partner_new INTO TABLE it_partner_new.
              wa_partner_newx-display_type = 'X'.
              wa_partner_newx-no_type = 'X'.
              wa_partner_newx-partner_fct = 'X'.
              wa_partner_newx-partner_no = 'X'.
              wa_partner_newx-mainpartner = 'X'.
              INSERT wa_partner_newx INTO TABLE it_partner_newx.
               IF it_partner_new[] IS NOT INITIAL AND it_partner_newx[] IS NOT INITIAL.
        "maintain all changes to be done
        CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
          TABLES
            partner  = it_partner_new
            partnerx = it_partner_newx.
        CLEAR : wa_guid1.
        REFRESH : it_guid1.
        wa_guid1-guid = w_guid_ref.
        APPEND wa_guid1 TO it_guid1.
        "save the changes
        CALL FUNCTION 'BAPI_ACTIVITYCRM_SAVE'
          TABLES
            objects_to_save = it_guid1.
        "commit the transaction
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    Please reply if anything else os required.
    Please reward points if useful.
    Regards,
    Ashlesha

  • How to manage the operations on service order ?

    Hello,
    Do you know some bapi or MF to manage the operation on service order  (IW32).
    I have to create some operation, and in dialogue mode Iu2019m using 
    "Task list selection,  to reference object."
    But I need to do it by a bapi or MF.
    Tks a lot.
    R.

    Hi,
    Check with the following FM:
      MAINTENANCE_ITEM_POST
    Regards,
    Venkat.

  • I want the t code to see the against which service order payment was done ?

    i want the t code to see the against which service order payment was done ?

    you can use ME2S, but if not what you are looking for then ask ABAP to develop a customized report for service orders only for whom payment is done.
    regards,
    qsm sap

  • Infopath form Restrict users not to delete the attachments uploaded by others

    Hi ,
    Could any one please help me on the below requirement , 
    In infopath form, can we restrict the users to delete the attachments(multiple) which are uploaded by other users and one shold be able to delete the attachments which are uploaded by him/her self,
    Any ideas are highly appricated ,
    ANIL

    Hello,
    This trick will work if you want to do for all users. Somehow you have to store the current user name, who has attached the files then hide show section based on user using conditional formatting.
    Your job can be easy if only one person is uploading file in one form. In that case you can use UserName() function to get current user name and based on this name you can add rule on section.
    But if multiple people are allow to upload file in same form then you are in trouble.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Restrict Deletion of Components from Service Order

    Hello All,
    I noticed that I am able to delete the components from the Components tab of a Service Order even after I have completely issued the components.
    Is there a possible way to prevent deletion of components that have already been issued..?
    I think I can use the Business Transaction RMKL in the system status GMPS. But I guess this will prevent deletion of those components which have not been issued to the service order.
    What would be the best way to prevent deletion of components that have already been issued...?
    Thanks
    Jensibo

    Hello All,
    I don't know if you all received the last reply I posted against this thread... coz I am not able to find it in the thread. I had asked for your comments on any repercussions that may occur because of this config.
    Anyway, the thing is, I followed Narashiman's suggestion and although I did not use the exact config he pointed me to, I used the config in the following nodes:
    1.) Production --> Shop Floor Control --> System Modifications --> Define System Message Attributes
    2.) Production Planning & Process Industries --> Process Order --> System Modifications --> Define System Message Attributes
    and added an entry: Application Area = CN, Message No. = 750-Component & item & was already withdrawn and Category = E.
    Having done this, the system did display the "Component & item & was already withdrawn" message when I tried to delete a component that was issued to a service order, but it did not delete the component from the service order. I was able to save the service order with the issued component still in the components tab.
    Narashiman,
    to specifically respond to your latest reply, I did find the node you pointed me to. But the trouble was that it did not have an entry for CN750 in it. When I tried to add an entry, the system did not let me do so and displayed the error message "Please specify a legal value".
    So I went around opening each system message control node and finally found the two that I mentioned earlier that did work for me.
    Thanks
    Jensi

  • How to prevent the replication of service order from CRM to R/3

    Hi,
    I create a service order and it displays in SMW01. Does it mean that system tries to replicate it from CRM to R/3?  I have deleted the subscription in SMOEAC while publication of BUS_TRANS_MSG can't be deleted. Is there any other configuration affecting the replication from CRM to R/3?
    BR,
    ROBERT

    Hi Robert,
    The replication to R/3 will not happen if you dont have a R/3 site maintained in smoeac. This itself should be enough as it wont know which R/3 should the data be transferred to. Hence the data will not get replicated to R/3.
    The bdoc that you see in SMW01 does not mean that data will get replicated. it just indicates what has been created in CRM.
    Thanks,
    Abishek

  • Attachments in service orders - location

    Hi!
    Is there any way of retrieving the documents attached to service orders in one place?
    Kind regards,
    Borut

    Hi,
    Check the attachment view under service order in web ui, get the detail of bsp component view's.
    In on_new_focus of the attachment view you can find how attachments are stored w.r.t service order ( by looking at the bol relation).
    Once you know the bol relation, you can fire "service order" bol query and get the list of attachments via above relation.
    Cheers,
    Sumit Mittal

  • DNS The Zone cannot be deleted - the active directory service is not available

    Hello TechNet Members,
    As you can see from the Summery, I got this message when I'm trying to delete DNS Zone.
    It's not matter if the DNS Zone newly created or its an Old One.
    After this message the computer is telling you "The Computer is about to make Restart".
    It's so strange and i really don't know what to check first.
    More Information:
    5 Servers that Replicate together.
    The Operation System is Windows Server 2012R2 for all the entire DC's
    1 Domain In the Forest.
    Thanks,

    Hi Jesper,
     DCdiag /fix and no errors in there everything marked as PASSED.
     I did Demotion for one of the DC to troubleshoot, but with no luck i'm back to the same point i started
     I tried to delete the brand new Zone from the commandline using DNScmd it's still not working and the  computer is reboot himslef.
    I've checked the permissions from the ADSIEdit.msc:
    Inherit from MicrosoftDNS section to the ROOT
    DNSAdmins > Full Control
    Domain Admins > Full Control
    From "DNS Server" section at the EventViewer
    The DNS server is waiting for Active Directory Domain Services (AD DS) to signal that the initial synchronization of the directory has been completed. The DNS server service cannot start until the initial synchronization is complete because critical DNS
    data might not yet be replicated onto this domain controller. If events in the AD DS event log indicate that there is a problem with DNS name resolution, consider adding the IP address of another DNS server for this domain to the DNS server list in the Internet
    Protocol properties of this computer. This event will be logged every two minutes until AD DS has signaled that the initial synchronization has successfully completed.
    "The DNS server was unable to complete directory service enumeration of zone TestZone1.  This DNS server is configured to use information obtained from Active Directory for this zone and is unable to load the zone without it.  Check that the Active
    Directory is functioning properly and repeat enumeration of the zone. The extended error debug information (which may be empty) is "". The event data contains the error. "
    The DNS server has encountered a critical error from the Active Directory. Check that the Active Directory is functioning properly. The extended error debug information (which may be empty) is "". The event data contains the error.
    Thanks,

  • Changing & deleting the SNP PDS planned order in APO using BAPI

    Hi,
    There is a requirement to consolidate the SNP PDS planned order created from CTM in APO. This is to change one of the SNP PDS planned order by adding the quantities of the other planned order , which is to make it into one & delete the other SNP PDS planned order. Can this be done progrmatically using BAPI?. As we know this cant be changed in RRP3 as the SNP-PDS are uneditable.Please help me on this one. As I need the solution to this ASAP.
    Is there any BAPI/FM using which SNP PDS planned order can be changed? What is the BAPI for PPDS planned order creation / change?
    With thanks & regards,
    Naveen
    Message was edited by: Naveen Srinivasa

    Hi Mariano,
    I have gone through the description of the FM it says:
    This function module is complex and is subject to several technical restrictions. For this reason, you should not use ORDER_CHANGE for extended periods of time.
    The recommended alternatives are:
    OM_ORDER_CREATE
    for creating orders
    OM_ORDER_DELETE
    for deleting orders
    OM_ORDER_MODIFY
    for changing existing order components
    Have you used these FM any time?.Kindly share more details in case is you have used them.
    with thanks & regards,
    Naveen

  • Is it possible to delete the item in sales order .

    Hi
    I have 5 items in the sales order , 
    The delivery and billing is over .
    But the one line item still shows the open status .
    Is it possible to delete that  item in the order ?
    Thanks,
    Phani

    Hi Phani,
    Is the Line Item that you want to Delete is not delivered or not Invoiced Yet?
    If you haven't done any subsequent processing with that line item, yes you can delete that line item from the sales order. result is you will not see that Line Item number again in the sales order. Even if you look at the sales order line item table, you cannot see that LI number.
    Eg:
    If you have 5 line items, 10, 20, 30, 40 & 50, you have NOT DONE delivery billing to any line item (Say 30), you can delete that line item without any issue by selecting DELETE ITEM option in the sales order /Item Overview tab.
    Prime Requirement for Deletion: No Delivery billing should be done
    If you have partially delivered and / or billed, in that case you cannot use that option.
    Then you have another option to close that line.
    Go to Line item & select a "Rejection Reason" there. Though you have partially delivered & invoiced, now your line item is closed. It won't appear in you MRP also.
    Eg: If you have 100 quantity in the line item, and you have delivered 80. and customer don't want any deliveries again, In that case you can do this.
    Best thing is create a new Rejection Reason as "Complete".
    Then assign that  "Complete" rejection reason, for this type of scenarios.
    Best regards,
    Anupa

  • How to get the Attachment ID for Service order in CRM

    Hi Guys,
    I need to delete the attachments in Service order; can I use the FM CRM_ICSS_DEL_ATTACH_OF_OBJECT?
    This FM required in Attachment ID as input, could you please any one help me.
    Thanks,
    Gourisankar.

    I have never used this function module before, but looking at the coding, I don't think this will serve your purpose.
    I think it might be better to use method(s) from class CL_CRM_DOCUMENTS.
    Via the GET_INFO method you can retrieve the documents you need and using the DELETE method should delete these object. I did use the GET_INFO method etc. but we haven't deleted any objects. But according to the name of the method, it should DELETE the documents.

Maybe you are looking for

  • Networking with window 7 computer

    Cannot get my MAcBook Pro to see another laptop running windows 7. That computer can see and access my computer. How do I add him to my network? My computer can see another machine which we have that runs XP.

  • 802.1x / dot1x Authentication, including Voice-Vlan and Guest-Vlan

    Hello, i have tried to configure a dot1x based Authentication. With an single host including guest-vlan, everything works fine. But i want to use an IP-Phone (wich is every times authenticated) and behind the Phone an Client. Is there a possible solu

  • Firefox being slow when using Flash

    When using Flash in Firefox its becoming very slow or unresponsive. Could this because of to many addons ? if not is there any other reason ? == URL of affected sites == http://

  • Premier Pro CC Feature Request: Automatic Window Selection

    I wanted to see if anyone else would like this feature.  It's not due to a major issue, just a minor but constant annoyance. So when I started working with 60fps footage, I realized that automatic dissolve transitions (by pressing Ctrl+D) were set at

  • "What You Hear" Not work

    Alright so I know how "What You Hear" is supposed to work, but sometimes it doesn't.. Sometimes rebooting the PC helps, sometimes it doesn't it's very odd. I have what you hear selected, and I have Music playing through WAVE, I'm saying stuff on the