ABAP 内表的行列转换-发货通知单-打印到Excel里
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ABAP 内表的行列转换-发货通知单-打印到Excel里相关的知识,希望对你有一定的参考价值。
需要传入数据到Excel里的模板如上图所示
*&---------------------------------------------------------------------*
*& Report Z_TEST_COL_TO_ROW_02
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_test_col_to_row_02.
TABLES: vttp,lips,likp,kna1 ,vttk.
INCLUDE ole2incl.
DATA: gs_fcat TYPE lvc_s_fcat,
gt_fcat TYPE lvc_t_fcat,
gs_layo TYPE lvc_s_layo,
gs_grid TYPE lvc_s_glay.
DATA: gt_event TYPE slis_t_event WITH HEADER LINE,
gt_event_exit TYPE slis_t_event_exit WITH HEADER LINE.
DATA: ref_grid TYPE REF TO cl_gui_alv_grid .
DATA: excel TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
cell TYPE ole2_object,
row TYPE ole2_object.
TYPES: BEGIN OF ty_all,
tknum LIKE vttk-tknum,"运单号
vbeln LIKE lips-vbeln,"交货单号
tplst LIKE vttk-tplst ,"装运点
name1 LIKE kna1-name1 ,"客户
erdat LIKE vttk-erdat ,"创建日期
tdlnr LIKE vttk-tdlnr ,"物流公司
route LIKE vttk-route ,"线路
distz LIKE vttk-distz ,"里程
add01 LIKE vttk-add01 ,"车主
exti1 LIKE vttk-exti1 ,"卸货点
add02 LIKE vttk-add02 ,"司机
bfart LIKE vttk-bfart ,"车厢类型
matnr LIKE lips-matnr,"物料编码
arktx LIKE lips-arktx,"物料描述
brgew LIKE lips-brgew,"货物单项目毛重
lfimg LIKE lips-lfimg,"单项目数量
vrkme LIKE lips-vrkme ,"单位
gewei LIKE lips-gewei,"重量单位
lgort LIKE lips-lgort,"库存地点
beizhu(30) TYPE c,"备注
END OF ty_all.
TYPES:BEGIN OF ty_header,
tknum LIKE vttk-tknum,"运单号
vbeln LIKE lips-vbeln,"交货单号
name1 LIKE kna1-name1 ,"客户
tplst LIKE vttk-tplst ,"装运点
erdat LIKE vttk-erdat ,"装运日期
tdlnr LIKE vttk-tdlnr ,"物流公司
route LIKE vttk-route ,"线路
distz LIKE vttk-distz ,"里程
add01 LIKE vttk-add01 ,"车主
exti1 LIKE vttk-exti1 ,"卸货点
add02 LIKE vttk-add02 ,"司机
bfart LIKE vttk-bfart ,"车厢类型
total_brgew LIKE lips-brgew,"一个交货单的总重量
lgort LIKE lips-lgort,"库存地点
END OF ty_header.
*单据抬头结束
*单据明细开始
TYPES:BEGIN OF ty_items,
tknum LIKE vttk-tknum,"运单号
vbeln LIKE lips-vbeln,"交货单号
name1 LIKE kna1-name1 ,"客户
matnr LIKE lips-matnr,"物料编码
arktx LIKE lips-arktx,"物料描述
brgew LIKE lips-brgew,"单项目毛重
gewei LIKE lips-gewei,"重量单位