Skip to Content
0
Former Member
Oct 18, 2006 at 07:39 AM

Dynamic program generation problem

40 Views

Hi guys,

Does subroutine in dynamically generated program can't be be invoked with parameter?

If perform dyn subroutine without any parameters, it's run well, anybody can tell me why?

REPORT z_test.

TYPES: BEGIN OF tp_sflight,

carrid TYPE sflight-carrid,

connid TYPE sflight-connid,

fldate TYPE sflight-fldate,

price TYPE sflight-price,

END OF tp_sflight.

DATA: BEGIN OF fld_list OCCURS 0,

fld_name(20),

END OF fld_list.

DATA: gt_outtab TYPE TABLE OF tp_sflight WITH HEADER LINE.

DATA: source_line(72).

DATA:

gi_source LIKE STANDARD TABLE OF source_line,

l_prog_name(30) TYPE c,

l_msg(120) TYPE c,

l_line(10) TYPE c,

l_word(10) TYPE c,

l_off(3) TYPE c.

START-OF-SELECTION.

SELECT * FROM sflight

INTO CORRESPONDING FIELDS OF TABLE gt_outtab

UP TO 10 ROWS.

fld_list-fld_name = 'connid'.

APPEND fld_list.

fld_list-fld_name = 'price'.

APPEND fld_list.

APPEND 'PROGRAM MY_SUBPOOL.' TO gi_source.

APPEND 'FORM WRITE_DYN_CONTENT USING wa TYPE sflight.' TO gi_source.

LOOP AT fld_list.

CLEAR source_line.

CONCATENATE 'WRITE wa-' fld_list-fld_name '.' INTO source_line.

APPEND source_line TO gi_source.

ENDLOOP.

APPEND 'ENDFORM.' TO gi_source.

GENERATE SUBROUTINE POOL gi_source

NAME l_prog_name MESSAGE l_msg LINE l_line

WORD l_word OFFSET l_off.

IF sy-subrc <> 0.

WRITE : / 'Error', l_msg.

ENDIF.

WRITE l_prog_name.

LOOP AT gt_outtab.

PERFORM write_dyn_content <b>USING gt_outtab </b> IN PROGRAM (l_prog_name).

ENDLOOP.

Regards,

Tim

Message was edited by: jingen tang