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

alv report

Former Member
0 Likes
516

hi ,

i m facing the problem in looping, well when i m transfering the data into final table be4 that one if condition is there, means my 4 fields contents should not be same.

but the problem is i m not getting the required putput because i m using only one loop on first table and comparing data is coming from another table, so what should do for best result.

form read_data.

clear T_J_3GBELP.

refresh T_J_3GBELP.

select equnr J_3GEMPFAE into

corresponding fields of table

T_J_3GBELP

from J_3GBELP

where J_3GEMPFAE in Reciver.

if sy-subrc <> 0.

message 'No data found' type 'I'.

g_exit = c_x.

stop.

endif.

sort T_J_3GBELP by equnr J_3GEMPFAE.

if not T_J_3GBELP[] is initial.

clear T_EQKT.

refresh T_EQKT.

select EQUNR EQKTX into corresponding fields of table T_EQKT

from EQKT for all entries in T_J_3GBELP

where equnr = T_J_3GBELP-equnr.

endif.

if not T_J_3GBELP[] is initial.

CLEAR T_ITOB.

REFRESH T_ITOB.

select EQUNR SWERK IWERK GSBER into corresponding fields of table T_ITOB

from ITOB for all entries in T_EQKT

where EQUNR = T_EQKT-EQUNR.

endif.

  • Move the data to Final Output Internal Table

loop at T_J_3GBELP.

IF T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-SWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-IWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-GSBER.

T_final-EQUNR = T_J_3GBELP-EQUNR. " EQUIPMENT LOG

T_final-J_3GEMPFAE = T_J_3GBELP-J_3GEMPFAE.

  • Read the FUEL ISSUED QUANTITY from T_ZPM_BPO Internal Table

read table T_EQKT with key EQUNR = T_J_3GBELP-EQUNR binary search.

if sy-subrc = 0.

T_FINAL-EQKTX = T_EQKT-EQKTX.

ENDIF.

read table T_ITOB with key EQUNR = T_eqkt-EQUNR binary search.

if sy-subrc = 0.

T_FINAL-SWERK = T_ITOB-SWERK.

T_FINAL-IWERK = T_ITOB-IWERK.

T_FINAL-GSBER = T_ITOB-GSBER.

ENDIF.

endif.

append t_final.

clear t_final.

ENDLOOP.

DELETE T_FINAL WHERE EQUNR = '' .

endform. "Read Data

thanks and regards

vj

rewards will be sure for each helpfull answer

hi ,

i m facing the problem in looping, well when i m transfering the data into final table be4 that one if condition is there, means my 4 fields contents should not be same.

but the problem is i m not getting the required putput because i m using only one loop on first table and comparing data is coming from another table, so what should do for best result.

form read_data.

clear T_J_3GBELP.

refresh T_J_3GBELP.

select equnr J_3GEMPFAE into

corresponding fields of table

T_J_3GBELP

from J_3GBELP

where J_3GEMPFAE in Reciver.

if sy-subrc <> 0.

message 'No data found' type 'I'.

g_exit = c_x.

stop.

endif.

sort T_J_3GBELP by equnr J_3GEMPFAE.

if not T_J_3GBELP[] is initial.

clear T_EQKT.

refresh T_EQKT.

select EQUNR EQKTX into corresponding fields of table T_EQKT

from EQKT for all entries in T_J_3GBELP

where equnr = T_J_3GBELP-equnr.

endif.

if not T_J_3GBELP[] is initial.

CLEAR T_ITOB.

REFRESH T_ITOB.

select EQUNR SWERK IWERK GSBER into corresponding fields of table T_ITOB

from ITOB for all entries in T_EQKT

where EQUNR = T_EQKT-EQUNR.

endif.

  • Move the data to Final Output Internal Table

loop at T_J_3GBELP.

IF T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-SWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-IWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-GSBER.

T_final-EQUNR = T_J_3GBELP-EQUNR. " EQUIPMENT LOG

T_final-J_3GEMPFAE = T_J_3GBELP-J_3GEMPFAE.

  • Read the FUEL ISSUED QUANTITY from T_ZPM_BPO Internal Table

read table T_EQKT with key EQUNR = T_J_3GBELP-EQUNR binary search.

if sy-subrc = 0.

T_FINAL-EQKTX = T_EQKT-EQKTX.

ENDIF.

read table T_ITOB with key EQUNR = T_eqkt-EQUNR binary search.

if sy-subrc = 0.

T_FINAL-SWERK = T_ITOB-SWERK.

T_FINAL-IWERK = T_ITOB-IWERK.

T_FINAL-GSBER = T_ITOB-GSBER.

ENDIF.

endif.

append t_final.

clear t_final.

ENDLOOP.

DELETE T_FINAL WHERE EQUNR = '' .

endform. "Read Data

thanks and regards

vj

rewards will be sure for each helpfull answer

3 REPLIES 3
Read only

Former Member
0 Likes
490

Hi Vijay,

as you are comaring for the second internal table... i.e.T_ITOB

and there would be no data in it;s header... so your condition is going false there...

Please read that internal table...

loop at T_J_3GBELP.

<b>read table T_ITOB</b> ......... binary search.

IF T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-SWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-IWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-GSBER.

Do it every time when you are using the contents froim other internal table for comparing...

Hope it helps.

Regards,

Jayant

Read only

Former Member
0 Likes
490

Hello,

I wud like to know abt the alv rep which ur working.

Can u mail back to me at [email protected].

regards

Rohini

Read only

Former Member
0 Likes
490

You forgot to do a READ on ITOB. So thats why the condition might be creating problems -

loop at T_J_3GBELP.

  • Read ITOB

<b>READ TABLE T_ITOB WITH EQUNR = T_J_3GBELP-EQUNR.

CHECK SY-SUBRC EQ 0.</b>

IF T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-SWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-IWERK

or T_J_3GBELP-J_3GEMPFAE+1(4) NE T_ITOB-GSBER.

Hope it helps.

SKC.