cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve attachment file

Former Member
0 Kudos

I am trying to create a program that will retrieve an Attachment that a candidate has uploaded into the eRecruitment system. Infotype HRP5134 has a pointer to the attachment, but where is the attachment stored? Is there a method, function module or BAPI that can retrieve the attachment?

I want to retrieve the file and get the size of the file.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Got the solution and the solution is replied in the thread

Former Member
0 Kudos

Hi,

Check the FM

"BAPI_ERC_READ_ATTACHMENTS"

and "HRRCF_MDL_CAND_ATT_RETRIEVE"

Hope this may help you.

Regards,

Subbu.

Former Member
0 Kudos

Hi Subbu,

Thank u for so prompt reply. FM - HRRCF_MDL_CAND_ATT_RETRIEVE give the link of the URL. Now again my new question how to get the size of the document

Former Member
0 Kudos

Hi Ankit,

I am not sure if my logic will work. But try this.

I believe the attachements from e-Rec would be stored as Archive data in SAP in the Work directory folder.

So Goto OAAd and go for technical search.

Now give Business object = PAPL and Document type = HRIAPPLINT and execute. Try if any of your docs are available.

Hope this helps you.

Regards,

Subbu.

Former Member
0 Kudos

Hi Subbu,

It is not stored in Archive. I got the solution. I just want to share with u. Actually i wanted the size of the documents. I came out with the solution in 2 steps.

1 step. : I retreived all the attached document through function module HRRCF_MDL_CAND_ATT_RETRIEVE (suggested by u).

2 step : i took the URL and used the function module SCMS_HTTP_GET_WITH_URL. this gave me the size of the document in bytes. (thats what i wanted)

Thank you very much for your efforts

Sample code for your knowledge

v_obj-plvar = '01'.

v_obj-otype = 'NA'.

v_obj-objid = '50000020'.

CALL FUNCTION 'HRRCF_MDL_CAND_ATT_RETRIEVE'

EXPORTING

cand_hrobject = v_obj

langu = sy-langu

  • HTTPS =

IMPORTING

records = it_record

messages = it_error .

LOOP AT it_record INTO wa_record.

CALL FUNCTION 'SCMS_HTTP_GET_WITH_URL'

EXPORTING

url = wa_record-attachment_url

  • BLANKSTOCRLF = ' '

IMPORTING

length = length

contenttype = contenttype

mimetype = mimetype

charset = charset

version = version

TABLES

data = data1

EXCEPTIONS

bad_request = 1

unauthorized = 2

not_found = 3

conflict = 4

internal_server_error = 5

error_http = 6

error_url = 7

error_signature = 8

OTHERS = 9

.

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.