ABAP excel移动到数据库

DATA: innertable1 TYPE TABLE OF alsmex_tabline,
structor1 TYPE alsmex_tabline,
innertable2 TYPE TABLE OF zztcomp_gs,
structor2 TYPE zztcomp_gs,

  innertable11 TYPE TABLE OF alsmex_tabline,
  structor11   TYPE alsmex_tabline,
  innertable22 TYPE TABLE OF zztcompt_gs,
  structor22   TYPE zztcompt_gs,
  aim_path TYPE rlgrap-filename.

SELECTION-SCREEN BEGIN OF BLOCK qwe WITH FRAME TITLE TEXT-001.

PARAMETERS: filepath type rlgrap-filename,
filename type rlgrap-filename ,
coltotal type i default 15.

SELECTION-SCREEN END OF BLOCK qwe.

INITIALIZATION.
move ‘C:\Users\I527935\Desktop’ to filepath.
at SELECTION-SCREEN.
aim_path = filepath && filename.
CALL FUNCTION ‘ALSM_EXCEL_TO_INTERNAL_TABLE’
EXPORTING
filename = aim_path
i_begin_col = 1
i_begin_row = 2
i_end_col = coltotal
i_end_row = 618
TABLES
intern = innertable1.

LOOP AT innertable1 INTO structor1.
CASE structor1-col.
WHEN 1.
structor2-matnr = structor1-value.
WHEN 2.
REPLACE ALL OCCURRENCES OF ‘/’ IN structor1-value WITH ‘’.
structor2-ersda = structor1-value.
WHEN 3.
structor2-ernam = structor1-value.
WHEN 4.
REPLACE ALL OCCURRENCES OF ‘/’ IN structor1-value WITH ‘’.
structor2-laeda = structor1-value.
WHEN 5.
structor2-aenam = structor1-value.
WHEN 6.
structor2-vpsta = structor1-value.
WHEN 7.
structor2-pstat = structor1-value.
WHEN 8.
structor2-lvorm = structor1-value.
WHEN 9.
structor2-mtart = structor1-value.
WHEN 10.
structor2-mbrsh = structor1-value.
WHEN 11.
structor2-matkl = structor1-value.
WHEN 12.
structor2-bismt = structor1-value.
WHEN 13.
structor2-meins = structor1-value.
WHEN 14.
structor2-bstme = structor1-value.
ENDCASE.
write: / structor1-row,
structor1-col,
structor1-value.

AT END OF row.
  APPEND structor2 TO innertable2.
ENDAT.

ENDLOOP.

MODIFY zztcomp_gs FROM TABLE innertable2.

CALL FUNCTION ‘ALSM_EXCEL_TO_INTERNAL_TABLE’
EXPORTING
filename = ‘C:\Users\I527935\Desktop\component description.XLSX’
i_begin_col = 1
i_begin_row = 2
i_end_col = 5
i_end_row = 632
TABLES
intern = innertable11.

LOOP AT innertable11 INTO structor11.
CASE structor11-col.
WHEN 1.
structor22-mandt = structor11-value.
WHEN 2.
structor22-matnr = structor11-value.
WHEN 3.
structor22-spras = structor11-value.
WHEN 4.
structor22-maktx = structor11-value.
WHEN 5.
structor22-maktg = structor11-value.
ENDCASE.
AT END OF row.
APPEND structor22 TO innertable22.
ENDAT.

ENDLOOP.

MODIFY zztcompt_gs FROM TABLE innertable22.
call TRANSACTION ‘SE16’.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值