Application Development 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: 

Need to update Ztable from final internal table

Former Member
0 Kudos

Hi,

ITAB = Final internal table has 9 fields : 1 2 3 4 5 6 7 8 9

Ztable = Ztable has 6 fields ex : 1 3 4 6 7 8

Structure of both Itab and Ztable are different.

I have data in the Final Internal table and needs to update data into a ztable.

If condition is true...

Modify ztable from itab

endif.

Any suggestions how I can update Ztable from the INternal table

Regards,

Kittu

1 ACCEPTED SOLUTION

shishupalreddy
Active Contributor
0 Kudos

Hello,

Create one more internal table with simliar structure of ZTABLE

If u r condition is true

Populate the required 6 entries into that internal table

and update u r ztable from internal table

regards

9 REPLIES 9

shishupalreddy
Active Contributor
0 Kudos

Hello,

Create one more internal table with simliar structure of ZTABLE

If u r condition is true

Populate the required 6 entries into that internal table

and update u r ztable from internal table

regards

former_member242255
Active Contributor
0 Kudos

if you want to UPDATE the entries in ZTABLE,then you can declare a internal with the same structure of ZTABLE and fill the data into taht and then use the MODIFY statement..

but if u r inserting new entries you can diretly INSERT the entries in internal table to the ZTABLE

Former Member
0 Kudos

hello kittu ,

if two have different strucutres then declare a work area which has same as ztable

and move the fields into work area and update from this work area

hope it soles ur issue

afzal

Former Member
0 Kudos

Use move-corresponding to move the data contents to the work area of the ztable and update the ztable.

Former Member
0 Kudos

Hello,

First keep the loop to the final internal table then move all the records to the work area after moving to workarea then create another workarea for the Ztable then move only the field values which are there in Ztable then use modify keyword.

example

move:

y_wa_final_itab-kdauf to y_wa_zhr_item-vbeln,

y_wa_final_itab-kdpos to y_wa_zhr_item-posnr,

y_wa_final_itab-receiptno to y_wa_zhr_item-receiptno

modify zhr_item from y_wa_zhr_item

peter_ruiz2
Active Contributor
0 Kudos

Hi Kittu,

The best thing to do here is to have an internal table with the same structure of the ztable.

1. create a new internal table with the same structure as your table

2. loop at your final table and do the conditions and update your new internal table

3. modify the ztable from your new internal table by using this MODIFY ztable FROM new_itab.

Regards,

Peter

Former Member
0 Kudos

If condition is true...

move-corresponding itab to ztable.

modify ztable.

clear ztable.

endif.

Former Member
0 Kudos

  Modify ztable from itab .  "COmment this

  MODIFY ztable from table itab. "Add this or write table
  if sy-subrc = 0.
   COmmit worK. "add this staement also
 Endif.

regards,

Prabhudas

Former Member
0 Kudos

HI ,

Thank you rfor your response!

Your suggestions were helpful...

Regards,

Kittu