Tip

Create ABAP code on the fly

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                                       

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.