2007 Nov 12 8:20 AM
Hello Gurus.
a short question. I's is possibel to create an Dynamical Case Condition.
For Example
Select * From HIT into table it_hit.
Case it_hit-number.
When '1: - Dynamic ???
When '2'
endase
2007 Nov 12 8:27 AM
Hi,
Yes it it possible, but not directly.
You will have to first put the code into an internal table,
then using GENERATE SUB ROUTINE POOL statement,
Create a dynamic program and call in background.
Regards,
Samson Rodrigues.
Hi,
Yes it it possible, but not directly.
You will have to first put the code into an internal table,
then using GENERATE SUB ROUTINE POOL statement,
Create a dynamic program and call in background.
Regards,
Samson Rodrigues.
2007 Nov 12 8:27 AM
Hi,
Yes it it possible, but not directly.
You will have to first put the code into an internal table,
then using GENERATE SUB ROUTINE POOL statement,
Create a dynamic program and call in background.
Regards,
Samson Rodrigues.
2007 Nov 12 8:30 AM
Hy Samson ,
that's a good idear. But its ab 4.6 System. I cant create Dynamic Tables.
Regards
Chris
2007 Nov 12 9:04 AM
Hey Chris,
I was not talking about dynamic tables,
create a table with only one field of 72 chars,
DATA: Begin of gt_itab occurs 0,
line(72) type c,
End of gt_itab.
data: gv_fname(30) type c value 'ZTEST_SAMSON', "program name
gv_err(120) type c, "error variable
then move all ur code into this, as if it is a program,
gt_itab-line = 'REPORT ZTEST_SAMSON.' .
append gt_itab .
gt_itab-line = 'FORM new_sub USING <some parameters>.' .
append gt_itab .
gt_itab-line = 'ur code here ' .
append gt_itab .
.........
keep adding lines of ur code to the table.
then close the sub routine
gt_itab-line = 'ENDFORM.'.
append gt_itab.
generate subroutine pool gt_itab name gv_fname message gv_err .
if sy-subrc eq 0.
perform new_sub in program (gv_fname) using <parameters>
if found.
write:/ gv_err .
clear gv_err.
else.
write:/ gv_err.
endif.
Regards,
Samson Rodrigues.
2007 Nov 12 8:29 AM
Hi Christian,
try this short example:
tables: mara.
*
parameters: p_matkl0 like mara-matkl default '06'.
parameters: p_matkl1 like mara-matkl default '13'.
*
select * from mara up to 1000 rows.
case mara-matkl.
when p_matkl0.<b> "dynamic</b>
write: / p_matkl0, mara-matnr, mara-matkl.
when p_matkl1.<b> "dynamic</b>
write: / p_matkl1, mara-matnr, mara-matkl.
endcase.
endselect.
Regards, Dieter
2007 Nov 12 8:36 AM
Hello Dieter
I see no different between
p_matkl0 like mara-matkl default '06'
and
When '06'.
The Data are in a Table It_hit.
I want to youse the Date from the internen Tabel for the case.
Regards
Chris
2007 Nov 12 8:45 AM
Hi Christian,
p_matkl0 is an parameter. the value '06' is only default.
If you insert on schreen '10' the it mean When '10'. ...
Therefore i mean it's dynamic.
If you doesn't mean this, could you explane it a little bit more.
Regards, Dieter
2007 Nov 12 8:50 AM
Hello Dieter ,
there is a table with the data:
PREIS
LFDNR
TABNAME
FIELDNAME
FIELDNAME_REF
FAKTOR
I want This
Case FIELDNAME
when '1'
When '2'.
endcase.
Regards Chris
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |