2007 Jul 27 11:21 AM
hi gurus.
iam getting the data into my internal table (g_vcontrol_itab) before this logic
but my records what ever in internal table is not inserting into my
database please check this code .
WHEN 'INSERT'.
LOOP AT g_vcontrol_itab INTO g_vcontrol_wa.
INSERT into zcust_call_rec values g_vcontrol_wa.
IF sy-subrc = 0.
MESSAGE i010(zmessage).
ELSE.
MESSAGE i000(0) WITH 'NOT INSERTED'.
ENDIF.
ENDLOOP.
regards ,
satheesh.
2007 Jul 27 11:27 AM
hi,
Verify the data present in the DB table.
Error may be due to the duplicate records present in the internal table.
Regards,
Sankar
hi gurus.
iam getting the data into my internal table (g_vcontrol_itab) before this logic
but my records what ever in internal table is not inserting into my
database please check this code .
WHEN 'INSERT'.
LOOP AT g_vcontrol_itab INTO g_vcontrol_wa.
INSERT into zcust_call_rec values g_vcontrol_wa.
IF sy-subrc = 0.
MESSAGE i010(zmessage).
ELSE.
MESSAGE i000(0) WITH 'NOT INSERTED'.
ENDIF.
ENDLOOP.
regards ,
satheesh.
2007 Jul 27 11:26 AM
Hi,.
Try this.
LOOP AT g_vcontrol_itab .
INSERT into zcust_call_rec values g_vcontrol_itab.
IF sy-subrc = 0.
MESSAGE i010(zmessage).
ELSE.
MESSAGE i000(0) WITH 'NOT INSERTED'.
ENDIF.
ENDLOOP.
Remove work area
Regards,
Priyanka.
2007 Jul 27 11:27 AM
hi,
Verify the data present in the DB table.
Error may be due to the duplicate records present in the internal table.
Regards,
Sankar
2007 Jul 27 11:28 AM
hi,
Just chk this sample.
DATA : BEGIN OF int OCCURS 0,
client LIKE ztable-client,
emp_name LIKE ztable-emp_name,
emp_id LIKE ztable-emp_id,
END OF int.
int-client = '501'.
int-emp_name = 'Test Data'.
int-emp_id = '0001'.
APPEND int.
INSERT ztable FROM TABLE int.
COMMIT WORK.Rgds
Reshma
2007 Jul 27 11:30 AM
Hi
Did you check if there are any records in the table, with the same Primary key as that of the records in the internal table.
Except for that, i dont see any reason why its failing.
<b>INSERT INTO dbtab VALUES wa.</b>
Regards
Raj
2007 Jul 27 11:53 AM
If you restructure your code a little like this:
WHEN 'INSERT'.
LOOP AT g_vcontrol_itab INTO g_vcontrol_wa.
clear: zcust_call_rec.
move-corresponding g_vcontrol_wa to zcust_call_rec.
*" put a break-point here to see what is in zcust_call_rec
break-point.
insert zcust_call_rec.
IF sy-subrc = 0.
MESSAGE i010(zmessage).
ELSE.
MESSAGE i000(0) WITH 'NOT INSERTED'.
ENDIF.
ENDLOOP.then at the break-point you will be able to see what is about to be attempted in the DB insert more clearly e.g. you may have some key fields in zcust_call_rec empty.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |