2007 Apr 13 3:34 PM
Hi experts,
I developed a function module to update the confirmations tab of a PO on ME22N screen. Now, I want to have a lock object in the FM so that a user cant make changes while this FM is in use. I do not know if there is any standard lock object for this purpose. I created a lock object in SE11 'EZEKES' since table EKES corresponds to vendor confirmations details. The Enqueue function was called into the program. The code is below:
CALL FUNCTION 'ENQUEUE_EZPHLOCK'
EXPORTING
MODE_EKES = 'E'
MANDT = SY-MANDT
EBELN = ponumber
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
The problem is, i'm not able to have a lock on the confirmations tab when the FM is in use. Is there any problem with the lock object i have created. The lock mode is Exclusive,Cumulative.
Please help me with this.
Hi experts,
I developed a function module to update the confirmations tab of a PO on ME22N screen. Now, I want to have a lock object in the FM so that a user cant make changes while this FM is in use. I do not know if there is any standard lock object for this purpose. I created a lock object in SE11 'EZEKES' since table EKES corresponds to vendor confirmations details. The Enqueue function was called into the program. The code is below:
CALL FUNCTION 'ENQUEUE_EZPHLOCK'
EXPORTING
MODE_EKES = 'E'
MANDT = SY-MANDT
EBELN = ponumber
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
The problem is, i'm not able to have a lock on the confirmations tab when the FM is in use. Is there any problem with the lock object i have created. The lock mode is Exclusive,Cumulative.
Please help me with this.
2007 Apr 13 3:40 PM
Hi,
You can use <b>ENQUEUE_E_TABLE</b>. Check this.
DATA: VARKEY LIKE RSTABLE-VARKEY.
VARKEY = SY-MANDT.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
TABNAME = 'EKES'
VARKEY = VARKEY
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.Regards,
RS
2007 Apr 13 3:53 PM
I tried to use the FM suggested by you, but i got the following error.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGAL_TYPE',
was neither
caught nor passed along using a RAISING clause, in the procedure "ZPH_POUPDATE"
"(FUNCTION)"
.
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
The call to the function module "ENQUEUE_E_TABLE" is incorrect:
The function module interface allows you to specify only
fields of a particular type under "TABNAME".
The field "EKES" specified here is a different
field type
.
The lock object created by me, it didnt give error, but im not sure if that works perfectly.
2007 Apr 13 3:57 PM
Hi,
Can you try the same FM in SE37. I tried this FM in SE37 and it did not give any error.
Also, can you paster your code here? Are you handling exception exceptions in FM using EXCEPTIONS?
Regards,
RS
2007 Apr 13 4:07 PM
Code:
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(PONUMBER) TYPE EKKO-EBELN
*" TABLES
*" ITAB STRUCTURE UEKES
*"----
TABLES: EKES, EKKO.
DATA: BEGIN OF I_EKKO OCCURS 0,
EBELN LIKE EKKO-EBELN,
END OF I_EKKO.
DATA: X LIKE EKES-ETENS.
data: i_tab like itab occurs 0 with header line.
move itab[] to i_tab[].
DATA: i_ekes LIKE uekes OCCURS 0 WITH HEADER LINE.
SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE EBELN = PONUMBER.
IF NOT I_EKKO[] IS INITIAL.
SELECT * FROM EKES INTO TABLE I_EKES
FOR ALL ENTRIES IN I_EKKO
WHERE EBELN = I_EKKO-EBELN.
ENDIF.
select single etens from ekes into x WHERE EBELN = PONUMBER.
x = x + 1.
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: VARKEY LIKE RSTABLE-VARKEY.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = EKES
VARKEY = VARKEY
X_TABNAME = ' '
X_VARKEY = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_TAB. "WHERE EBELN = PONUMBER.
READ TABLE I_TAB.
LOOP AT i_ekes WHERE ebelp EQ ITAB-EBELP "itemnumber
AND ebtyp EQ 'LA'.
i_ekes-menge = ITAB-MENGE. "quantity.
i_ekes-kz = 'U'.
i_ekes-eindt = ITAB-EINDT. "deldate.
I_EKES-XBLNR = ITAB-XBLNR.
i_ekes-erdat = sy-datum.
i_ekes-ezeit = sy-uzeit.
MODIFY i_ekes.
ENDLOOP.
ENDLOOP.
IF sy-subrc NE 0.
LOOP AT I_TAB. "WHERE EBELN = PONUMBER.
READ TABLE I_TAB.
LOOP AT i_ekes WHERE ebelp EQ ITAB-EBELP "itemnumber
AND ebtyp EQ 'AB'.
i_ekes-menge = ITAB-MENGE. "quantity.
i_ekes-ebtyp = 'LA'.
i_ekes-kz = 'I'.
i_ekes-etens = x.
i_ekes-eindt = ITAB-EINDT. "deldate.
I_EKES-XBLNR = ITAB-XBLNR.
i_ekes-erdat = sy-datum.
i_ekes-ezeit = sy-uzeit.
APPEND i_ekes.
ENDLOOP.
ENDLOOP.
ENDIF.
To update the confirmations tab
CALL FUNCTION 'ME_CONFIRMATION_UPDATE'
EXPORTING
I_EBELN = PONUMBER
TABLES
XEKES = i_ekes[].
YEKES = I_EKES[].
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = EKES.
VARKEY = VARKEY
X_TABNAME = ' '
X_VARKEY = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
.
ENDFUNCTION.
2007 Apr 13 6:13 PM
Your TABNAME field is of different type. You have to use the following for the tabname.
DATA : ls_tabname type RSTABLE-TABNAME.
hith.
Sunil Achyut
2007 Apr 16 3:11 PM
When creating a lock object, we have the key fields of a table as lock parameters. Does that mean that we cant make changes only to those fields or any fields of the table?
I'm trying to lock table EKES, but not making any changes in the key fields, i'm trying to update other fields.....still I cant see the lock activated.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |