Sometimes, you want to create ABAP code but do not necessarily want to keep it. Here's how you do it:
Execute the program and type a title (for the program) and routine name (without spaces) and execute. When the editor comes up, type in your code and click save.
report zexecprg no standard page heading. parameters: titel(80). parameters: routine(32). data: program(8). data: lines(72) occurs 0 with header line. data: mezzage(128). data: line_no type i. data: length type i. data: startpos type i. editor-call for lines. lines = 'report zreport.'. insert lines index 1. concatenate 'form' routine '.' into lines separated by space. insert lines index 2. append 'endform.' to lines. generate subroutine pool lines name program
message mezzage line line_no. if sy-subrc is initial. set pf-status 'ZEXY'. startpos = ( sy-scols - strlen( titel ) ) / 2. write at (startpos) titel. perform (routine) in program (program). else. write:/ mezzage. endif.
This was first published in March 2002