The easiest one is by using 'parameters'. Let's see this example :
/nse38
report zdialogscreen.
parameters :
p1(20) type c,
p2 as checkbox,
p3 as checkbox.
write : / 'p1 = ',p1, /p2, /p3
How to change the display label ? I don't like p1,p2,p3...what kind of food is that :). Follow this path : Goto > Text Elements > Selection Text. Then input texts that represent p1,p2,p3.
Field String
To mimic the structure in the DDIC, we can define it as a field string. There are two ways, one is by using [data] statement, the second one is by [tables] statement. Both ways do not save the data permanently to tables, just reside in memory for a temporary moment. While in [data] statement, we need to define first the group of fields, but in [tables] statement, we need the pre-existing created tables. Let's see the samples below :
report zdata.
data:
begin of datastructure,
productname type c,
price type p,
end of datastructure.
datastructure-productname = 'desktop PC'.
datastructure-price = 1000.
write: / datastructure-productname, datastructure-price.
report ztables.
tables zlfa. "remember, zlfa tables should be preexisted.
zlfa-name1 = 'desktop'.
zlfa-prize = 1000.
write : /zlfa-name1, zlfa-prize.
How to Define New Type of Variable
"...I want to simplify to define the type variable, what should I do ?..." Simplifying the type of variable may improve the readibility of your program. For example :
/nse38
report znewtype.
types mychar(10) type c.
data :
myvariable type mychar value 'Bellanova'.
write : myvariable.