‎2011 Aug 30 8:16 AM
Hi All,
I have created a table named as zproject_mat and there is a field 'LONG_D' for long description and its size is not limited, so i used 'STRING' data type for this field. But the problem is: when i use this field in where condition with 'SELECT QUERY' in my abap program , it throws me an error..'The field long_d is a long string , so it cannot be used in WHERE, ON, or having conditions'.
Can anyone help me regarding this. I dont know which data type will be suitable in both conditions, LONG DESC AND SELECT QUERY.
Regards
Rahul
‎2011 Aug 30 9:50 AM
HI,
REPORT ztest_94test.
DATA :it_itab TYPE STANDARD TABLE OF Ztable,
wa TYPE Ztable.
*Ztable will have a string field.
SELECT * FROM Ztable INTO TABLE it_itab.
LOOP AT it_itab into wa WHERE z_long = 'string'.
ENDLOOP.
Hope this will be helpful.
Regards
Aravind.
‎2011 Aug 30 9:32 AM
Hi Rahul,
If a variable with 220 characters can suffice your requirement, then, you can use the Data Element 'BAPI_MSG'. A select query can be made against such a variable using WHERE condition.
Conversely, if you still need to have a select query, you will have to define the length of your variable by creating a ZDATA_ELEMENT with length as 1024 and then use the same in your table and Select query.
Regards,
Pranav.
‎2011 Aug 30 11:31 AM
Hi Pranav,
I am not getting. Can yo please explain it. Which data type should i use if i want to give its length around 1500.
Can you please answer me with helpful answer.
Regards,
Rahul
‎2011 Aug 30 9:50 AM
HI,
REPORT ztest_94test.
DATA :it_itab TYPE STANDARD TABLE OF Ztable,
wa TYPE Ztable.
*Ztable will have a string field.
SELECT * FROM Ztable INTO TABLE it_itab.
LOOP AT it_itab into wa WHERE z_long = 'string'.
ENDLOOP.
Hope this will be helpful.
Regards
Aravind.
‎2011 Aug 30 11:06 AM
Hi Aravind,
I am using this query with 'LIKE'.
CONCATENATE '%' MATERIAL_CODE '%' INTO LV_3.
CONCATENATE '%' SHORT_DES '%' INTO LV_4.
CONCATENATE '%' LONG_DES '%' INTO LV_5.
CONCATENATE '%' PLANT '%' INTO LV_6.
SELECT *
FROM ZPROJ_MATERIAL
INTO TABLE IT_MATERIAL
WHERE MATNR LIKE LV_3
AND SHORT_D LIKE LV_4
AND LONG_D LIKE LV_5 'Problem in this field.'
AND PLANT LIKE LV_6.
So how do i write 'where' condition in Loop with 'LIKE'.
Regards,
Rahul
‎2011 Aug 30 1:19 PM
Hi Rahul,
As mentioned your Table name is 'zproject_mat' and there is a field 'LONG_D'.
The field 'LONG_D' will have a Data Element associated with it. Create a new input Data Element & Domain 'ZLONG' of Type CHAR with Length = 1100. This will used in the code.
For the Table 'zproject_mat', you need to need to break up your field as 'LONG_D1', 'LONG_D2', ........, 'LONG_D5' with Data Element as 'BAPI_MSG'.
To INSERT data in table:
In your code, you need to write your logic where the field 'LONG_D' is SPLIT into 5 words and saved in your table against the 5 fields.
To SELECT data from table:
In your code, again you need to write your logic where the field 'LONG_D' is SPLIT into 5 words as abaove and pass them to your SELECT query...
SELECT SINGLE *
FROM zproject_mat
INTO wa_zproject_mat
WHERE long_d1 = v_split1
AND long_d2 = v_split2........
AND long_d3 = v_split3.
The limitation of a table length is 4096 whereas of a field is 255 to make it RFC compatible. Table/Structure fields that are passed via RFC for integration have this limitation and to maintain database standards, these limitations exist.
Hope this helps.
Regards,
Pranav.