2007 Nov 09 6:52 AM
Hi gurus,
I would just like to ask for your ideas on how can I output in ALV the multiple entries in your select-options. Here's the scenario, I have a select-option which is unit of measurement and it can have a multiple entries. The requirement is that I should output in ALV the conversion based on how many are the entries. If there are two entries, I should have 2 conversion and both of them should be in ALV.
I hope you can help me gurus.thanks in advance.
regards,
gizelle
2007 Nov 09 7:10 AM
Just to make it clear: when you enter km and miles in your select-option, you would like to have two columns in your alv showing a distance in km and in miles? And if you select additionally lightyears to your options, you would like to have three columns showng the distance in three units?
2007 Nov 09 7:33 AM
Hi rainer,
Yes your correct. That's how my output should be.
Do you have any ideas on how can I make it?
Thanks in advance.
2007 Nov 09 8:05 AM
Yes, you have to build your fieldcatalog dynamically, the select options are nothing else but a table of type ranges, so just loop over the table like this:
loop at s_measure.
if s_mesure-low = 'km'.
CLEAR wa_fcat.
wa_fcat-fieldname = 'KM'.
wa_fcat-seltext_l = 'Kilometers'.
wa_fcat-seltext_m = 'Kilometers'.
wa_fcat-seltext_s = 'Kilometers'.
APPEND wa_fcat TO it_fcat.
endif.
if s_mesure-low = 'miles'.
CLEAR wa_fcat.
wa_fcat-fieldname = 'MILES'.
wa_fcat-seltext_l = 'Miles'.
wa_fcat-seltext_m = 'Miles'.
wa_fcat-seltext_s = 'Miles'.
APPEND wa_fcat TO it_fcat.
endif.
if s_mesure-low = 'LY'.
CLEAR wa_fcat.
wa_fcat-fieldname = 'LY'.
wa_fcat-seltext_l = 'lightyeras'.
wa_fcat-seltext_m = lightyeras'.
wa_fcat-seltext_s = 'lightyeras'.
APPEND wa_fcat TO it_fcat.
endif.
endloop.
Of course theres a lot more to do but i hope you get the point. You have to foresee every possible measurment and react on this.
2007 Nov 09 8:40 AM
can i create dynamic tables for this? but I dont know how to create a dynamic table. I hope you could help me gurus.thanks.
2007 Nov 09 10:10 AM
Even if you are creating a dynamic table you have to fill the fieldcatalog like i showed you.
I really suggest that you limit down your measures to a fix amount of them and let the user choose via radiobuttons.
Your problem isnt solvable in this forum, its too complex using dynamic tables if you havent a glue of them.