hi,
like this...
u can call screen from normal report
TYPES: BEGIN OF values,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
END OF values.
DATA: matnr(18) TYPE c,
werks(4) TYPE c.
DATA: progname TYPE sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values,
values_tab TYPE TABLE OF values.
DATA : len TYPE i,
no TYPE i,
mat_t(18) TYPE c,
mat(18) TYPE c.
<b>CALL SCREEN 100.</b>
&----
*& Module init OUTPUT
&----
text
----
MODULE init OUTPUT.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value, dynpro_values.
field_value-fieldname = 'MATNR'.
APPEND field_value TO dynpro_values.
ENDMODULE. " init OUTPUT
&----
*& Module cancel INPUT
&----
text
----
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE. " cancel INPUT
----
MODULE value_material INPUT
----
*
----
MODULE value_material INPUT.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'MARC'
fieldname = 'MATNR'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'MATNR'.
ENDMODULE. "value_material INPUT
----
MODULE value_plant INPUT
----
*
----
MODULE value_plant INPUT.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = progname
dynumb = dynnum
translate_to_upper = 'X'
TABLES
dynpfields = dynpro_values.
READ TABLE dynpro_values INDEX 1 INTO field_value.
len = STRLEN( field_value-fieldvalue ).
IF len < 18.
CLEAR : no,mat_t,mat.
no = 18 - len.
DO no TIMES.
CONCATENATE '0' mat_t INTO mat_t.
ENDDO.
CONCATENATE mat_t field_value-fieldvalue INTO mat.
ENDIF.
SELECT matnr werks
FROM marc
INTO CORRESPONDING FIELDS OF TABLE values_tab
WHERE matnr = mat.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'WERKS'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'WERKS'
value_org = 'S'
TABLES
value_tab = values_tab.
ENDMODULE. "value_plant INPUT
<i>The major difference between the program flow of an executable program and a dialog program is that in a dialog program, you can program screens to appear in any sequence you want.
In executable programs, the screen sequence is controlled by events, which occur in a fixed order.
In a dialog program, the programmer is free to program any sequence of screens, and the user can affect the program flow by his or her actions.
However, it is still possible to call a freely-defined screen sequence within an executable program and thus to branch into a form of dialog program.</i>
-
with reference to SAP Library -
Add a comment