cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help in COde Error

Former Member
0 Kudos

Hi,

i new to WebDynpro,

i do the exercise 3 from Ja312 and in the Book i have to Add

this code Below:

the problem is that i have redlines in getCmp_firstname

and in response how can i solve it?

Regards

public void onPlugFromStartView(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onPlugFromStartView(ServerEvent)
    
    String firstname =
    wdThis.wdGetExc_IntroController().wdGetContext().   
	currentContextElement().getCmp_firstname(); 
    
    
    String lastname =
	wdThis.wdGetExc_IntroController().wdGetContext().
	currentContextElement().getCmp_lastname();
		
		if ( ( firstname!=null ) & (lastname!=null)){
			response = "hellow , "+firstname+" " +lastname ;				
		}else {
			response = "Hellow, stranger";
		}
		
		wd.Context.currentContextElemnt().set_txtviewresult(response);
    
    
    //@@end
  }

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ricardo,

For resolving the issue, please go to the component controller "Exc_IntroController" and select the context tab. There you will find the attribute under Context. There should be n attribute with name exactly as 'Cmp_firstname'. If the name is not exactly same then replace the below line of code with the exact name:

String firstname =

wdThis.wdGetExc_IntroController().wdGetContext().

currentContextElement().get_Cmp_firstname_();

Hope this resolves your issue.

Regards,

Arafat

Former Member
0 Kudos

hi Arfat,

thanks but What about field responce ?

Regards

Former Member
0 Kudos

If variable response is not declared somewhere else, put String response=null; at the begining of the method.

public void onPlugFromStartView(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onPlugFromStartView(ServerEvent)
    String response = null;

Answers (0)