on 03-26-2020 7:41 AM
I wnt to make disbale screen input with some condition, one of codition is USER STATUS. i use FM status_text_edit to get value of user status. like my code below.
But there is problem, when user change user status, it's error.
FORM USEREXIT_FIELD_MODIFICATION.
DATA : it_status TYPE STANDARD TABLE OF jstat,
wa_status LIKE LINE OF it_status,
lv_objnr TYPE vbak-objnr,
lv_line TYPE BSVX-STTXT,
lv_status TYPE BSVX-STTXT.
CLEAR : lv_objnr.
REFRESH it_status.
SELECT SINGLE objnr FROM vbak INTO lv_objnr WHERE vbeln = vbak-vbeln.
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
CLIENT = SY-MANDT
FLG_USER_STAT = 'X'
objnr = lv_objnr
ONLY_ACTIVE = 'X'
spras = sy-langu
* BYPASS_BUFFER = ' '
IMPORTING
* ANW_STAT_EXISTING =
* E_STSMA =
LINE = lv_line
USER_LINE = lv_status
* STONR =
EXCEPTIONS
OBJECT_NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF sy-tcode EQ 'VA02'.
IF sy-uname NE 'STC25' AND sy-uname NE 'STC26'.
IF lv_status EQ 'AP' or lv_status EQ 'CBDA'. "AP AND CBDA"
CASE SCREEN-NAME.
WHEN 'RV45A-KWMENG'.
IF VBAP-PSTYV EQ 'ZPPR'.
SCREEN-input = 0.
MODIFY SCREEN.
ENDIF.
WHEN 'VBAP-VRKME'.
IF VBAP-PSTYV EQ 'ZPPR'.
SCREEN-input = 0.
MODIFY SCREEN.
ENDIF.
WHEN 'VBEP-WMENG'.
IF VBAP-PSTYV EQ 'ZPPR'.
SCREEN-input = 0.
MODIFY SCREEN.
ENDIF.
ENDCASE.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
LOOP AT SCREEN
ENDLOOP
Is missing
Please see the code below
IF sy-tcode EQ 'VA02'.
IF sy-uname NE 'STC25' AND sy-uname NE 'STC26'.
IF lv_status EQ 'AP' OR lv_status EQ 'CBDA'. "AP AND CBDA"
LOOP AT SCREEN.
CASE screen-name.
WHEN 'RV45A-KWMENG'.
IF vbap-pstyv EQ 'ZPPR'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
WHEN 'VBAP-VRKME'.
IF vbap-pstyv EQ 'ZPPR'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
WHEN 'VBEP-WMENG'.
IF vbap-pstyv EQ 'ZPPR'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDCASE.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe, there was one related question, in that I said to use STATUS_READ
and Use the table JEST to get the detail.
Using this function STATUS_TEXT_EDIT - inside this exit - creates - to many radio button on error.
CALL FUNCTION 'STATUS_READ'
EXPORTING
CLIENT = SY-MANDT
objnr = vbak-objnr
ONLY_ACTIVE = ' '
* IMPORTING
* OBTYP =
* STSMA =
* STONR =
TABLES
STATUS = it_status
EXCEPTIONS
OBJECT_NOT_FOUND = 1
OTHERS = 2<br>
FORM USEREXIT_FIELD_MODIFICATION.
DATA : lv_objnr TYPE vbak-objnr,
lv_line TYPE BSVX-STTXT,
lv_status TYPE BSVX-STTXT.
DATA : it_status TYPE TABLE OF JSTAT,
wa_status LIKE LINE OF it_status.
CLEAR : lv_objnr,lv_line,lv_status.
SELECT SINGLE objnr FROM vbak INTO lv_objnr WHERE vbeln = vbak-vbeln.
IF sy-tcode EQ 'VA02'.
CALL FUNCTION 'STATUS_READ'
EXPORTING
CLIENT = SY-MANDT
objnr = lv_objnr
* ONLY_ACTIVE = ' '
* IMPORTING
* OBTYP =
* STSMA =
* STONR =
TABLES
STATUS = it_status
* EXCEPTIONS
* OBJECT_NOT_FOUND = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT it_status INTO wa_status WHERE stat <> 'I0002' AND INACT <> 'X'.
lv_status = wa_status-stat.
ENDLOOP.
IF sy-uname NE 'STC25' AND sy-uname NE 'STC26'.
IF lv_status EQ 'E0002' or lv_status EQ 'E0005'. "AP AND CBDA"
CASE SCREEN-NAME.
WHEN 'RV45A-KWMENG'.
IF VBAP-PSTYV EQ 'ZPPR'.
SCREEN-input = 0.
MODIFY SCREEN.
ENDIF.
WHEN 'VBAP-VRKME'.
IF VBAP-PSTYV EQ 'ZPPR'.
SCREEN-input = 0.
MODIFY SCREEN.
ENDIF.
WHEN 'VBEP-WMENG'.
IF VBAP-PSTYV EQ 'ZPPR'.
SCREEN-input = 0.
MODIFY SCREEN.
ENDIF.
ENDCASE.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
Okay, as per your code, based on some status - you are making the Quantity and unit fields as read only - correct?
But anyone can change the status ?
Also make note that, you cannot put any status. There should be a logical sequence in the status profile. Please confirm if you are changing it to the next level.
Otherwise, this code should work and no impact on the status getting not saved.
Regards,
Venkat
User | Count |
---|---|
70 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.