Ниже небольшая программка на ABAP для массовой загрузки файлов в GOS (Generic Object Service) хранилище. Это когда в PA30 вверху можно нажать кнопочку и “Создать приложение”.

На вход подается текстовый файл с разделителем табуляции из двух колонок: табельный номер и путь к файлу. Запускаете и система скармливает файл каждому табельному номеру.

Исходник мой частично – кусочки утащил из сети разных авторов, допилил, поэтому на 100% авторские права не претендую.

*&---------------------------------------------------------------------*
*& Report  ZHR_GOS_UPLOAD
*&
*&---------------------------------------------------------------------

report zhr_gos_upload.

parameters: p_list type string,
            p_descr(50) type c lower case OBLIGATORY.


types: begin of zlocal,
  pernr like p0000-pernr,
  fname type string,
end of zlocal.

data: lt_items type table of zlocal.
data: ls_item type zlocal.

data: p_pernr like bapiempl-pernr.
data: p_fname type string.

data: git_path type table of sood6.
data: g_folderid type soodk.
data: g_filename type string.

start-of-selection.

* Read all pernr and files
  call function 'GUI_UPLOAD'
    exporting
      filename            = p_list
      has_field_separator = 'X'
      filetype            = 'ASC'
    tables
      data_tab            = lt_items.

  loop at lt_items into ls_item.
    write: / 'Working on ', ls_item-pernr.

    call function 'SO_FOLDER_ROOT_ID_GET'
      exporting
        region    = 'B'
      importing
        folder_id = g_folderid.
    if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.


*2. Insert the object
    data: g_docdata like sodocchgi1.
    data: g_extension type soodk-objtp.
    data: git_objhdr  type table of solisti1 with header line,
          git_objcont type table of solisti1 with header line,
          git_hexcont type table of solix with header line,
          g_docinfo   type sofolenti1.

    data: g_path type string.
    data: doc_size type i.

*2.1  Read file
    g_filename = ls_item-fname.
    perform load_local_file tables git_hexcont   "git_objcont
                          changing g_filename
                                   g_extension
                                   doc_size.
    g_docdata-doc_size = doc_size.
    g_docdata-obj_name  = 'MESSAGE'.
    g_docdata-obj_descr = p_descr.
    g_docdata-obj_langu = 'RU'.

    concatenate '&SO_FILENAME=' g_filename into git_objhdr-line.
    append git_objhdr.

    git_objhdr-line = '&SO_FORMAT=BIN'.
    append git_objhdr.

    call function 'SO_DOCUMENT_INSERT_API1'
      exporting
        folder_id                  = g_folderid
        document_data              = g_docdata
        document_type              = g_extension
      importing
        document_info              = g_docinfo
      tables
        object_header              = git_objhdr
*       object_content             = git_objcont
        contents_hex               = git_hexcont
*       OBJECT_PARA                =
*       OBJECT_PARB                =
      exceptions
        folder_not_exist           = 1
        document_type_not_exist    = 2
        operation_no_authorization = 3
        parameter_error            = 4
        x_error                    = 5
        enqueue_error              = 6
        others                     = 7.
    if sy-subrc <> 0.
      write:/ 'SO_DOCUMENT_INSERT_API1 SY-SUBRC = ', sy-subrc.
    endif.

*3. Create binary relation
    data: g_bizojb     type borident,
          g_attachment type borident.

* Object key = personnel number + trip number
    g_bizojb-objkey = ls_item-pernr.
    g_bizojb-objtype = 'BUS1065'.

*Attachment folder id is in g_docinfo
    g_attachment-objkey  = g_docinfo-doc_id.
    g_attachment-objtype = 'MESSAGE'.

    call function 'BINARY_RELATION_CREATE'
      exporting
        obj_rolea    = g_bizojb
        obj_roleb    = g_attachment
        relationtype = 'ATTA'.

    if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.


*4. Commit

    commit work.
  endloop.
*&---------------------------------------------------------------------*
*&      Form  LOAD_LOCAL_FILE
*&---------------------------------------------------------------------*
form load_local_file tables ot_filetable
                   changing o_filename type string
                            o_extension type soodk-objtp
                            doc_size type i.

  data: l_name type string.

  split o_filename at '.' into l_name o_extension.

  call function 'GUI_UPLOAD'
    exporting
      filename   = o_filename
      filetype   = 'BIN'
    importing
      filelength = doc_size
    tables
      data_tab   = ot_filetable.
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.


*
endform.