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

Range-Table with NUMC-Fields

Former Member
0 Likes
2,490

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

11 REPLIES 11
Read only

Former Member
0 Likes
1,763

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.

Read only

Former Member
0 Likes
1,763
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.
Read only

0 Likes
1,763

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

Read only

0 Likes
1,763

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

Read only

0 Likes
1,763

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.

Read only

0 Likes
1,763

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.

Read only

0 Likes
1,763

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?

Read only

0 Likes
1,763

@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.

Read only

0 Likes
1,763
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

.

Read only

0 Likes
1,763

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

Read only

Former Member
0 Likes
1,763

also modify the table

modify table it_ranges transporting low.