10-29-2008 11:26 AM
Hello...I have a function module that I need to add in the new sets of data into the "zresmort" table when the function module is being called several of times. currently, when the function module is being called several of times, the new sets of data will not write into the table. i have a sample coding as below, does anyone know why the problems occured?
FUNCTION Z_MBB_WRITE_RES_MORT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_CKF_CONTRACT) TYPE /BA1/R2_STR_CALC_KF
*" REFERENCE(I_CKF_PROCESS) TYPE /BA1/R2_STR_CKF_PROCESS
*"----------------------------------------------------------------------
TABLES ZRESMORT.
DATA: E_ZRESMORT TYPE STANDARD TABLE OF ZRESMORT WITH HEADER LINE,
ver_count TYPE /BA1/R0_DTE_JOBVERSION.
ver_count = 1.
DELETE FROM ZRESMORT
WHERE MORT_KDATE NE I_CKF_PROCESS-TECHNICAL-KEY_DATE.
E_ZRESMORT-MORT_FT_ID = I_CKF_CONTRACT-COMMON-CONTRACT_ID_EXT.
E_ZRESMORT-MORT_KDATE = I_CKF_PROCESS-TECHNICAL-KEY_DATE.
E_ZRESMORT-MORT_TSTAMP = I_CKF_PROCESS-TECHNICAL-TIMESTAMP.
E_ZRESMORT-MORT_FLAG = 1.
E_ZRESMORT-MORT_BUPA = I_CKF_CONTRACT-BUPA-BUSINESS_PARTNER_ID.
E_ZRESMORT-MORT_PORTFO = I_CKF_CONTRACT-BUPA-PORTFOLIO_CAT.
E_ZRESMORT-MORT_FT_ID_DUM = I_CKF_CONTRACT-COMMON-CONTRACT_ID.
E_ZRESMORT-MORT_STATUS = ver_count.
*SELECT SINGLE * FROM ZRESMORT.
*IF SY-DBCNT EQ 0.
INSERT INTO ZRESMORT VALUES E_ZRESMORT.
*ELSE.
* UPDATE ZRESMORT FROM TABLE E_ZRESMORT.
* COMMIT WORK.
*ENDIF.
IF SY-SUBRC EQ 0.
ENDIF.
ENDFUNCTION.
10-29-2008 11:53 AM
Hi,
Can you list the primary keys of the custom table ?
Thanks & Regards,
Navneeth K.
10-29-2008 11:57 AM
hello...the primary keys for this table are "mort_ft_id", "mort_kdate" and ", "mandt"
10-29-2008 11:53 AM
Hi,
Instead of INSERT statement try
*INSERT INTO ZRESMORT VALUES E_ZRESMORT.
MODIFY ZRESMORT FROM E_ZRESMORT
Best regards,
Prashant
10-29-2008 12:17 PM
hello...i try to insert the coding that you provide just now but it looks like not working as well..