We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-dev] How to Read Data from MSEG and EKPO Tables

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from P_Applestone on Sep 14 at 11:56 AM
Hi Sreekar,

1) Based on this code snippet, you'll need to use LOOP AT lt_ekpo INTO wa_ekpo WHERE EBELN = lw_mseg_ebeln etc. READ TABLE is only designed to return 1 record into the work area.
2) Also try using MOVE-CORRESPONDING lw_mseg TO wa_mseg instead of the cumbersome MOVE statement at the beginning.
3) For best practice, stick with one naming convention for work area - lw or wa, not both.

Peter

---------------Original Message---------------
From: SREEKAR REDDY ALLURU
Sent: Friday, September 14, 2012 11:21 AM
Subject: How to Read Data from MSEG and EKPO Tables

Hi sir/mam,

I'm trying to get Txz01 and Bednr data from ekpo using the key fields Mseg-ebeln, Mseg-lgort and Mseg-werks as there are same PO No., werks and lgort in ekpo as in Mseg so that i could read only the first record at each time it loops. let me show example of my code:

LOOP AT LT_MSEG INTO LW_MSEG.
MOVE : LW_MSEG-MBLNR TO WA_MSEG-MBLNR, LW_MSEG-MJAHR TO WA_MSEG-MJAHR, LW_MSEG-ZEILE TO WA_MSEG-ZEILE,
LW_MSEG-MATNR TO WA_MSEG-MATNR, LW_MSEG-WERKS TO WA_MSEG-WERKS, LW_MSEG-LGORT TO WA_MSEG-LGORT,
LW_MSEG-LIFNR TO WA_MSEG-LIFNR, LW_MSEG-MENGE TO WA_MSEG-MENGE, LW_MSEG-MEINS TO WA_MSEG-MEINS,
LW_MSEG-EBELN TO WA_MSEG-EBELN.
READ TABLE LT_EKPO INTO LW_EKPO WITH KEY EBELN = LW_MSEG-EBELN LGORT = LW_MSEG-LGORT WERKS = LW_MSEG-WERKS .
IF SY-SUBRC EQ 0.
IF lw_ekpo-matnr = v_matnr.
* i really not getting any idea of how to read the very next line of lt_ekpo.
else.
MOVE : LW_EKPO-BEDNR TO WA_MSEG-BEDNR, LW_EKPO-TXZ01 TO WA_MSEG-TXZ01.
ENDIF.
ENDIF.
APPEND WA_MSEG TO IT_MSEG.
ENDLOOP.

Please guide me, how to read the other 3 records in lt_ekpo

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
P_Applestone  

achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Become a blogger at Toolbox.com and share your expertise with the community. Start today.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language