Code: Alles auswählen.
DATA: ok_code LIKE sy-ucomm.
DATA: gt_mara TYPE TABLE OF mara.
DATA: gs_stock TYPE zmm_s_bestandspflege.
DATA: gv_matnr TYPE matnr.
*&---------------------------------------------------------------------*
*& Start
*&---------------------------------------------------------------------*
START-OF-SELECTION.
DATA(lo_mm_bestandspflege) = NEW zcl_mm_bestandspflege( ) .
CALL SCREEN '100'.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'Bestandspflege'.
lo_mm_bestandspflege->display( ).
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& text
*&----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'OK_SEARCH'.
lo_mm_bestandspflege->filter_data( iv_matnr = gv_matnr ).
ENDCASE.
ENDMODULE.
Code: Alles auswählen.
gt_stock = get_data( ).
Code: Alles auswählen.
METHOD display.
*&---------------------------------------------------------------------*
*& Container erzeugen
*&---------------------------------------------------------------------*
CREATE OBJECT go_cont
EXPORTING
container_name = co_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_cont
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = co_structure_name
CHANGING
ct_fieldcat = gf_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
go_grid->set_table_for_first_display(
CHANGING
it_outtab = gt_stock
it_fieldcatalog = gf_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 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.
ENDIF.
ENDMETHOD.
Code: Alles auswählen.
METHOD filter_data.
* DELETE gt_stock WHERE NOT matnr = iv_matnr.
clear: gt_stock.
SELECT a~matnr,
b~maktx,
c~meins,
d~lvsme,
a~lpmax,
a~lpmin,
a~nsmng
FROM mlgt AS a
INNER JOIN makt AS b ON a~matnr = b~matnr
INNER JOIN mara AS c ON a~matnr = c~matnr
INNER JOIN mlgn AS d ON a~matnr = d~matnr
where a~matnr = @iv_matnr
INTO TABLE @gt_stock.
go_grid->refresh_table_display(
EXCEPTIONS
finished = 1 " Display wurde beendet ( durch Export ).
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.
ENDMETHOD.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Egzon