Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How do I edit the file created by code generator?

hi all,

I want to modify a java file that is generated when you create the webdynpro, but I can not change.

// -


// This file has been generated partially by the Web Dynpro Code Generator.

// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.

// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.

// -


how can I disable the file to modify

thanks!

Former Member
Former Member replied

Hi Pablo.

There's no way to modify it, NW2004s and its IDE has a code compilation based in some internal scripts based on eclipse plugin architecture.

In your code you must consider this.

1 - Try to find in your declared methods, importing directives, packages declarations some like this:

// -


// This file has been generated partially by the Web Dynpro Code Generator.

// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.

// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.

// -


package com.sap.teste;

//

// IMPORTANT NOTE:

// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED

// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN

// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateTesteApp).

// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY

// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS

// OF IMPORT STATEMENTS.

//

//@@begin imports

import com.sap.teste.wdp.IPrivateTesteApp;

import com.sap.myimport.MyClass;

//@@end

//@@begin

//@@end

it means that between begin and end...you can add what you want..and the code will not be removed after class compilation....

//@@begin javadoc:wdDoExit()

/** Hook method called to clean up controller. */

//@@end

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

int this case too....if you implement something between //@@begin and //@@end in the method scope...all part of your code will be surely safe.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question