Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create a structure based on Selection option field values?

Former Member
0 Likes
486

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.

2 REPLIES 2
Read only

Sm1tje
Active Contributor
0 Likes
442

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

Read only

Former Member
0 Likes
442

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