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: 

table.

Former Member
0 Kudos
130

Hi.

please look at this code, its giving runtime error like this 'Error in an ABAP/4 statement when processing an internal table'. how to correct this.

loop at lv_order1.

select single werks from s886 into werks where pkunag = lv_order1-cust.

if sy-subrc <> 0.

  • MESSAGE w008(ykmessage) WITH zporder-cust.

write 😕 'Customer Code', lv_order1-cust,' is not Present'.

skip.

else.

modify lv_order2 from lv_order1.

endif.

select single maktx from makt into maktx where matnr = lv_order1-matnr.

if sy-subrc <> 0.

  • MESSAGE w003(ykmessage) WITH lv_order1-matnr.

write 😕 'Material Code',lv_order1-matnr,' Not Present'.

skip.

else.

modify lv_order2 from lv_order1.

endif.

endloop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
99

Hi Prajwal,

Your statement

<b>modify lv_order2 from lv_order1.</b>

is trying to modify the whole lv_order2 internal table with the data of lv_order1 header. Is that what you want. If not plz include a <b>where clause</b> or <b>move lv_order1</b> header data <b>to lv_order2</b> header data and then <b>append lv_order2</b>.

<b>

Reward points if this helps you,</b>

Kiran

10 REPLIES 10

Former Member
0 Kudos
99

Please check if data definition is correct.

Tables:werks,

maktx.

and Lv oder1 has a headerline...?

as u were trying to modify lv_order2 from lv_order1.

Regards,

Reema.

0 Kudos
99

HI Reema .

lv_order1 has headerline . its still giving error.

Former Member
0 Kudos
99

Hi

You need to check whether you have declared the table s886

and how u have declared your internal table- with header line or w/o it.

regards

dinesh

Former Member
0 Kudos
99

Hi,

Don't use select statement within loop ... endloop.Better use read table statement

Reward points if helpful.

Regards.

Srikanta Gope

Former Member
0 Kudos
100

Hi Prajwal,

Your statement

<b>modify lv_order2 from lv_order1.</b>

is trying to modify the whole lv_order2 internal table with the data of lv_order1 header. Is that what you want. If not plz include a <b>where clause</b> or <b>move lv_order1</b> header data <b>to lv_order2</b> header data and then <b>append lv_order2</b>.

<b>

Reward points if this helps you,</b>

Kiran

0 Kudos
99

hi kiran.

s i want to modify the table with the data of lv_order1 header

Former Member
0 Kudos
99

check if lv_order1 has the same type of lv_order2.

regards,

Reema.

Former Member
0 Kudos
99

check if lv_order1 has the same type of lv_order2.

else try using "append "

Regards,

Reema.

0 Kudos
99

thanks to all

Former Member
0 Kudos
99

Hi,

Do not modify internal table directly.

use the following syntax to slove problem.

loop at lv_order1.

select single werks from s886 into werks where pkunag = lv_order1-cust.

if sy-subrc <> 0.

  • MESSAGE w008(ykmessage) WITH zporder-cust.

write 😕 'Customer Code', lv_order1-cust,' is not Present'.

skip.

else.

<b>move-corresponding lv_order1 to lv_order2.

append lv_order2.

clear lv_order2.</b>

endif.

As such there is not any problem in select statement. try this and check the output.

<b>Rewards if useful.</b>

Regards,

Kinjal