REPORT ZDEBUG_ME.
define _debug_new_var.
* Creamos las variable
field-symbols: <_ss_>.
data: begin of _stack occurs 0,
txt(20),
val(60),
tipo(1),
long like dd03l-leng,
dec like dd03l-decimals,
end of _stack,
_sval like sval occurs 0 with header line,
_tab like dd03l-tabname,
_fie like dd03l-fieldname,
_ii(1),
_dcr(1).
end-of-definition.
define _debug_push_var.
* Apilamos variable
get parameter id 'DCR' field _dcr.
check _dcr = 'X'.
clear _stack.
assign (&1) to <_ss_>.
describe field <_ss_>: type _stack-tipo,
length _stack-long,
decimals _stack-dec.
_stack-txt = &1.
_stack-val = <_ss_>.
if _stack-tipo = 'P'. condense _stack-val no-gaps. endif.
append _stack.
end-of-definition.
define _debug_get_val.
call function 'POPUP_GET_VALUES'
exporting
NO_VALUE_CHECK = 'X'
popup_title = 'Cambiar Variables'
importing
returncode = _ii
tables
fields = _sval
EXCEPTIONS
ERROR_IN_FIELDS = 1
OTHERS = 2.
end-of-definition.
define _debug_show_var.
* Mostramos las variables
get parameter id 'DCR' field _dcr.
check _dcr = 'X'. "Variable que lo har funcionar en Productivo
clear _sval. refresh _sval.
loop at _stack.
select tabname fieldname into (_tab, _fie) from dd03l
where inttype = _stack-tipo and
intlen = _stack-long
and decimals = _stack-dec
and datatype ne 'CURR'.
read table _sval with key tabname = _tab fieldname = _fie.
check sy-subrc ne 0.
_sval-tabname = _tab.
_sval-fieldname = _fie.
_sval-value = _stack-val.
_sval-FIELDTEXT = _stack-txt.
append _sval.
exit.
endselect.
endloop.
_debug_get_val.
check _ii ne 'A'.
loop at _stack.
read table _sval with key FIELDTEXT = _stack-txt.
check sy-subrc eq 0.
assign (_stack-txt) to <_ss_>.
<_ss_> = _sval-value.
endloop.
end-of-definition.
define _debug_more_var.
* Añadimos ms variables
get parameter id 'DCR' field _dcr.
check _dcr = 'X'.
clear _ii.
while _ii ne 'N'.
call function 'POPUP_TO_CONFIRM_STEP'
exporting
textline1 = '...add more variables'
titel = 'Do you want to...'
IMPORTING
ANSWER = _ii.
check _ii = 'J'.
clear _sval. refresh _sval.
_sval-tabname = 'SYST'.
_sval-fieldname = 'PRTXT'.
_sval-FIELDTEXT = _sval-value = 'Qu variable quieres añadir'.
append _sval.
_debug_get_val.
check _ii ne 'A'.
read table _sval index 1.
check sy-subrc eq 0.
read table _stack with key txt = _sval-value.
check sy-subrc ne 0.
_debug_push_var _sval-value.
endwhile.
end-of-definition.
data: si(30),
di type p decimals 2,
datu like sy-datum.
end-of-selection.
datu = sy-datum - 1.
di = '33.22'.
si = 'Hello World'.
_debug_new_var.
_debug_push_var: 'SI', 'DATU'.
_debug_more_var.
_debug_show_var.