BSP Search Help
– BSP 화면(Call 하는 Application)
: Call 받는 부분에서 script로 던지고, Call한 부분에서 값을 넘겨 받는다.
SPAN { font-family: “Courier New”; font-size: 10pt; color: #000000;
background: #FFFFFF; } .L3S33 { color: #009300; } .L3S50 { color: #00008B; }
.L3S51 { color: #8B0000; } <script>
function setEmpNo(empno , empnm , deptnm , deptno , position ){
document.forms[‘default_form’].elements[‘GS_HEADER-CR_USER_NAME’].value = empnm;
document.forms[‘default_form’].elements[‘GS_HEADER-CR_USER_ID’].value = empno;
}
function setVendorInfo( lifnr, name1){
document.forms[‘default_form’].elements[‘GS_HEADER-LIFNR’].value = lifnr;
document.forms[‘default_form’].elements[‘GS_HEADER-NAME1’].value = name1;
}
function setMaterialInfo( matnr, maktx){
document.forms[‘default_form’].elements[‘GS_HEADER-MATNR’].value = matnr;
document.forms[‘default_form’].elements[‘GS_HEADER-TXZ01’].value = maktx;
}
</script>
: 입력받는 필드
SPAN { font-family: “Courier New”; font-size: 10pt; color: #000000;
background: #FFFFFF; } .L3S32 { color: #7D9EC0; } .L3S33 { color: #009300; }
.L3S50 { color: #00008B; } .L3S51 { color: #8B0000; }
/** SEARCH HELP **/
function getSearchHelp(page, width, height ) {
var name = ‘SERACHHELP’
var win= null;
var winl = (screen.width-width)/2;
var wint = (screen.height-height)/2;
var settings =‘height=’+height+‘,’;
settings +=‘width=’+width+‘,’;
settings +=‘top=’+wint+‘,’;
settings +=‘left=’+winl+‘,’;
settings +=‘scrollbars=yes,’;
settings +=‘resizable=yes,’;
settings +=‘status=yes’;
win=window.open(‘../../sap/zap_ve_co_2000/’+page,name,settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
SPAN { font-family: “Courier New”; font-size: 10pt; color: #000000;
background: #FFFFFF; } .L3S33 { color: #009300; } .L3S51 { color: #8B0000; }
<htmlb:inputField id = “GS_HEADER-LIFNR”
disabled = “<%= gv_edit_flag %>”
showHelp = “TRUE”
alignment = “left”
size = “17”
onValueHelp = “getSearchHelp(‘search_vendor_info.htm’ , ‘450’ , ‘600’ );”
value = “<%= GS_HEADER-LIFNR %>” />
SPAN { font-family: “Courier New”; font-size: 10pt; color: #000000; background:
#FFFFFF; } .L3S32 { color: #7D9EC0; } .L3S33 { color: #009300; } .L3S50 { color:
#00008B; } .L3S51 { color: #8B0000; } <script>
function enter_key () {
if(event.keyCode==13) {
document.all[“BTN_SEARCH”].click();
}
}
function check_form(htmlbevent) {
if ( document.all[“PA_SEARCH_TEXT”].value == ” || document.all[“PA_SEARCH_TEXT”].value.length < 2 ) {
alert(‘2자 이상 입력하세요 ‘);
htmlbevent.cancelSubmit = true ;
return ;
}
}
</script>
SPAN { font-family: “Courier New”; font-size: 10pt; color: #000000;
background: #FFFFFF; } .L3S31 { font-style: italic; color: #FF0000; } .L3S33 {
color: #009300; } .L3S50 { color: #00008B; } .L3S51 { color: #8B0000; } .L3S56 {
font-style: italic; color: #666666; } <input type=“Text”
class=“urEdf2TxtEnbl urV”
autocomplete=“off”
id=“PA_SEARCH_TEXT”
ct=“InputField”
name=“PA_SEARCH_TEXT”
st=“”
tp=“STRING”
value=“<%= PA_SEARCH_TEXT %>”
onkeyup=“javascript:enter_key()”
style=“width:100;ime-mode:active;”
>
<%– <htmlb:inputField id = “PA_SEARCH_TEXT”
value = “<%= PA_SEARCH_TEXT %>”
submitOnEnter = “TRUE”
/> –%>
<!– script enter_key()를 먹게 하기위해 사용 –>
<div style=“display:none”>
<htmlb:inputField id=“ZTEMP” />
</div>
<htmlb:button id = “BTN_SEARCH”
onClick = “BTN_SEARCH”
text = “<%= otr(ZAVOTR/BTN_SEARCH) %>”
tooltip = “<%= otr(ZAVOTR/BTN_SEARCH) %>”
design = “EMPHASIZED”
onClientClick = “check_form(htmlbevent)” />
– BSP : Oninputprocessing
SPAN { font-family: “Courier New”; font-size: 10pt; color: #000000; background:
#FFFFFF; } .L1S31 { font-style: italic; color: #FF0000; } .L1S32 { color:
#3399FF; } .L1S33 { color: #4DA619; } .L1S52 { color: #0000FF; } CASE event->server_event.
WHEN ‘BTN_SEARCH’.
* TRANSLATE pa_search_text TO UPPER CASE.
* CONCATENATE ‘%’ pa_search_text ‘%’ INTO searchtext.
CONDENSE pa_search_text.
CLEAR: pt_test, lt_org, pt_result.
CALL FUNCTION ‘Z_VE_GET_HRMS_USER_INFO’
EXPORTING
empnm = pa_search_text
* EMPNO = EMPNO
TABLES
itab = pt_test .
” get data
lt_org = pt_test .
LOOP AT lt_org INTO ls_org.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_ep
FROM zvet_ep1000
WHERE sabun = ls_org-empno .
IF sy-subrc = 0.
ls_result-code1 = ls_ep-sapid.
ls_result-text1 = ls_org-empnm.
ls_result-code2 = ls_org-deptno.
ls_result-text2 = ls_org-deptnm.
ls_result-text3 = ls_org-aposition.
CONCATENATE ‘javascript:opener.setEmpNo( ‘
”” ls_result-code1 ”” ‘,’ ” 사번
”” ls_result-text1 ”” ‘,’ ” 이름
”” ls_result-text2 ”” ‘,’ ” 부서명
”” ls_result-code2 ”” ‘,’ ” 부서코드
”” ls_result-text3 ”” ” 직급
‘);’
‘self.close();’
INTO ls_result-href.
APPEND ls_result TO pt_result.
ENDIF.
ENDLOOP.
ENDCASE.
2. 또 다른 샘플
– http://saptechnical.com/Tutorials/BSP/F4Help/Tutorial.htm