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: 

MIRO - Service for Objects button - attachments for a particular PO

Former Member
0 Kudos
298

Hello everyone,

I have got a requirement to check whether a PO has attachment In MIRO (for a particular PO).

The user will do attachments in tcode ME22N using Service for Objects Button. And when we check the MIRO then the line item checkbox for the particular PO should give a error / warning message that the attachment is not done for the particular PO.

If that PO has attachment already then we dont have to show any error/ warning message.

Now as an abaper, i want to know how to find the attachment document for the particular PO ?

I have checked many codes thro google but nothing helped me in finding the document for the PO.

And even if i find the tables and the joins, is it possible to do this exit / enhancement in MIRO for my requirement?

If anyone got any tables to find the Attachments for the particular PO then please let me know.

Please advice.

Edited by: Ashok Kumar on Jun 9, 2010 2:45 PM

1 REPLY 1

former_member182371
Active Contributor
0 Kudos
48

Hi,

i would try this piece of code in badi INVOICE_UPDATE (method CHANGE_AT_SAVE)


DATA: wa_rseg_new TYPE mrmrseg. "items
CLEAR: wa_rseg_new.
DATA: lt_object  LIKE sibflporb,
      lt_stat    TYPE sgs_t_acnt,
      ls_stat    LIKE LINE OF lt_stat.

LOOP AT ti_rseg_new INTO wa_rseg_new WHERE NOT ebeln IS INITIAL.

CLEAR: lt_object, lt_stat, ls_stat.
REFRESH: lt_stat.

lt_object-instid = wa_rseg_new-ebeln
lt_object-typeid = 'BUS2081'.
lt_object-catid  = 'BO'.

CALL METHOD cl_gos_attachment_query=>count_for_object
  EXPORTING
    is_object = lt_object
    ip_arl    = space
  RECEIVING
    rt_stat   = lt_stat.

LOOP AT lt_stat
  TRANSPORTING NO FIELDS
  WHERE counter > 0.
  EXIT.
ENDLOOP.

IF sy-subrc NE 0.
* If there is no attachment send a message here
  MESSAGE EXXX(zxxx) RAISING error_with_message.
ENDIF.

ENDLOOP.

This is a first approach. I have not tested it on my system but you could give it a try.

Best regards.