‎2010 Feb 03 7:37 AM
I have the code as below:
SELECT MATNR
FROM MARA
INTO TABLE IT_MARA
WHERE MTART = 'FERT'.
LOOP AT IT_MARA INTO WA_MARA.
SELECT MAKTX matnr FROM MAKT INTO TABLE IT_MAKT
WHERE MATNR = WA_MARA-MATNR.
LOOP AT IT_MAKT INTO WA_MAKT.
APPEND WA_MAKT to IT_MAKT.
ENDLOOP.
ENDLOOP.
when i run this code i get the following error "No more storage space available for extending an internal table".
please suggest how can i optimise the code.
‎2010 Feb 03 7:39 AM
‎2010 Feb 03 7:39 AM
‎2010 Feb 03 7:41 AM
>
> hi
> LOOP AT IT_MARA INTO WA_MARA.
> SELECT MAKTX matnr FROM MAKT INTO TABLE IT_MAKT
> WHERE MATNR = WA_MARA-MATNR.
>
> use into corresponding field of the table it_makt after checking your table defination for table it_makt
>
> thanx
> gaurav
And this would "optimize the code"?
pk
‎2010 Feb 03 7:42 AM
‎2010 Feb 03 7:53 AM
Hi Ashu ,
You should take some tutorial related with basics and performance tuning.
There are many posts avaliable on SDN related to these.
Press F1 on for all entries to know an alternate approach for your logic.
Hope this helps you.
‎2010 Feb 03 7:56 AM
Hi,
Please check
SELECT MATNR
FROM MARA
INTO TABLE IT_MARA
WHERE MTART = 'FERT'.
if sy-subrc eq 0 and it_mara is not initial.
SELECT MAKTX matnr FROM MAKT FOR ALL ENTRIES IN IT_MARA INTO TABLE IT_MAKT
WHERE MATNR = IT_MARA-MATNR.
endif.what this loop statement is doing.
LOOP AT IT_MAKT INTO WA_MAKT.
APPEND WA_MAKT to IT_MAKT.
ENDLOOP.
Is that you need to populate the internal table with a material and its corresponding material descriptions. ?
thanks,
‎2010 Feb 03 8:06 AM
‎2010 Feb 03 8:10 AM
‎2010 Feb 03 8:12 AM
‎2010 Feb 03 8:18 AM
Hello Raymond,
I had got it the first time you had mentioned
Cheers,
Suhas
‎2010 Feb 03 8:36 AM
Hi,
For Optimising,
1st) Instead of first loop use Select For All Enteries (query)
2nd) Avoid calling select queries from inside of a loop, its not a good pratice.
3rd) regarding the dump error, contact your BASIS for memory settings of SAP.
Thanks!