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

Problem in Select Query For Inserting Data In Table

Former Member
0 Likes
1,245

Hi,

I am working on a report in which i have to insert the data from tables but i am not able to do it properly.

Here is the link to the code : -

http://docs.google.com/View?id=dfxswwff_12cxpxm3c5

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,194

Hi,

Define the internal table as below.

It will take all the fields from your custome table.

You have have missed some fields so insert is not working properly.


Data: t_zth1 type standard table of ZTBSUM_PP1,
	T_TAB1	type standard table of ZTBDTL_PP.

then use


 MODIFY  ZTBSUM_PP1 FROM TABLE t_zth1 .
 MODIFY  ZTBDTL_PP FROM TABLE T_TAB1 .

after modify what message are you showing?

Please check SY-SUBRC and then show the message.

Edited by: pravin s. on Feb 23, 2010 7:06 AM

11 REPLIES 11
Read only

Former Member
0 Likes
1,194

Hi,

Can you please explain the problem you are facing with this code?

Thanks,

Archana

Read only

0 Likes
1,194

Hi,

1. I am facing the probklem that i am trying to get data from the 2 tables i.e. ZTBDTL_PP and ZTBHDR_PP as the the first is for details and 2nd is storing the dates of accounting document... when i am trying to inner join them,it is not able to pick up the data from the respective tables and it is showing very less data in the final table i.e.ZTBSUM_PP1.

2. I am not using the code : - MODIFY ZTBSUM_PP1 FROM T_ZTH1.

3. I had checked the structure of db table(ZTBSUM_PP1) and the final internal table (ZTBSUM_PP1)they all are same but still it is not displaying the correct data.

Read only

0 Likes
1,194

hi

You can use for all entries concept.

check the table entries and debug the coding and check the logic.

Read only

0 Likes
1,194

Hi,

I had checked in the debug mode and the internal table is filling right and when it comes to the inserting it into the db table it is not filling it correctly.

I think i should insert 2 more fields in the database table and see its effect on it.. i will revert back if there is probem.

Read only

Former Member
0 Likes
1,194

hi,

Just try - remove the table from the below syntax.

MODIFY ZTBSUM_PP1 FROM T_ZTH1.

hope this helps.

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
1,194

Hi,

Please check whether the structure of the internal table that you are using to update database table is exactly same as the database table or not. The structure of both the tables shld be same.

Thanks & Regards

Rocky

Read only

Former Member
0 Likes
1,194

Hi...

any foreign key relationship between te tabls?

check the structure is correct w_zth1 ( and ZTBSUM_PP1 )...

Check sy-subrc after insert command

MODIFY ZTBSUM_PP1 FROM TABLE T_ZTH1. -->No need

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
1,194

Hi,

Even declare the table you are modifying in the tables declaration.

TABLES ZTBSUM_PP1.

Hope it will solve your problem..

Thanks & Regards

Rocky

Read only

Former Member
0 Likes
1,195

Hi,

Define the internal table as below.

It will take all the fields from your custome table.

You have have missed some fields so insert is not working properly.


Data: t_zth1 type standard table of ZTBSUM_PP1,
	T_TAB1	type standard table of ZTBDTL_PP.

then use


 MODIFY  ZTBSUM_PP1 FROM TABLE t_zth1 .
 MODIFY  ZTBDTL_PP FROM TABLE T_TAB1 .

after modify what message are you showing?

Please check SY-SUBRC and then show the message.

Edited by: pravin s. on Feb 23, 2010 7:06 AM

Read only

0 Likes
1,194

Hi,

I had the solve the problem and the solution is i had two more key fields in the final table i.e. accounting document and the line item and now it is showing the data accurately.

Thanks all of you for the valueable responses.

Read only

0 Likes
1,194

hi

Please close the tread as 'Answered'.