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: 

Simple ABAP Loop Correction

Former Member
0 Kudos

Hi Friends, I have simple correction required in the Loop at wa_itab since this is not picking the entries in one line and appending it I want to show all in one line. Can u please correct the Bold Part to fix it.

Thanks

Soniya Kapoor

<b>ABAP Code in Start Routine</b>

types: begin of tp_itab,

ZINTRENO type /BIC/AZDBREB_000-/BIC/ZINTRENO,

ZYEAR type /BIC/AZDBREB_000-/BIC/ZYEAR,

ZINSTYP type /BIC/AZDBREB_000-/BIC/ZINSTYP,

ZINSVAL type /BIC/AZDBREB_000-/BIC/ZINSVAL,

ZBBAUW13 type /BIC/AZDBREB_000-/BIC/ZBBAUW13,

COMP_CODE type /BIC/AZDAREB_000-COMP_CODE,

MAINUSAGE type /BIC/AZDAREB_000-MAINUSAGE,

ZOWNSTAT type /BIC/AZDAREB_000-/BIC/ZOWNSTAT,

ASSDVALUE type /BIC/AZDAREB_000-ASSDVALUE,

INSUREVAL type /BIC/AZDAREB_000-INSUREVAL,

COUNTRY type /BIC/AZDAREB_000-COUNTRY,

REGION type /BIC/AZDAREB_000-REGION,

PROFIT_CTR type /BIC/AZDAREB_000-PROFIT_CTR,

CO_AREA type /BIC/AZDAREB_000-CO_AREA,

end of tp_itab.

types: begin of typ_tgl.

include type /BIC/AZDBREB_000.

types: end of typ_tgl.

data: itab type table of tp_itab with key ZINTRENO ZYEAR ZINSTYP.

data: zgltab type table of tp_itab with key ZINTRENO ZYEAR

ZINSTYP.

data: wa_itab type tp_itab.

data: wa_zdtg type typ_tgl.

select a/BIC/ZINTRENO a/BIC/ZYEAR a~/BIC/ZINSTYP

a/BIC/ZINSVAL a/BIC/ZBBAUW13 b~ASSDVALUE

bRELOCAT bREGION b~COMP_CODE

bCOUNTRY b/BIC/ZOWNSTAT b~MAINUSAGE

bBLDG_VAL bINSUREVAL bPROFIT_CTR bCO_AREA into

corresponding fields of table itab

from /BIC/AZDBREB_000 as a inner join /BIC/AZDAREB_000 as

b

on a/BIC/ZINTRENO eq b/BIC/ZINTRENO.

<b> <b> loop at itab into wa_itab.

select * from /BIC/AZDBREB_000 into wa_zdtg

where /BIC/ZINTRENO eq wa_itab-ZINTRENO.

if sy-subrc = 0.</b> wa_zdtg-/BIC/ZINTRENO = wa_itab-zintreno.</b>

wa_zdtg-/bic/zyear = wa_itab-zyear.

wa_zdtg-/BIC/ZINSTYP = wa_itab-ZINSTYP.

wa_zdtg-/BIC/ZINSVAL = wa_itab-ZINSVAL.

wa_zdtg-/BIC/ZBBAUW13 = wa_itab-ZBBAUW13.

wa_zdtg-COMP_CODE = wa_itab-COMP_CODE.

wa_zdtg-MAINUSAGE = wa_itab-MAINUSAGE.

wa_zdtg-/BIC/ZOWNSTAT = wa_itab-ZOWNSTAT.

wa_zdtg-ASSDVALUE = wa_itab-ASSDVALUE.

wa_zdtg-INSUREVAL = wa_itab-INSUREVAL.

wa_zdtg-COUNTRY = wa_itab-COUNTRY.

wa_zdtg-REGION = wa_itab-REGION.

wa_zdtg-PROFIT_CTR = wa_itab-PROFIT_CTR.

