Skip to Content

Regarding Ranges : to search for a patter which starts with 0 and any no: 0

HI,

My requirement is to use ranges on LIFNR to select data from EKKO.

Here, I need to give 000123 for a vendor 123. ie, I need to prefix zeros.

The problem is I cannot use any pattern here.. like if I give 12*, the conversion exit will give a dump.

  • Is there any pattern to specify <0(or any occurance of 0)>12.*

Thanks in advance,

Sreekanth

Edited by: Sreekanth Krishnan on Dec 1, 2009 7:46 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2009 at 07:23 AM

    Hi,

    Try the following code:

      DATA: lv_lifnr     TYPE lifnr,
            lt_range_ext TYPE RANGE OF lifnr,
            lt_range_int TYPE RANGE OF lifnr,
            ls_range     LIKE LINE OF lt_range_ext.
    
      ls_range-sign = 'I'.
      ls_range-option = 'CP'.
      ls_range-low = '12*'.
      APPEND ls_range TO lt_range_ext.
    
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_RANGE_I'
        EXPORTING
          input     = lv_lifnr
        IMPORTING
          output    = lv_lifnr
        TABLES
          range_ext = lt_range_ext
          range_int = lt_range_int.
    

    The result is a range (lt_range_int) with the following patterns:

    12*

    012*

    0012*

    00012*

    000012*

    0000012*

    00000012*

    000000012*

    0000000012

    The paramter "input" is only provided because it is a mandatory paramter.

    The parameter "output" is needed to determining how many leading zeros to insert. Only the length of the type is evluated here, not the value of the paramter.

    Best regards,

    Christoffer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2009 at 07:39 AM

    hai sreekanth,

    try given Below program, May be helpful For u.....

    TABLES LFA1.
    data : begin of ivendor OCCURS 10,
           lifnr like lfa1-lifnr,
           end of ivendor.
    data: iekko like ekko OCCURS 10 WITH HEADER LINE.
    SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.
    INITIALIZATION.
    VENDOR-LOW    =   1000.        " It specifies the range starting value.
    VENDOR-HIGH    =   2000.       " It specifies the range ending value.
    VENDOR-OPTION  =  'BT'.        " specifies ranges value is in between.
    VENDOR-SIGN      = 'I'.           "specifies both inclussive.
    
    APPEND VENDOR.
    
    shift vendor-low LEFT DELETING LEADING space.
    shift vendor-high LEFT DELETING LEADING space.
    ivendor-lifnr = vendor-low.
    CONCATENATE '000' ivendor-lifnr into ivendor-lifnr.
    append ivendor.
    
    loop at ivendor.
    if ivendor-lifnr+3(6) <> vendor-high.
    ivendor-lifnr = ivendor-lifnr + 1.
    shift ivendor-lifnr LEFT DELETING LEADING space.
    CONCATENATE '000' ivendor-lifnr into ivendor-lifnr.
    append ivendor.
    endif.
    endloop.
    
    select * from ekko into table iekko for all ENTRIES IN ivendor
                                      where lifnr = ivendor-lifnr.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 01, 2009 at 07:05 AM

    Hi, Sreekanth

    Test the following Sample Code Hope will help you to solve out your problem,

    TABLES: ekko.
    DATA: it_ekko LIKE STANDARD TABLE OF ekko WITH HEADER LINE.
    
    SELECT-OPTIONS: solifnr FOR ekko-lifnr.
    
    SELECT * INTO CORRESPONDING FIELDS OF TABLE it_ekko
      FROM ekko
      WHERE lifnr IN solifnr.
    
    INITIALIZATION.
      IF solifnr[] IS INITIAL.
        solifnr-low = '*123*'.
        APPEND solifnr.
      ENDIF.

    Best Regards,

    Faisal

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.