Application Development and Automation 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: 
Read only

How to create attachments from an abap program?

Former Member
0 Likes
3,014

I have an abap report that shows material documents.

Now by clicking on a button (at the end of each row), it should allow the user to attach a document.

How to achieve this?

(I tried to see the code behing the Private Objects of a document at FB03 but I could not decipher it much).

Thanks,

Ven..

I have an abap report that shows material documents.

Now by clicking on a button (at the end of each row), it should allow the user to attach a document.

How to achieve this?

(I tried to see the code behing the Private Objects of a document at FB03 but I could not decipher it much).

Thanks,

Ven..

9 REPLIES 9
Read only

andreas_mann3
Active Contributor
0 Likes
2,019

search for fm's with function groups SGOS*

A.

Read only

0 Likes
2,019

This does not help - it tells about adding the attachment to a transaction

I am looking for a similar functionality to include in an abap report..

I found this link after searching with "attachment"

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0e6b0d95-0a01-0010-4696-ca0a48de...

I think this should be the solution for my query..

Read only

0 Likes
2,019

Yeah it does pretty much answers your question ( and mine jaja)...

I think you should set the status of the post as answered ..

Cheers

Read only

0 Likes
2,019

The above link I pasted refers to attachment for the whole report output - rahter at header level.

However..

I need to insert a button per line on the ALV report and when the user clicks on it should display the current list as well as allow him to attach a new document.

How to attach a document at line item level?

Read only

0 Likes
2,019

>

> The above link I pasted refers to attachment for the whole report output - rahter at header level.

>

> However..

>

> I need to insert a button per line on the ALV report and when the user clicks on it should display the current list as well as allow him to attach a new document.

>

>

> How to attach a document at line item level?

If you use GOS to create attachments, the attachments are linked to the key of the business object, so if you define the key as document number concatenated with document line number then the attachment should be attached to that particular line.

Use method START_SERVICE_DIRECT from class CL_GOS_MANAGER together with the appropriate service reference to display / add attachments - search these forums if you need help on how to do this.

Read only

0 Likes
2,019

I tried per the blog above but I am getting short dump in the step CREATE_ATTA (case 3).

SET_HANDLER_HOBJ_NULL dump occurs at

SET HANDLER is_service-service->on_service_canceled FOR me.

The service is getting returned as blank and so the dump seems to be occurs.

Per the above specified blog, What does the screen 100 contain?

Also, there seem to be some differences between 46C and ECC5 versions.

Does anybody have steps for ECC5?

********************************************************************

Resolved this by passing the service as PCATTA_CREA and not CREATE_ATTA..

Read only

0 Likes
2,019

Hello,

Can u share the solution for the query u raised..

Even i have got exact the same requirement...

please do share it...

BHarathi.J

Read only

0 Likes
2,019

CALL METHOD manager->start_service_direct(

EXPORTING

ip_service = 'PCATTA_CREA'

is_object = borident

EXCEPTIONS

no_object = 1

object_invalid = 2

execution_failed = 3

OTHERS = 4 ).

Read only

Former Member
0 Likes
2,019

CONSTANTS : objtype TYPE borident-objtype VALUE 'ZGOS2'.
DATA : manager TYPE REF TO cl_gos_manager,
       obj     TYPE borident,
       gs_lopr TYPE sibflpor.

  

parameter: srlno type matnr.

IF srlno IS NOT INITIAL.
    obj-objtype = objtype.
    obj-objkey  = srlno.

    gs_lopr-instid = srlno .
    gs_lopr-typeid = 'ZGOS2'.
    gs_lopr-catid  = 'BO'.

   AT SELECTION-SCREEN OUTPUT. 

  CREATE OBJECT manager
      EXPORTING
        is_object    = obj
        is_bc_object = gs_lopr
        IP_NO_COMMIT = 'R'      "This is commit document for that material.
      EXCEPTIONS
        OTHERS       = 1.
  ENDIF.

try this it will work