on 07-14-2009 2:33 PM
Hi All,
I have 2 BAPIS : BAPI 'ABC' and BAPI 'XYZ'.
I have 2 Views: 'abc' and 'xyz' view.
Now, I have XYZ bapi in xyz View and ABC bapi in abc View. I want to use a field of XYZ bapi inside abc view. How to call it?
I have tried doing this but it failed, I had called XYZ bapi in abc view's context and used the field. But all the time, it shows the same value becuse the bapi execution is done in xyz View.
Please help.
Hi,
First map both views context to component controller, so that u can use the field in two views.
u can use that filed in abc view also.
Regards,
Sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarbjeet,
Yes, the same field is displayed there in xyz view, but here it's showing proper string value. But that same field in zbc View is showing null.
I think it's because, in xyz we have executed the bapi..but in abc View, we are directly calling the field without executing bapi. Is it so ?
If you are still confused, pls give me your email id.
Hi Nikesh Shah,
Sarbjeet is correct.
Let me tell in simple way.
you already created View A and View B and you already mapped the BAPI A from
Models->ComponentController-->ViewA and you ececuting the Bapi in view A.
you are navigating from ViewA to ViewB. right.
simply map what ever field u want to display in ViewB like in component contoller you have that node right, map like this
Componetcontroller--->view B. and directly bind that attribute with UI element. it will automatically display the value.
Let me know if you have any queries.
HI Nikesh,
This might also haapen if you havent mapped the correct model attribute from the component controller.
Check it once again whether you have mapped the correct attribute i.e . the this attribute should be present in the output node of the bapi. you might be mapping the attribute from the input node.
Check it out and let me know.
regards,
SARBJEET SINGH GILL
Hi All, I'll have to explain U in detail.
I have 2 views : ShoppingCart View n StatusDetail View.
I have a BAPI : Z_Bapi_Musa_Salesorder_Create_Input in which a field is : I_Note_Text
In ShoppingCart View, all d Sales Order process is executed. n d BAPI also gets executed with all d input parameters passed to it frm portal. So d field I_Note_Text also works fine n gives proper output.
Now, in StatusDetail view, I hv a button, n once u click that, it shud call d field I_Note_Text for d generated Sales order number. It was not happening n it gave me Null value for all the sales order numbers.
I have mapped the field also in Component Contrller. It was giving me Null value before, so I did some coding in StatusDetail View, but now this goes into loop and nothing happens.
Coding here for both the views:
For ShoppingCart View:
wdContext.nodeZ_Bapi_Musa_Salesorder_Create_Input().invalidate();
wdContext.nodeZ_Bapi_Musa_Salesorder_Create_Input().bind(new Z_Bapi_Musa_Salesorder_Create_Input());
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().setI_Ship_To_Party(ship_to[0].trim());
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().setI_Sold_To_Party(ship_to[0].trim());
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().setI_Note_Text(text);
items.setAttributeValue("MATNR",wdContext.currentCARTCONTENTElement().getPRODUCT_ID());
items.setAttributeValue("PRODUCT_TYPE",wdContext.currentCARTCONTENTElement().getITEM_TYPE());
items.setAttributeValue("REQ_QTY",String.valueOf(wdContext.currentCARTCONTENTElement().getPRODUCT_QTY()));
items.setAttributeValue("VTEXT",wdContext.currentCARTCONTENTElement().getZ_Term());
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().modelObject().addI_Orderitems(items);
wdThis.wdGetMUSACenterController().executeZ_Bapi_Musa_Salesorder_Create_Input();
The code works fine in ShoppingCart View.
For StatusDetail View:
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().setI_Dealer("");
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().setI_Sold_To_Party("");
wdContext.currentZ_Bapi_Musa_Salesorder_Create_InputElement().setI_Ship_To_Party("");
wdThis.wdGetMUSACenterController().executeZ_Bapi_Musa_Salesorder_Create_Input();
Right now, this code is not working for StatusDetail View, The Bapi is not getting executed and just continues to loop.
Hi
No need of executing the bapi in the second view.
see your bapi Z_Bapi_Musa_Salesorder_Create_Inputwill be having one node Z_Bapi_Musa_Salesorder_Create_Output
Do you have the field I_Note_Text there in the output node.
If it is there, are you mapping this field from the component controller.
Regards,
Sarbjeet
Hi Nikesh Shah,
the bapi structure will look like in component controller
<BapiName>_Input
|
---input1
---input2
output |
-
export1
-
export2
if it is table parameter that will come under both input and output nodes.
if your I_Note_Text field is under tables parameter bind the I_Note_Text which is under tables and that table is under output node.
If your I_Note_Text field is under any structure then bind the I_Note_Text which is under structure and that structure is under output node.
If your I_Note_Text field is directly under output node then bind the I_Note_Text under output node.
let me know if you have any queries.
Thanks&Regards,
Bhargava.
Hi Bhargava,
It's a model attribute and inside that Bapi as a input parameter.
From portal we have to pass this at the time of Sales order creation. and thn it gets saved properlly. This happens perfectly in ShoppngCart View. After that once we switch to StatusDetail view, and click on that button, then the field again shows the perfect value.
But, if we directly call the StatusDetail view first time(without executing bapi), the field shows Null value. Actually it should bring the value that is stored in backend.
Hi Nikesh Shah,
if it is a input parameter u need to set the value in ShoppngCart View before navigating to StatusDetail view.
try to set that value in the action where exactly you are navigating to StatusDetail view.
let me tell on thing to you if it is a input parameter that will not carry any value after executing the BAPI from backend to portal.
the inputparameter will hold the value whatever u set and that input parameter carry that value from portal to backend.
let me know if you have any quries.
Thanks&Regards,
Bhargava.
Yes I understand this point, but as I already told you that this field gets the value at the time of sales order creation process. i.e. in ShoppingCart view.
But in StatusDetail view, we are directly calling this field from Bapi from backend because it got stored before. But it's coming as Null. In StatusDetail view we are not doing sales order creation again, so we can't pass the value frm this view. It should come from backend, as it's been stored before.
Working Condition : ShoppingCart view -> StatusDetail view, with sales order creation.
Not working condition : Directly calling StatusDetail view and fetching the stored value.
Hi Nikesh Shah,
you mean to say that field is export parameter in the BAPI. if it is yes then you must need to call the BAPI then that will bring the value from beckend to portal.
if you are already calling the bapi then check first whether the bapi is returning the value or not. for this u need to check in ABAP system if it is returning perfectly try to execute the BAPI before navigating to second view and bind directly that variable to UI element.
let me know still you are facing problem.
Thanks&Regards,
Bhargava.
Hi
when you are directly calling the second view and trying to fetch this field from the bapi. then you are not executing the bapi.
Even if you execute the bapi, this field will not get any value because it is not present in the output parameter node of the bapi.
By using the bapi you are actually, entering the value in the backend. But it is not necessary that same bapi is having the inout parameter in the output parameters also. which is the current scnerio. So what you should do is find out a bapi in the backend
which gives this sales number or whatever your field as the output.
By using this bapi you cannot do it.
regards,
SARBJEET
Hi Nikesh,
are you going from xyz view to abc view.
beacuse if xyz is your first view then you will execute the bapi in that and when you will go to abc view new value of the field will be there.
but if abc is your first view and xyz is your second view than you need to execute xyz abpi in abc view also to get the correct value of the mapped field.
thanks
sarb
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Sarb is right.
1.) Assume your BAPI is bound to the controller context
2.) The BAPI get's executed in view XYZ
3.) The result of the BAPI will be written into the controller context automatically.
4.) You are moving from view xyz to view abc.
5.) You have mapped one local context of view abc entity to the controller (the bapi controller context)
6.) You must be able to retieve the xyz data via the loca context of the view abc.
Sorry but I have no source code available on short notice.
Best regards
Uwe
Hi both,
Let me put it in a simpler way> I have 2 views A and B.
In View A, I have a Bapi C, which is having a field. In this view, I have executed the bapi and mapped that field with Component Controller.
Now in view B, i want to use the same field. Now what is happening is, I have created a model attribute in this view, and mapped that with the component controller's field.(No coding is done here, just added that field in layout)
When I try to open that view B, it shows Null for that field, since it's a string.
Please now tell me where I am getting wrong?
Hello,
you have to map the field in the context.
Have a context in view xyz-field_a and bind it to the context of the controller xyz-field_a
The same you do in view abc. create a field in the context xyz-field_a and bind it to the controller xyz-field_a
So if you are calling BAPI XYZ in view xyz, add the value to the ...currentcontext....
Then switch to view abc and you will find the value of xyz in abc.
Hope this is not too confusing.
Best regards
Uwe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.