2011 Jun 27 11:53 AM
READ TABLE .......... INTO ............ is not executing in one of my programs.
LOOP AT i_bseg INTO struct_bseg.
READ TABLE I_BKPF INTO STRUCT_BKPF WITH KEY
BUKRS = STRUCT_BSEG-BUKRS
BELNR = STRUCT_BSEG-BELNR
GJAHR = STRUCT_BSEG-GJAHR.
IF SY-SUBRC = 0.
STRUCT_BKPF_BSEG-LIFNR = STRUCT_BSEG-LIFNR.
STRUCT_BKPF_BSEG-MENGE = STRUCT_BSEG-MENGE.
STRUCT_BKPF_BSEG-MEINS = STRUCT_BSEG-MEINS.
STRUCT_BKPF_BSEG-DMBTR = STRUCT_BSEG-DMBTR.
STRUCT_BKPF_BSEG-MATNR = STRUCT_BSEG-MATNR.
STRUCT_BKPF_BSEG-EBELN = STRUCT_BSEG-EBELN.
STRUCT_BKPF_BSEG-BUKRS = STRUCT_BKPF-BUKRS.
STRUCT_BKPF_BSEG-BELNR = STRUCT_BKPF-BELNR.
STRUCT_BKPF_BSEG-BUDAT = STRUCT_BKPF-BUDAT.
STRUCT_BKPF_BSEG-XBLNR = STRUCT_BKPF-XBLNR.
STRUCT_BKPF_BSEG-WAERS = STRUCT_BKPF-WAERS.
APPEND STRUCT_BKPF_BSEG TO I_BKPF_BSEG.
ENDLOOP.
but the same statement is working fine in some other program. What may be the reason?
READ TABLE .......... INTO ............ is not executing in one of my programs.
LOOP AT i_bseg INTO struct_bseg.
READ TABLE I_BKPF INTO STRUCT_BKPF WITH KEY
BUKRS = STRUCT_BSEG-BUKRS
BELNR = STRUCT_BSEG-BELNR
GJAHR = STRUCT_BSEG-GJAHR.
IF SY-SUBRC = 0.
STRUCT_BKPF_BSEG-LIFNR = STRUCT_BSEG-LIFNR.
STRUCT_BKPF_BSEG-MENGE = STRUCT_BSEG-MENGE.
STRUCT_BKPF_BSEG-MEINS = STRUCT_BSEG-MEINS.
STRUCT_BKPF_BSEG-DMBTR = STRUCT_BSEG-DMBTR.
STRUCT_BKPF_BSEG-MATNR = STRUCT_BSEG-MATNR.
STRUCT_BKPF_BSEG-EBELN = STRUCT_BSEG-EBELN.
STRUCT_BKPF_BSEG-BUKRS = STRUCT_BKPF-BUKRS.
STRUCT_BKPF_BSEG-BELNR = STRUCT_BKPF-BELNR.
STRUCT_BKPF_BSEG-BUDAT = STRUCT_BKPF-BUDAT.
STRUCT_BKPF_BSEG-XBLNR = STRUCT_BKPF-XBLNR.
STRUCT_BKPF_BSEG-WAERS = STRUCT_BKPF-WAERS.
APPEND STRUCT_BKPF_BSEG TO I_BKPF_BSEG.
ENDLOOP.
but the same statement is working fine in some other program. What may be the reason?
2011 Jun 27 11:57 AM
Hi,
are you getting sy-subrc 4?
if yes, check
1) if the I_BKPF & STRUCT_BKPF have same structures.
2)I_bkpf is not initial.
3)STRUCT_bseg has same values as in struct_bkpf.
What error are you getting?
2011 Jun 27 12:07 PM
hi,
use below code
LOOP AT i_bseg INTO struct_bseg.
READ TABLE I_BKPF WITH KEY BUKRS = STRUCT_BSEG-BUKRS
BELNR = STRUCT_BSEG-BELNR
GJAHR = STRUCT_BSEG-GJAHR.
IF SY-SUBRC = 0.
STRUCT_BKPF_BSEG-LIFNR = STRUCT_BSEG-LIFNR.
STRUCT_BKPF_BSEG-MENGE = STRUCT_BSEG-MENGE.
STRUCT_BKPF_BSEG-MEINS = STRUCT_BSEG-MEINS.
STRUCT_BKPF_BSEG-DMBTR = STRUCT_BSEG-DMBTR.
STRUCT_BKPF_BSEG-MATNR = STRUCT_BSEG-MATNR.
STRUCT_BKPF_BSEG-EBELN = STRUCT_BSEG-EBELN.
STRUCT_BKPF_BSEG-BUKRS = I_BKPF-BUKRS.
STRUCT_BKPF_BSEG-BELNR = I_BKPF-BELNR.
STRUCT_BKPF_BSEG-BUDAT = I_BKPF-BUDAT.
STRUCT_BKPF_BSEG-XBLNR = I_BKPF-XBLNR.
STRUCT_BKPF_BSEG-WAERS = I_BKPF-WAERS.
APPEND STRUCT_BKPF_BSEG TO I_BKPF_BSEG.
ENDLOOP.REGARDS
dEEPAK.
2011 Jun 27 1:03 PM
Your code is syntactically incorrect - you don't close the IF clause with an ENDIF. The only other reasons that you'd not get anything read are
1. You have nothing in I_BKPF which matches STRUCT_BSEG-BUKRS/BELNR/GJAHR
2. There's nothing in I_BSEG.
Statements in ABAP don't just "not work". They do exactly what they're supposed to do. Have you debugged your code to check the contents of I_BKPF and I_BSEG?
2011 Jun 27 1:13 PM
hi..
First check the internal table "i_bseg" and "i_bkpf" has values.
If both have values, check whether the values in both are same..that you can find it with the SY-SUBRC value..if sy-subrc = 0. the it should read the value definitely..
2011 Jun 27 1:46 PM
Hi,
Please include the SORT I_BKPF statement before the the LOOP.
SORT I_BKPF BY BUKRS
BELNR
GJAHR.
Please try to implement this logic and let me know in case of any.
Regards,
SRinivas
2011 Jun 27 3:25 PM
1.ENDIF Statement is missing IF sy-subrc = 0. within the LOOP AT., ENDLOOp.
2.Checks the INTO strcture(STRUCT_BKPF) with I_BKPF.
Pls, Let me know if its right or wrong
2011 Jun 29 1:57 PM
Check the values in the internal table I_BKPF and see if it matches with the read criteria.
2011 Jul 05 10:15 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |