inputField를 readonly로 처리하는 방법
1. 헤더
<bsp:findAndReplace find = “<input”
find1 = “urEdf2TxtEnbl”
replace = “<input readonly”
replace1 = “urEdf2TxtRead” >
<htmlb:inputField alignment = “left”
id = “if_bukrs”
value = “<%= application->gs_header4-bukrs %>”
width = “100px” />
</bsp:findAndReplace>
2. 아이템(Iterator)
DATA: lr_fr TYPE REF TO cl_bsp_find_and_replace,
lr_ip TYPE REF TO cl_htmlb_inputfield,
lr_dlb TYPE REF TO cl_htmlb_dropdownlistbox,
lr_bee TYPE REF TO cl_bsp_bee_table.
DATA: lv_find TYPE string.
DATA: lv_find1 TYPE string.
DATA: lv_replace TYPE string.
DATA: lv_replace1 TYPE string.
CLEAR: lv_find, lv_replace, lv_rowno, lv_columnno, lv_tvid .
SPLIT p_cell_id AT ‘_’ INTO lv_tvid lv_rowno lv_columnno. ” tabvDefault_2_3.
IF <fs>-status = ‘A0’ OR <fs>-status = ‘R0’. ” 전표미생성 or 반려.
lv_find = ‘<input’ .
lv_replace = `<input style = ‘ime-mode:active;’`.
lv_find1 = ‘urEdf2TxtEnbl’.
lv_replace1 = ‘urEdf2TxtEnbl’.
ELSE.
lv_find = ‘<input’ .
lv_replace = `<input readonly onkeydown=’disableBack(event);’`.
lv_find1 = ‘urEdf2TxtEnbl’.
lv_replace1 = ‘urEdf2TxtRead’.
ENDIF.
lr_fr = cl_bsp_find_and_replace=>factory( find = lv_find
find1 = lv_find1
replace = lv_replace
replace1 = lv_replace1
mode = `FIRST_OCCURRENCE` ).
lv_value = get_column_value( column_name = p_column_key ).
lr_ip = cl_htmlb_inputfield=>factory( id = p_cell_id
value = lv_value
size = ’25’
alignment = ‘LEFT’
invalid = lv_invalid
maxlength = ’25’ ).
CREATE OBJECT lr_bee.
lr_bee->add( level = 1 element = lr_fr ).
lr_bee->add( level = 2 element = lr_ip ).
p_replacement_bee = lr_bee.
3. script
<htmlb:documentBody marginLeft = “20”
marginRight = “10”
marginTop = “10”
marginBottom = “0”
onLoad = “changeStatus(‘<%= application->gv_edit %>’);” >
function changeStatus(status){
if (status == “”) {
document.getElementById(“if_bldat”).readOnly = true;
document.getElementById(“if_bldat”).className = ‘urEdf2TxtRead’;
document.getElementById(“if_budat”).readOnly = true;
document.getElementById(“if_budat”).className = ‘urEdf2TxtRead’;
document.getElementById(“if_bukrs”).readOnly = true;
document.getElementById(“if_bukrs”).className = ‘urEdf2TxtRead’;
document.getElementById(“if_waers”).readOnly = true;
document.getElementById(“if_waers”).className = ‘urEdf2TxtRead’;
document.getElementById(“if_bktxt”).readOnly = true;
document.getElementById(“if_bktxt”).className = ‘urEdf2TxtRead’;
document.getElementById(“if_lifnr”).readOnly = true;
document.getElementById(“if_lifnr”).className = ‘urEdf2TxtRead’;
document.getElementById(“if_wrbtr”).readOnly = true;
document.getElementById(“if_wrbtr”).className = ‘urEdf2TxtRead’;
document.getElementById(“dlb_gsber”).readOnly = true;
document.getElementById(“dlb_gsber”).className = ‘urEdf2TxtRead’;
}
}