‎2008 Jun 27 9:28 AM
Hi,
My requirement is when the user inputs a value on the selection screen for the fiscal period as 1 to 12 and fiscal year as 2007 to 2008 then the dates corresponding to these periods have to be displayed as column headers in the o/p.This is a dynamic column and changes based on the input given by the user.The purchase price amounts have to be displayed under the corresponding dates as shown below.
2007-1 2007-2 2007-3----
2008-1 2008-2 2008-3 Total
10 15 23 16 34 65 163
The total of all these amounts have to be displayed in the total column.
In my program the total amount is displayed but the individual amounts are not getting displayed in the output.
Can anyone tell me a solution for this.
‎2008 Jun 27 9:29 AM
Make use of dynamic internal table.You will find a lot of stuff regarding this on SDN.
Reward if useful.
‎2008 Jun 27 9:35 AM
hi check this ...
use this function module for getting the dates from the year and month...
POPUP_TO_SELECT_MONTH
for getting the total use this in the fieldcat..
it_fieldcat-do_sum = 'X'.
‎2008 Jun 27 9:36 AM
Hi Hema,
You have to use the technique of creating dynamic internal table.
I am giving you a simple code for buiding dynamic internal table using fieldcatalog .
You can debug the code and check how it builds the internal table and accordingly you can apply this in your code also.
********************************************************************
REPORT Z_DYNITALV.
TYPE-POOLS: slis.
DATA: new_table TYPE REF TO data,
new_line TYPE REF TO data,
IS_LVC_CAT type LVC_S_FCAT,
IT_LVC_CAT type LVC_T_FCAT,
IS_FIELDCAT type SLIS_FIELDCAT_ALV.
FIELD-SYMBOLS: <l_table> TYPE TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
data:fieldname(30),
N(2) type n value '00' .
Do 10 times.
N = N + 1.
fieldname = 'column'.
concatenate fieldname N into fieldname.
IS_LVC_CAT-FIELDNAME = fieldname.
append IS_LVC_CAT to IT_LVC_CAT.
clear fieldname.
enddo.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = IT_LVC_CAT
IMPORTING
ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
******************************************************************
Just use this code snippet and see what happens in debugger.
I hope this will help you.
Help children of U.N World Food Program by rewarding points and encourage others to answer your queries.