Skip to Content
0
Former Member
Dec 13, 2011 at 04:00 PM

Unprotect a Protected Field?

118 Views

I am trying to change the GL Account in Code 1 below. However, when the logic flows into CODE2, the field is protected = 'X'. And, the field is not changeable on the Purchase Requisition tab as well for a scenario I am working on.

I assume that because it is not changeable, and 'protected', that my ABAP code can not change it? correct?

Is there a way to unprotect it, or is this something configured in SPRO for a Purchase Requisition?

CODE1: Is my custom code.

CODE2: Is the SAP code that my will flow into where this field appears to be unchangeable.

Thank-You

(CODE1)

METHOD IF_EX_ME_PROCESS_REQ_CUST~PROCESS_HEADER.
 
*Purchase Requisition Item Declarations
  DATA: LT_ITEMS        TYPE MMPUR_REQUISITION_ITEMS.
  DATA: LS_ITEM         TYPE MEREQ_ITEM.
 
  FIELD-SYMBOLS: <FS_ITEM> TYPE LINE OF MMPUR_REQUISITION_ITEMS.
 
*Purchase Requisition Accounting Declarations.
  DATA: LT_ACCT         TYPE MMPUR_ACCOUNTING_LIST.
  DATA: LS_ACCT         TYPE EXKN.
  DATA: LS_SETX          TYPE MEPOACCOUNTING_DATAX.
 
  FIELD-SYMBOLS: <FS_ACCT> TYPE LINE OF MMPUR_ACCOUNTING_LIST.
 
  CALL METHOD IM_HEADER->GET_ITEMS
    RECEIVING
      RE_ITEMS = LT_ITEMS.
 
  LOOP AT LT_ITEMS ASSIGNING <FS_ITEM>.
    LS_ITEM = <FS_ITEM>-ITEM->GET_DATA( ).
    LT_ACCT = <FS_ITEM>-ITEM->IF_ACCT_CONTAINER_MM~GET_ITEMS( ).
    LOOP AT LT_ACCT  ASSIGNING <FS_ACCT>.
      LS_ACCT =  <FS_ACCT>-MODEL->GET_EXKN( ).
      LS_ACCT-SAKTO = 'N500300   '.
      LS_SETX-SAKTO = 'X'.
      <FS_ACCT>-MODEL->SET_EXKN( LS_ACCT ).
      <FS_ACCT>-MODEL->SET_EXKNX( LS_SETX ).
    ENDLOOP.
  ENDLOOP.
ENDMETHOD.

(CODE2)

METHOD if_accounting_model_mm~set_exkn.
 
  DATA: ls_buffer     LIKE LINE OF my_data_input_buffer,
        ls_bufferx    LIKE LINE OF my_data_input_bufferx,
        l_buffered    TYPE sy-subrc,
        l_data_old    TYPE exkn,
        l_data_oldx   TYPE mepoaccounting_datax,
        l_data_newx   TYPE mepoaccounting_datax,
        l_indx        TYPE sy-tabix.      "1478013
 
  *PROTECT EQ 'X'
  CHECK my_state->protect EQ mmpur_no.