Idoc importieren

Hier ein kleines Bsp. Programm, um ein Idoc vom Front-End zu importieren.

Format ORDERS

report zbc_idoc_import.

data lt_files type table of edi_path.
data lv_date type sydatum.

parameters: p_path type edi_pthnam obligatory.
parameters: p_mestyp type edipmestyp obligatory default 'ORDERS'.
parameters: p_port type edi_pvrcvp obligatory.
select-options: so_date for syst-datum default sy-datum.

class application definition create private.
  public section.
    class-methods run.
    class-methods get_files.
    class-methods call_rseinb00
      changing
        c_path type edi_pthnam.
endclass.
class application implementation.
  method run.
    application=>get_files( ).

    loop at lt_files assigning field-symbol(<file>).

      application=>call_rseinb00( changing c_path = <file>-pthnam ).
    endloop.

  endmethod.

  method get_files.
    data dir_name type eps2filnam.
    data dir_list type standard table of eps2fili.

    dir_name = p_path.

    call function 'EPS2_GET_DIRECTORY_LISTING'
      exporting
        iv_dir_name = dir_name
      tables
        dir_list    = dir_list
      exceptions
        others      = 8.

    if sy-subrc <> 0.
      return.
    endif.

    loop at dir_list assigning field-symbol(<entry>).
      find  p_mestyp in <entry>-name.
      if sy-subrc is initial.
        call function 'CONVERT_DATE_TO_INTERNAL'
          exporting
            date_external            = <entry>-mtim(10)
          importing
            date_internal            = lv_date
          exceptions
            date_external_is_invalid = 1
            others                   = 2.
        if lv_date in so_date.
          append initial line to lt_files assigning field-symbol(<file>).
          concatenate p_path '\' <entry>-name into <file>-pthnam.
        endif.
      endif.
    endloop.
  endmethod.

  method call_rseinb00.

    submit rseinb00 and return
      with p_file = c_path
      with p_port = p_port.

  endmethod.

endclass.

start-of-selection.
  application=>run( ).