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

Attachment in Report Program

Former Member
0 Likes
967

Hi,

I tried some development to attach a document in a report program.

I'm able to create and view the attachment but the attachment is not saved.

Once I'm out and in back to the report program, the previously created attach does not exists.

Please let me know, if I missed anything. Thanks

****CODES

CONSTANTS: OBJTYPE TYPE BORIDENT-OBJTYPE VALUE 'ZGOS1'.

DATA: MANAGER TYPE REF TO CL_GOS_MANAGER,

OBJ TYPE BORIDENT.

data:

l_objkey type swo_typeid,

lo_gos_service type ref to cl_gos_document_service,

ls_srgbtbrel type srgbtbrel,

lt_srgbtbrel type srgbtbrel occurs 10.

PARAMETERS: MATNR TYPE MARA-MATNR.

AT SELECTION-SCREEN OUTPUT.

CLEAR : OBJ.

  • SET OBJECT TYPE TO 'ZGOS'.

OBJ-OBJTYPE = OBJTYPE.

  • SET OBJECT KEY = REPORT NAME

SELECT SINGLE NAME FROM TRDIR

INTO OBJ-OBJKEY WHERE NAME = SY-REPID.

*CALL GOS MANAGER WITHOUT CONTAINER (WILL BE DISPLAYED IN THE TOOLBAR)

CREATE OBJECT MANAGER

EXPORTING

IS_OBJECT = OBJ

EXCEPTIONS

OTHERS = 1.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
783

HI,

Check after giving this..

'COMMIT WORK'

or

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT.

Regards

Surya.

5 REPLIES 5
Read only

Sandra_Rossi
Active Contributor
0 Likes
783

You must use a COMMIT WORK somewhere to commit the attachment creation.

Read only

Clemenss
Active Contributor
0 Likes
783

Hi gold.member,

except from the missing COMMIT WORK please post your code and mark it as code with the above <_> button:

CONSTANTS: objtype TYPE borident-objtype VALUE 'ZGOS1'.

  DATA: manager TYPE REF TO cl_gos_manager,
    obj TYPE borident.

  DATA:
    l_objkey TYPE swo_typeid,
    lo_gos_service TYPE REF TO cl_gos_document_service,
    ls_srgbtbrel TYPE srgbtbrel,
    lt_srgbtbrel TYPE srgbtbrel OCCURS 10.

  PARAMETERS: matnr TYPE mara-matnr.

AT SELECTION-SCREEN OUTPUT.

  CLEAR : obj.

* SET OBJECT TYPE TO 'ZGOS'.
  obj-objtype = objtype.
* SET OBJECT KEY = REPORT NAME
  SELECT SINGLE name FROM trdir
  INTO obj-objkey WHERE name = sy-repid.

*CALL GOS MANAGER WITHOUT CONTAINER (WILL BE DISPLAYED IN THE TOOLBAR)
  CREATE OBJECT manager
    EXPORTING
      is_object = obj
    EXCEPTIONS
      OTHERS    = 1.

You can try the PREVIEW button to see the posting result. This helps.

Kind regards,

Clemens

Read only

Former Member
0 Likes
784

HI,

Check after giving this..

'COMMIT WORK'

or

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT.

Regards

Surya.

Read only

Former Member
0 Likes
783

Solved via CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

Read only

0 Likes
783

You could have passed ip_no_commit = 'X' or 'R' instead.

CREATE OBJECT manager

EXPORTING

is_object = obj

ip_no_commit = 'R'.

regards,

Aabhas