‎2009 May 18 12:36 PM
Hi ABAP Expert.
Please see the code below.
RANGES: COMPANY_CODE FOR VBAK-BUKRS_VF.
COMPANY_CODE-LOW = 2500
COMPANY_CODE-HIGH = 2500
SELECT * FROM VBAK
WHERE VBAK~BUKRS_VF IN COMPANY_CODECompare the above code with below code
SELECT * FROM VBAK
WHERE VBAK~BUKRS_VF = 2500I am getting different results.
Looking for ur reply
thanks
‎2009 May 18 12:41 PM
Hi,
Do the following Way,
TYPES: BEGIN OF ty_vbak,
bukrs_vf like vbak-bukrs_vf,
END OF ty_vbak.
RANGES: company_code FOR vbak-bukrs_vf.
DATA: it_vbak type STANDARD TABLE OF ty_vbak WITH HEADER LINE .
company_code-option = 'EQ'. " EQ when only one Value like you are using this time only 2500 if like this Low = 2000 to High = 2500 thna use BT
company_code-sign = 'I'.
company_code-low = '2500'.
company_code-high = '2500'.
APPEND company_code.
SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE it_vbak
WHERE vbak~bukrs_vf IN company_code.and Please always use Meaningful Subject Line
Regards,
Faisal
‎2009 May 18 12:41 PM
Hi,
Do the following Way,
TYPES: BEGIN OF ty_vbak,
bukrs_vf like vbak-bukrs_vf,
END OF ty_vbak.
RANGES: company_code FOR vbak-bukrs_vf.
DATA: it_vbak type STANDARD TABLE OF ty_vbak WITH HEADER LINE .
company_code-option = 'EQ'. " EQ when only one Value like you are using this time only 2500 if like this Low = 2000 to High = 2500 thna use BT
company_code-sign = 'I'.
company_code-low = '2500'.
company_code-high = '2500'.
APPEND company_code.
SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE it_vbak
WHERE vbak~bukrs_vf IN company_code.and Please always use Meaningful Subject Line
Regards,
Faisal
‎2009 May 18 12:42 PM
Example for Ranges:
*Ranges declaration for PO Number
DATA : r_ebeln TYPE RANGE OF ebeln,
w_ebeln LIKE LINE OF r_ebeln.
MOVE :'I' TO w_ebeln-sign,
'EQ' TO w_ebeln-option,
wa_cdpos-objectid+0(10) TO w_ebeln-low.
APPEND w_ebeln TO r_ebeln.
CLEAR: w_ebeln.
‎2009 May 18 12:42 PM
hi
there is an error in first example...
it should be:
COMPANY_CODE-LOW = 2500.
COMPANY_CODE-HIGH = 2500.
COMPANY_CODE-OPTION = 'EQ'
COMPANY_CODE-SIGN = 'I'.
APPEND COMPANY_CODE.
regards, darek
‎2009 May 18 12:42 PM
Point 1: the RANGES statement is obsolete and should not be used anymore. try using following:
Data: company_code type range of bukrs_vf.Point 2: iu cant see any append when building your range. i guess the first statement gives you ALL records.
‎2009 May 18 12:55 PM
‎2009 May 18 12:57 PM
Hi
use this code.... it will give you complete result....
RANGES: COMPANY_CODE FOR VBAK-BUKRS_VF.
COMPANY_CODE-SIGN = 'I'.
COMPANY_CODE-OPTION = 'EQ'.
COMPANY_CODE-LOW = 2500.
APPEND COMPANY_CODE.
SELECT * FROM VBAK
WHERE VBAK~BUKRS_VF IN COMPANY_CODERegards,
Siddarth
‎2009 May 18 1:07 PM
HI Ajay,
RANGES: r_company_code FOR VBAK-BUKRS_VF.
r_company_code-sign = 'I'.
r_company_code-option = 'EQ'.
r_company_code-LOW = 2500
append r_company_code.
SELECT *
FROM VBAK
WHERE VBAK~BUKRS_VF IN r_company_codeRegards,
Sravanthi
‎2009 May 18 1:13 PM
Hi,
RANGES: COMPANY_CODE FOR VBAK-BUKRS_VF.
COMPANY_CODE-LOW = 2500
COMPANY_CODE-HIGH = 2500
SELECT * FROM VBAK
WHERE VBAK~BUKRS_VF IN COMPANY_CODE
Compare the above code with below code
SELECT * FROM VBAK
WHERE VBAK~BUKRS_VF = 2500
-
There was a difference in both statments.
For the first select query it will retrieve the data from company code 0000 to 2500. Ranges will creates a Sign, Options, Low and High.
Sign = I
Options = BT
Low = 2500
High = 2500
So your condition is retrieving the data as a company code input BT 0001 to 2500. So you gill get the result from 0000 to 2500.
The second select query it will fetches the record only the company code 2500. So you will get the record for only 2500.
Let me know if you have anything.
Regards
Thiru