Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Making attachment mandatory in services for object button

0 Kudos

Dear Experts,

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

Regards,

Mohammed Samiuddin.

6 REPLIES 6

former_member196651
Contributor
0 Kudos

Hai Mohammed,

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

Regards,

Abijith

Former Member
0 Kudos

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

0 Kudos

Hi Abinath,

In Generic Object Services(GOS) making attachment mandatory.

Regards,

Mohammed Samiuddin.

former_member196651
Contributor
0 Kudos

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

0 Kudos

Dear Experts,

I checked MIGO BADI,but didnt got anything in BADI.

Regards,

Mohammed Samiuddin.

ParagMahajan
Explorer
0 Kudos

Hi,

We are having the same requirement.

Kindly share if anyone has found the solution to make the GOS attachments mandatory at the time of Goods receipt in MIGO transaction.