11-07-2007 11:47 AM
HI,
I am unable to update the records in to the z-table using PAI, module pool. Could any one help me please.,
the prg is as folows:
INCLUDE MZFIRSTPAGETOP . " global Data
TABLES: ZCHP_CUST_INFO.
DATA: OKCODE LIKE SY-UCOMM.
DATA: CNAME LIKE ZCHP_CUST_INFO-CREATED_BY,
REQTYP LIKE ZCHP_CUST_INFO-REQUEST_TYPE,
DESC LIKE ZCHP_CUST_INFO-SHORT_TEXT,
PRIO_TYPE LIKE ZCHP_CUST_INFO-PRIORITY_TYPE,
EFFECTIVE_DATE like ZCHP_CUST_INFO-REQUIRED_STR_DAT,
COMM_TYP like ZCHP_CUST_INFO-MODE_OF_COMM,
COMM like ZCHP_CUST_INFO-ADDRESS.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'FOR1000'.
SET TITLEBAR '1000'.
ENDMODULE. " STATUS_0100 OUTPUT
INCLUDE MZFIRSTPAGEO01 . " PBO-Modules *
INCLUDE MZFIRSTPAGEI01 . " PAI-Modules *
INCLUDE MZFIRSTPAGEF01 . " FORM-Routines *
&----
*& Module USER_COMMAND_1000 INPUT
&----
text
----
MODULE USER_COMMAND_1000 INPUT.
CASE SY-UCOMM.
WHEN 'SUBMIT'.
Updating the record.
ZCHP_CUST_INFO-CREATED_BY = CNAME.
ZCHP_CUST_INFO-REQUEST_TYPE = REQTYP.
ZCHP_CUST_INFO-PRIORITY_TYPE = PRIO_TYPE.
ZCHP_CUST_INFO-SHORT_TEXT = DESC.
ZCHP_CUST_INFO-CREATED_ON = EFFECTIVE_DATE.
ZCHP_CUST_INFO-MODE_OF_COMM = COMM_TYP.
ZCHP_CUST_INFO-ADDRESS = COMM.
*ENDIF.
INSERT ZCHP_CUST_INFO.
COMMIT WORK.
WHEN 'RESET'.
CLEAR: CNAME,REQTYP,PRIO_TYPE,
DESC,EFFECTIVE_DATE,COMM_TYP,COMM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
Thanks in advance,
Sunil
11-12-2007 2:12 PM
Hi,
Try to change the Delivery and maintenance settings of the user table as modifiable.
Are you trying to update or insert? If u r trying to update the use update statement instead of insert. If the record is not there in table it would be created by the statement.
11-12-2007 2:30 PM
Hi Sunil,
try with below statement.
INSERT into ZCHP_CUST_INFO values ZCHP_CUST_INFO.
COMMIT WORK.
Reward points if it helps,
Satish
11-12-2007 2:43 PM
Change the insert to a modify statement. This will update the record if it already exists otherwise insert it.
MODIFY ZCHP_CUST_INFO.