Posted: Sat Sep 22, 2007 7:04 pm Post subject: REUSE_ALV_HIERSEQ_LIST_DISPLAY
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.
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.