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

regarding insertion in the database table

Former Member
0 Likes
517

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....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
493

Hi Rajat,

Try this,

loop at table1 into wa_table1

INSERT INTO ZHRT_XML_TO_SAP values wa_table1

endloop.

Thanks,

Muthu

3 REPLIES 3
Read only

Former Member
0 Likes
493

Hi rajat...

INSERT INTO ZHRT_XML_TO_SAP from table table1.

regards

vivek

Read only

former_member404244
Active Contributor
0 Likes
493

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

Read only

Former Member
0 Likes
494

Hi Rajat,

Try this,

loop at table1 into wa_table1

INSERT INTO ZHRT_XML_TO_SAP values wa_table1

endloop.

Thanks,

Muthu