Showing results for 
Search instead for 
Did you mean: 

Problem Copying records from one table to another?

Former Member
0 Kudos

Hi all,

I have two tables Table1 and Table2. In table one one of the column is delivery Qty and another pick QTY,

Pick qty is editable field i can enter any value. If pick qty is more than del qty i am trhrowing error. upto this is ok.

table1 fields - posnr, matnr , del qty and pick qty.

table2 fields - matnr,pickqty, and some other.


suppose in table1 some line items are there i select all items and isert means i want to insert all recoreds in table2 , here also i ahve to check del qty with pick qty.. This part i done, it is working for me fine.

case 2.

For example Del qty is 2, first i am selecting pick qty as 1 and click on isert that record will be inserted to table2. so here i can isert that record two times , and if i try to insert 3rd time it should not allow, because del qty is only 2.

How can i achieve in case2 situation??? any helps



View Entire Topic
Former Member
0 Kudos

In the Table 2, is the PICK Qty column editable or not.

If in TABLE Del qty is 100, pick qty is 50

As per your requirement, When I try to copy, COPY is allowed based onwhich Delivery qty & pick Qty is equal. Then in this case the col2 is not editable in table 2 right.

I have some questions on your requirement -

1. When the qty is equal in table 2, are you disbaling that row in table 1 as pcik qty is still editable.

2. After inserting rows in table 2, If the Pick qty in table 1 is changed, then inserted rows in table 2 needs to be deleted right when the quantity matches..Which records needs to be deleted should be decided.

3. Also as there is a mutliple selection allowed and can be copied, all these checks needs to be imposed.

Handling these things look clumsy.

Anyways -

Hope you have used 2 nodes to bind data to different tables.

You need to take one more attribute in node2 to hold the tbale 2 data. when ever you try to copy, this attribue should store the uniquie identifer value or any number or MATNR in this case (Assumption that matnr is not repeted in table 1) , so that it can be best used for comparision, gets the totals of pick qty to throw the error.

Former Member
0 Kudos


thanks lekha and monish for your replies..

1. Pick qty allowed equal to del or less than del qty. Pick qty editable in table1 only. In table2 all are display fields.

2.supoose del qty is 5 he can pick any amount of qty upto 5, for example first he can pick 2 and insert, next he can pick 1 and

insert next 2 and insert like that. If insert again throws error.(How can i achieve this ).

3.Same material should be repeated any no of times, i think i need to cnsider here POSNR.

4. suppose in table1 3 records are there, he can select at a time 3 and he can pick any amount of pick qty and insert, then also based on qtys i need to throw error.

hope you understand..



Active Contributor
0 Kudos

hello venkat,

you need to write the logic to campare the quantities.

as suggested above in one post add one more attribute and use it as counter.

and just before adding , i.e. in the eventhandler of the insert button.

add the pick quantity sum of all the rows you want to insert to counter variable

and then compare this varibale to total quantity if it is more than total

then throw the error. and here substract the pick quantity of these rows once again after the error


sarbjeet singh

Former Member
0 Kudos

Hi Sarbjeet,

thanks for your reply..

If i use some variable for total, that is ok for one item, but here for example table1 contains 3 records so for each records i have to calculate total may be no of times for 1 item or at a time, and in another case if user select multiple i have to calculate all items total.

So I think i have to calculate item wise total.. right??

Can anybody tell me how to calculate item wise subtotals in table??? I searched here i am not getting any for table.

Please help..



Former Member
0 Kudos

As your internal tbale has already the required data, based on MATNR POSNR combination you can sum up thiings and store in some variable with in the internal table. You canadd one more field in the internal table to store this value right.

Former Member
0 Kudos

Hi Lekha,

I solved all cases except one. please tell me how to solve this...

For example, in table1 i have some records, 1 records having delivery qty as 5, now user can make pick qty of any amount

for example first he make 2 as pick qty and isert

sec time 2 and insert

3rd 1 and insert

if he try to insert 4th time error should come...?? How can i achieve this.. Any helps



Former Member
0 Kudos


I think you have to do some coding before doing other coding.

Follow like this..

1. Read Table1 first.

2. Read table2.

3. Loop table2, declare one variable to store sum, calculate sum in loop.

so when you inserting first time no records, for example Delivery Qantity is 2, so when you trying to insert 3rd time , you get sum value 2. Now del quantity and sum are equal, so if equal rise error message else follow your other coding.

Hope it will solve.



Former Member
0 Kudos


Table 1 records

For same MATNR and POSNR combination -

1. Delv Aty 5 and Pick qty 2 (Editable field) - > When the user enters the record like this, then click on copy, this will be inserted in TABLE2 right

2. Del Qty 5 Pick Qty 3-> Now user tries to insert the recod in TABLE 2.

Now -

While Copying,

LOOP at TABLE 1 into WA.

LOOP at TABLE2 where matnr = wa-matnr and Posnr = wa-posnr.

  • Sum up the Pickup Qty. and validate against the DEL QTY.


  • set a flag or move these error records to other internal table.


  • Insert the records by modifying the TABLE2 or Move it to other internal table and bind this new table.



  • Based on FLAG or Error records - Show the errors.

Now - in this case, COPY can not be done for error ones.

After the error occurs, highlight the error records in TABLE 1 so that user will correct them.

You need to ensure that TABLE 2 records are consistent.

One more thing, For ex: in TABLE2 if everything is fine, Are you disbaling the input fields(PICKQTY) for that record in TABLE1.

Where there is a match between TABLE1 and TABLE 2, now user will have an option to change the qyt fields again right.

How many times this can be done..Is there any this.

Former Member
0 Kudos

Thanks Kris,

that is working fine, but for multiple items not working, if user select multiple items then also i have to check qtys and through error,

can you give me any idea??



Former Member
0 Kudos


Compare Table1 delivery qty with table2 pick qty. If both qtys equal raise error message.