美文网首页SAPSAP 修行
用代码显示SAP CRM某个订单维护的长文本

用代码显示SAP CRM某个订单维护的长文本

作者: _扫地僧_ | 来源:发表于2020-07-04 11:28 被阅读0次
    REPORT znote_display_tool.
    
    PARAMETERS: id   TYPE crmd_orderadm_h-object_id OBLIGATORY DEFAULT '1656',
                type TYPE crmd_orderadm_h-process_type OBLIGATORY DEFAULT 'ASOP',
                tid TYPE stxh-tdname OBLIGATORY DEFAULT '0090FA0D8DC21EE3ABCE672A80C1470C'.
    
    TYPES: text_line(cl_crm_odata_oppt_constant=>gc_oppt_notes_textlength)  TYPE c.
    
    DATA: lv_char32   TYPE char32, " CRMD_ORDERADM_H-guid,
          lv_textname TYPE string,
          lv_id       LIKE id,
          lv_guid     TYPE crmd_orderadm_h-guid,
          lt_stxh     TYPE STANDARD TABLE OF stxh,
          ls_stxh     LIKE LINE OF lt_stxh,
          ls_notes    TYPE crmt_odata_oppt_notes.
    DATA: ls_thead                TYPE thead.
    DATA: lt_text_table           TYPE TABLE OF text_line.
    
    DATA: ls_bupa_addr            TYPE bapiaddr3.
    DATA: ls_return               TYPE STANDARD TABLE OF bapiret2.
    DATA: lt_lines                TYPE STANDARD TABLE OF tline.
    
    lv_id = id.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = lv_id
      IMPORTING
        output = lv_id.
    
    SELECT SINGLE guid FROM crmd_orderadm_h INTO lv_guid WHERE object_id = id AND process_type = type.
    IF sy-subrc <> 0.
      WRITE: / 'No opportunity found' COLOR COL_GROUP.
      RETURN.
    ENDIF.
    
    lv_char32 = lv_guid.
    
    CONCATENATE lv_char32 '%' INTO lv_textname.
    
    SELECT * FROM stxh INTO TABLE lt_stxh
                       WHERE  tdobject  EQ   'CRM_ORDERH'
                         AND  tdname    EQ tid.
    
    IF lines( lt_stxh ) <> 1.
      WRITE: / 'Cound not read given text' COLOR COL_NEGATIVE.
      RETURN.
    ENDIF.
    
    READ TABLE lt_stxh INTO ls_stxh INDEX 1.
    
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id       = ls_stxh-tdid
        language = ls_stxh-tdspras
        name     = ls_stxh-tdname
        object   = ls_stxh-tdobject
      IMPORTING
        header   = ls_thead
      TABLES
        lines    = lt_lines
      EXCEPTIONS
        OTHERS   = 1.
    CHECK sy-subrc EQ 0.
    CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
      TABLES
        itf_text    = lt_lines
        text_stream = lt_text_table.
    CONCATENATE LINES OF lt_text_table INTO ls_notes-content RESPECTING BLANKS.
    
    CALL METHOD cl_demo_output=>display_text( ls_notes-content ).
    

    相关文章

      网友评论

        本文标题:用代码显示SAP CRM某个订单维护的长文本

        本文链接:https://www.haomeiwen.com/subject/mifuqktx.html