‎2008 Aug 05 11:48 AM
my database table is given below:
MANDT MANDT CLNT 3 0 Client
EMPLOYEECODE PERSNO NUMC 8 0 Personnel number
CURRENTDATE SYDATUM DATS 8 0 Current Date of Application Server
CURRENTTIME SYUZEIT TIMS 6 0 Current Time of Application Server
EMPLOYEECARDNO CHAR 8 0 Employee Card Number
PUNCHDATE DATS 8 0 Date On Which Employee's Punch
PUNCHTIME TIMS 6 0 Time On Which Employee's Punch
INDICATORS CHAR 3 0 IN/OUT Indicators
here the mandt and employee code is primary key but when i use this codes
to get inserted into my table it is not inserting the table.
codes:
report z.
types:BEGIN of s_final.
Include structure ZHRT_XML_TO_SAP.
types:end of s_final.
----
Workarea Begin with WA_ *
----
data:wa_final type s_final.
----
Internal tables Begin with Itab_ *
----
data:itab_final type TABLE OF s_final,
MOVE '00000001' tO wa_final-EMPLOYEECODE.
move '12345678' to wa_final-EMPLOYEECARDNO.
move '20080804' to wa_final-PUNCHDATE.
move '15:50' to wa_final-PUNCHTIME.
move 'P10' to wa_final-INDICATORS.
move sy-datum to wa_final-CURRENTDATE.
move sy-uzeit to wa_final-CURRENTTIME.
append wa_final to itab_final.
clear:wa_final.
MOVE '00000002' tO wa_final-EMPLOYEECODE.
move '12345679' to wa_final-EMPLOYEECARDNO.
move '20080804' to wa_final-PUNCHDATE.
move '15:50' to wa_final-PUNCHTIME.
move 'P20' to wa_final-INDICATORS.
move sy-datum to wa_final-CURRENTDATE.
move sy-uzeit to wa_final-CURRENTTIME.
append wa_final to itab_final.
clear:wa_final.
***Function Module:
CALL FUNCTION 'ZHRF_XML_TO_SAP'
TABLES
TABLE1 = itab_final.
****and in function module the inserting command is written here basically
it is a bapi made by me
**fm--ZHRF_XML_TO_SAP
if not table1[] is initial.
INSERT INTO ZHRT_XML_TO_SAP values table1 .
if sy-subrc = 0.
endif.
endif.
plz help me sort out this problem....
‎2008 Aug 05 1:26 PM
Hi Rajat,
Try this,
loop at table1 into wa_table1
INSERT INTO ZHRT_XML_TO_SAP values wa_table1
endloop.
Thanks,
Muthu
‎2008 Aug 05 1:21 PM
Hi rajat...
INSERT INTO ZHRT_XML_TO_SAP from table table1.
regards
vivek
‎2008 Aug 05 1:26 PM
Hi,
use modify statement..
if not table1[] is initial.
modify ZHRT_XML_TO_SAP from tabele table1 .
if sy-subrc = 0.
commit work.
endif.
endif.
Regards,
Nagaraj
‎2008 Aug 05 1:26 PM
Hi Rajat,
Try this,
loop at table1 into wa_table1
INSERT INTO ZHRT_XML_TO_SAP values wa_table1
endloop.
Thanks,
Muthu