Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data not inserting into ztable

Former Member
0 Likes
1,162

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.

9 REPLIES 9
Read only

Former Member
0 Likes
872

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.

Read only

Former Member
0 Likes
872

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

Read only

0 Likes
872

I am using Ztable which are inserting from input fields

Read only

Former Member
0 Likes
872

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

Read only

Former Member
0 Likes
872

Hi,

Try using this.

MODIFY zissue FROM wa_issue.

Regards.

Abhisek

Read only

Former Member
0 Likes
872

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

Read only

0 Likes
872

ZISSUE-CONSULTANT is screen field and wa_issue is work area

Read only

Former Member
0 Likes
872

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

Read only

Former Member
0 Likes
872

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.