Dynamically call htmlb button event
Hi
Does anybody know how to dynamically call the onClick event of an htmlb button?
for regular html, you use <buttonID>.fireEvent("onClick")
thanks in advance
Anton Kruse
Hi,
Use both onClientClick to call the client event an use onClick to execute the server event.onClientClick is executed with first priority and then the onClink event is fired in the server.
e.g :
<hbj:button
id="Send_Button"
text="Send"
tooltip="Sends my name"
jsObjectNeeded="true" onClientClick="validate();"
onClick="onSendButtonClicked"
width="100"
design="EMPHASIZED">
First the validate javascript method executes then the onClick "onSendButtonClicked()" method in the controller executes.
If helps reward with points.
Regards
Ritu
Thanks
Similar Messages
-
HTMLB- Button Event CASE Dyn Nav problem
Hi,
I am prototyping a solution in BSP which has a page with two buttons at the bottom, a BACK button and a SUBMIT button which both send the User to different pages, and I can't make the re-directs work.
I am trying to stick to HTMLB and not get lazy and use HTML.
I have a page call it page1.htm, at the bottom there is a submit button and back button with htmlb code as follows:
<htmlb:button text = "Back"
onClick = "event_1" />
<htmlb:button text = "Submit Request"
onClick = "event_2" />
in the EVENT HANDLER for the OnInputProcessing Event I have the following CASE statement:
CASE event_id.
WHEN 'event_1':.
navigation->goto_page( 'default.htm' ).
WHEN 'event_2':.
navigation->goto_page( 'submitresult.htm' ).
ENDCASE.
the idea is that when the BACK button is pressed the OnInputProcessing event handler will pick this up and using the value of the EVENT_ID which can be either event_1 or event_2 the CASE statement will re-direct the User to the correct page.
Problem -> it doesn't work.
Does anyone have any ideas where I am going wrong.
Thanks for your time,
Milan.Hallo Milan, (interesting name, English?)
Somehow we are just overlooking something. I quickly built a very small cut-and-paste example.
Create a new BSP application, and add into it three pages called page1.htm, page2.htm and page3.htm. The source is below. (Note all three has the same event handler:).
<b><u>onInputProcessing for all three pages</u></b>
DATA: event TYPE REF TO if_htmlb_data.
event = cl_htmlb_manager=>get_event_ex( request ).
IF event IS NOT INITIAL AND event->event_name = 'button'.
navigation->goto_page( event->event_server_name ).
ENDIF.
<b><u>page1.htm</u></b>
<%@page language="abap" otrTrim="true"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page>
<htmlb:form>
<htmlb:button text = "Page 2"
design = "NEXT"
onClick = "page2.htm" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b><u>page2.htm</u></b>
<%@page language="abap" otrTrim="true"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page>
<htmlb:form>
<htmlb:button text = "Page 1"
design = "PREVIOUS"
onClick = "page1.htm" />
<htmlb:button text = "Page 3"
design = "NEXT"
onClick = "page3.htm" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b><u>page3.htm</u></b>
<%@page language="abap" otrTrim="true"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page>
<htmlb:form>
<htmlb:button text = "Page 2"
design = "PREVIOUS"
onClick = "page2.htm" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
I highly recommend to run this in design2003. You will love that PREVIOUS/NEXT design on the buttons. If this example is not working for you, there are a few other things to be checked. But first try this.
++bcm -
Event Handling for HTMLB Buttons
Dear Pros,
How we handle HTMLB Button Events for the following Code in the Layout section:
I want the user to Click this button for Downloading the Internal table displayed onto an Excel file on Presentation Server.
<htmlb:content design="classic" >
<htmlb:page title="page1 " >
<htmlb:form>
<htmlb:button id = "Dwd_Excl"
text = "Download to Excel"
tooltip = "Please click for Excel Download"
onClientClick = "EXCEL"
design = "small"
width = "200" />
<htmlb:tableView id = "tv1"
headerText = "Sales Statement"
design = "alternating"
headerVisible = "true"
visibleRowCount = "20"
selectionMode = "lineEdit"
table = "<%= t_zsstable %>"
iterator = "<%= iterator %>" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Waiting for your suggestions/replies.
Sincere Thanks to All.
Vivek Singh.Hi Craig,
Just worked on the code sample you provided. Heres' how my code looks in OnInputProcessing segment:
Some internal table population code here
then the following code segment:
file = 'C:\ZSS.XLS'.
event = cl_htmlb_manager=>get_event_ex( request ).
IF event IS NOT INITIAL AND event->event_id = 'Dwd_Excl'.
results = 'Button was pushed'.
ENDIF.
IF results = 'Button was pushed'.
CALL FUNCTION 'WS_EXCEL'
EXPORTING
filename = file
TABLES
data = t_zsstabl
EXCEPTIONS
unknown_error = 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.
ENDIF.
ENDIF.
The problem is that when I push the Download to Excel HTMLB Button, the following Error is being displayed on the page :
500 SAP Internal Server Error
Error message: Exception condition "NO_BATCH" raised. ( type of termination: RABAX_STATE )
The Layout part code is :
<htmlb:content design="classic" >
<htmlb:page title="page1 " >
<htmlb:form>
<htmlb:button id = "Dwd_Excl"
text = "Download to Excel"
tooltip = "Please click for Excel Download"
onClick = "ExcelButton"
design = "small"
width = "200" />
<htmlb:tableView id = "tv1"
headerText = "Sales Statement"
design = "alternating"
headerVisible = "true"
visibleRowCount = "20"
selectionMode = "lineEdit"
table = "<%= t_zsstabl %>"
iterator = "<%= iterator %>" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
I hope you can suggest something on this.
Waiting for your response.
Best Regards,
Vivek. -
How to call a dynamic URL on 'button press' event, in MVC-based BSP
Hi,
My requirement is as below:
On selecting a row in table view, and pressing a button, I need to open a browser.
The Browser URL depends on the row selected.
The key field from table view, is added at the end of the URL string.
Shortly, I can say that, I am getting a value on row selection & want to pass it to button event.
In Views Section, there are 2 tags- (1)table view & (2)button.
Right now, I have put the code for getting the key field, in DO_HANDLE_DATA method.
In Button's OnClientClick method, I have called the Javascript to open the browser.
If I now write the code to concatenate the key field value to form the dynamic URL in 'OnClick' method,
it will be called only after the browser is opened.
(as OnClick event is executed only after OnClientClick event is executed)
Could anyone please tell me what event (and in which tag) can be used to solve this.
Is there any event which is triggered, as soon as the row is selected, & before the button press event is triggered ?
Would really appreciate responses made to this query.
Thanks,
Nisha Vengal.Hi Nisha,
The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.
function fn_button()
htmlbSL(this,2,'b_row_selection:onInputProcessing()');
window.open("new_page",target="BLANK");
Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.
Try this out and let us know if it works for you.
Regards,
Saurabh -
CRM5.2 UI-Call a dynamic URL on button click
Hi all,
My requirement is to call a dynamic url on the click of a button in the overview page. I have added a custom button in the method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS , and the related code in do_handle_event.I have created a custom method for the button event. I have enhanced a custom controller and created an attribute.In the custom method created for the button event, I have written the code for retrieving the parameters to be passed to the url.
In the layout of the view associated with the display view , I have written the following code for calling the URL in a new window.
<%
DATA: lr_cuco_EMA TYPE REF TO ZL_BP_CONT_BPCONT_IMPL,
lv_url TYPE string,
lv_url1 type string,
lv_count type i.
lr_cuco_EMA ?= controller->get_custom_controller( 'ZBP_CONT/BPCONT' ).
check lr_cuco_EMA is bound.
if lr_cuco_EMA->gv_VALUE is not initial.
if lr_cuco_EMA->gv_COUNT IS NOT INITIAL.
clear lr_cuco_EMA->gv_COUNT.
endif.
LV_URL = lr_cuco_EMA->gv_VALUE.
Concatenate 'http:/' LV_URL into LV_URL1.
Concatenate '"http:/' LV_URL '"' into LV_URL.
lv_count = lr_cuco_EMA->gv_COUNT mod '2'.
if lv_count Ne 0.
lv_url = lv_url1.
endif.
%>
<scrpt language="Javascript">
window.open(<%= lv_url%>).focus();
</script>
<%
lr_cuco_EMA->gv_COUNT = lr_cuco_EMA->gv_COUNT + 1.
clear lr_cuco_EMA->gv_value.
clear lv_count.
clear lv_url.
clear lv_url1.
ENDIF.
%>
But here my URl is getting called alternate times.If I do not write the code by using the variable GV_COUNT the url is getting called only the first time of the button click and to call the URL again you need to navigate back to the search page and again back to the overview page and click on the button.
Can anyone help me regarding this? I want the URL to be called in a new page on every button click.
Thanks in Advance,
ChandanaHi Nisha,
The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.
function fn_button()
htmlbSL(this,2,'b_row_selection:onInputProcessing()');
window.open("new_page",target="BLANK");
Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.
Try this out and let us know if it works for you.
Regards,
Saurabh -
Htmlb:button onClick event
Hi experts I'm using follwoing code for htmlb :button
<htmlb:button id = "myButton2"
text = "<%= v_save %>"
tooltip = "<%= v_save %>"
onClick = "approveClick"
design = "emphasized"
/>
and in
do_handle_event I'm using followin code
DATA : button_event TYPE REF TO cl_htmlb_event_button,
event1 TYPE REF TO cl_htmlb_event.
event1 = cl_htmlb_manager=>get_event( runtime->server->request ).
CASE event1->server_event.
WHEN 'approveClick'.
button_event ?= event1 .
< some code >
ENDCASE.
when i clicked the button it is not going into do_handle_event
I'm unable to capture onclick event of button .I tried it by keeping some break points .But couldn't be ableto capture it
Here I'm using MVC pattern .When one check box clicked in view of another controller the page which contains this button will be displayed.Do i need to write any additional code for itThere are 2 kind of break-points.
1. Session break-points - This will wok only to debug normal ABAP codes.
2. External break-points - This will help you to debug BSP/Webdynpro application.
Set the external-break point to figure out whether its triggering the events or not.
<b>
To set the external Break-points:</b>
Before settings the external-break-point, you need to Active External break-point for HTTP. YOu can find this option in
SE80, in
Utilites--> Break-point/External break-point or Utilites--> External break-point --> Set External break-point
or if you dont find, then
utilities-->setttings -> ABAP Workbench -> look at the debugger tab
& find the external Debugging check box or External Debugging user ID. Give SAP User ID
Also have a look at this..
http://help.sap.com/saphelp_nw2004s/helpdata/en/17/00ab3b72d5df3be10000000a11402f/frameset.htm
<i>* Reward each useful answer</i>
Raja T
Message was edited by:
Raja Thangamani -
Call the button click event programmically
I have customised the billing.aspx page. I now need to programmically call the click event of the continue image button to continue to the next page. I can't fire the click event. Does any one know the click event name of the continue button?
I've tried using this line to call the event
this.btnNext_Click(this, new EventArgs());
or
this.btnNext_Clicked(this, new EventArgs());Thomas,
You could also just click the button client-side with javascript:
function clickTheButton(theButton){
fireAnEvent(theButton,'click','MouseEvents');
function fireAnEvent(theControl, evtName, theModule){
if(document.createEvent){
var evObj = document.createEvent(theModule);
evObj.initEvent(evtName,true,true);
theControl.dispatchEvent(evObj);
else if(document.createEventObject) {
theControl.fireEvent('on' + evtName);
Cheers,
Corbin -
'Call' in PL/SQL button event handler
I have created a form with only one 'Custom' button on it.
In the PL/SQL button event handler, in 'Custom' event item, I
inserted some PL/SQL code and, at the end, a call like the
following:
my_url:= 'PORTAL30.wwv_component_control.run_as_portlet?'
|| 'p_module_id=' || '2836550185';
call(my_url,return_url);
I have a compilation error:
"PLS-00201: identifier 'CALL' must be declared"
I also tried to put this code in 'On successful submission of a
form'. I have no compilation error but it doesn't work.
Anybody knows hw to solve this problem?
Thanks.Hello Antonnella,
I have a good tip for you:
write the next scirp in the 'On successful submission of a
form'field in the form where you want to call the component:
declare
l_url varchar2(2000);
begin
l_url := 'the url of the component you want to call' ;
PORTAL30.wwa_app_module.set_target(l_url,'CALL');
end;
you can get the url from:
develop -> call interface:show -> Example of Call from URL .
Success,
Haseeb -
Can I launch a new JSP on a popup window, when cliking a HTMLB button ?
Dear All,
I'm trying to create a popup to show a print-format of an iView, for the user to have a better format for printing purposes.
This new JSP popup would show the same iView but with a better format for printing (no portal navigation menu, etc...)
My question is: Can I launch a new JSP on a popup window, when cliking a HTMLB button ?
Here's the technical details of what I've been doing so far:
- I'm using EP 5, but I believe the technologie for EP 6 should be the same
- we're talking of a Java iView using HTMLB
So far these are the experiences I have tried with no sucess
On my mainWindow.jsp I have this piece of code, but it doesn't work:
(etc...)
<%
ResourceBundle res = componentRequest.getResourceBundle();
IResource rs = componentRequest.getResource(IResource.JSP, "printFormat.jsp");
String JSP_URL = rs.getResourceInformation().getURL(componentRequest);
%>
(etc...)
<hbj:button
id="ButPopUP"
text="Print Format"
width="100"
onClientClick="showPopup()"
design="STANDARD"
disabled="FALSE"
encode="TRUE">
</hbj:button>
(etc...)
<script language="Javascript">
function showPopup(){
mywindow = window.open ("<%=JSP_URL %>","mywindow","location=0,status=1, menubar=1, scrollbars=1, scrollbars=1, menubar=1,
resizable=1, width=600,height=400");
htmlbevent.cancelSubmit=true;
</script>
(etc...)
Thank you very kindly for your help.Hi Kiran,
sorry for the late reply.
Thank you so much for your JAR file.
Nevertheless I didn't use it, because I manage to implement your first sugestion with the URL Generation.
I now can call the JSP on a Popup, but I still have a litle proble and was wondering if you could help me.
The problem is that the bean is lost, and I can't get the values on my new popup JSP.
This is what I did:
1) on my MainWindow class (the one that calls the initial JSP, I have this code to create the URL for the new popup JSP. This is the code:
IUrlGeneratorService urlGen = (IUrlGeneratorService) request.getService(IUrlGeneratorService.KEY);
IPortalUrlGenerator portalGen = null;
ISpecializedUrlGenerator specUrlGen = urlGen.getSpecializedUrlGenerator(IPortalUrlGenerator.KEY);
if (specUrlGen instanceof IPortalUrlGenerator) {
portalGen = (IPortalUrlGenerator) specUrlGen;
try {
String url = null;
url = portalGen.generatePortalComponentUrl(request, "Forum_IS.popvalues");
myBeanDados.setPopupURL(url);
} catch (NullPointerException e) {
log.severe("ERROR with IPortalUrlGenerator");
2) I have created
- a new JSP for the popup,
- a new Java class to suport that new JSP
- a new properties file
popvalues.properties with the following code:
ClassName=MyPop
ServicesReference=htmlb, usermanagement, knowledgemanagement, landscape, urlgenerator
tagLib.value=/SERVICE/htmlb/taglib/htmlb.tld
MyPop is the new class that is associated with the new JSP popup.
The problem now is that the bean was lost.
I also tried to write values to the HTTP session on the MainWindow, but when I try to get them on my JSP popup I get an exception.
How can I pass the values (or beans) to my new popup JSP ?
Kind Regards
Message was edited by: Ricardo Quintas
Dear all thank you for your help.
I have managed to solve the problem I had.
Here's the problem + solution sumary.
I have to remind you that we are talking of EP 5, PDK 5 (Eclipse version 2.1.0), with JAVA JDK 1.3.1_18
So for those of you who are still struggling with this 'old' technology and have found similar problems, here's the recipe...
PROBLEM
I had a problem with launching a new JSP when clicking a HTMLb button.
I wanted to create a JSP to present a 'print-format' of an iView.
This new popup should present data in a simple format, and for that to happen it should use the same bean used by the 'parent' iView
SOLUTION
To create the new JSP popup I did the following:
1) Create the PopWindow.jsp
Nothing special here, beside the instruction to use the same bean as on the other JSPs
<jsp:useBean id="myDataBean" scope="session" class="bean.DataBean" />
2) Create the associated JAVA class
MyPop.java. This class will be used to call the PopWindow.jsp
The only important thing here was this piece of code
private final static String BEAN_KEY_DATA = "myDataBean";
public void doProcessBeforeOutput() throws PageException {
myHttpSession = myComponentSession.getHttpSession();
myDataBean = (DataBean) myHttpSession.getAttribute(BEAN_KEY_DATA);
myComponentSession.putValue(BEAN_KEY_DATA, myDataBean);
this.setJspName("PopWindow.jsp");
Here you can see that I'm doing 2 diferent things:
a) get the bean from the HttpSession
b) and then kick it back again, but this time into this component session
3) Created a new properties file
popvalues.properties. This file contains the follwing code:
ClassName=MyPop
tagLib.value=/SERVICE/htmlb/taglib/htmlb.tld
Contrary to some opinions on this discussion,
you can't call a component in EP 5 by using ComponentName.JSPname.
Or at least that didn't work for me.
You nee to use an aproach like this one ComponentName.NewProperiesFileName
4) On my main class MainClass.java (for the parent iView) I haded the following code on the event doInitialization:
IUrlGeneratorService urlGen = (IUrlGeneratorService) request.getService(IUrlGeneratorService.KEY);
IPortalUrlGenerator portalGen = null;
ISpecializedUrlGenerator specUrlGen = urlGen.getSpecializedUrlGenerator(IPortalUrlGenerator.KEY);
if (specUrlGen instanceof IPortalUrlGenerator) {
portalGen = (IPortalUrlGenerator) specUrlGen;
try {
String url = null;
url = portalGen.generatePortalComponentUrl(request, "MyMainApplication.popvalues");
myDataBean.setPopupURL(url);
} catch (NullPointerException e) {
etc...
The idea here was to build dinamicaly a URL to call the popup.
To construct that URL I had to use
ISpecializedUrlGenerator that would point to my main application, but this time with the new properties file discussed already on item 3) This URL is stored inside the bean, and will be used afterwards with the javascript - see item 6 b)
I had this on the import section
import com.sapportals.portal.prt.service.urlgenerator.IUrlGeneratorService;
import com.sapportals.portal.prt.service.urlgenerator.specialized.IPortalUrlGenerator;
import com.sapportals.portal.prt.service.urlgenerator.specialized.ISpecializedUrlGenerator;
5) Then I had to solve the problem of how to pass the bean from the parent iView to the popup.
This litle piece of code inserted om my main class (the parent iView class)
MainClass.java solved the problem:
import javax.servlet.http.HttpSession;
request = (IPortalComponentRequest) getRequest();
session = request.getComponentSession();
session.putValue(BEAN_KEY_DATA, myDataBean);
myHttpSession = session.getHttpSession();
myHttpSession.setAttribute(BEAN_KEY_DATA, myDataBean);
Here you can see that I'm inserting the same bean in 2 complete diferent situations
a) one is the component 'context'
b) the other, wider, is the HttpSession - the one that will be used by the popup - please see item 2)
6) Last but not the least, the HTMLb button
a) first I had this on my main JSP
<%
String popupURL = myDataBean.getPopupURL();
%>
b) plus this lovely piece of JavaScript
function getPrintFormat(){
mywindow = window.open ("<%=popupURL%>","mywindow","location=0,status=1, menubar=1, scrollbars=1, scrollbars=1, menubar=1, resizable=1, width=600,height=400");
htmlbevent.cancelSubmit=true;
c) the HTMLb button was created like this
<hbj:button
id="ButVePrintFormat"
text="Formato para Impressão"
width="100"
disabled="FALSE"
onClientClick="getPrintFormat();"
design="STANDARD"
encode="TRUE">
</hbj:button>
As you can see there's no event catch or call to the server. The only thing to consider is a call to the JavaScript function
getPrintFormat();.
Está todo lá dentro.
That's all there is to it. -
HTMLB + htmlb:button
Hello Friends,
I have a problem in using HTMLB, button in view of BSP page. Actually the problem is that I want to call the main contrller when user click on the button. But as in view there is not Event Handler, so while "onClick="event_1"/>, how I can handle this event!
here is a bit of code segment!
<htmlb:button width="10" onClick="event_1"/>
Does it work ?? like this if I call controller direct ??
<htmlb:button width="10" onClick="main.do"/>
With Regards,
Haider Syed.So, after making a small mistake in my last post (corrected now), I will try to bring some light into this situation:
First, summarize all the options you have:
Each form has a "target" (<b><form action="target_controller.do"></b>) which the browser will submit the form data to.
Note that this is different from the actual target-attribute (<b><form target="_blank"></b>), which is used to specify the location where the server-response will be displayed - you can let it be shown in a new window here.
Then, for form elements, you have the option to set client-side javascripts, using the <b>onClientClick</b> attribute. It's best if you just call a javascript function here, and define this function somewhere else in your code (javascript-file-include for example).
<htmlb:button ...
onClientClick="yourFunction();" />
You can access your HTML elements (also form elements) using javascript, so changing the target or action parameter from within your function is possible!
To finish this post, there is the server-side event, specified by the <b>onClick</b> attribute, which is usually checked for in DO_HANDLE_EVENT (in case of MVC) or in OnInputProcessing (for non-MVC BSP pages, like Craig mentioned). But remember, this is server-side event!
So, with this info, you should be able to specify in more detail what you call "for each button a new event" - whether you mean server-side or client-side event ... maybe thinking about this alone will almost solve your problem.
Regards,
Max -
Dynamical Call of ALV - No data update
Hi,
I tried to use use the ALV dynamically. With dynamically I mean that I that I have diffrent data structures, depending what was selected by the user. The first call of the program is always correct. The data is displayed correctly. But when the data structure is changing, the ALV display is not updated. For a better understanding I post a extract of my coding:
<b>1. Creation of Container</b>
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'PARENT_CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
<b>2.Creation of splitter container</b>
CREATE OBJECT splitter
EXPORTING
parent = g_custom_container
rows = 2
columns = 2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
container_2 = splitter->get_container(
row = 1
column = 2 ).
<b>3.Dynamic Creation of alv object</b>
CREATE OBJECT go_grid
EXPORTING
i_parent = container_2.
<b>4. Get Fieldcatalogue</b>
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = lv_structure_name
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
<b>5. Set table for first display</b>
CALL METHOD go_grid->set_table_for_first_display
* EXPORTING
* i_structure_name = lv_structure_name
CHANGING
it_fieldcatalog = lt_fieldcat
it_outtab = <lt_out_data>.
CALL METHOD ls_alv_ref-alv_ref->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
Perhaps someone could help.....
Best Regards, EdgarHello Edgar
The following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_8</b> shows how to solve your problem. Please note that for the sake of simplicity I replaced the tree containing the structure names with an ALV list. However, the switch between the different structures is triggered by the <b>DOUBLE_CLICK</b> event.
I like to add that the integration of the first displayed ALV list (DD02L) into GT_OUTTAB is not really elegant. In addition, with <b>$TMP</b> I marked a problematic part of the coding with respect to your requirement to have the right layout for each displayed ALV list:
If you have a <b>fixed </b>assignment of <i>tabname -> 4-digit handle</i> then it is ok. I my sample report the layouts only work if you select the tabnames in the very same order.
Before showing the entire coding I describe crucial parts of the coding:
[code]TYPES: BEGIN OF ty_s_outtab.
TYPES: tabname TYPE tabname.
TYPES: layout TYPE lvc_s_layo.
TYPES: variant TYPE disvariant.
TYPES: fcat TYPE lvc_t_fcat.
TYPES: data TYPE REF TO data.
TYPES: END OF ty_s_outtab.[/code]
Every time a new structure is selected the corresponding ALV data are stored as new record in GT_OUTTAB which is of line type TY_S_OUTTAB.
[code] READ TABLE gt_outtab INTO gs_outtab INDEX 2.
ASSIGN gs_outtab-fcat TO <gt_fcat>.
ASSIGN gs_outtab-data->* TO <gt_outtab>.[/code]
Since the ALV list data and the fieldcatalog are fully dynamic I use global field-symbols for these data.
[code]&----
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
SET TITLEBAR 'xxx'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
is_variant = gs_outtab-variant
i_save = 'A'
CHANGING
it_outtab = <gt_outtab>
it_fieldcatalog = <gt_fcat>
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT[/code]
The second ALV list which displays the table records is always newly displayed in the PBO module.
In the event handler method <b>HANDLE_DOUBLE_CLICK</b> we need to do two things:
- store the current fieldcatalog back to GT_OUTTAB
- store the name of the new selected table/structure -> trigger PAI
In routine <b>HANDLE_DB_CLICK</b> we create a new entry for GT_OUTTAB if it does not yet exist. Next we select this entry and display it again as second ALV list.
[code]
*& Report ZUS_SDN_TWO_ALV_GRIDS_8
*& Description: Display two ALV lists in splitter container (left/right)
*& Left ALV list contains DB table names,
*& right ALV list displays entries of selected DB table
*& SDN thread: Dynamical Call of ALV - No data update
*& Link: https:||Dynamical Call of ALV - No data update
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
REPORT zus_sdn_two_alv_grids_8.
TYPE-POOLS: abap.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
TYPES: BEGIN OF ty_s_outtab.
TYPES: tabname TYPE tabname.
TYPES: layout TYPE lvc_s_layo.
TYPES: variant TYPE disvariant.
TYPES: fcat TYPE lvc_t_fcat.
TYPES: data TYPE REF TO data.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gt_dd02l TYPE STANDARD TABLE OF dd02l,
gs_outtab TYPE ty_s_outtab,
gt_outtab TYPE ty_t_outtab.
FIELD-SYMBOLS:
<gt_fcat> TYPE lvc_t_fcat,
<gt_outtab> TYPE table.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_tabname_selected TYPE tabname READ-ONLY.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
define local data
DATA:
ls_dd02l TYPE dd02l,
ls_outtab TYPE ty_s_outtab.
CHECK ( sender = go_grid1 ).
READ TABLE gt_dd02l INTO ls_dd02l INDEX e_row-index.
" Store data of currently displayed ALV list (except for DD02L)
IF ( md_tabname_selected = space ).
ELSE.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY tabname = md_tabname_selected. " old
CALL METHOD go_grid2->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = ls_outtab-fcat.
MODIFY gt_outtab FROM ls_outtab INDEX syst-tabix.
ENDIF.
md_tabname_selected = ls_dd02l-tabname. " new selected DB table
Triggers PAI of the dynpro with the specified ok-code
cl_gui_cfw=>set_new_ok_code( 'HANDLE_DB_CLICK' ). " not 4.6c
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'HANDLE_DB_CLICK'
IMPORTING
RC =
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
gd_repid = syst-repid.
SELECT * FROM dd02l INTO TABLE gt_dd02l
WHERE tabname LIKE 'KN%1' OR
tabname LIKE 'LF%1' OR
tabname LIKE 'VB%' OR
tabname LIKE 'MAR%' OR
tabname LIKE 'E07%'
AND tabclass = 'TRANSP'. " transparent table
SORT gt_dd02l BY tabname.
PERFORM init_controls.
PERFORM add_first_table.
Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
READ TABLE gt_outtab INTO gs_outtab INDEX 1.
Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
CHANGING
it_outtab = gt_dd02l
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE gt_outtab INTO gs_outtab INDEX 2.
ASSIGN gs_outtab-fcat TO <gt_fcat>.
ASSIGN gs_outtab-data->* TO <gt_outtab>.
NOTE: method called in PBO module
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
is_variant = gs_outtab-variant
i_save = 'A'
CHANGING
it_outtab = <gt_outtab>
it_fieldcatalog = <gt_fcat>
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
SET TITLEBAR 'xxx'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
is_variant = gs_outtab-variant
i_save = 'A'
CHANGING
it_outtab = <gt_outtab>
it_fieldcatalog = <gt_fcat>
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
User has pushed button "Display Details"
WHEN 'HANDLE_DB_CLICK'.
PERFORM handle_db_click.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form HANDLE_DB_CLICK
text
--> p1 text
<-- p2 text
FORM handle_db_click.
define local data
DATA:
ld_handle(4) TYPE n,
ls_outtab TYPE ty_s_outtab.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY tabname = lcl_eventhandler=>md_tabname_selected.
IF ( syst-subrc NE 0 ).
CLEAR: ls_outtab.
ls_outtab-tabname = lcl_eventhandler=>md_tabname_selected.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = ls_outtab-tabname
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = ls_outtab-fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 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.
ENDIF.
CREATE DATA ls_outtab-data TYPE TABLE OF (ls_outtab-tabname).
ASSIGN ls_outtab-data->* TO <gt_outtab>.
SELECT * FROM (ls_outtab-tabname) UP TO 50 ROWS
INTO TABLE <gt_outtab>.
ls_outtab-layout-no_toolbar = abap_false.
ls_outtab-layout-zebra = abap_true.
ls_outtab-layout-smalltitle = abap_true.
CONCATENATE ls_outtab-tabname ':'
INTO ls_outtab-layout-grid_title.
CONCATENATE ls_outtab-layout-grid_title 'Table Records'
INTO ls_outtab-layout-grid_title
SEPARATED BY space.
ls_outtab-variant-report = gd_repid.
DESCRIBE TABLE gt_outtab.
ld_handle = syst-tfill + 1.
WRITE ld_handle TO ls_outtab-variant-handle. " $TMP: Problem!!!
APPEND ls_outtab TO gt_outtab.
ENDIF.
" NOTE: read into GLOBAL variable gs_outtab !!!!
READ TABLE gt_outtab INTO gs_outtab
WITH KEY tabname = lcl_eventhandler=>md_tabname_selected.
ASSIGN gs_outtab-fcat TO <gt_fcat>.
ASSIGN gs_outtab-data->* TO <gt_outtab>.
ENDFORM. " HANDLE_DB_CLICK
*& Form INIT_CONTROLS
text
--> p1 text
<-- p2 text
FORM init_controls .
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999 " full-size screen
EXCEPTIONS
cntl_error = 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.
ENDIF.
Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 2
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 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.
ENDIF.
Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
CALL METHOD go_splitter->set_column_mode
EXPORTING
mode = cl_gui_splitter_container=>mode_relative
IMPORTING
RESULT =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 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.
ENDIF.
CALL METHOD go_splitter->set_column_width
EXPORTING
id = 1
width = 25
IMPORTING
RESULT =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 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.
ENDIF.
CALL METHOD go_splitter->set_column_sash
EXPORTING
id = 1
type = cl_gui_splitter_container=>type_movable
value = cl_gui_splitter_container=>false
IMPORTING
RESULT =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 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.
ENDIF.
Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_left
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form ADD_FIRST_TABLE
text
--> p1 text
<-- p2 text
FORM add_first_table .
define local data
DATA:
ls_outtab TYPE ty_s_outtab.
ls_outtab-tabname = 'DD02L'.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = ls_outtab-tabname
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = ls_outtab-fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 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.
ENDIF.
GET REFERENCE OF gt_dd02l INTO ls_outtab-data.
ls_outtab-layout-no_toolbar = abap_false.
ls_outtab-layout-zebra = abap_true.
ls_outtab-layout-smalltitle = abap_true.
CONCATENATE ls_outtab-tabname ':'
INTO ls_outtab-layout-grid_title.
CONCATENATE ls_outtab-layout-grid_title 'Table Records'
INTO ls_outtab-layout-grid_title
SEPARATED BY space.
ls_outtab-variant-report = gd_repid.
ls_outtab-variant-handle = '0002'.
INSERT ls_outtab INTO gt_outtab INDEX 1.
ls_outtab-layout-no_toolbar = abap_true.
ls_outtab-layout-zebra = abap_true.
ls_outtab-layout-smalltitle = abap_true.
ls_outtab-layout-grid_title = 'DB Tables'.
ls_outtab-variant-report = gd_repid.
ls_outtab-variant-handle = '0001'.
DELETE ls_outtab-fcat WHERE ( fieldname NE 'TABNAME' ).
INSERT ls_outtab INTO gt_outtab INDEX 1.
ENDFORM. " ADD_FIRST_TABLE[/code]
Regards,
Uwe -
Does anyone know how I could either
a) Dynamically call a ruleset with a decision service or
b) Have one ruleset call another ruleset in the rules engine
I am trying to dynamically call a certain ruletset set from a single BPEL process, a user will have their request passed to 1 of 10 possible rulesets.
Any help would be appreciated!Hi,
Use both onClientClick to call the client event an use onClick to execute the server event.onClientClick is executed with first priority and then the onClink event is fired in the server.
e.g :
<hbj:button
id="Send_Button"
text="Send"
tooltip="Sends my name"
jsObjectNeeded="true" onClientClick="validate();"
onClick="onSendButtonClicked"
width="100"
design="EMPHASIZED">
First the validate javascript method executes then the onClick "onSendButtonClicked()" method in the controller executes.
If helps reward with points.
Regards
Ritu
Thanks -
Clicking a htmlb:button via Java Script
Hi all!
I would like to 'click' a htmlb:button via Java Script.
Example with a html-button:
<htmlb:button id="b1" onClientClick="javascript:document.form_id['b2'].click()" text="Call Button 2"/>
<input id="b2" type="button" onclick="alert('2')">
Does anybody have an idea how it works with a htmlb:button?
Thanks!
Stefan
Message was edited by: Stefan KittsteinerHi Stefan,
Use this
<script>
function submit()
return htmlbSL(this,2,'b2:b2Click');
</script>
<htmlb:button id="b1" onClientClick="javascript:submit()" text="Call Button 2" />
<htmlb:button id="b2" onClientClick="alert('I am clicked')" text="Button 2" />
b2Click is server event for button 'b2'.
You can also use <bsp:htmlbEvent> for more details see weblog <a href="/people/brian.mckellar/blog/2004/07/18/bsp-in-depth-using-the-htmlb-event-system In-Depth: Using the HTMLB Event System</a>
Regards,
Narinder Hartala -
Where did access to button events on page 0 go?
Hello.
I have a simple menu system established for my applications where a select list item and a button are created on page 0.
If I choose to "Create a button in a region position" when I establish the button (let's call it "GO_MENU", I am given the option of choosing the button event for branches on the other pages in the Conditions for the branch under "When Button Pressed". So far so good.
However, if I choose "Create a button displayed among this region's items" when I establish the button, the button does not appear in the LOV for the "When Button Pressed" condition in the branches for any of the other application pages. What's magical about this choice that suppresses the availability of the button event from the other pages?
Thanks,
ViniVini,
For your branch,
use condition type: "Request = Expression 1"
expression 1 = P0_GO_MENU
Why it doesn't show your page item button in the LOV? Because it's not a standard button anymore...
I don't have other information... someone from the ApEx dev team should be able to give more technical explanation.
Louis-Guillaume
Homepage : http://www.insum.ca
Blog : http://insum-apex.blogspot.com -
Handling button events for dialog boxes of a used component
Hello,
After I call a dialog box/window for the view of the used component, how can I handle the button events of the window that I called?
I create the window using the method CREATE_WINDOW_FOR_CMP_USAGE of the interface IF_WD_WINDOW_MANAGER. This method returns window reference of type IF_WD_WINDOW.
Thanks & Regards,
ReenaIt's very easy.
Have a look to the document: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e242bf5-0901-0010-c99c-83c180163c73
You will find the SUBSCRIBE_TO_BUTTON_EVENT on page 6.
Sergio
Maybe you are looking for
-
Problem in Implementing Filter BADI
Hi Experts , I have a problem in Implementing Standard BADI OIJ_NOMIT_VALIDATION , this one is a Filter BADI , with Filter type OIJ_NOMITEM_CHCK . i created a implementation ZOIJ_NOMIT_VALIDATION with filter ZOIJ_NOMIT and write code in m
-
Apple not offering OSX 10.6 any more?
I have an iMac Intel machine that is running 10.5.8. I'd like to update the OS but can't find 10.6 anywhere on Apple's site... Pretty sure my machine will run 10.6, which I need to run some new apps I need. Am I screwed?
-
Infospoke with two data source
Hi all, is there a way in an Infospoke to include infoobjects belonging to two different data source? tks, Federico
-
Active Directory Migration Tool Moving Users before groups?
How are permissions to resources granted? By user or by group? It's been so long I can't actually remember, but I think we moved users and groups together. The SIDs will change if things are moving to a new domain. But the migration tool handles tha
-
I have found backups in bookmarks backup file, which is a start, but I am unclear how to restore from there. How do I do it.