05-10-2010 7:53 AM
Dear Abapers,
I am doing a report where I need to create a dynamic internal, I am not much familiar with Oops so please advice.
My Requirement is:
In my selection screen I have.. bukrs , mtart and spmon( month & year )
First I need to select and display all materials from mara for a particular material type.
LOOP AT MONTH.
SELECT MATNR
MTART FROM MARA
INTO CORRESPONDING FIELDS OF S_MARA
WHERE MTART IN ('FERT','HALB','ROH','HIBE').
S_MARA-MONTH = MONTH-MONT.
APPEND S_MARA TO I_MARA.
ENDSELECT.
ENDLOOP.
If the user enters 01.2010 to 05.2010 in selection-screen.
My o/p header should be:
'Material Number' 'Jan 2010' 'Feb 2010' 'Mar 2010' 'Apr 2010' 'May 2010'
and corresponding Values of each month I need to fetch from different table.
Please advice
Edited by: Karthik R on May 10, 2010 12:23 PM
Edited by: Karthik R on May 10, 2010 12:25 PM
05-10-2010 8:34 AM
Hi Karthik,
You can refer to my article in the below link on how to create a dynamic structure and dynamic internal table.
http://www.divulgesap.com/blog.php?p=MTI4
The example contains code sample for building a dynamic internal table for display with dynamic weeks.
Hope it helps.
Regards,
Ravikiran
05-10-2010 8:34 AM
Hi Karthik,
You can refer to my article in the below link on how to create a dynamic structure and dynamic internal table.
http://www.divulgesap.com/blog.php?p=MTI4
The example contains code sample for building a dynamic internal table for display with dynamic weeks.
Hope it helps.
Regards,
Ravikiran
05-13-2010 7:37 AM
Dear Ravikiran C ,
Thank U !!
Can U please advice how to do the same using write statement.
05-10-2010 9:06 AM
Hi,
For the display in ALV output format ,* creating an instance of ALV.
TRY.
CALL METHOD cl_salv_table=>factory
you will surely get the expected result in the desired format.
Thanks
Rohini.
05-13-2010 7:45 AM
First of all dynamic internal table has got nothing to do with OOPs.
Yes, if you want to use the RTTS classes thats OO. But i don't understand why do you fear OO ? Trust me it doesn't bite 😄
Anyways to answer your question, to read the contents of a dynamic internal table you need to use ASSIGN COMPONENT command. Further details on SDN & SAP help.
BR,
Suhas