Hi everybody.
I have a "Find" button near an input box in a page, and i want a modal page, with the options for that input box, to be shown after pushing the button. After choosing an option, the modal page will be closed, and the option will appear in the input box of the original page.
The modal page will show options readed from a SAP table.
Can someone help me to know how to do this?
Thanks in advance.
Hello Marièn,
To realize this functionality you need some javascript code:
after your "find" button was clicked you have to open a new window via javascript. I use a method to retrieve the server information, e.g.
CALL METHOD cl_http_server=>get_extension_info
EXPORTING
extension_class = 'cl_http_ext_bsp'
IMPORTING
urls = l_urls.
then you can concatenate the url of your popup window.
After this you build up you JS - STring, e.g.
CONCATENATE
'<script type="text/javascript">' ' ' 'NW' lv_contract_num " any ID ' ' '=' ' ' 'window.open( ' '"' lv_url "your url '"' ',' '"' lv_window_name "place a nice name here:-) '"' ',' '"' 'resizable=yes,status=yes,scrollbars=yes,menubar=no,Width=850,' 'Height=650,top=20,left=30' '"' ' );' ' ' '</SCRIPT>' INTO model->gv_javascript_opener. On the html-page I check if this javascript-string is filled and let it render --- <%= model.>gv_javascript_opener %> ... Now the window is open. To write back the selected value into your opener window you can use JS coding like this: CONCATENATE '<script type="text/javascript">' ' ' 'window.parent.opener.document.getElementById(' '"' model->GS_MATSEARCH_T_DETAIL-SOURCE_ID '"' ').value =' '"' lv_t_matnr '"' ';' ' ' 'top.window.close();' ' ' '</SCRIPT>' INTO model->gv_onclick_target_matnr. Render this string the same way on your new "find"- window when a value was selected. What you need is the "NAME" of input field to set the selected value via the JS method getElementByID(). In our case model->gs_matsearch_t_detail-source_id is the name of that input field.
Now I pray that you don't work within a SAP Enterprise Portal Infrastructrue because then the JS will only work if Portal and WebAS are within the same domain.
Hope that helps instead of confusing anyone.....
Regards, Bernd
Add a comment