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

multiple entry in table control

Former Member
0 Likes
767

Hiiii members

Plzz help.....

I have created a table control where i want to save multiple records in table with one document no.

As if now i have new document no for each line item.....

Can anybody tell me how to save multiple line item in one document no

my code is like this....

WHEN 'SAVE'.

LOOP AT itab1.

itab1-contractor = itab-transporter.

zutility-contractor = itab1-contractor.

itab1-equipment = itab-type.

zutility-equipment = itab1-equipment.

itab1-regno = zwb_m_v-vehicle.

zutility-regno = itab1-regno.

itab1-oiltype = zutility-oiltype .

itab1-shift_d = zutility-shift_d.

itab1-shift_h = zutility-shift_h .

itab1-date1 = zutility-date1.

itab1-time2 = zutility-time2 .

itab1-plant = zutility-plant.

itab1-driver = zutility-driver.

itab1-helper = zutility-helper.

itab1-quantity = zutility-quantity.

zutility-serial_no = itab1-serial_no.

zutility-dept = itab1-dept.

zutility-time1 = itab1-time1 .

zutility-opening_km = itab1-opening_km.

zutility-remark1 = itab1-remark1.

SELECT SINGLE MAX( document_no )

FROM zutility INTO serial.

itab1-document_no = serial + 1.

MODIFY zutility FROM itab1.

ENDLOOP.

IF sy-subrc = 0.

MESSAGE s398(00) WITH 'D1ata Saved successfuly'.

ENDIF.

ENDCASE.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
721

yaa i have written my code... incrementing document no for each line item...

but i want logic to save multiple data entry for one document...

which i m unable to do.

can u plzz make me understand..what should be the logic..

5 REPLIES 5
Read only

Former Member
0 Likes
721

Hello Akanksha,

If you want to store multiple documents for number of line items then why are you incrementing

the document number for every new entry. So here you need to decided the logic for grouping multiple line items and once you have all the line items in table then next time you can increment the document number.

Also, do not use select in loop endloop that will degrade you report performance. instead select all the entries in table at one go using into table and then use read statement in loop.

Hope this helps!

Thanks,

-Anand.

Read only

Former Member
0 Likes
721

Thanks anand for your help.....

yaaa....i want the login for group entry.

as i m unable to do it...

Thanks

Akanksha

Read only

Former Member
0 Likes
722

yaa i have written my code... incrementing document no for each line item...

but i want logic to save multiple data entry for one document...

which i m unable to do.

can u plzz make me understand..what should be the logic..

Read only

0 Likes
721

You need to define zutility table in following way:

Document_No Item_no other fields goes here .....

Doc1 1 other field data for item 1 for Doc1

Doc1 2 other field data for item 2 for Doc1

Doc1 3 other field data for item 3 for Doc1

So, Document No. and Item No. both will form composite key in table zutility. To form composite key you need to define both the fields as key unique key fields in database.

As far as logic is concern you need to add one more field item_no in table control and instead of incrementing

document number increment item_no then save it in zutility table.

Hope this resolves your issue.

Thanks,

-Anand.

Read only

Former Member
0 Likes
721

Thanks a lot anand...

my problem has been solved

Thanks

Akanksha