12-01-2009 6:46 AM
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
12-01-2009 7: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
12-01-2009 7: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
12-01-2009 7: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
12-01-2009 7: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.