[ABAP]SMW0 데이터 다운로드

SAPWISE·2024년 3월 25일
  data : lv_filename type string,
        lv_path type string,
        lv_fullpath type string,
        lv_file type string,
        lv_default type string.

  data : ls_key type wwwdatatab,
        lv_dest type rlgrap-filename value 'C:\'.

  data : p_ext type string,
        p_path_file type string,
        lv_rc type sy-subrc.

  "SMWO KEY 가져오기
  select single *
    into corresponding fields of ls_key
    from wwwdata
    where objid = '오트젝트 ID'.

  "다운로드 위치
  call method cl_gui_frontend_services=>file_save_dialog
    exporting
      window_title      = 'Select Download File'
      default_extension = 'XLSX'  "확장자
      default_file_name = lv_file
      file_filter       = 'All Files (*.*)|*.*|Text files (*.txt)|*.txt'  "필터
    changing
      filename          = lv_file
      path              = lv_path
      fullpath          = p_path_file.
  lv_dest = p_path_file.

  if sy-subrc <> 0.
    message '다운로드 중 오류가 발생했습니다.' TYPE 'E'.
  endif.

  "다운
  call function 'DOWNLOAD_WEB_OBJECT'
    exporting
      key         = ls_key
      destination = lv_dest
    importing
      rc          = lv_rc.
profile
SAP, ERP, ABAP

0개의 댓글