2008 Apr 07 11:56 AM
Dear Guru,
My program should able to validate the textfield
P_SCAN. After the validation, it should clear the field.
I have created a interface and class. However, I cannot clear the field and a error message "The field 'P_SCAN' cannot be changed" keep on prompting when I try to activate it.
Anyone has any idea what is not right here and why I cannot change field value?
method ZIF_TESTWONG8~CHECK_2D.
*The '#' between 'A' and 'B' is the identifier for 2D label
SEARCH P_SCAN FOR 'A#B'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'This is 2D label.'.
CLEAR: P_SCAN.
ENDIF.
endmethod.
THanks in advance.
2008 Apr 07 12:17 PM
Check this piece of code:
*&---------------------------------------------------------------------*
*& Report ZTEST_READ_CLUSTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztest_read_cluster.
PARAMETERS: p_scan TYPE string.
** CLASS
CLASS: cl_verification DEFINITION DEFERRED.
DATA: gcl_verify TYPE REF TO cl_verification.
*----------------------------------------------------------------------*
* CLASS cl_verification DEFINITIOAN
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_verification DEFINITION.
PUBLIC SECTION.
METHODS: lcm_check CHANGING p_scan TYPE string.
ENDCLASS. "cl_verification DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_verfication IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_verification IMPLEMENTATION.
METHOD: lcm_check.
PERFORM sub_check CHANGING p_scan.
ENDMETHOD. "lcm_check
ENDCLASS. "cl_verfication IMPLEMENTATION
*&---------------------------------------------------------------------*
*& Form SUB_CHECK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_P_CHECK text
*----------------------------------------------------------------------*
FORM sub_check CHANGING cw_check TYPE string.
SEARCH p_scan FOR 'G#S'.
IF sy-subrc = 0.
MESSAGE w208(00) WITH 'This is 2D label. Please scan data matrix!'
.
CLEAR: p_scan.
ENDIF.
ENDFORM. " SUB_CHECK
AT SELECTION-SCREEN ON p_scan.
CREATE OBJECT gcl_verify.
CALL METHOD gcl_verify->lcm_check
CHANGING
p_scan = p_scan.
Hope That Helps
Anirban M.
Dear Guru,
My program should able to validate the textfield
P_SCAN. After the validation, it should clear the field.
I have created a interface and class. However, I cannot clear the field and a error message "The field 'P_SCAN' cannot be changed" keep on prompting when I try to activate it.
Anyone has any idea what is not right here and why I cannot change field value?
method ZIF_TESTWONG8~CHECK_2D.
*The '#' between 'A' and 'B' is the identifier for 2D label
SEARCH P_SCAN FOR 'A#B'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'This is 2D label.'.
CLEAR: P_SCAN.
ENDIF.
endmethod.
THanks in advance.
2008 Apr 07 12:17 PM
Check this piece of code:
*&---------------------------------------------------------------------*
*& Report ZTEST_READ_CLUSTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztest_read_cluster.
PARAMETERS: p_scan TYPE string.
** CLASS
CLASS: cl_verification DEFINITION DEFERRED.
DATA: gcl_verify TYPE REF TO cl_verification.
*----------------------------------------------------------------------*
* CLASS cl_verification DEFINITIOAN
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_verification DEFINITION.
PUBLIC SECTION.
METHODS: lcm_check CHANGING p_scan TYPE string.
ENDCLASS. "cl_verification DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_verfication IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_verification IMPLEMENTATION.
METHOD: lcm_check.
PERFORM sub_check CHANGING p_scan.
ENDMETHOD. "lcm_check
ENDCLASS. "cl_verfication IMPLEMENTATION
*&---------------------------------------------------------------------*
*& Form SUB_CHECK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_P_CHECK text
*----------------------------------------------------------------------*
FORM sub_check CHANGING cw_check TYPE string.
SEARCH p_scan FOR 'G#S'.
IF sy-subrc = 0.
MESSAGE w208(00) WITH 'This is 2D label. Please scan data matrix!'
.
CLEAR: p_scan.
ENDIF.
ENDFORM. " SUB_CHECK
AT SELECTION-SCREEN ON p_scan.
CREATE OBJECT gcl_verify.
CALL METHOD gcl_verify->lcm_check
CHANGING
p_scan = p_scan.
Hope That Helps
Anirban M.
2008 Apr 07 3:20 PM
Thanks for the tips. I found that I have actually used the wrong type. I should use CHANGING instead of EXPORTING.
Appreciate it.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |