‎2005 Feb 10 9:37 AM
Hi.
I have made a screen with dynamic inputfields using the class cl_input_elements. The fields are created using data from an internal table, but now im having problems getting the data from the inputfields, can anybody help me please. Im very new to ABAP i only got my certification a month ago, so please have patioens with me.
Here is the code where i generate the inputfields:
LOOP AT it_zkeydef INTO wa_zkeydef.
index = temp_index.
length = wa_zkeydef-pto - wa_zkeydef-pfrom + 1.
CONCATENATE fieldname index INTO field.
fieldname2 = field.
labeltext = wa_zkeydef-fname.
CALL METHOD form_area->add_text
EXPORTING
text = labeltext
sap_fontsize = cl_dd_area=>large.
CALL METHOD form_area->add_input_element
EXPORTING
name = fieldname2
size = length
maxlength = length
IMPORTING
input_element = input_element.
CALL METHOD form_area->new_line.
temp_index = temp_index + 1.
ENDLOOP.
CALL METHOD document->merge_document.
CALL METHOD document->display_document
EXPORTING
container = 'CONTAINER200'.
I sure hope somebody can help me, i have been fighting with this problem for a wile now.
Liselotte
‎2005 Feb 10 9:53 AM
Sorry the class is of course called cl_dd_input_element.
-Liselotte-
‎2005 Feb 10 9:57 AM
After reading your message, I feel that I am new to ABAP.
Look for similar programs in Development class(or Package) <b>SDYNAMICDOCUMENTS</b>.
Also refer http://help.sap.com/saphelp_470/helpdata/en/f0/edd938d8dbe93de10000000a11405a/frameset.htm
Regards,
Subramanian V.
‎2005 Feb 10 10:34 AM
..
.After reading your message, I feel that I am new to ABAP.
...
-> I agree with Subramanian
Im very new to ABAP i only got my certification a month ago, so please have patioens with me.
...
-> Liselotte, this is <b>understatement pure</b> - whatever - welcome to SDN-Abap-Forum !
Andreas
‎2005 Feb 10 12:15 PM
Im sorry if you think that about me, but it <b>is</b> true that i have only been working with ABAP for 4 weeks and this is my first project. I dont like beeing called a liar.
-Liselotte-
Message was edited by: Liselotte Hjelmbjerg
‎2005 Feb 10 1:30 PM
Hi Liselotte,
Please don't take it the wrong way. It is a way of saying that, even though you have just 4 weeks of experience in ABAP, you are quite/very good at it and to be already working in such advanced topics. We don't dare to call anyone liar.
Please let us know, if your problem got solved , or if you found some way to solve it, do share it with us.
Regards,
Subramanian V.
‎2005 Feb 10 1:39 PM
Thanks for your reply, im sorry i went off like that but i have been fighting with this problem for 3 days and im absolutly lost, i think im in over my head :). I found out how to get the data from a field, the problem is that all fields have the same object reference so when i get the data it is only the data from the last inputfield.
-Liselotte-
‎2005 Feb 10 2:12 PM
....more focusing on your problem - I think you have to define an event handler to check the input of the fields.
Program DD_ADD_FORM_INPUT illustrates how.
Christian
‎2005 Feb 10 3:42 PM
After having a glance at your code, I find that, using index, fieldname, field2 and concatenate, you are trying to create a new fieldname. I suspect that, this fieldname is not created properly.
instead of using the logic for creating newfields, I suggest, you do something similar to this :
<b>
data: lv_c_tabix(2) type c.
loop at it_skeydef into wa_skeydef.
lv_c_tabix = sy-tabix.
concatenate fieldname lv_c_tabix into field.
* Your logic here
endloop.</b>You have also suggested that , this problem is due to all fieldnames being created with the same name, despite, your logic. Suggest you to dig deep and debug this.
Regards,
Subramanian V.
‎2006 Oct 30 5:21 PM
Hallo All,
unfortunely no one has had an answer for liselotte and now also for me.
The question is:
How to get data from the input_element at any time, that means if the user just put something in the field and press NOT <enter>, F1 or F4 which are covered by the events of the input_element
Please help !
Uwe
‎2006 Oct 30 7:58 PM
Uwe,
nobody can help with that.
For reaons I do not fully or partially understand, events for controls cover only a couple of keystrokes like ENTER, ESCAPE and function keys as well as mouse (double) clicks.
With todays ABAP there is no way of reacting on any key stroke.
small addition: I just checked the class and I saw what I guessed: Just a few events
<pre>
BUTTON_CLICKED
ITEM_SELECTED
INPUT_ENTERED
INPUT_HELPF1
INPUT_HELPF4
ENTERED
HELP_F1
HELP_F4
</pre>
You have to create a method get_input as a handler for event ENTERED (or INPUT_ENTERED?). This method should just return the value of attribute VALUE. Use SET HANDLER to activate the method.
Regards,
Clemens
Message was edited by: Clemens Li
‎2006 Oct 30 8:32 PM
Check
<a href="http://help.sap.com/saphelp_nw2004s/helpdata/de/0b/11e1cb04b311d4a7400000e83dd863/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/de/0b/11e1cb04b311d4a7400000e83dd863/frameset.htm</a>
If you want to react on events create a (local) eventhandler for the events. Import the special parameter 'sender' in order ot get the input field, which threw the event.
In the event handler method you get via sender->value the value of the input field.
Best regards,
Thomas
‎2006 Oct 31 8:05 AM
Hallo Thomas,
that's not the question.
I just know how to react on events.
I want to read out the input field at any time, but as Clemens mentioned there is no way to do that.
Is the probably a way to simalate the pressing of <enter> in the input_field to fire the event ????
Uwe
‎2006 Oct 31 8:37 AM
Hi,
it can not be possible. All the dynamic GUI elements are components of the frontend and are thus running on your local PC and not on the application server. What you therefore need is a sort of synchronisation event as the flushes for the GUI Control Framework. Thus the only way to get the screen data is to fire an event.
By the way, you have the same problem with the modifiable ALV.
Best regards,
Thomas
‎2006 Oct 31 8:55 AM
But which event to fire ?
with the modifiable ALV you have only to "event" something e.g. leave the modified field, so you get notice of the modification in the events data_changed and data_cahnged_finished
BR
Uwe
‎2006 Oct 31 12:00 PM
Just maybe worth a try:
CALL METHOD cl_gui_cfw=>flush.
after entering something in the field before an event is raised.
FLUSH method is designed to clean up the automation queue to synchronize SAP server with client-run control.
Possibly you get the actual field content by reading the inputfield attribute after flushing.
Sorry, I won't try now; other tasks waiting.
Let me know what's happening.
Regards,
Clemens
‎2006 Oct 31 12:12 PM
Hi Clemens,
the dynamic documents are not part of the GUI framework. Therefore I think, flushing will have no effect. But I am not sure.
Best regards,
Thomas
‎2006 Oct 31 12:48 PM
since its a HTML form you have two options,
1. use javascript along with CL_JAVA_SCRIPT class to read the form field value and pass it to ABAP varialbe.
2. you have to submit the form using js/or button (user interaction) and read and pass the value back to abap vairalbe. only after submit the < cl_dd_input_element>->value will hold the value entered by the user.
Regards
Raja
‎2006 Oct 31 1:12 PM
just to inform you:
as Thomas mentioned: FLUSH doesn't work !
I checked that 3 days ago, just before wasting your time with this problem
Uwe
‎2006 Oct 31 1:17 PM
Hello Duraiaj,
i'm not common with Cl_JAVA_SCRIPT. Do you have an code example for "read the form field value and pass it to ABAP varialbe"
Thx
Uwe
‎2006 Nov 01 5:49 AM
check demo programs starting with DEMO_JAVA_SCRIPT*
in particularly DEMO_JAVA_SCRIPT_EXECUTE
(this is not for getting form field value but for buliding js and running it from ABAP environment)
if you have trouble following that let me know.
Regards
Raja
‎2006 Nov 02 12:42 PM
Hallo Durairaj,
seems to be on the right way now.
I unterstand that I must "connect" the value of the input field to an ABAP variable via BIND as in e.g. DEMO_JAVA_SCRIPT_BIND_METH_VAL
But there is one (or more ) essential question:
How to reference the input_field ????
Thies is the code i wrote to create to the inpu_fields g_input1 and g_input2:
CREATE OBJECT g_dyn_doc
EXPORTING
background_color = g_dyn_doc->col_background_level2.
CALL METHOD g_dyn_doc->add_table
EXPORTING
no_of_columns = 2
border = '1'
IMPORTING
table = g_table.
set columns
CALL METHOD g_table->add_column
IMPORTING
column = g_col1.
CALL METHOD g_table->add_column
IMPORTING
column = g_col2.
text = 'Weiterbildung'.
CALL METHOD g_col1->add_text
EXPORTING
text = text
sap_emphasis = 'strong'.
text = 'geplante Tage'.
CALL METHOD g_col2->add_text
EXPORTING
text = text.
CALL METHOD g_table->new_row.
text = 'fachlich'.
CALL METHOD g_col1->add_text
EXPORTING
text = text.
value = '0'.
ADD_INPUT_ELEMENT -> ***
CALL METHOD g_col2->add_form
IMPORTING
formarea = g_form1.
CALL METHOD g_form1->add_input_element
EXPORTING
name = 'FACHLICH'
size = 2
maxlength = 2
IMPORTING
input_element = g_input1.
<- ADD_INPUT_ELEMENT ***
CALL METHOD g_table->new_row.
text = 'außerfachlich'.
CALL METHOD g_col1->add_text
EXPORTING
text = text.
ADD_INPUT_ELEMENT -> ***
CALL METHOD g_col2->add_form
IMPORTING
formarea = g_form2.
CALL METHOD g_form2->add_input_element
EXPORTING
name = 'AUSSERFACHLICH'
size = 2
maxlength = 2
IMPORTING
input_element = g_input2.
Regards
Uwe
‎2006 Nov 01 6:38 AM
Hi
Did you have a look at the SAP standard example <b>DD_ADD_TABLE</b> in se38.This might solve your purpose