Code: Alles auswählen.
SELECTION-SCREEN BEGIN OF BLOCK bl_001 WITH FRAME TITLE text-001.
PARAMETERS: matnr LIKE CSAP_MBOM-MATNR,
werks LIKE CSAP_MBOM-WERKS,
stlan LIKE CSAP_MBOM-STLAN default '1',
stlal LIKE CSAP_MBOM-STLAL,
remote(1) type c no-display.
SELECTION-SCREEN END OF BLOCK bl_001.
at selection-screen on value-request for stlal.
perform f4_stlal.
START-OF-SELECTION.
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Form f4_stlal
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form f4_stlal.
data: begin of f4_stlal occurs 0,
stlal like mast-stlal,
stktx like stko-stktx,
end of f4_stlal.
DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
data: dynfields like DYNPREAD occurs 0 with header line.
data: flag type c,
v_matnr like mara-matnr.
clear: f4_stlal[], return_tab, flag.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = 'ZVS_PRODUCTION_BOM'
DYNUMB = '1000'
* TRANSLATE_TO_UPPER = ' '
REQUEST = 'A'
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = ' '
* START_SEARCH_IN_MAIN_SCREEN = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
DYNPFIELDS = dynfields
* EXCEPTIONS
* INVALID_ABAPWORKAREA = 1
* INVALID_DYNPROFIELD = 2
* INVALID_DYNPRONAME = 3
* INVALID_DYNPRONUMMER = 4
* INVALID_REQUEST = 5
* NO_FIELDDESCRIPTION = 6
* INVALID_PARAMETER = 7
* UNDEFIND_ERROR = 8
* DOUBLE_CONVERSION = 9
* STEPL_NOT_FOUND = 10
* OTHERS = 11
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
read table dynfields with key fieldname = 'MATNR'.
matnr = dynfields-fieldvalue.
read table dynfields with key fieldname = 'WERKS'.
werks = dynfields-fieldvalue.
read table dynfields with key fieldname = 'STLAN'.
STLAN = dynfields-fieldvalue.
*text-900 = 'Material Nummer und Werk müssen gefüllt sein.'
if matnr is initial or werks is initial.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TEXTLINE1 = text-900.
else.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = matnr
IMPORTING
output = v_matnr.
select mast~stlal stko~stktx into (f4_stlal-stlal, f4_stlal-stktx )
from ( mast inner join stko on mast~stlnr = stko~stlnr
and mast~stlal = stko~stlal )
where mast~matnr eq v_matnr
and mast~werks eq werks
and mast~stlan eq stlan.
append f4_stlal.
endselect.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'STLAL'
DYNPPROG = 'ZVS_PRODUCTION_BOM'
DYNPNR = '1000'
DYNPROFIELD = 'STLAL'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = f4_stlal
return_tab = return_tab
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0
endif.
endform.
Code: Alles auswählen.
REPORT.
PARAMETERS: x TYPE dd04d-datatype AS LISTBOX VISIBLE LENGTH 20 USER-COMMAND space.
AT SELECTION-SCREEN.
BREAK-POINT.
Code: Alles auswählen.
REPORT.
PARAMETERS: p_matnr TYPE matnr AS LISTBOX VISIBLE LENGTH 60 USER-COMMAND space.
AT SELECTION-SCREEN.
BREAK-POINT.
INITIALIZATION.
PERFORM fill_listbox.
*&---------------------------------------------------------------------*
*& Form FILL_LISTBOX
*&---------------------------------------------------------------------*
FORM fill_listbox .
TYPE-POOLS: vrm.
DATA: t_values TYPE vrm_values,
id TYPE vrm_id.
id = 'P_MATNR'.
SELECT matnr AS key
maktx AS text
INTO CORRESPONDING FIELDS OF TABLE t_values
FROM makt UP TO 20 ROWS
WHERE spras = sy-langu.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = id
values = t_values.
ENDFORM. " FILL_LISTBOX