‎2006 Sep 21 12:10 PM
hi experts,
for my smartform this is the driver program i have written.
when exucuted i am getting a error message in teh third select quirey i have written which is in bold here.
the actuall error is coming here <b>WHERE objek = gt_resb-charg</b>
the error is like 'both should be same lenghth and type'.
could u plz suggest me how to correct this.
Tables
----
TABLES:vekp, "Handling Unit - Header Table
vevw, "Where-Used List for Handling Units
afvc, "Operation within an order
resb, "Reservation/dependent requirements
makt, "Material Descriptions
ausp. "Characteristic Values
TYPES:BEGIN OF ty_vekp,
exidv TYPE vekp-exidv,
handle TYPE vekp-handle,
vpobjkey TYPE vekp-vpobjkey,
END OF ty_vekp.
TYPES:BEGIN OF ty_vevw,
objkey TYPE vevw-objkey,
handle TYPE vevw-handle,
END OF ty_vevw.
TYPES:BEGIN OF ty_afvc,
objnr TYPE afvc-objnr,
ltxa1 TYPE afvc-ltxa1,
aufpl TYPE afvc-aufpl,
aplzl TYPE afvc-aplzl,
END OF ty_afvc.
----
Internal tables Declaration
----
DATA: gt_resb TYPE STANDARD TABLE OF resb ,
gt_makt TYPE STANDARD TABLE OF makt ,
gt_ausp TYPE STANDARD TABLE OF ausp .
----
Work area Declaration
----
DATA:wa_vekp TYPE ty_vekp,
wa_vevw TYPE ty_vevw,
wa_afvc TYPE ty_afvc.
----
Variables *
----
DATA : lf_fmname TYPE rs38l_fnam.
CONSTANTS: c_fmname(25) TYPE c VALUE 'ZWM_HANDLING_UNIT_LABEL'.
----
S e l e c t O p t i o n s *
P a r a m e t e r s *
----
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_exidv LIKE vekp-exidv, "Handling Unit Number
p_objkey LIKE vevw-objkey, "Process Order Number
p_ltxa1 LIKE afvc-ltxa1, "Phase Description
p_copies(3) TYPE N. "NO of Copies to be print
SELECTION-SCREEN END OF BLOCK block1.
----
AT SELECTION-SCREEN
----
AT SELECTION-SCREEN.
IF p_exidv IS NOT INITIAL.
SELECT single exidv
handle
vpobjkey
FROM vekp
INTO wa_vekp
WHERE exidv = p_exidv.
ENDIF.
IF p_objkey IS NOT INITIAL.
SELECT single objkey
FROM vevw
INTO wa_vevw
WHERE handle = wa_vekp-handle
AND objkey = wa_vekp-vpobjkey
AND objkey = p_objkey.
ENDIF.
IF p_ltxa1 IS NOT INITIAL.
SELECT single objnr
ltxa1
aufpl
aplzl
FROM afvc
INTO wa_afvc
WHERE objnr = wa_vevw-objkey
AND ltxa1 = p_ltxa1 .
ENDIF.
----
START-OF-SELECTION
----
START-OF-SELECTION.
SELECT * FROM resb
INTO TABLE gt_resb
WHERE objnr = wa_afvc-objnr
AND aufpl = wa_afvc-aufpl
AND aplzl = wa_afvc-aplzl.
IF NOT gt_resb[] IS INITIAL.
SELECT * FROM makt
INTO TABLE gt_makt
FOR ALL ENTRIES IN gt_resb
WHERE matnr = gt_resb-matnr.
ENDIF.
<b>IF NOT gt_resb[] IS INITIAL.
SELECT * FROM ausp
INTO TABLE gt_ausp
FOR ALL ENTRIES IN gt_resb
WHERE objek = gt_resb-charg
AND atinn IN ('LOBM_VFDAT','LOBM_QNDAT').
</b> ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = c_fmname
IMPORTING
FM_NAME = lf_fmname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
regards,
siri.
‎2006 Sep 21 12:14 PM
Hello,
It's nothing but type of field objek in AUSP and the type of the field "charg" in internal table should be one and the same.
Go to table AUSP and check for the type of the field and take that dataelement and refer it for the field charg in the internal table declaration.
Regs,
Venkat
‎2006 Sep 21 12:16 PM
hi,
This is because the field objek is char50 and charg is char10.
do this.
begin of gt_resb.
charg like ausp-objek.
end of gt_resb.
rgds
anver
if hlped mark points
‎2006 Sep 21 12:17 PM
IF NOT gt_resb[] IS INITIAL.
SELECT * FROM ausp
INTO TABLE gt_ausp
FOR ALL ENTRIES IN gt_resb
WHERE <b>objek = gt_resb-charg</b>
AND atinn IN ('LOBM_VFDAT','LOBM_QNDAT').
OBJEK length is 50 and charg length is 10. So thats why your query is giving error.
declare the gt_resb table by using.
data: begin of gt_resb occurs 0,
<b> charg like ausp-OBJEK,</b>all other fields
end of gt_resb.
Regards,
‎2006 Sep 21 12:18 PM
<b>DATA: gt_resb TYPE STANDARD TABLE OF resb</b>
make internal table instead of this.
data: begin of gt_resb occurs 0,
field requried,
<b>charge(50),</b>
end of gt_resb .
‎2006 Sep 21 12:28 PM
Thanx Kishan,
i got the same thought but in my smartform in form interface tables i declared the internal table like this.
<b>gt_resb like resb</b> then in this condition is it possible to change the length of that particular field <b>charg</b>
regards,
siri
‎2006 Sep 21 12:18 PM
hI,
You cannot use IN operator in the WHERE class of a select query when you use FOR ALL ENTRIES addition. Instead use separate conditions.
Rgds
‎2006 Sep 21 12:26 PM
Hi,
when using all entries comapring fields should be
of same type and length. change ur code as below
data:begin of gt_resb occurs 0.
include structire resg.
data charg1 like ausp-objek.
end of gt_resb.
loop at gt_resb.
gt_resb-charg1 = gt_resb-charg.
modify gt_resb transporting charg1.
endloop.
IF NOT gt_resb[] IS INITIAL.
SELECT * FROM ausp
INTO TABLE gt_ausp
FOR ALL ENTRIES IN gt_resb
<b>WHERE objek = gt_resb-charg1</b>AND atinn IN ('LOBM_VFDAT','LOBM_QNDAT').
ENDIF.
Regards
Amole
‎2006 Sep 21 12:35 PM
but in my smartform in form interface tables i declared the internal table like this.
gt_resb like resb then in this condition is it possible to change the length of that particular field charg
regards,
siri
‎2006 Sep 21 12:44 PM
ya u r rite it is not possible..
but u can do like that .
make anothe internal table like gt_resb1 where charge is 50 char.
gt_resb1[] = gt_resb[].
now fetch the recored based on gt_resb1