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

please help me

Former Member
0 Likes
740

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

8 REPLIES 8
Read only

Former Member
0 Likes
721

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

Read only

Former Member
0 Likes
721

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

Read only

0 Likes
721

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.

Read only

0 Likes
721

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

Read only

0 Likes
721

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

Read only

Former Member
0 Likes
721

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.

Read only

Former Member
0 Likes
721

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

Read only

Former Member
0 Likes
721

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