Skip to Content

Making attachment mandatory in services for object button

Dear Experts,

Please suggest how to make services of object attachment mandatory in MIGO.

Regards,

Mohammed Samiuddin.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Dec 23, 2014 at 06:22 AM

    Hai Mohammed,

    Are you asking about attaching objects through the Generic Object Services(GOS)? Can you please clarify on this?

    Regards,

    Abijith

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2014 at 06:36 AM

    Hi,

    As per my understanding the document attachment to a particular MIGO document can only be verified after the MIGO commit work is done in the backend so as to have the link between the attached document and the generated MIGO number.

    Regards,

    Aashika Agarwal

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 07:51 AM

    Hi Abinath,

    In Generic Object Services(GOS) making attachment mandatory.

    Regards,

    Mohammed Samiuddin.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 09:52 AM

    Hai Mohammed,

    You can check the attachment to a MIGO document by using the following piece of code. You need to check for the attachments before saving the MIGO document using a proper BAdI implementation. I was having the same requirement for PO under approval. So I used the code with the business object of the PO.

    DATA : wa_lpor              TYPE sibflporb.           "Buseinss object key

    DATA : gt_relat             TYPE obl_t_relt,          "For attachment type selection

                wa_relat             LIKE LINE OF gt_relat.

    DATA : gt_links             TYPE obl_t_link,          "To read links

                wa_links             LIKE LINE OF gt_links.

    DATA : lo_root              TYPE REF TO cx_root.

    DATA : wa_folder_id         TYPE soodk,

                wa_object_id         TYPE soodk,

                wa_document_id       TYPE sofmk,

                wa_sood              TYPE sood.

    *Set buseinss object key

      wa_lpor-instid   = docno.

      wa_lpor-typeid  = 'BUS2017'.

      wa_lpor-catid    = 'BO'.

    *For getting notes/attachments

      wa_relat-sign     = 'I'.

      wa_relat-option  = 'EQ'.

    *  wa_relat-low     = 'NOTE'.        "For notes

      wa_relat-low      = 'ATTA'.     "For Attachements

      APPEND wa_relat TO gt_relat.

      TRY.

          CALL METHOD cl_binary_relation=>read_links

             EXPORTING

                is_object           = wa_lpor

                it_relation_options = gt_relat

             IMPORTING

                et_links            = gt_links.

         CATCH cx_obl_parameter_error .

         CATCH cx_obl_internal_error .

         CATCH cx_obl_model_error .

      ENDTRY.

    *Check for attachment

      IF gt_links IS NOT INITIAL.

         LOOP AT gt_links INTO wa_links.

           CLEAR : wa_sood, wa_document_id, wa_folder_id, wa_object_id.

           wa_document_id = wa_links-instid_b.

           wa_folder_id-objtp = wa_document_id-foltp.

           wa_folder_id-objyr = wa_document_id-folyr.

           wa_folder_id-objno = wa_document_id-folno.

           wa_object_id-objtp = wa_document_id-doctp.

           wa_object_id-objyr = wa_document_id-docyr.

           wa_object_id-objno = wa_document_id-docno.

           "Getting details about attachment

           SELECT SINGLE * FROM sood INTO wa_sood

              WHERE objtp = wa_document_id-doctp AND objyr = wa_document_id-docyr

                            AND objno = wa_document_id-docno.

           IF sy-subrc = 0.

           ENDIF.

        ENDLOOP.

      ENDIF.

    If you are getting SOOD table entry means, attachment is there. Otherwise trigger an appropriate error message.

    Regards,

    Abijith

    Add comment
    10|10000 characters needed characters exceeded