博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SAP 到出XLS
阅读量:4581 次
发布时间:2019-06-09

本文共 4763 字,大约阅读时间需要 15 分钟。

report z_test7.data:gv_fname like rlgrap-filename," filename       gv_filename type string.data:begin of gt_sflight_down_header occurs 0,carrid(20),fldate(20),cityfrom(20),cityto(20),fltime(20),price(20),currency(20),end of gt_sflight_down_header.*define the download internal tabledata:begin of gt_sflight_down occurs 0, "存放表体数据carrid like sflight-carrid,fldate like sflight-fldate,cityfrom like spfli-cityfrom,cityto like spfli-cityto,fltime like spfli-fltime,price like sflight-price,currency like sflight-currency,end of gt_sflight_down.perform download."下面是要call的function:*&---------------------------------------------------------------------**&      Form  download*&---------------------------------------------------------------------**       text*----------------------------------------------------------------------*form download .  clear gt_sflight_down_header[]. "必须要清空,否则会出现数据重复下载的情况  clear gt_sflight_down[].*set the data header  gt_sflight_down_header-carrid = 'companyid'.  gt_sflight_down_header-fldate = 'flightdate'.  gt_sflight_down_header-cityfrom = 'origin'.  gt_sflight_down_header-cityto = 'destination'.  gt_sflight_down_header-fltime = 'flighttime'.  gt_sflight_down_header-price = 'cost'.  gt_sflight_down_header-currency = 'currency'.  append gt_sflight_down_header.*set the main download data*      loop at gt_sflight.**        gt_sflight_down-carrid = gt_sflight-carrid.**        gt_sflight_down-fldate = gt_sflight-fldate.**        gt_sflight_down-cityfrom = gt_sflight-cityfrom.**        gt_sflight_down-cityto = gt_sflight-cityto.**        gt_sflight_down-fltime = gt_sflight-fltime.**        gt_sflight_down-price = gt_sflight-price.**        gt_sflight_down-currency = gt_sflight-currency.**        append gt_sflight_down.**      endloop.  gt_sflight_down-carrid = 1.  gt_sflight_down-fldate = 2.  gt_sflight_down-cityfrom = 3.  gt_sflight_down-cityto = 3.  gt_sflight_down-fltime = 3.  gt_sflight_down-price = 3.  gt_sflight_down-currency = 3.  append gt_sflight_down.  call function 'WS_FILENAME_GET'    exporting      mask             = ',*.xls,*.xlsx.'      mode             = 'S'      title            = 'choose the location'    importing      filename         = gv_fname    exceptions      inv_winsys       = 1      no_batch         = 2      selection_cancel = 3      selection_error  = 4      others           = 5.  if sy-subrc <> 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.  endif.  concatenate gv_fname '.xls' into gv_filename. "给返回的文件路径加上后缀名  call function 'GUI_DOWNLOAD' "第一次调用,先下载表头数据    exporting      filename                = gv_filename      filetype                = 'ASC'      write_field_separator   = 'X'    tables      data_tab                = gt_sflight_down_header[]    exceptions      file_write_error        = 1      no_batch                = 2      gui_refuse_filetransfer = 3      invalid_type            = 4      no_authority            = 5      unknown_error           = 6      header_not_allowed      = 7      separator_not_allowed   = 8      filesize_not_allowed    = 9      header_too_long         = 10      dp_error_create         = 11      dp_error_send           = 12      dp_error_write          = 13      unknown_dp_error        = 14      access_denied           = 15      dp_out_of_memory        = 16      disk_full               = 17      dp_timeout              = 18      file_not_found          = 19      dataprovider_exception  = 20      control_flush_error     = 21      others                  = 22.*download the main data  call function 'GUI_DOWNLOAD' "第二次调用,下载表体数据    exporting      filename                = gv_filename      filetype                =  'ASC'      write_field_separator   = 'X'      append                  =  'X' "指定下载模式为附加    tables      data_tab                = gt_sflight_down[]    exceptions      file_write_error        = 1      no_batch                = 2      gui_refuse_filetransfer = 3      invalid_type            = 4      no_authority            = 5      unknown_error           = 6      header_not_allowed      = 7      separator_not_allowed   = 8      filesize_not_allowed    = 9      header_too_long         = 10      dp_error_create         = 11      dp_error_send           = 12      dp_error_write          = 13      unknown_dp_error        = 14      access_denied           = 15      dp_out_of_memory        = 16      disk_full               = 17      dp_timeout              = 18      file_not_found          = 19      dataprovider_exception  = 20      control_flush_error     = 21      others                  = 22.  if sy-subrc = 0.    message i012(zeduc132_m).  endif.endform.                    "" download

 

转载于:https://www.cnblogs.com/charles-guo/archive/2013/05/23/3094736.html

你可能感兴趣的文章
Eclipse 写代码是自动重启服务
查看>>
3.8 spring - AbstractBeanDefinition 介绍
查看>>
如何在Visual Studio里面查看程序的汇编代码?
查看>>
解决IE11只能用管理员身份运行的问题
查看>>
android学习-LocationManager(一)-
查看>>
Linux安装单机solr
查看>>
dos alias/cname address
查看>>
NAT模式实现局域网物理机与虚拟机的互通访问
查看>>
cygwin下用arm-xscale-linux-gnueabi交叉编译libcgi
查看>>
delphi中WMI的使用(网卡是否接入)
查看>>
转载:面试:----电商项目中比较难得问题
查看>>
js弹出遮罩层
查看>>
Linux tar打包命令
查看>>
iOS中的UIView动画
查看>>
解决android textview 混合文字、数字换行后对列不齐
查看>>
Winform PPT切换图片效果
查看>>
ionic调用数据接口(post、解决 payload 问题)
查看>>
奇偶数分离
查看>>
1020 PAT
查看>>
hdu6080(最小环)
查看>>