SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Retrieve comment texts from cluster table for infotype 19



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Oct 13, 2007 1:27 pm    Post subject: Retrieve comment texts from cluster table for infotype 19 Reply with quote

Code:
*......................................................................*
*: Report  ZIT0019_TXT                                                :*
*: Author  SAPdev.co.uk                                               :*
*:.....................................................................*
*: Description :                                                      :*
*:.............:                                                      :*
*: Retrieves comment text for infotype 0019 form PCL1 cluster table   :*
*:                                                                    :*
*: Please visit www.sapdev.co.uk for further info                     :*
*:....................................................................:*
REPORT  zp191rep_txt.                                               .

NODES: pernr.
INFOTYPES: 0019.
TYPE-POOLS: slis.

*---------------------------------------------------------------------*
*        Daten zu Cluster TX (Infotyptexte)                           *
*---------------------------------------------------------------------*
INCLUDE RPC1TX00.

*INCLUDE rpcitx00.
*INCLUDE rpcitd00.


TYPES: BEGIN OF t_reptab,
  pernr TYPE pernr-pernr,
  subty TYPE p0019-subty,
  termn TYPE p0019-termn,
  text  LIKE ptext-line,
 END OF t_reptab.
DATA: it_reptab TYPE STANDARD TABLE OF t_reptab INITIAL SIZE 0,
      wa_reptab TYPE t_reptab.

*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
      gd_tab_group TYPE slis_t_sp_group_alv,
      gd_layout    TYPE slis_layout_alv,
      gd_repid     LIKE sy-repid,
      it_sortcat   TYPE slis_sortinfo_alv OCCURS 1,
      wa_sort LIKE LINE OF it_sortcat.


SELECTION-SCREEN BEGIN OF BLOCK subtyp WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_sub FOR p0019-subty.
SELECTION-SCREEN END OF BLOCK subtyp.



************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

GET pernr.

*rp_provide_from_last p0019 space pn-begda pn-endda.
  PROVIDE * FROM p0019 BETWEEN pn-begda AND pn-endda.
    CHECK p0019-subty IN so_sub.
    MOVE-CORRESPONDING p0019 TO tx-key.
    tx-key-infty = '0019'.
    rp-imp-c1-tx.
    IF sy-subrc = 0.

      LOOP AT ptext.
        MOVE-CORRESPONDING p0019 TO wa_reptab.
        wa_reptab-text = ptext-line.
        APPEND wa_reptab TO it_reptab.
        CLEAR: wa_reptab.
      ENDLOOP.
    ENDIF.
  ENDPROVIDE.

  SORT it_reptab BY pernr subty.

************************************************************************
*END-OF-SELECTION.
END-OF-SELECTION.

  PERFORM build_fieldcatalog.
  PERFORM build_layout.
  PERFORM build_sortcat.
  PERFORM display_alv_report.



*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*       Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
FORM build_fieldcatalog.
  fieldcatalog-fieldname   = 'PERNR'.
  fieldcatalog-seltext_m   = 'Personnel Num'.
  fieldcatalog-col_pos     = 0.
  fieldcatalog-outputlen   = 10.
  fieldcatalog-emphasize   = 'X'.
  fieldcatalog-key         = 'X'.
*  fieldcatalog-do_sum      = 'X'.
*  fieldcatalog-no_zero     = 'X'.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.

  fieldcatalog-fieldname   = 'SUBTY'.
  fieldcatalog-seltext_m   = 'Sub Type'.
  fieldcatalog-col_pos     = 1.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.

  fieldcatalog-fieldname   = 'TERMN'.
  fieldcatalog-seltext_m   = 'Sub Type'.
  fieldcatalog-col_pos     = 1.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.

  fieldcatalog-fieldname   = 'TEXT'.
  fieldcatalog-seltext_m   = 'Text'.
  fieldcatalog-col_pos     = 2.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
ENDFORM.                    " BUILD_FIELDCATALOG


*&---------------------------------------------------------------------*
*&      Form  BUILD_LAYOUT
*&---------------------------------------------------------------------*
*       Build layout for ALV grid report
*----------------------------------------------------------------------*
FORM build_layout.
  gd_layout-no_input          = 'X'.
  gd_layout-colwidth_optimize = 'X'.
  gd_layout-totals_text       = 'Totals'(201).
*  gd_layout-totals_only        = 'X'.
*  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
*                                         "click(press f2)
*  gd_layout-zebra             = 'X'.
*  gd_layout-group_change_edit = 'X'.
*  gd_layout-header_text       = 'helllllo'.
ENDFORM.                    " BUILD_LAYOUT


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*       Display report using ALV grid
*----------------------------------------------------------------------*
FORM display_alv_report.
  gd_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program      = gd_repid
*            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
*            i_callback_user_command = 'USER_COMMAND'
*            i_grid_title           = outtext
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            it_sort                 = it_sortcat
*            it_special_groups       = gd_tabgroup
*            IT_EVENTS                = GT_XEVENTS
            i_save                  = 'X'
*            is_variant              = z_template

       TABLES
            t_outtab                = it_reptab
       EXCEPTIONS
            program_error           = 1
            OTHERS                  = 2.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " DISPLAY_ALV_REPORT


*&---------------------------------------------------------------------*
*&      Form  build_sortcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_sortcat .
  wa_sort-spos      = 1.
  wa_sort-fieldname = 'PERNR'.
*  gd_sortcat-tabname
  APPEND wa_sort TO it_sortcat.

  wa_sort-spos      = 2.
  wa_sort-fieldname = 'SUBTY'.
*  gd_sortcat-tabname
  APPEND wa_sort TO it_sortcat.

  wa_sort-spos      = 3.
  wa_sort-fieldname = 'TERMN'.
*  gd_sortcat-tabname
  APPEND wa_sort TO it_sortcat.
ENDFORM.                    " build_sortcat
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.