Application Development 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: 

Delete Unnecessary lines from ABAP Programs

0 Kudos

looking for a way to parse an ABAP program code to remove unnecessary new lines or spaces

7 REPLIES 7

Sandra_Rossi
Active Contributor
0 Kudos

Is the question about reading and updating ABAP "source code units" (whatever is to be changed), or, if you know how to read and update, about a standard algorithm to "remove unnecessary new lines or spaces"?

0 Kudos

I have few custom program and function module from where i need to remove unnecessary new lines or spaces. if there is any program or standard algorithm, will work for me. Just need to remove unnecessary lines and space from my program

0 Kudos

Please use the COMMENT button for comments, questions, adding details, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area. At the same time, the person will be informed of your comment (currently not).

>> Just need to remove unnecessary lines and space from my program

My above answer solves that problem!

>> I have few custom program and function module from where i need to remove unnecessary new lines or spaces.

What is a few? Ten or hundreds? If it is around 10, above solution should still work fine. If it is 100s, yeah, I see why you are trying to automate tidying it up 😉

>> if there is any program or standard algorithm, will work for me.

Program as in SAP program or functionality as in "Pretty Printer"? No, not that I know of.
Standard algorithm? What is that? Do you write standard or non-standard algorithms?

I am curious, why do you need this so bad? The editor doesnt mind a few lines and spaces and sometimes those couple extra lines can even make it more readable and the compiler doesnt get to see those at all 😉

michael_piesche
Active Contributor

You could first use the pretty printer (gets rid of spaces in empty lines and spaces after coding).

Then you copy and paste it to a text editor, search and replace " \n\r\n\r" with "\n\r". And then copy and paste it back to your SAP editor.

shanthi_bhaskar
Active Contributor
0 Kudos

there is no standard way to it..You have to do manually.

If there is standard way then we don't need ABAP consultants to write the programs in first place 🙂

michael_piesche
Active Contributor
0 Kudos

anuragkathal, please follow up on your open question.

  • comment answers or your question if there are still open issues.
  • otherwise mark an answer as accepted if it helped you solve your problem
  • or post an answer of yourself and accept it if you found another useful solution yourself
  • or redirect your question to another question that is related and was useful to solve your problem
  • in the end, close your question