2007 Mar 15 12:46 PM
I am trying to use an offset in my select but it says the offset is the same length of the field. Basically what I want to do is remove the 1st 3 characters form the one field and have the last 3 be moved into the field. They are of different length but I thought the offset would take care of that. here is the code
LOOP AT DATA_PACKAGE.
SELECT AC_DOC_NO
DOC_ITEM
PROFIT_CTR
INTO TABLE T_AZFIG
FROM /BIC/AZFIG_O5100
WHERE
AC_DOC_NO = DATA_PACKAGE-AC_DOC_NO AND
DOC_ITEM = DATA_PACKAGE-ITEM_NUM+3(3).
ENDLOOP.
2007 Mar 15 12:48 PM
Hi Mike,
This should work, but make sure that the DOC_ITEM type and the DATA_PACKAGE-ITEM_NUM type should be same
Regards
Sudheer
2007 Mar 15 12:51 PM
Well taht is the issue. they are both characters but one is of lenth 3 and the other 6. Do I need to first move it inot a working area and then set them equal?
2007 Mar 15 12:50 PM
Hello Mick,#
The problem is the field DOC_ITEM from the table should be of length 3. Since u r offsetting for lenght 3.
Regards,
Vasanth
2007 Mar 15 12:53 PM
2007 Mar 15 1:06 PM
Hi Mick,
Try this option
DATA: l_tempvar(3) type c.
LOOP AT DATA_PACKAGE.
l_tempvar = DATA_PACKAGE-ITEM_NUM+3(3).
SELECT AC_DOC_NO
DOC_ITEM
PROFIT_CTR
INTO TABLE T_AZFIG
FROM /BIC/AZFIG_O5100
WHERE
AC_DOC_NO = DATA_PACKAGE-AC_DOC_NO AND
DOC_ITEM = l_tempvar.
clear l_tempvar.
ENDLOOP.
Hope this solves ur problem.
Enjoy SAP and award points if the reply was useful.
Rajasekhar
2007 Mar 15 1:27 PM
2007 Mar 15 1:52 PM
Hi ,
If the field length is 6 then u have to use
DOC_ITEM = DATA_PACKAGE-ITEM_NUM+2(3).
since the position starts from i got this problem earlier u have to change the position to position-1 since position starts from 0.
so the qusery is now changed to
LOOP AT DATA_PACKAGE.
SELECT AC_DOC_NO
DOC_ITEM
PROFIT_CTR
INTO TABLE T_AZFIG
FROM /BIC/AZFIG_O5100
WHERE
AC_DOC_NO = DATA_PACKAGE-AC_DOC_NO AND
DOC_ITEM = DATA_PACKAGE-ITEM_NUM+2(3).
ENDLOOP.
Check the types of DOC_ITEM and DATA_PACKAGE-ITEM_NUM are same or not.
Reward points if u found it useful
Regards,
Ravi Kumar