2009 May 08 1:46 PM
Hi All,
My program is giving the dump i.e. DO_WHILE_VARY_NOT_IN_RANGE .Please tell me any alternative for the below peace of code.
DATA: BEGIN OF S_FA0102,
FA01 LIKE DNTAB-FIELDNAME,
FA02 LIKE DNTAB-FIELDNAME,
END OF S_FA0102.
DATA: faxx like f01.
describe table relev lines linecount.
do linecount times varying faxx from S_FA0102-FA01 next S_FA0102-FA02 RANGE S_FA0102.
Does anyone has any idea how to avoid this error in ECC 6.0?
Hi All,
My program is giving the dump i.e. DO_WHILE_VARY_NOT_IN_RANGE .Please tell me any alternative for the below peace of code.
DATA: BEGIN OF S_FA0102,
FA01 LIKE DNTAB-FIELDNAME,
FA02 LIKE DNTAB-FIELDNAME,
END OF S_FA0102.
DATA: faxx like f01.
describe table relev lines linecount.
do linecount times varying faxx from S_FA0102-FA01 next S_FA0102-FA02 RANGE S_FA0102.
Does anyone has any idea how to avoid this error in ECC 6.0?
2009 May 08 2:03 PM
Hi Amruta,
You have to exit from the do loop when all data frm the internal table is read or when ur condition is satisfied.... RANGE addition ensures that the system accesses data within that range.. but you've to explicitly provide the exit from the loop.. even with the RANGE addition.
Check the below example:
DATA : BEGIN OF g_s_vbak_vbap,
field1 TYPE c VALUE 'A',
field2 TYPE c VALUE 'B',
field3 TYPE c VALUE 'C',
field4 TYPE c VALUE 'D',
field5 TYPE c VALUE 'F',
END OF g_s_vbak_vbap,
char1 TYPE c.
START-OF-SELECTION.
DO VARYING char1 FROM g_s_vbak_vbap-field1 NEXT g_s_vbak_vbap-field3
RANGE g_s_vbak_vbap.
WRITE char1.
IF sy-index = 3.
EXIT.
ENDIF.
ENDDO.
It exits the do loop when the condition (sy-index = 3) is met.
Regards,
Soumya.
2009 May 09 4:33 AM
Hi,
Actually i want to execute this program in ECC 6.0 and in ECC 6.0 VARYING is obsolete.Please find the below piece of code which is not working in ECC 6.0:
do linecount times varying faxx from S_FA0102-FA01 next S_FA0102-FA02 RANGE S_FA0102.
if sy-index > 20.
exit. " restliche werden missachtet
endif.
read table relev with key objtya = 'X'.
if sy-subrc eq 0.
move: relev-field to faxx.
delete relev index sy-tabix.
else.
exit.
endif.
enddo.
2009 May 09 5:51 AM
Hi,
The above code is working in ECC 6.0. I have checked it.
There may be problem in your code!
Please provide you full code!
Thanks and Best Regards,
Suresh
2009 May 09 6:40 AM
HI,
DATA: BEGIN OF S_FA0102,
FA01 LIKE DNTAB-FIELDNAME,
FA02 LIKE DNTAB-FIELDNAME,
END OF S_FA0102.
DO linecount TIMES VARYING faxx FROM s_fa0102-fa01 NEXT s_fa0102-fa02 RANGE s_fa0102.
The linecount in the DO statement should contain value 2 or less than 2. Because there are two field FA01 & FA02 ..so depending on the no. of fields you want to read in the row that would be your loop count.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |