How To Attach A File To A FI Document

REPORT  zdummy_create_fi_attachment.

 
 

DATA:

  go_doc TYPE REF TO cl_gos_document_service,

  gf_obj TYPE borident,

  gv_att TYPE swo_typeid.

 
 

PARAMETERS:

  p_bukrs TYPE bkpf-bukrs OBLIGATORY,

  p_belnr TYPE bkpf-belnr OBLIGATORY,

  p_gjahr TYPE bkpf-gjahr OBLIGATORY.

 
 

START-OF-SELECTION.

 
 

  CONCATENATE

    p_bukrs

    p_belnr

    p_gjahr

  INTO gf_obj-objkey.

 
 

  gf_obj-objtype = ‘BKPF’.

 
 

  CREATE OBJECT go_doc.

 
 

  CALL METHOD go_doc->create_attachment

    EXPORTING

      is_object     = gf_obj

    IMPORTING

      ep_attachment = gv_att.

 
 

  IF gv_att IS INITIAL.

    WRITE:/ ‘ERROR’.

  ELSE.

    WRITE:/ ‘SUCCESS’.

    COMMIT WORK AND WAIT.

  ENDIF.

 
 

ENDOF-SELECTION.

One thought on “How To Attach A File To A FI Document

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s