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

Insert Statement is not working in module pool programming

Former Member
0 Likes
3,048

Dear All,

I am facing issue with one of module pool programming. My First screen is given below.

What exactly i am looking for, in our next screen we will add some detail and same should be added in the next screen in the next line.

Now after adding these details, new line should be inserted in the next screen.and also the same should be updated in the next line of z-table. But right now its showing the current record only. not adding the next line with new record.

3rd screen is like this, but not inserting the records that we have added.

Thanks and regards

Jai

18 REPLIES 18
Read only

former_member249399
Active Participant
0 Likes
2,944

Hi,

Share your code.

Thanks.

Read only

0 Likes
2,944

Hi Ranju,

Kindly chk the code.

BREAK-POINT.

       LOOP AT it_zexp_advice INTO wa_zexp_advice.

*        DELETE it_zexp_advice WHERE eano IS INITIAL.

         lwa_expadvice-eorder = wa_zexp_advice-eorder.

         lwa_expadvice-buyer = wa_zexp_advice-buyer.

         lwa_expadvice-buyer_code = wa_zexp_advice-buyer_code.

         lwa_expadvice-containers = wa_zexp_advice-containers.

         lwa_expadvice-dispatch_sch = wa_zexp_advice-dispatch_sch.

         lwa_expadvice-last_date_dispatch = wa_zexp_advice-last_date_dispatch.

         lwa_expadvice-basic_artwork = wa_zexp_advice-basic_artwork.

         lwa_expadvice-ty_pack_mat = wa_zexp_advice-ty_pack_mat.

         lwa_expadvice-packing_date_bags = wa_zexp_advice-packing_date_bags.

         lwa_expadvice-best_bfr_bags = wa_zexp_advice-best_bfr_bags.

         lwa_expadvice-crop_year_bags = wa_zexp_advice-crop_year_bags.

         lwa_expadvice-batch_bags = wa_zexp_advice-batch_bags.

         lwa_expadvice-barcode_bags = wa_zexp_advice-barcode_bags.

         lwa_expadvice-tag_bags = wa_zexp_advice-tag_bags.

         lwa_expadvice-stitching = wa_zexp_advice-stitching.

         lwa_expadvice-stickers = wa_zexp_advice-stickers.

         lwa_expadvice-fumigation = wa_zexp_advice-fumigation.

         lwa_expadvice-inner_bag = wa_zexp_advice-inner_bag.

         lwa_expadvice-seal = wa_zexp_advice-seal.

         lwa_expadvice-empty_bags = wa_zexp_advice-empty_bags.

         lwa_expadvice-sample_pre_shipment = wa_zexp_advice-sample_pre_shipment.

         lwa_expadvice-sample_post_shipment = wa_zexp_advice-sample_post_shipment.

         lwa_expadvice-sample_oaa = wa_zexp_advice-sample_oaa.

         lwa_expadvice-third_party_ins = wa_zexp_advice-third_party_ins.

         lwa_expadvice-blank1 = wa_zexp_advice-blank1.

         lwa_expadvice-blank2 = wa_zexp_advice-blank2.

         lwa_expadvice-blank3 = wa_zexp_advice-blank3.

         lwa_expadvice-blank4 = wa_zexp_advice-blank4.

         lwa_expadvice-blank5 = wa_zexp_advice-blank5.

         lwa_expadvice-prepared_by = wa_zexp_advice-prepared_by.

         lwa_expadvice-prepared_date = wa_zexp_advice-prepared_date.

         lwa_expadvice-approved_by = wa_zexp_advice-approved_by.

         lwa_expadvice-approved_date = wa_zexp_advice-approved_date.

         lwa_expadvice-ppc = wa_zexp_advice-ppc.

         lwa_expadvice-eano = wa_zexp_advice-eano.

         lwa_expadvice-others_txt = wa_zexp_advice-others_txt.

         lwa_expadvice-other_name = wa_zexp_advice-other_name.

         lwa_expadvice-zprirority = wa_main1-zprirority.

         lwa_expadvice-zplant     = wa_main1-zplant.

* MODIFY zexp_advice FROM lwa_expadvice.

         APPEND lwa_expadvice TO lt_expadvice.

         INSERT zexp_advice FROM lwa_expadvice.


Thanks and Regards

Jai

Read only

0 Likes
2,944

HI

You are updating the Z-table through workarea, so once try with MODIFY keyword.

regards

laxman

Read only

0 Likes
2,944

Hi Laxman,

With Modify command, i am not in a position to add a new record in the next line.

Thanks and regards

Jai

Read only

former_member202818
Active Contributor
0 Likes
2,944

Hi Jaiprakash,

Did you check your internal table for table control?

All records are there in internal table? Still displaying only single record?

Then add this piece of code before loop endloop, at PBO of screen having table control.

DESCRIBE TABLE itab LINES tbc-lines.

Regards

Sreekanth

Read only

0 Likes
2,944

Hi Sreekanth,

I have only added record in the internal table. and i am not able to get 2nd line in the internal table.

Thanks and regards

Jai

Read only

0 Likes
2,944

Hi,

Please check the select statement for the 3rd screen whether it is triggered after the insert statement which you mentioned above.

If you are trying to update the non-primary key and if the primary key remains the same of the new record, use MODIFY. Otherwise, use insert.

It is better if you can collect the details inside the loop in an internal table , if possible and then modify/insert using the internal table than the work area.

Read only

0 Likes
2,944

I didn't get you. You mean to say, APPEND lwa_expadvice TO lt_expadvice  is not working?

Read only

0 Likes
2,944

Hi Sreekanth,

Append is working but properly, its showing the data in the internal table. But Insert statement is not adding the record in the next line.

Refer the below screen shot.

INSERT zexp_advice FROM lwa_expadvice . statement is not adding data into table control as well as in our z-table zexp_advice.

Thanks and Regards

Jai

Read only

0 Likes
2,944

Hi Jai,

Fill MANDT in lwa_expadvice with sy-mandt value. Also make sure that the same key is not there in your table.

Regards

Sreekanth

Read only

0 Likes
2,944

Hi

make sure that the internal table you are using for table control in 3rd screen is lt_expadvice or not.

and according to your screen shots in that internal table having one record only so it wil display one record.

i think you are using other internal table for fist screen.

make sure both are same.

regards

laxman

Read only

pavanm592
Contributor
0 Likes
2,944

Hi ,

Check your table primary keys seems like you have only Export Advice No as key field.

once check the table key conditions might be issue there .

Regards,

Pavan

Read only

Former Member
0 Likes
2,944

Dear Pavan,

I have checked with the condition. but i think there is no any issue with the conditions.

Thanks and regards

Jai

Read only

Former Member
0 Likes
2,944

hi jaiprakash,

when record in inserted you have to refresh also

REFRESH CONTROL 'TAB_CTRL' FROM SCREEN 9001

Please check.

Read only

0 Likes
2,944

Dear Abdul,

Even though, i have used the refresh control, but still that is nor working.

Thanks and Regards

Jai

Read only

0 Likes
2,944

Hi jaiprakash,


please check whether plant and priority rae primary keys or not.


Regards.


Sridhar.A

Read only

Former Member
0 Likes
2,944

hi,

First you insert the record into the ztable and then append it to the internal table..

else you try with the update statement it may help you

Read only

0 Likes
2,944

Dear all,

I have tried everything, but its not working.

Thanks and regards

Jai