Callinfg ALV from another component
Hi all,
We have a main component in which on press of a button we need to show alv which is in another component.
I am trying to follow these steps but i need your inputs
1. I have declared the component which calls alv in used components
2. In the main view of my component i have placed a VCU
3. In the window of the main component i have embedded that VCU and embedded the view of the component which calls the alv.
Now how can i call alv on press of that button ?
Please let me know your suggestions
Regards
Bhanu
Hi,
Aditya has the right idea in my opinion. I always do things this way (altering visibility) because 1. it's easiest and 2. you don't have initializing problems. Here's how you can do it:
First of all, set your ViewContainer invisible in design time.
1. Go to the Component controller of your main component (where your ViewContainer is in), go to attributes
2. Add an attribute Z_GO_VIEW, Public, Type ref to, IF_WD_VIEW.
3. Go to your View of the CC where the VC actually is in.
4. Go to hook method WDDOMODIFYVIEW
5. Add the following code:
IF first_time = abap_true.
wd_comp_controller->z_go_view = view.
ENDIF.
--> now you have the instance of your view interface.
6. Make a button
7. In the event handler method of the button, code something alike to this:
DATA:
lo_el_ui_root TYPE REF TO cl_wd_uielement_container,
lo_el_trans_cont1 TYPE REF TO cl_wd_uielement_container,
lo_el_button1 TYPE REF TO cl_wd_button.
DATA: lv_visibility TYPE WDUI_VISIBILITY.
lo_el_ui_root ?= wd_comp_controller->z_go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lo_el_trans_cont1 ?= lo_el_ui_root->get_child( ID = 'TC_ONE' ).
lo_el_button1 ?= lo_el_trans_cont1->get_child( ID = 'I_AM_THE_MIGHTY_BUTTON' ).
lv_visibility = '02'.
lo_el_button1->set_visible( value = lv_visibility ).
This isn't exactly what you'll need but you get the picture: Get the View Instance, Downcast the UI tree for the Element you want to dynamically alter, use the right method for alterations.
This should solve your problem. If it doesn't, ask us again
regards, Lukas
Similar Messages
-
How I can call controller's functions from another component?
Hi again!
I make a few web Dynpro components, for example first for user-data processing, second - for project-data processing. In the controller of 1-st controller there is a function getUserById(). In the controller of 2-nd component I need such function. And I don't want to make a dublicate for this function in the controller of 2-nd component. Is there a way to call function in one component from another?Hi,
Yes, you can reuse the component. There are two basic types of component communication. 1. Intra Component communication 2.Inter Component communication.
1. Intra Component communication: The two components must be in same DC(project).
Procedure:Say there are C1,C2 components in a DC.
Open C2, Open interface controller, create a similar (_parameters and return type_) method to the method C2. Call C2's method in this Interface method.
Open C1, select and right click Used Web Dynpro Components -> Add Used Component. In the wizard, you can browse and select the C2 component,and enter a name to the usage. Then the usage of the interface <b>must </b>be added in properties required controllers of a view/component controller.
Now we can use the method that is available in the C1 interface controller.
You must define method before declaring usage
<b>2.Inter Component communication:</b> The two components are in different DCs
Open DC metadata of C2. Right click on Public part-> create new Public Part.Enter name-> Next -> Select entity type as Web Dynpro Component in wizard,in Select Entities select the component ,Finish.
A structure for public part is created.
Open C1, Open DC metadata of C1. Right click on Used Dcs-> AddUsed DC. Browse to C2's public part.
Select Finish.
regards,
Siva
Edited by: Siva Rama Krushna on Dec 19, 2007 10:07 AM -
Show messages from another component
Hello,
I have an application with several components, and I would like to know that I do to show messages from one component to another.
Thank youThank you for responding, the problem is that we show the messages in sigueinet way:
CALL METHOD l_message_manager->report_t100_message
EXPORTING
msgid = ls_errores-id
msgno = ls_errores-number
msgty = ls_errores-type
p1 = ls_errores-message_v1
p2 = ls_errores-message_v2
p3 = ls_errores-message_v3
p4 = ls_errores-message_v4
view = 'ID_BODY'.
The problem is that it shows us what the component in which we are, which is a POPUP, and we want to show in another component -
How to get a value of attribute/field From another Component/bol
Hello
I have to write some code in Component GS_CM/DocList.
From 'GS_CM' I have to get a value of field attribute-STATUS_CURRENT
From BT115QH_SLSQ/Details
Context Node = BTSTATUSH
Attributes = STATUS_CURRENT
In order to check and enable some other functions.
I know how to do it when I'm in the BT115QH_SLSQ/Details
lr_status ?= typed_context->btstatush->collection_wrapper->get_current( ).
lv_statush = lr_status->get_property_as_string( iv_attr_name = 'STATUS_CURRENT' ).
But, in my Componenet GS_CM/DocList the field "BTSTATUSH->COLLECTION_WRAPPER->GET_CURRENT" is unknown. It is not contained in one of the specified tables nor is it defined .
would be very grateful if you could help to solve this issue.
Thanks In Advance
SimaHi Sima,
then another short hint to the WD_USAGE_INITIALIZE.
Go to the component workbench, open the component BT115QH_SLSQ. Go now to the component controller class, go to it's methods. You will see that in the coding of the Method WD_USAGE_INITIALIZE, on the class CL_BT115QH__BSPWDCOMPONEN_IMPL:
WHEN 'CUGSCM' OR 'CUGSCM_DET'.
CALL METHOD iv_usage->bind_context_node
EXPORTING
iv_controller_type = cl_bsp_wd_controller=>co_type_custom
" iv_name = 'ContentManagementCuCo' "Custom Controller Name
iv_name = 'BT115QH_SLSQ/CUGSCMGenCuCo' "Custom Controller Name
iv_target_node_name = 'CMBO' "Name of Node in this Custom Controller
iv_node_2_bind = 'CMBUSOBJ'. "Name of Node in used component GS_CM
CALL METHOD iv_usage->bind_context_node
EXPORTING
iv_controller_type = cl_bsp_wd_controller=>co_type_custom
iv_name = 'BT115QH_SLSQ/CUGSCMGenCuCo'"#EC NOTEXT
iv_target_node_name = 'ATTRIBUTES' "#EC NOTEXT
iv_node_2_bind = 'ATTRIBUTES'. "#EC NOTEXT
Now I checked the context on the component controller and it contains the statusH, the node which you want to use in the component GS_CM. So make sure to prepare the GS_CM component by adding the Status context, and afterwards just add the binding in the code I pointed out above.
Best regards,
Erika -
Accessing a Variable from another component
Hey,
I have got a main application with different states.. in the
states I call different components.
like this:
quote:
<mx:State name="products">
<mx:AddChild>
<modules:Products/>
</mx:AddChild>
</mx:State>
<mx:State name="add_offer">
<mx:AddChild>
<modules:AddOffer bufferedProduct="{}" />
</mx:AddChild>
</mx:State>
In the product component, I have a button which saves some
information to a variable called "bufferedProduct". after that the
program leaves the state "products" und switches to the state
"add_offer", which is a different component. There I need the saved
information from the "bufferedProduct" variable.
Now my question, how can I "transfer" the information
previously stored within the "Products" component in the
"bufferedProduct" var into the "addOffer" component? Is there a way
I can do that? Or should I use a different way to build my
application :)
this does not work unfurtunately!
quote:
parentDocument.products.bufferedProduct
thx in advance
patHey,
I actually found one answer myself.
I created a var bufferedProduct in the main app. In te
Products state, I save the information to
"parentDocument.bufferedProduct" and then I sent the var to the
other component like this
quote:
<modules:AddOffer bufferedProduct="{bufferedProduct}"
/>
in the addOffer component I just had to declare another var
with the same name and thats it.
thx anyway.
pat -
How can I call a public function in one component from another component?
I have two components: Form and Confirmation. Form is a Canvas and Confirmation is a TitleWindow.
Form contains several controls and a submit button. Confirmation contains an OK button. When the user clicks the submit button, the Confirmation appears over the Form (Form is blurred). When the user clicks the OK button on the Confirmation, I want to run a function on Form to set some default values in the controls.
How can I address the function in the Form component from the Confirmation component so I can fire the function?
Thanks!Here is the source
CustomForm.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script>
<![CDATA[
public function callBack(): void {
lblStatus.text = "Success";
]]>
</mx:Script>
<mx:Label id="lblStatus"/>
<mx:Form x="50" y="50" verticalGap="15">
<mx:FormHeading label="Send us comments" />
<mx:FormItem label="Full Name:">
<mx:TextInput id="fullName" />
</mx:FormItem>
<mx:FormItem label="Email:">
<mx:TextInput id="email" />
</mx:FormItem>
<mx:FormItem label="Comments:">
<mx:TextArea id="comments" />
</mx:FormItem>
<mx:FormItem>
<mx:Button id="submit"
label="Submit" />
</mx:FormItem>
</mx:Form>
</mx:Canvas>
CustomTitle.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="200" height="80"
showCloseButton="true" close="closeMe(event)"
backgroundAlpha="1"
color="#173553" backgroundColor="#EEEEEE"
headerColors="#FFFFFF, #CBCCCC"
borderColor="#666666" borderStyle="solid">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
public var callBack: Function = new Function();
private function closeMe(event: Event): void {
PopUpManager.removePopUp(this);
callBack();
]]>
</mx:Script>
<mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="bottom">
<mx:Button id="btnOK" label="OK" click="closeMe(event)" />
</mx:HBox>
</mx:TitleWindow>
TitleWindowSample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*"
layout="absolute"
width="100%" height="100%"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private function init(): void {
customForm.submit.addEventListener(MouseEvent.CLICK, onMouseClick);
private function onMouseClick(event: MouseEvent): void {
customForm.lblStatus.text = "";
var customTitle: CustomTitle = new CustomTitle();
customTitle.callBack = customForm.callBack;
PopUpManager.addPopUp(customTitle, this);
PopUpManager.centerPopUp(customTitle);
]]>
</mx:Script>
<mx:VBox
width="100%" height="100%"
verticalAlign="middle" horizontalAlign="center">
<CustomForm id="customForm" width="500" height="300">
</CustomForm>
</mx:VBox>
</mx:Application> -
How to call a local variable from another component controller
Dear Experts,
I have created 1 component controller(Controller Name as B)and methods.In that methods I Have declared Local variable(For ex data: Lv_flag). I have Created 1 more component and name as A. I used Component B in Component A(Using component usage). In A component controller I have created methods.Now I want to call a local variable Lv-flag in this method from B controller Method. Please reply your valuable answer.Karthikeyan,
Please make sure that flag attribute is under some node, say NODEA. NOW please select the interface node property and input element of NODEA.
now NODEA will be available in interface controller. Interface controller acts like a global controller between two different components.
So from interface controller you can take that flag value.
pls reply back if you have any confusion.
Regards
Srinivas -
How to consume a method on the interface controller from another component?
Hello,
I have a project which contains two Components, A & B.
I have exposed a method at the interface controller of Component A. How can I consume it from Component B?Hi,
First add ComponentA as a used webdynpro component in ComponentB. Then open the Interface Controller of B and switch to Properties Tab. Select Add in the "Required Controllers" section. From the dialog that appears, select A's interface controller. Then you can access A's method from B's interface controller as:
wdThis.wdGetAComponentInterface().<method>;
Regards,
Satyajit. -
Fire window plug from another component
Hi,
I want to fire a plug which is created in the window of one component, from the view of a different component.
Is this possible?
Any information would be much appreciated.
Thank you!Hi Christian,
thank you for the tip.
But if I do this in that way then I get a new strange problem:
I have a main component and two sub-components A and B. The views from component A and B are embedded in a view container of the main component. So either component A or component B is displayed in the main view.
Now I fire the outbound plug in A (which is connected to the inbound plug of the main window).The main windows inbound plug handler fires the corresponding outbound plug connected to the view of component B.
Now the strange behavior is the main view will be displayed twiced. The second one is included in the first one.
Starting view:
| main view
| __________
| | view A
| __________
After firing the plug:
| main view
| __________
| | main view
| | ________
| | | view B
| | ________
| __________
Regards
Thorsten -
Make public property of a component and access it from another component?
Component "alpha.mxml"
propriety: mapevent_mapready
Component "beta.mxml"
<alpha:alpha mapevent_mapready="some_function()" />
how?Hi leonapster,
Say in your component alpha.mxml
<!--alpha.mxml -->
<AlphaComponent>
public var mapevent_mapready:Boolean=false;
</AlphaComponent>
<!-- Beta.mxml -->
<BetaComponent>
<mx:Script>
private function init():void
//Now you can access the mapevent_mapready property of Alpha Component as below:
var bool:Boolean = alphaComp.mapevent_mapready;
alphaComp.mapevent_mapready
</mx:Script>
<alpha:alpha id="alphaComp" />
</BetaComponent>
Thanks,
Bhasker -
How to Access the view from another Component
Hi,
Seek your advice on this following requirement.
1. Would like to add the view OVWindow of Component BTCATEGORIES in an assignment block of
CRMCMP_CMG similar to the assignment block exists in the BT116H_SRVO component.
2. Please provide the step by step procedure to implement this requirement.
Regards,
ArifHi,
I am having view1 and view2.
in view1 i am using roadmap. S1 is one of the step of road map.
in view1 i used this code to get the reference of this view in componentcontroller attribute
Data: lo_api TYPE REF TO if_wd_view_controller.
If first_time = 'X'.
lo_api = wd_this->wd_get_api( ).
wd_Comp_Controller->my_VIEW = lo_api.
endif.
in my view2 i want to access the roadmap step
i dono how to access that.. i used this code.......
wd_comp_controller->my_view->get_element( 'S1' ).
is this correct.. If not what is the code to get that id..
Can any one tell me clearly... -
Calling particular Window from another webdynpro application
Hello Friends,
I want to call a particular window of a component from another component.
Say my first component has three windows win1, win2 and win3.
from my second component i want to call any particular window say win2.
please let me know both cases DEfault window call or any particular window call.
Thanks
SaurabhLets elaborate on your example.
Lets consider a main component COMPONENT_MAIN, and a sub component COMPONENT_SUB.
COMPONENT_SUB has three windows: win1, win2 and win3.
Your objective is to use: one of the windows from COMPONENT_SUB as a view in COMPONENT_MAIN.
Steps:
1. Declare a component usage in the component, compcontroller, and window of the component, COMPONENT_MAIN.
2. Right click on the window of COMPONENT_MAIN where you want to embedd the window of the COMPONENT_SUB as a view.
3. Do an F4 on the available views, there you will get the windows of COMPONENT_SUB to be embedd as the view.
4. Create the navigation and thus you can make use of the window of the sub component as a view.
Best Regards,
Rajesh -
How to call an alv report from another program and return back
Hello ,
I am calling one abap program (Prgm B) from another program (Prgrm A).
Here, Prgm B is an ALV report. I have fetch some data from Prgem B that gets stored in an internal table.
Now, I am using below code in Prgrm A,
SUBMIT Prgrm B VIA SELECTION-SCREEN
WITH SELECTION-TABLE rspar
EXPORTING LIST TO MEMORY
AND RETURN.
When Prgrm A executed, it lead me to selection screen of Prgrm B and when I click F8, it shows me the report output, In short, it doesnt return back to Prgrm A. It ends up showing me the alv report if Prgrm B even afetr using RETURN statement.
I want to get back to Prgrm A by fetching some data from Prgrm B.
Please let me know, if i am missing something.
Regards,
SeemaHi Seema,
Refer below code.
DATA: v_matnr LIKE mara-matnr.
DATA: t_listobject TYPE abaplist OCCURS 0 WITH HEADER LINE.
DATA: t_mara TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_ascilist OCCURS 0,
line(200).
DATA: END OF t_ascilist.
data var(3) type c.
SELECT-OPTIONS: s_matnr FOR v_matnr.
var = ' 3'.
START-OF-SELECTION.
SUBMIT ztestaks1 WITH s_matnr IN s_matnr EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL FUNCTION 'LIST_TO_ASCI'
* EXPORTING
* LIST_INDEX = -1
* WITH_LINE_BREAK = ' '
TABLES
listasci = t_ascilist
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE:/ 'Below are the lines from the submitted program.'.
LOOP AT t_ascilist.
WRITE:/ t_ascilist-line.
ENDLOOP.
SKIP 2.
ENDIF.
ENDIF.
IMPORT t_mara FROM MEMORY ID 'T_MARA'.
WRITE:/
'Here is the output from the table exported from the submitted program.'
LOOP AT t_mara.
WRITE:/ t_mara-matnr.
ENDLOOP.
Submitted program
REPORT ZTESTAKS1.
DATA: v_matnr LIKE mara-matnr,
v_maktx LIKE makt-maktx.
DATA: t_mara TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_makt OCCURS 0,
matnr LIKE makt-matnr.
DATA: END OF t_makt.
SELECT-OPTIONS: s_matnr FOR v_matnr,
s_maktx FOR v_maktx.
START-OF-SELECTION.
SELECT matnr INTO TABLE t_makt
FROM makt
WHERE matnr IN s_matnr
AND maktx IN s_maktx.
if not t_makt[] is initial.
SELECT * FROM mara
INTO TABLE t_mara FOR ALL ENTRIES IN t_makt
WHERE matnr = t_makt-matnr.
endif.
EXPORT t_mara TO MEMORY ID 'T_MARA'.
WRITE:/ 'This list is from the submitted program'.
SKIP 1.
LOOP AT t_mara.
WRITE:/ t_mara-mtart.
ENDLOOP.
Hopes this helps you.
Thanks,
Ashok. -
Reading the data from one component view into another component view
Hi All,
I have requirement to read the data from one component into another component while creating the service order. Here are the details.
Main View for Service order: BT116H_SRVO in that we have two assignment blocks like Organizational data(BTORGSET) and amount allocation(BTAMNTALL).This two blocks are two different component which are associated with main component(BT116H_SRVO).
I need to read the sales org data from component/View(BTORGSET/Orgsetdata) into Component/View(BTAMNTALL(HdrBillPlanDet) method DO_VALIDATE_INPUT.
I searched in SDN but all the posts are related to the data exchange between two views in same component. But My scenario is different as explained above.
Refer the attachments for the component link..
Please let me know how we can achieve this one..
Thanks,
Sapsar.Finally I was able to fix my code...My Mistakes were need to read the parent node above three levels and need to use the relation entity name while reading the data..
Below is the correction code
IF iv_index IS NOT INITIAL.
lr_iterator ?= collection_wrapper->get_iterator( ).
lr_current ?= lr_iterator->get_by_index( iv_index ).
lr_entity ?= lr_iterator->get_by_index( iv_index ).
ELSE.
lr_current = collection_wrapper->get_current( ).
ENDIF.
*loop back to root entity
WHILE lr_entity->get_name( ) NE 'BTAdminH'.
lr_entity = lr_entity->get_parent( ).
ENDWHILE.
*Get the related entity
IF lr_entity IS BOUND.
lr_collection ?= lr_entity->get_related_entities( iv_relation_name = 'BTHeaderOrgmanSet' ) .
IF lr_collection IS BOUND.
lr_orgset_m = lr_collection->get_current( ).
* lr_orgset = lr_orgset_m->get_related_entity( iv_relation_name = 'BTOrgSet' ).
lr_orgset = lr_orgset_m->get_property_as_string( 'SALES_ORG' ).
ENDIF.
ENDIF.
Thanks,
Sapsar. -
Copy standard cost with Cost Component from another material
Hi,
I need to copy standard cost from another material not only total price but also details of cost component split. I try to used transaction CKUC with procedure of "explode material cost estimate" but the reference material use "mixed costing" and isystem stop explosion.
There is another procedure in order to make this copy? I can not use special procurement because are different codes (material A / Plant XXX copy froma material B /Plant XXX).
Thanks for your support.
MicHi Chandra,
thanks for your suggestion, it works but only if I explode a level ... material "B" contains two mix codes that also contain their mixes. So system shows this message "Mixed cost estimate explosion in level 2 for material xxx" and "Mixed cost estimate exists: maximum of 2 explosion level (s) possible".
So Is not possible to copy and esploded a standard cost with multi level mix?
Thanks
Michela
Maybe you are looking for
-
Multiple Single Values with Select Options
hi, I'm using the SELECT_OPTIONS to accept the multiple input values through CREATE_RANGE_TABLE and it is working well but 1) i have requirement for some input fields that should accept multiple single values means without RANGES(From .. To).. Usuall
-
What is a logical component & Solution
Hi gurus, I have a very basic query on Sol Man terminology. 1. Logical Component - what is it? Why its used? What is its relevance to the satellite systems I would add to Sol Man system? 2. What is a Solution? How is it related to the satellite sy
-
I have a 4 min video I am working on. It has picture in picture, voice, stills, and video. When I try to export it as a mobile file to send to a coworker i get the error that it quit unexpectedly. Any suggestions?
-
I have AL 0.5 installed and currently using WindowMaker and everything is going fine. Now when I try to use .xinitrc to have Gnome as the default DE and I run startx, Gnome begins to load and I see the Splashscreen, but after that, error messages pop
-
How do I upgrade the plug-ins in Adobe Indesign ??
Can someone tells me how to do that ? Because I get messages that the plug-ins has to be updated...