‎2008 Apr 15 10:41 PM
Hi Guys,
can anybody tell me is ther anyway to creat a strucitre after giving the values to selection screen .I have a req where fiscal period is entered based on this i have to create a structure suppose i he give 3 to 8 then i have to create a strucure with with some fields including period3 period4 like that until Period8 so is there anyway tocreate like that or not?
Thanks,
Gopi.
‎2008 Apr 15 10:48 PM
you can do this by using the RTTS classes:
Example:
CLASS cl_abap_structdescr
CLASS-METHODS create
IMPORTING
p_components TYPE component_table
p_strict TYPE abap_bool DEFAULT abap_true
RETURNING
value(p_result) TYPE REF TO cl_abap_structdescr
‎2008 Apr 15 11:10 PM
You need an internal table not a structure. Either count from from the low value to the high value adding a record to the table or select the entries from the Period master table for that selection range.
Option 1
REPORT ZCOUNT.
tables: t009b.
select-options:
s_period for t009b-poper no-extension.
data:
gt_poper type table of poper,
gs_poper type poper.
start-of-selection.
move s_period-low to gs_poper.
while gs_poper le s_period-high.
append gs_poper to gt_poper.
add 1 to gs_poper.
endwhile.
loop at gt_poper into gs_poper.
write:/ gs_poper.
endloop.
endloop.Option 2
REPORT ZCOUNT.
tables: t009b.
select-options:
s_period for t009b-poper.
data:
gt_poper type table of poper,
gs_poper type poper.
start-of-selection.
select poper
from t009b
into table gt_poper
where bdatj = '2007'
and poper in s_period.
loop at gt_poper into gs_poper.
write:/ gs_poper.
endloop.Not sure if t009b is the right table.
Ta... JR