‎2008 May 22 5:53 AM
hi all,
i have a problem in my report
where i need to compare ekbe belnr and gjahr with ser03 mblnr and mjahr.
the problem is
in gt_ser03 internal table i have data as
mblnr mjahr obknr
50505545 2007 1
50505545 2007 2
in gt_ekbe table i have data as
belnr gjahr
50505545 2007
while using read statement only obknr field value 1is coming to final internal table i need both 1 and 2 ,
there are no other fields for comarsion.
READ TABLE gt_ser03 WITH KEY mblnr = gt_ekbe-belnr
mjahr = gt_ekbe-gjahr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_ser03-obknr TO gt_final-obknr.
ENDIF.
please help me how to get both valuse
its urgent
‎2008 May 22 5:56 AM
hi,
READ TABLE gt_ser03 WITH KEY mblnr = gt_ekbe-belnr
mjahr = gt_ekbe-gjahr
BINARY SEARCH.
IF sy-subrc = 0.
loop at gt_ser03.
MOVE gt_ser03-obknr TO gt_final-obknr.
modify gt_final.
endloop.
ENDIF.
rewar if useful
Edited by: Anshuman Singh on May 22, 2008 6:57 AM
‎2008 May 22 6:00 AM
Hi Sri latha,
use loop inside the loop statement.
use parallel cursor method for better performance.
please check this link
http://www.saptechnical.com/Tutorials/ABAP/ParallelCursor.htm
Best regards,
raam
‎2008 May 22 6:03 AM
it is already in loop.
loop inside loop will cause performance issue.
it is coming inside the loop second time but it is picking same value 1 only instead of 2.
‎2008 May 22 6:10 AM
Hi,
Then use a counter. Check the two consecutive records. if MBLNR is same then increase the counter and fetch the next record.
Best regards,
raam
‎2008 May 22 6:19 AM
Hi,
Your code will work fine . Only thing I need to clear from you is,
Can you tell me your final internal table structure?
Are you appending new value to final internal table? If so then use APPEND statement.
If you modifying the exist value in final internal table then use MODIFY statement.
Regards,
Raghu
‎2008 May 22 6:28 AM
Hi friend,
while reading it will take single line in header line
u have 2 mblnr same value so do line this..
add zEILE - (item in materail docu) in gt_ser03 itab
and buzei - (item in mat docu) in gt_ekbe itab..
read like this
READ TABLE gt_ser03 WITH KEY mblnr = gt_ekbe-belnr
mjahr = gt_ekbe-gjahr zeile = gt_ekbe-buzei.
BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_ser03-obknr TO gt_final-obknr.
ENDIF.
reward points if usefull.
‎2008 May 22 7:07 AM
Hi,
gt_ser03-obknr TO gt_final-obknr.
READ TABLE gt_ser03 WITH KEY mblnr = gt_ekbe-belnr
mjahr = gt_ekbe-gjahr
BINARY SEARCH.
IF sy-subrc = 0.
you are using READ TABLE statement, it retrieves only the first matched row even though u repeat that statement 1000times. so do like this
LOOP AT GT_SER03.
READ TABLE GT_SER03 WITH KEY MBLNR=GT_EKBE-BELNR MJAHR = GT_EKBE-GJAHR INDEX SY-INDEX .
IF SY-SUBRC = 0.
DO WAT EVER U WANT TO DO
ENDIF.
ENDLOOP.
JUST THIS IS A PROCEDURE I NEVER MIND ABOUT SYNTAXES TRY THIS IT DEFENITELY WORKS
‎2008 May 22 7:07 AM
Hi,
you are using READ TABLE statement, it retrieves only the first matched row even though u repeat that statement 1000times. so do like this
LOOP AT GT_SER03.
READ TABLE GT_SER03 WITH KEY MBLNR=GT_EKBE-BELNR MJAHR = GT_EKBE-GJAHR INDEX SY-INDEX .
IF SY-SUBRC = 0.
DO WAT EVER U WANT TO DO
ENDIF.
ENDLOOP.
JUST THIS IS A PROCEDURE I NEVER MIND ABOUT SYNTAXES TRY THIS IT DEFENITELY WORKS