Skip to Content

Attach multiple files in GOS


When using the GOS Class the user can Attach documents one by one. But is it possible to let the user Attach multiple files in one step (by selecting multiple files with SHIFT or CTRL button upon file selection)?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Mar 19, 2013 at 12:54 AM


    Are you trying to do this via a program, or via the GOS GUI interface?

    If via a program, which class/method are you currently using?

    I'm not sure what you mean by 'the GOS class'.



    Add comment
    10|10000 characters needed characters exceeded

    • Hi

      Sorry: i´m using the Class in a customer program. Just as standard behavior. But when we select the create document function we only have the possibility to select 1 file at a time - the users wants to select multible files.

      But if it´s not possible i will develop my own function.

  • Mar 19, 2013 at 01:57 AM


    Unfortunately the Services for Object icon can only be provided when the application which is calling it is not run in the batch input mode. The reason or this is explained in SAP note 569421: the use of a GUI control is not permitted in batch input.



    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      If the standard option doesnot cater your requirement,you can disable the existing create attachment option, add your own attachment option to the GOS menu using and handle it by redifining the method execute

      Now, select multiple files using CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG, then perform the below logic( its just few parts of the code, I hope you will understand it )

      Loop at you file names and call as below,

        INCLUDE cntn01_swc.  TYPES: BEGIN OF ty_message_key,
      foltp TYPE so_fol_tp,
      folyr TYPE so_fol_yr,
      folno TYPE so_fol_no,
      doctp TYPE so_doc_tp,
      docyr TYPE so_doc_yr,
      docno TYPE so_doc_no,
      fortp TYPE so_for_tp,
      foryr TYPE so_for_yr,
      forno TYPE so_for_no,
      END OF ty_message_key. DATA:lv_xfname TYPE string,
      lv_xdoctype TYPE sofm-doctp,
      lv_xfile_lines TYPE i,
      lv_reltype TYPE oblreltype,
      ls_bin_content TYPE soli-line,
      lv_xmessage TYPE swc0_object,
      ls_xmessage_key TYPE ty_message_key,
      ls_key TYPE /acccpt/accr_itm_key,
      lv_xdoctitle TYPE string. DATA:lv_ename TYPE char255,
      lv_ext TYPE char255. DATA:lv_xobject_b TYPE borident,
      lv_xobject_a TYPE borident."Select Files, then
      file_ext = lv_xtention
      query = 'CREA'
      file_type = lv_file_type
      x_error = 1
      OTHERS = 2.
      IF sy-subrc = 0.
      lv_f_type = lv_file_type.
      lv_f_type = 'BIN'.
      filename = lv_file_full
      filetype = lv_f_type
      filelength = lv_file_length
      data_tab = lt_doc_content
      OTHERS = 17.
      IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING failed.
      ENDIF. lv_xfname = lv_ename.
      lv_xdoctype = lv_ext. TRANSLATE lv_xdoctype TO UPPER CASE.
      lv_xdoctitle = lv_xfname. swc0_create_object lv_xmessage 'MESSAGE' ls_xmessage_key. "<--GOS object Key
      swc0_set_element lcl_swc=>swo_container 'DOCUMENTTITLE' lv_xfname.
      swc0_set_element lcl_swc=>swo_container 'DOCUMENTLANGU' 'E'.
      swc0_set_element lcl_swc=>swo_container 'NO_DIALOG' 'X'.
      swc0_set_element lcl_swc=>swo_container 'DOCUMENTNAME' 'MESSAGE'.
      swc0_set_element lcl_swc=>swo_container 'DOCUMENTTYPE' lv_xdoctype.
      swc0_set_table lcl_swc=>swo_container 'DocumentContent' it_bin_content.
      swc0_set_element lcl_swc=>swo_container 'DOCUMENTSIZE' iv_file_length .
      swc0_refresh_object lv_xmessage.
      swc0_call_method lv_xmessage 'CREATE' lcl_swc=>swo_container.
      swc0_get_object_key lv_xmessage ls_xmessage_key. lv_xobject_a-objtype = c_gos_object. lv_xobject_b-objkey = ls_xmessage_key.
      lv_xobject_b-objtype = 'MESSAGE'. CALL FUNCTION 'BINARY_RELATION_CREATE'
      obj_rolea = lv_xobject_a
      obj_roleb = lv_xobject_b
      relationtype = c_gos_relat_type
      OTHERS = 1.