‎2007 Jan 10 9:19 AM
Hi,
I already have been searching in the forum, but didn't find a solution for my problem (propably I'm only overlooking something).
I need to work with a range-table with a NUMC-Type (length=20) for the low-/high-values. Unfortunately, when I fill the range-table with values (e.g. SIGN=I - OPTION=CP - LOW=*9), the numc-values are always changed to numbers with leading zeroes. I know that this is the standard-behavior of numc-fields, but how can I use a numc-range-table right?
Best regards, Stefan
‎2007 Jan 10 9:27 AM
Hi,
The only possible solution is to convert the values after getting/reading the value
from the range using the FM 'CONVERSION_EXIT_ALPHA_OUTPUT'
Regards,
GSR.
‎2007 Jan 10 9:37 AM
loop it_ranges.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = it_ranges-low
IMPORTING
OUTPUT = it_ranges-low.
modify table it_ranges transporting low.
endloop.
‎2007 Jan 10 9:56 AM
Thanks for your answers. I tried to do the following:
DATA: lt_table LIKE it_doc_id_ranges.
DATA: ls_doc_id_range LIKE LINE OF lt_table.
FIELD-SYMBOLS: <fs> LIKE LINE OF lt_table.
ls_doc_id_range-sign = 'I'.
ls_doc_id_range-option = 'CP'.
ls_doc_id_range-low = '*9'.
INSERT ls_doc_id_range INTO TABLE lt_table.
LOOP AT lt_table ASSIGNING <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = <fs>-low
IMPORTING
output = <fs>-low.
ENDLOOP.
SELECT * FROM zspec_doc_head INTO TABLE lt_docs WHERE doc_id IN lt_table.
The Problem is, that the wildcard (*) is removed anywhere - I guess at the insert-statement. Does anyone of you an idea what I can do to avoid this?
Greets, Stefan
‎2007 Jan 10 10:10 AM
use concatenate as below.
LOOP AT lt_table ASSIGNING <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = <fs>-low
IMPORTING
output = <fs>-low.
concatenate '*' <fs>-low into <fs>-low.
ENDLOOP.Message was edited by:
Chandrasekhar Jagarlamudi
‎2007 Jan 10 10:13 AM
i hope thts wht u wanted ..see my demo code and change ur tables accrodingly.
reward if helpfull.
tables zgill_main.
data: begin of lt_table occurs 0,
sign(1),
option(2),
low(2),
high(2),
end of lt_table.
DATA: ls_doc_id_range LIKE LINE OF lt_table.
FIELD-SYMBOLS: <fs> LIKE LINE OF lt_table.
data: begin of itab occurs 0.
include structure zgill_main.
data end of itab.
ls_doc_id_range-sign = 'I'.
ls_doc_id_range-option = 'CP'.
ls_doc_id_range-low = '*1'.
move-corresponding ls_doc_id_range to lt_table.
append lt_table.
INSERT ls_doc_id_range INTO TABLE lt_table.
LOOP AT lt_table ASSIGNING <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = <fs>-low
IMPORTING
output = <fs>-low.
modify lt_table index sy-tabix.
ENDLOOP.
SELECT * FROM zgill_main INTO TABLE itab WHERE pernr IN lt_table.
loop at itab.
write:/ itab-pernr.
endloop.
‎2007 Jan 10 10:19 AM
Hi,
I think I will need some time to check your solutions. I write again when I know if I can use any of your solution or not
@Chandrasekhar: Do I really need the modify-statement? I thought it would be ok to use a field-symbol.
‎2007 Jan 10 11:58 AM
Hi again,
anyhow the range with the numc-value doesn't work. I traced the Database-Select (ST05) with the following result:
SELECT WHERE "MANDT" = '001' AND "DOC_ID" LIKE '%0% 00000000000000000000'He always includes the high-value too. If I fill in the high-value %0% too, there are at least some spaces in the select-statement between the two values...
Does anyone use a range-table with numc-fields?
‎2007 Jan 10 12:57 PM
@Amit: Unfortunately I can't use your solution. I don't know which standard-type abap does use in the range but it seems to be a char-type. I have defined a range-table in the Dictionary which uses a data-element which is part of the table-key on which I do my select-statement. This data-element is of type numc - the lenght is 20.
I'm not happy about this, but I have to use this data-element in the range-table, otherwise in case of changes I would have to adjust the range-table manually.
@Chandrasekhar: Concatenate would be a solution but the original expression also could have been 6* or 5*7 and I wouldn't know what it was originally.
‎2007 Jan 10 2:00 PM
If original expression has * , then
search <fs>-low for '*'.
if sy-subrc NE 0.
* then only use CONVERSION_EXIT_ALPHA_INPUT and concatenate statement
ndif.
‎2007 Jan 10 3:16 PM
Hi Chandrasekhar,
even if the problem with the wildcards would be eliminated, the problem with the generated select-statement would still remain. I mean that the high-value is included in the stament in every case:
SELECT WHERE "MANDT" = '001' AND "DOC_ID" LIKE '%0% 00000000000000000000'or
SELECT WHERE "MANDT" = '001' AND "DOC_ID" LIKE '%0% %0%'Regards, Stefan
‎2007 Jan 10 10:12 AM
also modify the table
modify table it_ranges transporting low.