zoukankan      html  css  js  c++  java
  • ABAP中ALV导出excel表格时有个字段总是少一位,请问是什么原因?如何解决?

    http://zhidao.baidu.com/question/248924781.html

    这是SAP的一个Bug,FM方式ALV Grid和Class ALV Grid都会出现,但是ALV List好像没有这个BUG。

    在以下几个条件满足的时候就会出现这个问题:1.字段对应的域Convers. routine = ALPHA,也就是有前导零的字段,比如供应商号、商品号、客户号等。2.做ALV Fieldcat的时候,没有指定参考表和参考字段。3.列的表头文本(seltext_s等)比实际显示的数据短。 所以解决问题的时候从2、3两点下手即可。 REPORT z_barry_field_loss .TYPE-POOLS: slis.DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.DATA: sla TYPE slis_layout_alv , i_repid LIKE sy-repid , ls_fieldcat TYPE slis_fieldcat_alv.DATA: BEGIN OF itab OCCURS 0, lifnr LIKE lfa1-lifnr , kunnr LIKE kna1-kunnr , matnr LIKE mara-matnr , bukrs LIKE bsik-bukrs , END OF itab. START-OF-SELECTION. itab-lifnr = '0000100047'. itab-kunnr = '0000001006'. itab-bukrs = 'ZB01'. itab-matnr = '000000000001100198'. APPEND itab. CLEAR ls_fieldcat . ls_fieldcat-fieldname = 'LIFNR'. ls_fieldcat-seltext_s = 'LI'. ls_fieldcat-ref_fieldname = 'LIFNR'. "|注释 ls_fieldcat-ref_tabname = 'LFA1'. "| ls_fieldcat-ddictxt = 'S'. APPEND ls_fieldcat TO gd_fieldcat . CLEAR ls_fieldcat . ls_fieldcat-fieldname = 'KUNNR'. ls_fieldcat-seltext_s = 'KU'. ls_fieldcat-ref_fieldname = 'KUNNR'. "|注释 ls_fieldcat-ref_tabname = 'KNA1'. "| APPEND ls_fieldcat TO gd_fieldcat . CLEAR ls_fieldcat . ls_fieldcat-fieldname = 'BUKRS'. ls_fieldcat-seltext_s = 'BU'. APPEND ls_fieldcat TO gd_fieldcat . CLEAR ls_fieldcat . ls_fieldcat-fieldname = 'MATNR'. ls_fieldcat-seltext_s = 'MAT'. ls_fieldcat-ref_fieldname = 'MATNR'. "|注释 ls_fieldcat-ref_tabname = 'MAKT'. "| APPEND ls_fieldcat TO gd_fieldcat . i_repid = sy-repid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = i_repid it_fieldcat = gd_fieldcat[] i_save = 'A' is_layout = sla i_callback_user_command = 'USER_COMMAND' TABLES t_outtab = itab EXCEPTIONS program_error = 1 OTHERS = 2.

  • 相关阅读:
    Python练手例子(3)
    Python练手例子(2)
    Python练手例子(1)
    Python学习之旅(三十八)
    《剑指offer》— JavaScript(24)二叉树中和为某一值的路径
    《剑指offer》— JavaScript(23)二叉搜索树的后序遍历序列
    《剑指offer》— JavaScript(22)从上往下打印二叉树
    《剑指offer》— JavaScript(21)栈的压入、弹出序列
    《剑指offer》— JavaScript(20)包含min函数的栈
    《剑指offer》— JavaScript(19)顺时针打印矩阵
  • 原文地址:https://www.cnblogs.com/cnlmjer/p/4099832.html
Copyright © 2011-2022 走看看