2008 Aug 05 4:14 PM
Folks,
please find my code below:
SELECT partner bpkind FROM but000 INTO TABLE i_but000
FOR ALL ENTRIES IN lt_cmst_rtcm_bw
WHERE partner = lt_cmst_rtcm_bw-tk_partner_i+0(10).
SORT i_but000 BY partner.
partner is of length 10, tk_partner_i is of length 32.
when i use this offset value for comparison, its giving me the correct output. no errors.
but am getting this warning:
Bei der Verwendung von FOR ALL ENTRIES wird die Längenangabe für "TK_PARTNER_I" in dieser Bedingung ignoriert.
Do i have to mind this warning??..
if this is to be considered, please suggest me an alternate solution to use "For all entries" in this case.
Thanks in advance..
Yog
2008 Aug 06 2:21 PM
The simple solution is to create another field in the internal table with the correct attributes and move the correct field contents to it and use that in the SELECT.
Rob
Folks,
please find my code below:
SELECT partner bpkind FROM but000 INTO TABLE i_but000
FOR ALL ENTRIES IN lt_cmst_rtcm_bw
WHERE partner = lt_cmst_rtcm_bw-tk_partner_i+0(10).
SORT i_but000 BY partner.
partner is of length 10, tk_partner_i is of length 32.
when i use this offset value for comparison, its giving me the correct output. no errors.
but am getting this warning:
Bei der Verwendung von FOR ALL ENTRIES wird die Längenangabe für "TK_PARTNER_I" in dieser Bedingung ignoriert.
Do i have to mind this warning??..
if this is to be considered, please suggest me an alternate solution to use "For all entries" in this case.
Thanks in advance..
Yog
2008 Aug 05 4:31 PM
Sri,
If your programe code under the SAP guidlines than no warning should be occured.but in genral case it is not possible so you may ignore this warning message and go ahead.
Amit.
2008 Aug 05 4:35 PM
I think it depends on the requirement. If u r sure that in tk_partner_i for 1st 10 char. data will be maintained for partner then nothing to worry about, u can ignore this warning message. Otherwise u have to give a 2nd look to ur select.
Regards,
JOy.
2008 Aug 05 4:54 PM
Hi,
Actually am writing this code in CMOD-CRM system. those tables are having more than 16lakhs records. i dont have any direct mapping field available..
but tk_partner_i's first 10 digits will definitely match with partner. i have checked this in debugging mode and its working fine.
so to improve the overall performance, i definitely need this comparison, else it will impart huge performance difference.
thats why..any alternatives??
Thanks,
Yog
2008 Aug 05 4:56 PM
As Joy already said,you can ignore this message if you are getting desired result.
Amit.
2008 Aug 05 5:00 PM
Hi,
Please check if you have lot of records in table lt_cmst_rtcm_bw and if these records are duplicate for partner?
if yes, then it is suggestable to build a range for the partner and then pass it to the select query, it will improve the performance as well.
if table lt_cmst_rtcm_bw contains few records and thers is no duplicate records of partner then what you are doing is perfectly fine.
I hope it helps you in solving your query.
Thanks,
Kamesh Bathla
2008 Aug 05 5:33 PM
> Folks,
>
> please find my code below:
>
> SELECT partner bpkind FROM but000 INTO TABLE i_but000
> FOR ALL ENTRIES IN lt_cmst_rtcm_bw
> WHERE partner = lt_cmst_rtcm_bw-tk_partner_i+0(10).
> SORT i_but000 BY partner.
>
> partner is of length 10, tk_partner_i is of length 32.
>
> when i use this offset value for comparison, its giving me the correct output. no errors.
>
> but am getting this warning:
> Bei der Verwendung von FOR ALL ENTRIES wird die Längenangabe für "TK_PARTNER_I" in dieser Bedingung ignoriert.
>
> Do i have to mind this warning??..
>
> if this is to be considered, please suggest me an alternate solution to use "For all entries" in this case.
>
> Thanks in advance..
>
> Yog
The warning is telling you that the length specification (10) will be ignored. So, either your code won't work, or the warning is false, and SAP got it wrong. If you're totally convinced that your code is working as you expect, then you should let SAP know so they can fix their code.
2008 Aug 05 6:29 PM
Hi,
If the length specification is ignored, then it should generate the error saying that the two fields must have same length in order to do the comparison right??...
i am a BI consultant..dont know much in ABAP..please correct me if i am wrong..
i have checked in Debugging mode..that internal table is getting filled after this where condition is executed..
so do i have to consider any other factors to ensure this?..
Thanks,
Yog
2008 Aug 05 6:50 PM
correct way is to build a range for partner
ranges: r_partner for but000-partner.
r_partner -sign = 'I'.
r_partner -option = 'EQ'
loop at lt_cmst_rtcm_bw.
r_partner -low = lt_cmst_rtcm_bw-tk_partner_i+0(10).
append r_partner.
endloop.
delete adjacent duplicates from r_partner comparing low.
SELECT partner bpkind FROM but000 INTO TABLE i_but000
WHERE partner = r_partner.
if in case r_partner contains lot of records.. say more than 1000.
then you can do
ranges: r_partner_save for but000-partner.
r_partner_save[] = r_partner[].
DATA : l_index LIKE sy-tabix,
l_index_fr LIKE sy-tabix,
l_index_to LIKE sy-tabix,
l_packet TYPE i,
l_calcu TYPE p DECIMALS 3,
l_times TYPE i.
DESCRIBE TABLE r_partner LINES l_index.
IF l_index > 1000.
l_calcu = l_index / 1000.
l_times = CEIL( l_calcu ).
ELSE.
l_times = 1.
ENDIF.
CLEAR: l_packet.
DO l_times TIMES.
l_index_fr = 1 + l_packet.
l_index_to = 1000 + l_packet.
REFRESH r_partner. CLEAR r_partner.
APPEND LINES OF r_partner_save FROM l_index_fr TO l_index_to
TO r_partner.
l_packet = l_packet + 1000.
SELECT partner bpkind FROM but000 *APPENDING* TABLE i_but000
WHERE partner = r_partner.
enddo.Thanks,
Kamesh Bathla
Edited by: Kamesh Bathla on Aug 5, 2008 7:52 PM
2008 Aug 06 10:14 AM
>
> Hi,
>
> If the length specification is ignored, then it should generate the error saying that the two fields must have same length in order to do the comparison right??...
>
No. It will do its best to do a comparison.
Where "b" is a space, if partner contains "ABCDEFbbbb" and lt_cmst_rtcm_bw-tk_partner_i contains "ABCDEFbbbbbbbbbbbbbbbbbbbbbbbbbb" then you'll get a match. The following spaces are ignored.
However, if partner contains "ABCDEFGHIJ" and it_cmst_rtcm_bw-tk_partner_i contains "ABCDEFGHIJKbbbbbbbbbbbbbbbbbbbbbb" you won't get a match.
As Joyjit Ghosh said, if you KNOW that it_cmst_rtcm_bw-tk_partner_i always has at least 22 trailing spaces, then it's perfectly safe to do
SELECT partner bpkind FROM but000 INTO TABLE i_but000
FOR ALL ENTRIES IN lt_cmst_rtcm_bw
WHERE partner = lt_cmst_rtcm_bw-tk_partner_i.
SORT i_but000 BY partner.As the warning message says, the length specification is ignored, which means that it must be working without it!
I've done similar in my BI programming quite often.
2008 Aug 06 12:22 PM
Hi,
Actually i am writing this code in CRM system's CMOD-User exit program.
when i remove the offset i am getting this error:
When using the addition "FOR ALL ENTRIES IN itab", the fields "PARTNER" and "LT_CMST_RTCM_BW-TK_PARTNER_I" must have the same type and length.and length.
but with offset its generating warning and internal table is getting filled..
so can you please explain me on this?..
Thanks,
Yog
2008 Aug 06 12:24 PM
if you give the offset values in the select statement it will give you warning .....no need to consider this warning
2008 Aug 06 1:56 PM
>
> Hi,
>
> Actually i am writing this code in CRM system's CMOD-User exit program.
>
> when i remove the offset i am getting this error:
>
> When using the addition "FOR ALL ENTRIES IN itab", the fields "PARTNER" and "LT_CMST_RTCM_BW-TK_PARTNER_I" must have the same type and length.and length.
>
> but with offset its generating warning and internal table is getting filled..
>
> so can you please explain me on this?..
>
> Thanks,
> Yog
Wow! It seems you have indeed found a bug! With the length specification you get a warning, without you get an error!
I've also written a little test program
TYPES: BEGIN OF mandt_ty,
mandt TYPE char6,
END OF mandt_ty.
DATA: t_mandt TYPE STANDARD TABLE OF mandt_ty WITH NON-UNIQUE KEY mandt,
l_mandt TYPE mandt_ty.
DATA: lt_t000 TYPE STANDARD TABLE OF t000 WITH NON-UNIQUE KEY mandt,
ls_t000 TYPE t000.
l_mandt-mandt = '1201'.
INSERT l_mandt INTO TABLE t_mandt.
SELECT * FROM t000 INTO TABLE lt_t000 FOR ALL ENTRIES IN t_mandt WHERE mandt = t_mandt-mandt+1(3).
*SELECT * FROM t000 INTO TABLE lt_t000 FOR ALL ENTRIES IN t_mandt WHERE mandt = t_mandt-mandt.
LOOP AT lt_t000 INTO ls_t000.
WRITE: ls_t000-mandt.
ENDLOOP.And it seems that the offset isn't being ignored. I've also done and SQL trace, and this confirms that the offset isn't being ignored - the SQL issued actually says SELECT WHERE "MANDT" = '020' even though I've set it in the table to be 1201.
So it seems that, at the moment, you can safely ignore the message. But if SAP ever enforce it, or they make it an error instead of a warning, there will be problems.
matt
2008 Aug 06 12:27 PM
I think warning is given that code will not work for other language becuase you have given offset considering only EN language.
If you are sure that your code will not be used for any other language, that should be fine.
Regards,
Mohaiyuddin
2008 Aug 06 12:41 PM
Hi,
Can you please elaborate your explanation on Language consideration?????..sorry am not getting it..
FYI- these fields will have only numerical values and spaces..
Thanks,
Yog
2008 Aug 06 2:21 PM
The simple solution is to create another field in the internal table with the correct attributes and move the correct field contents to it and use that in the SELECT.
Rob
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |