• ABAP读取采购申请的项目文本 READ_TEXT


    DATA: it_texttable TYPE TABLE OF tline-tdline WITH HEADER LINE,
          it_tem_table TYPE TABLE OF tline WITH HEADER LINE.
    DATA:hk_text(50).
    DATA: BEGIN OF itb_s18 OCCURS 0.
            INCLUDE STRUCTURE thead.
    DATA: END OF itb_s18.
    DATA: BEGIN OF flines OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF flines.
    
    LOOP AT tab_5 ASSIGNING <fs>.                          "tab_5  内表
      CLEAR ebelnkp.
      CONCATENATE <fs>-banfn <fs>-bnfpo INTO ebelnkp.       "banfn采购申请号     bnfpo项次
      SELECT * FROM stxl INTO CORRESPONDING FIELDS OF TABLE itb_s18
      WHERE tdobject = 'EBAN' AND  tdname = ebelnkp.
    
      CLEAR hk_text.
      LOOP AT itb_s18.
        CLEAR hk_text.
        PERFORM frm_read_text USING 'B01' itb_s18-tdname 'EBAN' CHANGING hk_text .
        <fs>-mfrpn = hk_text.
      ENDLOOP.
    ENDLOOP.
    
    FORM frm_read_text USING fid fname fobject CHANGING hk_text .
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                  = sy-mandt
          id                      = fid
          language                = sy-langu
          name                    = fname
          object                  = fobject
        TABLES
          lines                   = flines
        EXCEPTIONS
          id                      = 1
          language                = 2
          name                    = 3
          not_found               = 4
          object                  = 5
          reference_check         = 6
          wrong_access_to_archive = 7
          OTHERS                  = 8.
    
      LOOP AT flines.
        it_tem_table-tdline = flines-tdline.
        APPEND it_tem_table.
      ENDLOOP.
    
    *Read_text读取长文本中<(>&<)>符号转换成正确的'&'符号
      CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'    
        EXPORTING
          language    = sy-langu
        TABLES
          itf_text    = it_tem_table
          text_stream = it_texttable.
      IF sy-subrc = 0 AND it_texttable[] IS NOT INITIAL.
        READ TABLE it_texttable INTO hk_text INDEX 1.
      ENDIF.
    ENDFORM.                    "FRM_READ_TEXT
    abap菜鸟,记录学习笔记。才疏学浅,如有错误,请直接在评论区留言。
  • 相关阅读:
    枚举类型总结
    正则表达式-Java
    java中Mongo
    cookie
    xsd解析
    水平分表的实现
    c#位运算小例子笔记
    c#设计模式之观察者模式(Observer Pattern)
    c#设计模式之代理模式(Proxy Pattern)
    .Net 数据缓存浅析
  • 原文地址:https://www.cnblogs.com/freeandeasy/p/12340215.html
Copyright © 2020-2023  润新知