wa_zdtg-CO_AREA = wa_itab-CO_AREA.

modify /BIC/AZDBREB_000 from wa_zdtg.

endif.

endselect.

endloop.

9 REPLIES 9

Former Member
0 Kudos

loop at itab into wa_itab.

select * from /BIC/AZDBREB_000 into wa_zdtg

where /BIC/ZINTRENO eq wa_itab-ZINTRENO.

if sy-subrc = 0.

wa_zdtg-/BIC/ZINTRENO = wa_itab-zintreno.

wa_zdtg-/bic/zyear = wa_itab-zyear.

wa_zdtg-/BIC/ZINSTYP = wa_itab-ZINSTYP.

wa_zdtg-/BIC/ZINSVAL = wa_itab-ZINSVAL.

wa_zdtg-/BIC/ZBBAUW13 = wa_itab-ZBBAUW13.

wa_zdtg-COMP_CODE = wa_itab-COMP_CODE.

wa_zdtg-MAINUSAGE = wa_itab-MAINUSAGE.

wa_zdtg-/BIC/ZOWNSTAT = wa_itab-ZOWNSTAT.

wa_zdtg-ASSDVALUE = wa_itab-ASSDVALUE.

wa_zdtg-INSUREVAL = wa_itab-INSUREVAL.

wa_zdtg-COUNTRY = wa_itab-COUNTRY.

wa_zdtg-REGION = wa_itab-REGION.

wa_zdtg-PROFIT_CTR = wa_itab-PROFIT_CTR.

wa_zdtg-CO_AREA = wa_itab-CO_AREA.

<b>append</b> /BIC/AZDBREB_000 from wa_zdtg.

endif.

endselect.

endloop.

you have to use append statement instead of modify

0 Kudos

I tried using Append it is throwing the error that no Table defined /BIC/AZDBREB_000. But if I use modify no syntax error. Please try in your system and suggest me the suitable correction in code that works

Thanks

Soniya Kapoor

null

0 Kudos

<b>append wa_zdtg to /BIC/AZDBREB_000 .</b>

can you try this and let me know ..

0 Kudos

I tried putting

append wa_zdtg to /BIC/AZDBREB_000

Error

E:Field "/BIC/AZDBREB_000" is unknown. It is neither in one of the specified tables. Can u please help me revise the code, I think it just somewhere minor mistake.

Thanks

Soniya

0 Kudos

Hello Soniya,

is it table /BIC/AZDBREB_000 ?

if you want to insert the records to table ,then use

modift /BIC/AZDBREB_000 from table int_table.

if you want to insert records to internal table from work area

append wa-area to int_table.

Let me know what do you want do ?

0 Kudos

HI I want to insert the records , What I am Doing is I have data in table /BIC/AZDBREB_000 now I am loading some more data to this table <b> /BIC/AZDBREB_000</b> from <b> /BIC/AZDAREB_000</b> where ever Internal Number ZINTRENO in Table <b> /BIC/AZDBREB_000</b> matches with table /BIC/AZDAREB_000 so that it comes in one line

Please help me modify the code so that it work . Please help

Thanks

Soniya

0 Kudos

Hi Seshu Please help me fix this Code If you want I can Have a Go meeting to show you this Code.

Please help me wil be grateful

Thanks

Soniya Kapoor

0 Kudos

I do not have system right now.

First get the data from /BIC/AZDAREB_000 to internal table with condition ZINTRENO ( Do not write inner join )

now keep the loop /BIC/AZDAREB_000 ( Internal table ).

Now get the data from /BIC/AZDBREB into internal table.

append the data one more internal table.

endloop.

here insert the data

modify /BIC/AZDBREB from table int_table.

0 Kudos

Hi seshu, I am not that good in ABAP, would really apeciate your help if you can modify my code with the logic you gave me. Since my client BMW will have the auditor for this model. would really be helpful. please do it.

Thanks

Sincerely

Soniya Kapoor