read change document

REPORT  ztest.

TABLES: cdhdr.    "Change document header
*--------------------------------------------------------------------*
*  SELECTION SCREEN
*--------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
PARAMETERS: p_class LIKE cdhdr-objectclas OBLIGATORY DEFAULT 'ADRESSE',
            p_obj   LIKE cdhdr-objectid   OBLIGATORY DEFAULT 'BP  0000016234'.
SELECTION-SCREEN END OF BLOCK blk.

*--------------------------------------------------------------------*
*  TYPE DECLARATION
*--------------------------------------------------------------------*
TYPES: BEGIN OF type_dis,
           udate LIKE cdred-udate,
           ftext LIKE cdred-ftext,
           new   LIKE cdred-f_new,
           old   LIKE cdred-f_old,
       END OF type_dis.

*--------------------------------------------------------------------*
* INTERNAL TABLE DECLARATION
*--------------------------------------------------------------------*
DATA: itab_hdr LIKE TABLE OF cdhdr,
      itab_pos LIKE TABLE OF cdred,
      itab_dis TYPE TABLE OF type_dis.

*--------------------------------------------------------------------*
*  WORKAREA
*--------------------------------------------------------------------*
DATA: wa_hdr LIKE cdhdr,
      wa_pos LIKE cdred,
      wa_dis TYPE type_dis.

*--------------------------------------------------------------------*
*  VARIABLE DECLARATION
*--------------------------------------------------------------------*
DATA: w_cols TYPE REF TO cl_salv_columns_table,
      w_grid TYPE REF TO cl_salv_table.

*--------------------------------------------------------------------*
*  START-OF-SELECTION
*--------------------------------------------------------------------*
START-OF-SELECTION.
  CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
    EXPORTING
      objectclass                = p_class
      objectid                   = p_obj
      username                   = ''
    TABLES
      i_cdhdr                    = itab_hdr
    EXCEPTIONS
      no_position_found          = 1
      wrong_access_to_archive    = 2
      time_zone_conversion_error = 3
      OTHERS                     = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    LOOP AT itab_hdr INTO wa_hdr.
      CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
        EXPORTING
          changenumber            = wa_hdr-changenr
        TABLES
          editpos_with_header     = itab_pos
        EXCEPTIONS
          no_position_found       = 1
          wrong_access_to_archive = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        LOOP AT itab_pos INTO wa_pos.
          CLEAR wa_dis.
          wa_dis-udate   = wa_pos-udate.
          wa_dis-new     = wa_pos-f_new.
          wa_dis-old     = wa_pos-f_old.
          wa_dis-ftext   = wa_pos-ftext.
          APPEND wa_dis TO itab_dis.
        ENDLOOP.
        REFRESH itab_pos.
      ENDIF.
    ENDLOOP.
    CALL METHOD cl_salv_table=>factory
      EXPORTING
        list_display = 'X'
      IMPORTING
        r_salv_table = w_grid
      CHANGING
        t_table      = itab_dis.
    w_cols = w_grid->get_columns( ).
    w_cols->set_optimize( 'X' ).
    w_grid->display( ).
  ENDIF.

你可能感兴趣的:(F#,Access)