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

REUSE_ALV_HIERSEQ_LIST_DISPLAY



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



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Sep 22, 2007 7:04 pm    Post subject: REUSE_ALV_HIERSEQ_LIST_DISPLAY Reply with quote

Code:
REPORT  znntest_alv.

data: BEGIN OF it_items occurs 0,
        vbeln LIKE vbap-vbeln,
        posnr LIKE vbap-posnr,
        matnr LIKE vbap-matnr,
        arktx LIKE vbap-arktx,
      END OF it_items.

data: BEGIN OF it_order occurs 0,
        vbeln LIKE vbak-vbeln,
        auart LIKE vbak-auart,
        kunnr LIKE vbak-kunnr,
      END OF it_order.

DATA: wa_items LIKE LINE OF it_items,
      wa_order LIKE LINE OF it_order.


* ALV
TYPE-POOLS: slis.

DATA: w_field_cat    TYPE  slis_t_fieldcat_alv,
      w_layout       TYPE  slis_layout_alv,
      w_field        TYPE  slis_fieldcat_alv,
      wa_keyinfo     TYPE  slis_keyinfo_alv.

DATA: wa_variant LIKE disvariant.

DATA: g_user_command TYPE slis_formname  VALUE 'USER_COMMAND'.
DATA: g_repid        LIKE sy-repid.

DATA: w_tabname_header TYPE slis_tabname VALUE 'IT_ORDER',
      w_tabname_item   TYPE slis_tabname VALUE 'IT_ITEMS'.


SELECT-OPTIONS: so_vbeln FOR wa_order-vbeln OBLIGATORY.

PARAMETERS: p_varnt LIKE disvariant-variant.                "ALV Layout


START-OF-SELECTION.

  PERFORM get_data.

  PERFORM display_alv.



*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_data.

  SELECT auart vbeln kunnr FROM vbak
    INTO CORRESPONDING FIELDS OF TABLE it_order
    WHERE vbeln IN so_vbeln.

  LOOP AT it_order INTO wa_order.

    SELECT vbeln posnr matnr arktx FROM vbap
      INTO CORRESPONDING FIELDS OF wa_items
      WHERE vbeln = wa_order-vbeln.

      APPEND wa_items TO it_items.

    ENDSELECT.

  ENDLOOP.

ENDFORM.                    " get_data

*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM display_alv.

  REFRESH w_field_cat.

  CLEAR w_field.
  w_field-fieldname = 'VBELN'.
  w_field-tabname = 'IT_ORDER'.
  w_field-seltext_l = 'Sales Doc'.
  w_field-seltext_m = 'Sales Doc'.
  w_field-seltext_s = 'Sales Doc'.
  w_field-ddictxt = 'M'.
  w_field-outputlen = 10.
  APPEND w_field TO w_field_cat.

  CLEAR w_field.
  w_field-fieldname = 'AUART'.
  w_field-tabname = 'IT_ORDER'.
  w_field-seltext_l = 'Doc Type'.
  w_field-seltext_m = 'Doc Type'.
  w_field-seltext_s = 'Doc Type'.
  w_field-ddictxt = 'M'.
  w_field-outputlen = 8.
  APPEND w_field TO w_field_cat.

  CLEAR w_field.
  w_field-fieldname = 'KUNNR'.
  w_field-tabname = 'IT_ORDER'.
  w_field-seltext_l = 'Sold-To'.
  w_field-seltext_m = 'Sold-To'.
  w_field-seltext_s = 'Sold-To'.
  w_field-ddictxt = 'M'.
  w_field-outputlen = 10.
  APPEND w_field TO w_field_cat.

*  CLEAR w_field.
*  w_field-fieldname = 'VBELN'.
*  w_field-tabname = 'IT_ITEMS'.
*  w_field-seltext_l = 'Sales Doc'.
*  w_field-seltext_m = 'Sales Doc'.
*  w_field-seltext_s = 'Sales Doc'.
*  w_field-ddictxt = 'M'.
*  w_field-outputlen = 10.
*  APPEND w_field TO w_field_cat.

  CLEAR w_field.
  w_field-fieldname = 'POSNR'.
  w_field-tabname = 'IT_ITEMS'.
  w_field-seltext_l = 'Item No'.
  w_field-seltext_m = 'Item No'.
  w_field-seltext_s = 'Item No'.
  w_field-ddictxt = 'M'.
  w_field-outputlen = 7.
  APPEND w_field TO w_field_cat.

  CLEAR w_field.
  w_field-fieldname = 'MATNR'.
  w_field-tabname = 'IT_ITEMS'.
  w_field-seltext_l = 'Material'.
  w_field-seltext_m = 'Material'.
  w_field-seltext_s = 'Material'.
  w_field-ddictxt = 'M'.
  w_field-outputlen = 18.
  APPEND w_field TO w_field_cat.

*  CLEAR w_field.
*  w_field-fieldname = 'ARKTX'.
*  w_field-tabname = 'IT_ITEMS'.
*  w_field-datatype = 'CHAR'.
*  w_field-seltext_m = 'Desc'.
*  w_field-ddictxt = 'M'.
*  w_field-outputlen = 40.
*  APPEND w_field TO w_field_cat.

  g_repid = sy-repid.

  w_layout-colwidth_optimize = 'X'.
*  w_layout-header_text       = 'Order'.
*  w_layout-item_text         = 'Item'.
*  w_layout-f2code            = 'DALL'.
  w_layout-detail_popup      = 'X'.
  w_layout-default_item = 'X'.

  SET TITLEBAR 'ZNNTEST_ALV'.

  wa_variant-report  = sy-repid.
  wa_variant-variant = p_varnt.

  CLEAR wa_keyinfo.
  wa_keyinfo-header01 = 'VBELN'.
  wa_keyinfo-item01   = 'VBELN'.
  wa_keyinfo-header02 = SPACE.
  wa_keyinfo-item02   = 'POSNR'.


  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
*   I_INTERFACE_CHECK              = ' '
    i_callback_program             = g_repid
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
    is_layout                      = w_layout
    it_fieldcat                    = w_field_cat
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   I_DEFAULT                      = 'X'
    i_save                         = 'A'
    is_variant                     = wa_variant
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
    i_tabname_header               = w_tabname_header
    i_tabname_item                 = w_tabname_item
*   I_STRUCTURE_NAME_HEADER        =
*   I_STRUCTURE_NAME_ITEM          =
    is_keyinfo                     = wa_keyinfo
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_BUFFER_ACTIVE                =
   I_BYPASSING_BUFFER             = 'X'
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
    TABLES
      t_outtab_header                = it_order
      t_outtab_item                  = it_items
* 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
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 -> ALV Grid / ALV Tree / ALV List 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.