1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
REPORT ztest_code_generate. PARAMETERS: p_matnr TYPE matnr. INITIALIZATION. DATA lt_itab TYPE TABLE OF string. DATA(lv_prog) = 'ZGENERATE'. lt_itab = VALUE #( ( |REPORT { lv_prog }. | ) ( |FORM get_matnr USING i_matnr TYPE matnr | ) ( | CHANGING ct_mara TYPE mara_tt.| ) ( | SELECT * INTO TABLE @ct_mara | ) ( | FROM mara | ) ( | WHERE matnr = @i_matnr. | ) ( |ENDFORM. | ) ). INSERT REPORT lv_prog FROM lt_itab. DATA: lv_mess TYPE string, lv_line TYPE i, lv_wrd TYPE string, dir TYPE trdir. SELECT SINGLE * FROM trdir WHERE name = @lv_prog INTO @dir. SYNTAX-CHECK FOR lt_itab MESSAGE lv_mess LINE lv_line WORD lv_wrd DIRECTORY ENTRY dir. IF lv_mess IS NOT INITIAL. MESSAGE lv_mess TYPE 'E' DISPLAY LIKE 'S'. RETURN. ENDIF. GENERATE REPORT lv_prog. IF sy-subrc <> 0. MESSAGE 'Ошибка при генерации кода' TYPE 'E'. RETURN. ENDIF. START-OF-SELECTION. DATA lt_mara TYPE mara_tt. PERFORM get_matnr IN PROGRAM (lv_prog) USING p_matnr CHANGING lt_mara. END-OF-SELECTION. |