cancel
Showing results for 
Search instead for 
Did you mean: 

Get Input Parameters BAPI

Former Member
0 Kudos

Hi,

In my Component Controller > Implementation >

in the method executeBapi_MYBAPI_Input( )

i write this code:

String s_nom_deb = "BT*"
			String s_nom_fin = "BV*"
			
			nom_deb.setUname(s_nom_deb);  
			nom_fin.setUname(s_nom_fin);
			
			wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_Start(nom_deb);
			wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_End(nom_fin);
			
			wdContext
				.currentBapi_MYBAPI_InputElement()
				.modelObject()
				.execute();
				
			wdContext.nodeOutput().invalidate();

and IT WORKS.

but i want value "BT" and "BV" became from inputfield,

but when i replace by:

wdContext.nodeNom_Start().currentNom_StartElement().getUname();

and wdContext.nodeNom_End().currentNom_EndElement().getUname();

it doesn't work.

how can i retrieve the value from my 2 inputfields ?

what sould i verifie in "mapping" ?

Regards,

Phoenix

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Take two value attributes of type string and map them to ur input fileds.

now ur code will be,

nom_deb.setUname(wdcontext.currentcontextelement.getS_nom_deb);

nom_fin.setUname(wdcontext.currentcontextelement.getS_nom_fin);

and try to execute the BAPI.

Former Member
0 Kudos

Hi sunitha,

thanks for ur answer but, i've ever write and execute that code but it doesn't work.

like if it can't retrive the data of the inputfield or like if there is a mapping problem...

Answers (4)

Answers (4)

Former Member
0 Kudos

upper/lower case problem which cause errors in BAPI execution (from the beginning, model mapping/binding, context mapping was good)

Message was edited by:

phoenix leo

Former Member
0 Kudos

Hi phoenix leo ,

Declare all ur value attrobutes and then map them to the Views. Now try accessing the elements.

Regards,

Jhansi

Former Member
0 Kudos

thanks Jhansi, but i've ever done that before.

my problem is that i can access to my inputfield in my ResultView with

			wdThis
				.wdGetListUserComponentController()
				.wdGetContext()
				.currentContextElement()
				.getUsername();

but not in my ListUserComponent with


wdContext.currentContextElement().getUsername();

😕

Former Member
0 Kudos

but i'm not sure that the inputfield in the context mapping is executed, like if

the data are not yet transfered to the Component.

I think, that in the ResultView, it's done as it's after the context mapping with Component

Message was edited by:

phoenix leo

Former Member
0 Kudos

Hi,

Let me know these context attributes are in component or in view

|->Nom_End----


>Nom_End

|->Nom_Start----


>Nom_Start

I think these fileds generalled model node value attributes getting from component controller only.

But input should be passed only thru View only for that sake u need to context mapping the conroller (end and start value attributes) to your View where u pass the input.

I think these two input value attributes values only input for the BAPI.

Otherwise explain your flow once agin we will solve your problem.

Thanks,

Lohi.

Former Member
0 Kudos

hi lohitha,

thanks for ur answer but i don't understand what u want to know...

START VIEW <----


> COMPONENT CONTROLLER

|->Nom_End----


>Nom_End

|->Nom_Start----


>Nom_Start

Former Member
0 Kudos

hi,

i've try an other things,

in my Component Controller

in my metho executeBapi_MYBAPI_Input()

i write

<b>			wdContext.currentContextElement().setUsername("BT*");
			wdContext.currentContextElement().setUsername_end("BV*");</b>

			s_nom_deb = wdContext.currentContextElement().getUsername();
			s_nom_fin = wdContext.currentContextElement().getUsername_end();

and IT WORKS

of course, the code in bold is made "manually" but it confirm that the code

wdContext.currentContextElement().getUsername()

is empty !!!

but i don't know why ???

Former Member
0 Kudos

hi,

is anybody know how i can access, in my componenet controller, an element which is in the StartView ?

For example, in the Context of the StartView, if i define a Value Attribute "<b>va_foo</b>".

In my Component Controller, can i access it by

wdContext.currentContextElement().getMap_va_foo();

<u>Informations</u>:

Context mapping between StartView and my Component Controller is

<b>va_foo -


>Map_va_foo</b>

StartView -> Layout : value of inputfield : <b>va_foo</b>

