‎2008 Mar 28 10:13 AM
Hi All,
I have designed z table with following fields.
1) CONSULTANT
2) MODULE_NAME
3) CR_DATE
4) ISSUE
5) RPT_NAME
6) TCODE
7) REQ_NO
😎 DEV_STA
9) QA_STA
10) PRD_STA.
the ztable contains no primaty key as we are storing the duplicates values
I have created One screen with all above fields using module pooled programming. One Input screen is designed containing all above fields. after that when i click on SAVE Button all above fields are getting inserted into ztable. But when i again fill the data the second record is not getting inserted into ztable.
I have written the following code for this :
wa_issue-CONSULTANT = ZISSUE-CONSULTANT.
wa_issue-MODULE_NAME = ZISSUE-MODULE_NAME.
wa_issue-CR_DATE = ZISSUE-CR_DATE.
wa_issue-ISSUE = ZISSUE-ISSUE.
wa_issue-RPT_NAME = ZISSUE-RPT_NAME.
wa_issue-TCODE = ZISSUE-TCODe.
wa_issue-REQ_NO = ZISSUE-REQ_NO.
wa_issue-DEV_STA = ZISSUE-DEV_STA.
wa_issue-QA_STA = ZISSUE-QA_STA.
wa_issue-PRD_STA = ZISSUE-PRD_STA.
insert into zissue values wa_issue .
commit work.
‎2008 Mar 28 10:17 AM
Hi,
It seems you are giving duplicate primary key. Check out the primary key in Ztable and try to give different value for that from 2nd record onwards.
Reward points if helpful.
Regards,
CS.
‎2008 Mar 28 10:21 AM
Hi
If the values are duplicate then the system wont update them in table
so check values and pass different values to update
use insert using internal table
Regards
Shiva
‎2008 Mar 28 10:24 AM
‎2008 Mar 28 10:22 AM
Hi Ulhas,
First let me know how can you create a table without having atleast one primay key.
In Sap you cannot creata table without one primary key.
First you clarify whether your table is activated or not .
after taking the vales into workarea append to an internal table
in the loop.
After a loop then insert into ztable from internal table.
Regards,
Madhavi
‎2008 Mar 28 10:26 AM
‎2008 Mar 28 10:30 AM
Hai Ulhas,
first of all how can u create a table with out a primary key.
there should be atleast one primary key in ur ZTABLE.
what is wa_issue-CONSULTANT
and what is ZISSUE-CONSULTANT
i mean which are table fields and which are module screen fields
regards
raam
‎2008 Mar 28 11:35 AM
‎2008 Mar 28 5:28 PM
Hi,
just give one serial number as primary key.then modify the database table using work area or internal table.
wa_issue-serialno = 1
wa_issue-CONSULTANT = ZISSUE-CONSULTANT.
wa_issue-MODULE_NAME = ZISSUE-MODULE_NAME.
wa_issue-CR_DATE = ZISSUE-CR_DATE.
wa_issue-ISSUE = ZISSUE-ISSUE.
wa_issue-RPT_NAME = ZISSUE-RPT_NAME.
wa_issue-TCODE = ZISSUE-TCODe.
wa_issue-REQ_NO = ZISSUE-REQ_NO.
wa_issue-DEV_STA = ZISSUE-DEV_STA.
wa_issue-QA_STA = ZISSUE-QA_STA.
wa_issue-PRD_STA = ZISSUE-PRD_STA.
wa_issue-serialno = 2
wa_issue-CONSULTANT = ZISSUE-CONSULTANT.
wa_issue-MODULE_NAME = ZISSUE-MODULE_NAME.
wa_issue-CR_DATE = ZISSUE-CR_DATE.
wa_issue-ISSUE = ZISSUE-ISSUE.
wa_issue-RPT_NAME = ZISSUE-RPT_NAME.
wa_issue-TCODE = ZISSUE-TCODe.
wa_issue-REQ_NO = ZISSUE-REQ_NO.
wa_issue-DEV_STA = ZISSUE-DEV_STA.
wa_issue-QA_STA = ZISSUE-QA_STA.
wa_issue-PRD_STA = ZISSUE-PRD_STA.
cheers
shibu
‎2008 Mar 28 9:01 PM
Hi ,
We cannot insert data into a table without a primary key. even though we have MANDT as the primary key , we should have any one field as the primary key.
You have mentioned that you need to insert duplicate values. I think you are inserting the same records with some modifications.so minimum there must be a primary key .
if the same record you are inserting again then there is no purpose for storing the same record multiple times
reward points if helpful.
Thanks and Regards.