Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg generate subroutine pool

Former Member
0 Likes
459

Hi All,

I have written the following code and it is executing successfully without any error, but it is not displaying the output(i.e is write statement)

data: begin of lt_source occurs 0,

line(128) type c,

end of lt_source.

data: l_name like sy-repid.

data: l_message(240) type c,

l_line type i,

l_word(72) type c.

lt_source-line = 'PROGRAM ZEXEC_ABAP_STMNT.'.

append lt_source.

lt_source-line = `DATA: GV_SLSORG(4) TYPE C.`.

append lt_source.

lt_source-line = `LOAD-OF-PROGRAM.`.

append lt_source.

lt_source-line = `SELECT SINGLE SALESORG INTO GV_SLSORG FROM /BI0/PMAT_SALES WHERE MAT_SALES = '000000000000013322'.`.

append lt_source.

lt_source-line = `FORM EXECUTE_QUERY.`.

append lt_source.

lt_source-line = `WRITE: / 'salesorg is', GV_SLSORG.`.

append lt_source.

lt_source-line = `ENDFORM.`.

append lt_source.

l_name = sy-repid.

generate subroutine pool lt_source name l_name

message l_message line l_line word l_word.

if sy-subrc eq 0.

PERFORM ('EXECUTE_QUERY') IN PROGRAM l_name IF FOUND.

ENDIF.

Can anyone help me to get the output(to print the write statement) for the above code.

2 REPLIES 2
Read only

Former Member
0 Likes
411

Hi,

Write as below , also Please look at F1 on Generate

data: begin of lt_source occurs 0,

line(128) type c,

end of lt_source.

data: l_name like sy-repid.

data: l_message(240) type c,

l_line type i,

l_word(72) type c.

lt_source-line = 'PROGRAM ZEXEC_ABAP_STMNT.'.

append lt_source.

lt_source-line = `DATA: GV_SLSORG(4) TYPE C.`.

append lt_source.

lt_source-line = `LOAD-OF-PROGRAM.`.

append lt_source.

lt_source-line = `SELECT SINGLE SALESORG INTO GV_SLSORG '

append lt_source.

' FROM /BI0/PMAT_SALES WHERE MAT_SALES = '''000000000000013322'''.`.

append lt_source.

lt_source-line = `FORM EXECUTE_QUERY.`.

append lt_source.

lt_source-line = `WRITE: / '''salesorg is''', GV_SLSORG.`.

append lt_source.

lt_source-line = `ENDFORM.`.

append lt_source.

l_name = sy-repid.

generate subroutine pool lt_source name l_name

message l_message line l_line word l_word.

if sy-subrc eq 0.

PERFORM ('EXECUTE_QUERY') IN PROGRAM (l_name) IF FOUND.

ENDIF.

Regards,

Srini.

Read only

Former Member
0 Likes
411

Thanq for your quick response it is working now