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: 

How to get PO attachments?

Former Member
0 Kudos

Hi ,

My requirement is to get the attachments of PO and send them via email .

I am looking for a FM which gets me the attachments in a PO (we can view attachments in PO display transaction ME23n. Select line item and click on button which has attachment icon. This will take you to the document display screen. You can also check your attachments through CV03n transaction. This is document display tcode in DMS.) .

My search in the forum says BDS_GOS_CONNECTIONS_GET can be used to get attchment list but it i don't get results in my system .

And FM BDS_BUSINESSDOCUMENT_GET_TAB which gets attchements

my importing values

LOGICAL_SYSTEM CSC_D20130

CLASSNAME Z2BUS2012

CLASSTYPE BO

CLIENT 130

OBJECT_KEY 1430000581

BINARY_FLAG X

TEXT_AS_STREAM X

still no result . Did I miss something or any config required ?

Please help

Rhea.

10 REPLIES 10

kesavadas_thekkillath
Active Contributor
0 Kudos

Check with CV120_DOC_CHECKOUT.

Kesav

GrahamRobbo
Active Contributor

Hi Rhea,

the method cl_binary_relation=>read_links will give you the list you are after.

Cheers

Graham Robbo

0 Kudos

Graham ,

I see that CALL METHOD cl_binary_relation=>read_links_of_binrels is called in BDS_GOS_CONNECTIONS_GET fm but lt_links is empty .

Any idea.

Rhea.

0 Kudos

Did you check the function I have mentioned , initially do a select from DRAW and pass the values to the function. The content will be available in the return table.Search in SCN for more information about the function

0 Kudos

Keshav , I am checking it .

Rhea.

0 Kudos

Kesav ,

The tables this fm fetches doesn't have data for these docs.

Rhea.

0 Kudos

Have a look here for the usage of CV120_DOC_CHECKOUT. it also uses CV120_GET_APPL_TYPE. You can check the content.

0 Kudos

The method I mentioned was cl_binary_relation=>read_links not cl_binary_relation=>read_links_of_binrels. It works fine for me. Not sure what else to suggest. Are you sure you are passing the correct details? Are you sure your PO actually has attachments?

Cheers

Graham Robbo

gokul_radhakrishnan3
Active Participant

Rhea,

I guess, a sample code will help you here. And as you rightly mentioned, use cl_binary_relation=>read_links_of_binrel for this.

Try something like this.

gs_lporb-instid = 'Your PO number'.

gs_lporb-typeid = 'BUS2012'.

gs_lporb-catid = 'BO'.

CALL METHOD cl_binary_relation=>read_links_of_binrel

EXPORTING

is_object = gs_lporb

ip_relation = 'ATTA'

ip_role = 'GOSAPPLOBJ'

IMPORTING

et_links = lt_links.

if you want to check what you have to pass in ip_relation, check table MDOBLREL and field RELTYPE_O.

If you want to read the attachment by using function module SO_OBJECT_READ, you can do that by using lt_links-instid_b. By splitting it 17 characters in to folder_id & object_id (two parameters you required to read it in that function module).

Regards,

Gokul

Karthik_Deva
Newcomer
0 Kudos

Hi Rhea,

I have the same requirement, To send the PO attachments via mail. Which approach you used for this. 

Kindly share some sample code if possible