05-30-2008 6:23 AM
Hi guys, pardon the question but I'm still new to ABAP programming.
Can't really explain it well so I'll just post the code.
TABLE: BSID
DATA: Ccode(4) TYPE C,
Fiscal(4) TYPE C.
SELECT-OPTIONS ComCode FOR Ccode No Intervals No-Extension OBLIGATORY.
SELECT-OPTIONS FYear FOR Fiscal No Intervals No-Extension OBLIGATORY.
SELECT * FROM BSID.
WRITE: BSID-BUKRS, BSID-GJAHR.
WRITE FYear.
ENDSELECT.
My problem is this, I get the parameter of FYear from the selection option in order to compare it to a field in the table. But everytime I get this. IEQ***. I can't compare it with the IEQ in the way, and If I try to make the Fyear an integer it writes. IEQ***00000. Is there any way to fix this. I'm new to this, just answering an exercise requiring me to use select-option statement as parameters. Any help would be great
05-30-2008 6:31 AM
Hi ,
I have not got your question completely n wht I got from your query is you want to use select option like parameter .
For this u can use fname -low in your query .
Hope this will help a bit.
05-30-2008 6:27 AM
Hi,
for select-options...
u can use fyear-low , fyear-high..
in select queris,
select * from table
into table itab
where
year in fyear.
reply back..
With Rgds,
S.Barani
05-30-2008 6:30 AM
hi,
Try to use CONDENSE statement ,it will solve ur problem.
Syntax Diagram
CONDENSE
Basic form
CONDENSE c.
Addition:
... NO-GAPS
Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type (see Overview).
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.See Use Only Character-Type Fields when Processing Strings.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Character String Processing and Unicode
Effect
Shifts the content of the field c to the left, so that sequences of blanks are reduced to exactly one blank. Leading blanks are removed, as are trailing blanks in string type fields.
Example
DATA NAME (30).
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
displays the following:
Dr. Michael Hofmann
Addition
... NO-GAPS
Effect
Suppresses all blanks from the field c
Example
DATA: BEGIN OF NAME,
TITLE(8) VALUE ' Dr.',
FIRST_NAME(10) VALUE 'Michael',
SURNAME(10) VALUE 'Hofmann',
END OF NAME.
CONDENSE NAME NO-GAPS.
The contents of NAME is now "Dr.MichaelHofmann".
Since the NAME structure is interpreted and handled like a type C field, the CONDENSE statement treats it as a whole and ignores any subfields. The contents of the subfield would therefore now be as follows:
NAME-TITLE = 'Dr.Micha'
NAME-FIRST_NAME = 'elHofmann '
NAME-SURNAME = ' '
Note
Do not use CONDENSE to manipulate field strings that include fields not of type C. This could result in the subfields containing characters of a different (that is, incorrect) type. Nor can you apply the statement to structures that contain components of type STRING.
Note
Performance:
The runtime required to condense three fields is about 20 msn (standardized microseconds). The variant ... NO-GAPS needs about 12 msn.
Related
SHIFT, CONCATENATE, REPLACE, SPLIT
Additional help
Condensing Field Contents
05-30-2008 6:31 AM
Hi ,
I have not got your question completely n wht I got from your query is you want to use select option like parameter .
For this u can use fname -low in your query .
Hope this will help a bit.
05-30-2008 6:41 AM
Hm.. Ok, I'll try to make it clearer.
I have this statmenet in my program:
SELECT-OPTIONS ComCode FOR Ccode No Intervals No-Extension OBLIGATORY.
SELECT-OPTIONS FYear FOR Fiscal No Intervals No-Extension OBLIGATORY.
as well as this one:
SELECT * FROM BSID WHERE BUKRS = ComCode AND GJAHR = FYear.
I'm basically just comparing the selected options to the fields in a table.
Problem with that is, I tried several test cases, and apparently they aren't equal.
Trying to debug it, I tried to print BURKS and GJAHR from the table as well as ComCode and FYear from select-option
This is what I got:
2002 2007 IEQ2002 IEQ2007.
So first two columns are those from the table and last two are those from teh selected option. As you can see they aren't equal at all because of the IEQ. I'm new at this so I'm not really sure if I'm doing the right thing. Is my format wrong in declaring the select statement?
BTW, I'm required to use select-option and not parameter. Thanks for the inputs though
Edited by: zsa tan on May 30, 2008 7:42 AM
05-30-2008 6:45 AM
05-30-2008 6:53 AM
05-30-2008 6:56 AM
05-30-2008 6:35 AM
Hi ,
sorry to say that your problem is not clear to me.
any how check with below code
TABLES: BSID
PARAMETRS:
COMCODE LIKE BSID-BUKRS OBLIGATORY,
FYEAR LIKE BSID-GJAHR OBLIGATORY.
START-OF-SELECTION
SELECT * FROM BSID.
WHERE BUKRS = COMCODE
AND GJAHR = FYEAR.
WRITE: BSID-BUKRS, BSID-GJAHR.
WRITE FYear.
ENDSELECT.
It is always recommended to select only those fileds u require
and avoid select and endselect.
so populate all the data into one internal tabla at once and use that internal table for further processing.
Reward points if useful
05-30-2008 6:44 AM
Hi ,
Do one thing try declaring your select option taking the reference of the dictionary element.
For example if Fyear is your field form table TAB, declare like
SELECT-OPTIONS FYear FOR TAB-FYEAR No-Extension OBLIGATORY.
Hope this helps
Regards
Sourabh