‎2009 Aug 24 10:07 PM
Hi
Iam getting dump when iam executing the following select statement...Please let me know What's wrong in this and how to get it resolved?
IF NOT it_bkpf[] IS INITIAL.
SELECT bukrs
gjahr
belnr
buzei
sgtxt
hkont
lifnr
wrbtr
pswsl
menge
meins
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE itab
FOR ALL ENTRIES IN it_bkpf
WHERE belnr EQ it_bkpf-belnr AND
sgtxt IN s_sgtxt AND
lifnr IN s_lifnr.
ENDIF.
When iam running the above statement iam getting the dump.
Iam getting the error like below
Runtime Errors DBIF_RSQL_INVALID_RSQL
Exception CX_SY_OPEN_SQL_DB
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
in
procedure "GET_DATA" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
In a SELECT access, the read file could not be placed in the target
field provided.
Either the conversion is not supported for the type of the target field,
the target field is too small to include the value, or the data does not
have the format required for the target field.
‎2009 Aug 24 10:29 PM
Hi,
In your ITAB check the types of each field bukrs, gjahr, belnr, buzei, sgtxt, hkont, lifnr, wrbtr, pswsl, menge and meins.
Some of teh fields are having a wrong type or the field is having lesser length.
This is causing the dump.
Kindly check.
Regards,
Ankur Parab
‎2009 Aug 24 10:29 PM
Hi,
In your ITAB check the types of each field bukrs, gjahr, belnr, buzei, sgtxt, hkont, lifnr, wrbtr, pswsl, menge and meins.
Some of teh fields are having a wrong type or the field is having lesser length.
This is causing the dump.
Kindly check.
Regards,
Ankur Parab
‎2009 Aug 25 6:30 PM
Thanks for your reply
It helps..the problem solved...but i have one more problem selecting from BKPF
The following statement is not fetching any data if i put all the fields in selection...
bukrs, gjahr, blart are parameters and belnr is select options...
SELECT bukrs
gjahr
blart
belnr
FROM bkpf
INTO TABLE it_bkpf
WHERE bukrs EQ p_bukrs AND
belnr IN s_belnr AND
gjahr EQ p_gjahr AND
blart EQ p_blart.
Could you please let me know why...
Thanks
Govi
‎2009 Aug 25 6:37 PM
Hi,
If you have declared the internal table properly and still the select is not fetching data there must be 2 possible reasons.
1) Check in SE16 for BKPF if the data is available for the parameters you have passed in the selection screen
2) For belnr, you may have to append the leading zero's using the FM conversion_exit_alpha_input and then pass it to the select statement.
Regards,
vik
‎2009 Aug 25 6:41 PM
‎2009 Aug 25 6:41 PM
Hi,
The select query
SELECT bukrs
gjahr
blart
belnr
FROM bkpf
INTO TABLE it_bkpf
WHERE bukrs EQ p_bukrs AND
belnr IN s_belnr AND
gjahr EQ p_gjahr AND
blart EQ p_blart.
will fetch records only if u pass value in P_BUKRS, P_GJAHR and P_BLART.
This is because if you do not pass any value in a parameter it matches with "space"
regards,
Ankur Parab
‎2009 Aug 25 7:03 PM
Thanks for your reply
I am getting the values from the table if i give only company code and accounting doc number(belnr)
I dont know why iam not able to get if i pass only 2 of the 4 inputs or 1 of the 4 inputs....
The data is getting populated only if i pass all the 4 inputs
WHERE bukrs EQ p_bukrs AND
belnr IN s_belnr AND
gjahr EQ p_gjahr AND
blart EQ p_blart.
i wanted to check whether its populating with only company code or company code and belnr, and bukrs,belnr,fiscal year
combinations...
Whats getting wrong here...do i need to mention all select-options here?
Thanks
‎2009 Aug 25 7:26 PM
Here is the detailed Explaination...so that you can understand
Iam GETTING the data into IT_BKPF for the following Combinations
company code(parameter)
fiscal year(parameter)
document type(parameter)
company code(parameter)
fiscal year(parameter)
document type(parameter)
Acc document(Select options)
=======================================================
Iam NOT getting the data for the following Combinations
1.company code(parameter)
2.fiscal year(parameter)
3.Document type(parameter)
4.Acc document(Select options)
5.company code(parameter)
fiscal year(parameter)
6. company code(parameter)
document type(parameter)
7.company code(parameter)
Acc document(Select options)
8.company code(parameter)
document type(parameter)
Acc document(Select options)
Please let me know
‎2009 Aug 25 7:44 PM
Hi,
WHERE bukrs EQ p_bukrs AND
belnr IN s_belnr AND
gjahr EQ p_gjahr AND
blart EQ p_blart.This is because you pass empty parameters in where clause and uses AND Condition.
For eg. if you only give value in company code as 'CMP1''.
As per your query the data will be fetched as BUKRS EQ 'CMP1' AND belnr in S_BELNR AND GJAHR EQ '0000' AND BLART EQ ' '.
This is because if you do not pass any values in parameter then empty/default values are used to fetch data. There will not be any data in table satisfying the where clause. Either use select options for all the parameters or pass some default values in parameter which are not filled up by the user or make dynamic queries depending upon what parameters or select options are passed in the program.
KR Jaideep,
‎2009 Aug 24 11:54 PM
hello. your internal table itab doesnot hold data types similar to the fetched fields. check the declaration of itab.
avoid using into corresponding fields.
‎2009 Aug 25 2:43 AM
Hi Govi,
Your internal table structure should be like below for the fields mentioned in the select query.
Thanks
Venkat.ODATA: BEGIN OF ITAB OCCURS 0,
BUKRS TYPE BSEG-BUKRS,
GJAHR TYPE BSEG-GJAHR,
BELNR TYPE BSEG-BELNR,
BUZEI TYPE BSEG-BUZEI,
SGTXT TYPE BSEG-SGTXT,
HKONT TYPE BSEG-HKONT,
LIFNR TYPE BSEG-LIFNR,
WRBTR TYPE BSEG-WRBTR,
PSWSL TYPE BSEG-PSWSL,
MENGE TYPE BSEG-MENGE,
MEINS TYPE BSEG-MEINS,
END OF ITAB.
‎2009 Aug 25 2:55 AM
Could you check 'it_bkpf-belnr ' data type or Internal table 'IT_BKPF'
‎2009 Aug 25 5:30 AM
Hi,
Your dump happens because there is a conflict in the internal table declaration and the operation you are trying to do using select query.
Check your internal table declaration - itab.
You could have possibly used the wrong data types.
‎2009 Aug 25 6:07 AM
Hi,
This dump is coming because of the mismatch in the data types of the fields in your internal table and database table.Please declare them in a similar manner.
‎2009 Aug 25 1:16 PM
hi,
this is only beacuse of data type mismatch
so declare the sequence of the field in the internal table as per the BSEG table u can even click on the pattern button select the structured data object radio button give the table name bseg n click the ok button n then select the fields u wanna use in ur internal table then click on ok again give the name for ur internal table it wl create an internal; table for u and then use select statement
rgds
shivraj
Edited by: ShivrajSinha on Aug 25, 2009 2:23 PM