Code: Alles auswählen.
REPORT ZCO_INV_ZHR0.
TABLES: KONV, VBRK.
TYPES : BEGIN OF vbrk_htab,
vbeln LIKE vbrk-vbeln,
fkart LIKE vbrk-fkart,
fkdat LIKE vbrk-fkdat,
knumv LIKE vbrk-knumv,
kunag LIKE vbrk-kunag,
kunrg LIKE vbrk-kunrg,
netwr LIKE vbrk-netwr,
waerk LIKE vbrk-waerk,
kschl LIKE konv-kschl,
END OF vbrk_htab.
DATA: H_ITAB TYPE STANDARD TABLE OF vbrk_htab WITH HEADER LINE.
TYPE-POOLS: SLIS.
CONSTANTS:
ST_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE-ALV'.
DATA: S_SAVE(1) TYPE C,
ST_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
ST_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
ST_LAYOUT TYPE SLIS_LAYOUT_ALV,
ST_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
ST_EVENTS TYPE SLIS_T_EVENT,
S_DEFAULT(1) TYPE C,
S_EXIT(1) TYPE C,
ST_VARIANT LIKE DISVARIANT,
CODE LIKE DISVARIANT-HANDLE,
S_VARIANT LIKE DISVARIANT,
S_STATUS TYPE SLIS_FORMNAME VALUE 'STANDARD_ST01',
S_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND-ALV',
S_REPID LIKE SY-REPID.
SELECTION-SCREEN BEGIN OF BLOCK ZCO WITH FRAME TITLE text-t01.
SELECT-OPTIONS : s_vbeln FOR vbrk-vbeln DEFAULT '90037628',
s_fkart FOR vbrk-fkart DEFAULT 'ZF8',
s_fkdat FOR vbrk-fkdat,
s_netwr FOR vbrk-netwr,
s_waerk FOR vbrk-waerk.
PARAMETERS: s_kschl LIKE konv-kschl DEFAULT 'ZHR0'.
SELECTION-SCREEN END OF BLOCK ZCO.
SELECT vbeln fkdat knumv kunag kunrg netwr waerk fkart
INTO CORRESPONDING FIELDS OF H_itab
FROM vbrk
WHERE vbeln IN s_vbeln AND
fkdat IN s_fkdat AND
fkart IN s_fkart AND
netwr IN s_netwr AND
waerk in s_waerk.
APPEND h_itab.
ENDSELECT.
LOOP AT h_itab.
SELECT kschl INTO h_itab-kschl FROM konv
WHERE kschl = s_kschl AND
knumv = H_itab-knumv.
MODIFY h_itab.
ENDSELECT.
ENDLOOP.
LOOP AT h_itab.
DELETE h_itab WHERE kschl NE s_kschl.
ENDLOOP.
perform build_fieldcatalog.
perform build_layout.
perform use_alv.
form use_alv.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
i_buffer_active = ' '
i_background_id = 'ALV_BACKGROUND'
i_callback_program = s_repid
i_callback_pf_status_set = s_status
i_callback_user_command = s_user_command
* I_STRUCTURE_NAME =
is_layout = st_layout
it_fieldcat = st_fieldcat[]
* IT_EXCLUDING =
it_special_groups = st_sp_group
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = s_save
is_variant = s_variant
it_events = st_events[]
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = h_itab
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.
form build_fieldcatalog.
st_fieldcat-inttype = 'P'.
st_fieldcat-fieldname = 'FKART'.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-outputlen = 4.
st_fieldcat-ddictxt = 'M'.
st_fieldcat-seltext_s = text-001 .
st_fieldcat-seltext_m = text-001 .
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'VBELN'.
st_fieldcat-ref_tabname = 'vbrk'.
st_fieldcat-outputlen = 10.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'FKDAT'.
st_fieldcat-ref_tabname = 'vbrk'.
st_fieldcat-outputlen = 8.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'NETWR'.
st_fieldcat-ref_tabname = 'vbrk'.
st_fieldcat-outputlen = 15.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'WAERK'.
st_fieldcat-ref_tabname = 'vbrk'.
st_fieldcat-outputlen = 5.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'KUNAG'.
st_fieldcat-ref_tabname = 'vbrk'.
st_fieldcat-outputlen = 10.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'KUNRG'.
st_fieldcat-ref_tabname = 'vbrk'.
st_fieldcat-outputlen = 10.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
clear: st_fieldcat.
st_fieldcat-fieldname = 'KSCHL'.
st_fieldcat-ref_tabname = 'konv'.
st_fieldcat-outputlen = 4.
st_fieldcat-ddictxt = 'L'.
st_fieldcat-sp_group = 'A'.
append st_fieldcat.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form build_layout
*&---------------------------------------------------------------------*
form build_layout.
s_repid = sy-repid.
st_layout-box_fieldname = 'SELK'.
st_layout-get_selinfos = 'X'.
st_layout-f2code = 'PICK' .
st_layout-confirmation_prompt = 'X'.
st_layout-key_hotspot = 'X'.
st_layout-info_fieldname = 'COL'.
endform. " build_layout
*----------------------------------------------------------------------
* FORM PF_STATUS_SET
*----------------------------------------------------------------------
form standard_st01 using extab type slis_t_extab.
* DELETE EXTAB WHERE FCODE = '&UMC'.
delete extab where fcode = '&RNT_PREV'.
delete extab where fcode = '&LFO'.
delete extab where fcode = '&NFO'.
set pf-status 'ALVLIST' excluding extab.
set titlebar '001' .
endform.
*&---------------------------------------------------------------------*
*& Form COMMENT_BUILD
*&---------------------------------------------------------------------*
* Bearbeitung des Listenkopfes
* Processing of listheader
*----------------------------------------------------------------------*
* -->P_ST_LIST_TOP_OF_PAGE[] text
*----------------------------------------------------------------------*
form comment_build using p_st_list_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
refresh p_st_list_top_of_page.
* Listenüberschrift: Typ H
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = text-t01.
append ls_line to p_st_list_top_of_page.
endform. " COMMENT_BUILD
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE-ALV.
*---------------------------------------------------------------------*
form top_of_page-alv.
*
call function 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = st_list_top_of_page.
endform.
*---------------------------------------------------------------------*
* FORM USER_COMMAND-ALV *
*---------------------------------------------------------------------*
* AT USER COMMAND-ALV *
*---------------------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*---------------------------------------------------------------------*
form user_command-alv using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: feld(10) type c.
read table h_itab index rs_selfield-tabindex.
rs_selfield-refresh = 'X'.
case r_ucomm.
when 'PICK' or '&IC1'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
st_layout-info_fieldname = 'DISPLAY-COL'. "Zeilenfarbe
when '&F03' or '&F12' or '&F15' or 'F15' or 'RW' or 'BACK' .
endcase.
endform.
*&---------------------------------------------------------------------*
*& Form EVENTTAB_BUILD
*&---------------------------------------------------------------------*
* Ereignistabelle füllen
* EVENTS TABLE fill
*----------------------------------------------------------------------*
form eventtab_build using p_st_events type slis_t_event.
data: ls_event type slis_alv_event.
*
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_st_events.
read table p_st_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move st_formname_top_of_page to ls_event-form.
append ls_event to p_st_events.
endif.
read table p_st_events with key name = slis_ev_user_command
into ls_event.
if sy-subrc = 0.
move s_user_command to ls_event-form.
append ls_event to p_st_events.
endif.
read table p_st_events with key name =
slis_ev_pf_status_set
into ls_event.
if sy-subrc = 0.
move s_status to ls_event-form.
append ls_event to p_st_events.
endif.
endform. " EVENTTAB_BUILD
*&---------------------------------------------------------------------*
*& Form VARIANT_INIT
*&---------------------------------------------------------------------*
* Initialisieren der Anzeigevariante
* initial the displayvariant
*----------------------------------------------------------------------*
form variant_init.
clear s_variant.
s_variant-report = s_repid.
s_variant-handle = code.
endform. " VARIANT_INIT
Code: Alles auswählen.
st_layout-box_fieldname = 'SELK'.
Code: Alles auswählen.
st_fieldcat-ref_tabname = 'vbrk'.
Code: Alles auswählen.
TYPES : BEGIN OF vbrk_htab,
vbeln LIKE vbrk-vbeln,
fkart LIKE vbrk-fkart,
fkdat LIKE vbrk-fkdat,
knumv LIKE vbrk-knumv,
kunag LIKE vbrk-kunag,
kunrg LIKE vbrk-kunrg,
netwr LIKE vbrk-netwr,
waerk LIKE vbrk-waerk,
kschl LIKE konv-kschl,
selk(1),
END OF vbrk_htab.
DATA: H_ITAB TYPE STANDARD TABLE OF vbrk_htab WITH HEADER LINE.