‎2005 Jun 06 8:13 PM
hi folks,
I need your help here. the data is not being displayed.
The code is syntacially correct.
The code goes like this.
data: bdata type standard table of structbdata with header line,
ddata type standard table of dunningdata with header line,
wa type structbdata,
accitab type standard table of zzaccountdata with header line,
wa1 type zzaccountdata,
zdate(8) type c,
zdate1(8) type c,
zproductdate(12) type c,
zadnumber(10) type c,
zwidth(7) type c,
zheight(7) type c,
zadsize(16) type c.
select kunnr fbuda vavtyp aubel breite_s HOEHE_S from zzjhtfp INNER JOIN
jhamot ON zzjhtfpaubel = jhamotavm_nr INTO CORRESPONDING FIELDS OF
table BDATA WHERE zzjhtfp~kunnr = p_custid.
The records are stored in Bdata but there is no record in the header line.
if sy-subrc eq 0.
select kunnr wrshb from mhnd into table ddata for all entries in bdata
where kunnr = bdata-kunnr.
The records are stored in ddata but there is no record in the header line.
endif.
if sy-subrc = 0.
loop at bdata into wa.
read table ddata
with key kunnr = bdata-kunnr.
if sy-subrc eq 0.
bdata-wrshb = ddata-wrshb.
modify bdata transporting wrshb where kunnr = ddata-kunnr.
write:bdata-fbuda to zdate ddmmyy.
write: zdate to zdate1 dd/mm/yy.
write: wa-aubel to zadnumber.
write: wa-breite_s to zwidth.
write: wa-HOEHE_S to zheight.
write:wa-vavtyp.
concatenate zdate1 wa-vavtyp into wa1-zdateproductcode separated
*by space.
concatenate zwidth zheight into wa1-zadsize separated by space.
*
insert wa1-zdateproductcode into accitab-zdateproductcode.
accitab-zdateproductcode = wa1-zdateproductcode.
accitab-zadnumber = wa-aubel.
accitab-zadsize = wa1-zadsize.
if sy-subrc = 0.
append accitab.
*
write:/20 accitab-zdateproductcode, 40 accitab-zadnumber,
*60 accitab-zadsize.
*
endif.
endif.
endloop.
endif.
‎2005 Jun 06 8:18 PM
Look at the following code....
loop at bdata into wa.
read table ddata with key kunnr = bdata-kunnr.
...
You are looping bdata and putting the data in that line into wa. So then your next statment will always fail. You need to have the read statement like this.
read table ddata
with key kunnr = wa-kunnr.
After this read statement, change all the references to BDATA to WA.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
‎2005 Jun 06 9:15 PM
thank you Rich, I had a small problem. When I am modifying the data for wrshb and transporting data into bdata the set values for wrshb stored in the ddata is not getting appended to the bdata and inturn to workarea 'wa'.
It is reading the first line data and displaying the same value for all the records.
can you help me out here?
I have awarded the points it definitely helped.
thanks
santhosh
‎2005 Jun 06 9:23 PM
‎2005 Jun 06 9:42 PM
actually the code goes like this.
what I am trying to do is the 'wrshb' is the data that needs to be populated into one of the fields i.e wa-wrshb. it is taking the first value and as it is looping into the internal table, the same value is read again and again but actually the internal table ddata has different set of values for this field.
my goal is to read this different set of data into wa-wrshb and in turn to accitab (internal table) that is where the final output comes.
i hope you got my problem here.
thanks
santhosh
if sy-subrc = 0.
loop at bdata into wa.
read table ddata
with key kunnr = wa-kunnr.
if sy-subrc eq 0.
wa-wrshb = ddata-wrshb.
modify bdata transporting wrshb where kunnr = ddata-kunnr.
append bdata.
write:wa-fbuda to zdate ddmmyy.
write: zdate to zdate1 dd/mm/yy.
write: wa-aubel to zadnumber.
write: wa-breite_s to zwidth.
write: wa-HOEHE_S to zheight.
write:wa-vavtyp.
write: wa-wrshb.
concatenate zdate1 wa-vavtyp into wa1-zdateproductcode separated
by space.
concatenate zwidth zheight into wa1-zadsize separated by space.
insert wa1-zdateproductcode into accitab-zdateproductcode.
accitab-zdateproductcode = wa1-zdateproductcode.
accitab-zadnumber = wa-aubel.
accitab-zadsize = wa1-zadsize.
accitab-zamount = wa-wrshb.
if sy-subrc = 0.
append accitab.
‎2005 Jun 07 6:43 AM
check out the codes which are in bold .
if sy-subrc = 0.
loop at bdata into wa.
read table ddata
with key kunnr = wa-kunnr.
if sy-subrc eq 0. <b>(if sy-subrc ne 0 then also clear wa_wrshb)</b><b>clear wa-wrshb .</b>
wa-wrshb = ddata-wrshb.
modify bdata transporting wrshb where kunnr = ddata-kunnr.
append bdata.
write:wa-fbuda to zdate ddmmyy.
write: zdate to zdate1 dd/mm/yy.
write: wa-aubel to zadnumber.
write: wa-breite_s to zwidth.
write: wa-HOEHE_S to zheight.
write:wa-vavtyp.
write: wa-wrshb.
concatenate zdate1 wa-vavtyp into wa1-zdateproductcode separated
by space.
concatenate zwidth zheight into wa1-zadsize separated by space.
insert wa1-zdateproductcode into accitab-zdateproductcode.
accitab-zdateproductcode = wa1-zdateproductcode.
accitab-zadnumber = wa-aubel.
accitab-zadsize = wa1-zadsize.
accitab-zamount = wa-wrshb.
if sy-subrc = 0.
append accitab.
<b>clear wa .</b>
endloop .
Regards
Raja
‎2005 Jun 07 4:19 PM
I tried that raja and none of the records are displaying. I hope you understand my problem here.
let me explain in detail.
I need help to modify the internal table. the code goes like this.
if sy-subrc = 0.
loop at bdata into wa.
bdata is the first internal table
read table ddata
with key kunnr = wa-kunnr.
ddata is the second internal table the field wrshb has alot of records which i need to populate in a particluar field of bdata
if sy-subrc eq 0.
wa-wrshb = ddata-wrshb.
I have modify the bdata internal table to populate field wrshb in bdata
modify bdata from wa transporting wrshb where kunnr = ddata-kunnr.
what's happening is. It is fetching the first record from ddata and populating the field into bdata and also the workarea ,in the loop after that it fetching the same data again populating the field in the table bdata. For the entire set of records it is fetching the first value.
I thought of using index in the modify .... transport statement but i do not have an idea.
How to go about that.
thanks in raja
santhosh
santhosh
‎2005 Jun 08 6:27 AM
So what you are saying is that for every BDDATA record there is a equivalent record in DDDATA and from there you want to pick up <b>wrshb</b> and move it to BDDATA.
then the read stt has to use the rigth key combination obtained from BDDATA - with your current approach the read stt. will always pick up the firts matching record for KUNNR.
Hope this is clear.
Regards
Raja