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

not getting data into 3rd int table

Former Member
0 Likes
572

Hi all,

here i ve data in 2 internal tables. this data i want store into 3rd internal table, here am adding with inner join but am not getting data into 3rd one.

plz check my logic.

REPORT ZEXCHANGE_RETES .

TABLES : tcurr, " Exchange Rates

/msg/rabr. " Account (Posting Headers)

DATA : l_date type datum.

TYPES : begin of t_tcurr,

kurst like tcurr-kurst, " Exchange Rate type

fcurr like tcurr-fcurr, " From Currrency

gdatu like tcurr-gdatu, " Date as of which

end of t_tcurr.

TYPES : begin of t_rabr,

OW_WHGNR like /msg/rabr-OW_WHGNR,

bil_dat like /msg/rabr-bil_dat,

abrnr like /msg/rabr-abrnr,

end of t_rabr.

TYPES : begin of t_output,

kurst like tcurr-kurst,

fcurr like tcurr-fcurr,

gdatu like tcurr-gdatu,

OW_WHGNR like /msg/rabr-OW_WHGNR,

bil_dat like /msg/rabr-bil_dat,

abrnr like /msg/rabr-abrnr,

end of t_output.

DATA : it_output TYPE STANDARD TABLE OF t_output WITH HEADER LINE,

wa_output TYPE t_output.

DATA : it_rabr TYPE STANDARD TABLE OF t_rabr WITH HEADER LINE,

wa_rabr TYPE t_rabr.

DATA : it_tcurr TYPE STANDARD TABLE OF t_tcurr WITH HEADER LINE,

wa_tcurr TYPE t_tcurr.

  • getting data into 1st itab

SELECT kurst fcurr gdatu

from tcurr into table it_tcurr

where kurst EQ 'M'.

SORT it_tcurr by fcurr GDATU DESCENDING.

delete adjacent duplicates from it_tcurr comparing fcurr.

  • getting data into 2nd itab

SELECT * FROM /msg/rabr into CORRESPONDING FIELDS OF TABLE it_rabr.

SORT it_rabr BY OW_WHGNR bil_dat abrnr.

  • getting data into 3rd itab

SELECT t~kurst

t~fcurr

t~gdatu

r~OW_WHGNR

r~bil_dat

r~abrnr

FROM tcurr as t INNER JOIN

/msg/rabr as r on tfcurr EQ rOW_WHGNR into table it_output

WHERE rabrnr BETWEEN '00000000000000800251' AND '00000000000000800300' AND rbil_dat < wa_tcurr-gdatu.

  • printing output

LOOP at it_output into wa_output.

WRITE: /10 wa_output-kurst,

15 wa_output-fcurr,

25 wa_output-gdatu,

50 wa_output-OW_WHGNR,

60 wa_output-bil_dat,

80 wa_output-abrnr.

ENDLOOP.

here am not getting data into 3rd i tab.

Thanks & Regards,

sudharsan.

4 REPLIES 4
Read only

0 Likes
547

AND r~bil_dat < wa_tcurr-gdatu

I couldn't find the place where you fill WA_TCURR. It would mean that wa_tcurr-gdatu is 'initial' therefore the condition is never reached.

Hope this helps.

Read only

Former Member
0 Likes
547

Hi,

The select command is the most fundamental function of writing ABAP programs allowing the retrieval of data from SAP database tables.

Try filling the 3rd internal table with Loop ... Endloop.

Loop at t_tcurr.

Read table t_rabr with key field1 = t_tcurr-field1.

If sy-subrc = 0.

Move t_tcurr-field1 = itab_final-field1.

Move t_tcurr-field2 = itab_final-field2.

Move t_rabr -field3 = itab_final-field3.

Move t_rabr -field4 = itab_final-field4.

Append itab_final.

Endloop.

Hope this helps you.

Regards,

Ruthra

Read only

0 Likes
547

Hi Ruthra,

Thsnks for ue replsy. we can move data to 3rd table as u told.

but there is no con check, i want to check the condition for Bil_dat and abrnr fields.

Regards,

sudharsan.

Read only

Former Member
0 Likes
547

Hi,

If you want to apply some condition, then check the condition before you move the field values from t_rabr to final table within the loop..endloop.

Regards,

Ruthra