Former Member
0 Kudos

Hi ,

Create a value attribute in controller with same name as it in view ,

now go to your view context , right click on value attribute , select edit context binding and select the value attribute which u created in controller .

now u can access it in controller as .....

wdContext.currentContextElement().getMap_va_foo();

Thanks,

Sunitha

Former Member
0 Kudos

hi,

finally,

it was a pb of upper/lower case in my inputfield which cause problems with BAPI execution ... 😕

i share points

Former Member
0 Kudos

Declare two value attributes binding with input field and those are like variables one and two

simply u can add like this.

wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_Start(wdContext.currentContextelement.getOne());

wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_End(wdContext.currentContextelement.getTwo());

it might helps you.

Thanks,

Lohi.

Former Member
0 Kudos

thanks Lohitha, but i've ever done this without success

Former Member
0 Kudos

Hi Phoenix,

Declare two value attributes (ex: a and b) and map them to your input fields.

Now get the values of input fields:

String s_nom_deb = wdContext.currentContextElement().getA();

String s_nom_fin = wdContext.currentContextElement().getB();

Now set them to

wdContext.currentBapi_MYBAPI_InputElement().setNom_Start(s_nom_deb); wdContext.currentBapi_MYBAPI_InputElement().setNom_End(s_nom_fin);

and call <b>executeBapi_MYBAPI_Input( )

</b> method.

And dont put the code executeBapi_MYBAPI_Input( ) method put it in Button action or where ever you want.

Regards,

Jhansi

Former Member
0 Kudos

hi Jhansi,

i've done what u've writen but it doesn't work.

i think that the problem is here:

String s_nom_deb = wdContext.currentContextElement().getA();
String s_nom_fin = wdContext.currentContextElement().getB();

s_nom_deb and s_nom_fin seem empty...

Former Member
0 Kudos

Hi ,

I think u haven't mapped inputfields properly.

check the properties of the UI element i.e inputfiled,

the value of the Inputfiled should be mapped to the value attribute which u have created.

Former Member
0 Kudos

i try to move this part of the code in the WdInit but whitout success...

String s_nom_deb = wdContext.currentContextElement().getA();
			String s_nom_fin = wdContext.currentContextElement().getB();
			
			nom_deb.setUname(s_nom_deb);  
			nom_fin.setUname(s_nom_fin);
			
			wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_Start(nom_deb);
			wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_End(nom_fin);

Former Member
0 Kudos

Hi ,

your code

<b>String s_nom_deb = wdContext.currentContextElement().getA();

String s_nom_fin = wdContext.currentContextElement().getB();

nom_deb.setUname(s_nom_deb);

nom_fin.setUname(s_nom_fin);

wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_Start(nom_deb);

wdContext.currentBapi_MYBAPI_InputElement().modelObject().setNom_End(nom_fin);

</b>

should be in executeBapi_MYBAPI_Input( ) method.

try this...

Former Member
0 Kudos

hi sunitha,

that's exactly what i've done but without success...

and my inputfiled are nice mapped as i can access it in my <b>ResultView</b>

with :

		nom_user =
			wdThis
				.wdGetListUserComponentController()
				.wdGetContext()
				.currentContextElement()
				.getUsername();

but in my <b>listUserComponent</b>,

with this code :

String s_nom_deb = wdContext.currentContextElement().getA();

i can't retrive the data of the inputfield

Former Member
0 Kudos

Hi ,

i think the problem is with ur value attributes mapping..

value attribute of view is not mapped to value atribute on the controller.

right click on the value attribute in view , select edit context mapping and map it to the value attribute in controller.

hope this will solve ur problem....

Former Member
0 Kudos

hi,

here are some explanations wich can be helpful:

when i double click on the link (between my StartView and my Component Controller) in my Data Modeler, i can see:

SartView ListUserComponent

Context Context

Bapi_MYBAPI_Input----


>Bapi_MYBAPI_Input

|->Nom_End----


>Nom_End

|->Nom_Start----


>Nom_Start

Name----


>Username

Name_End----


>Username_End

but may be that it should be,

Name(which is mapp to inputfield in StartView)----


>Nom_Start

Name_End(which is mapp to inputfield in StartView)----


>Nom_End

Former Member
0 Kudos

perhaps that the value are not yet affected is the attributes values "Name" and "name_end" ...