‎2008 Aug 13 7:48 AM
Hi All ,
If not t_zcust[] not initial.
select BUKRS BELNR GJAHR XBLNR BLART DMBTR WRBTR from BSIS
into corresponding fields of table t_bsis
for all entries in t_zcust where
XBLNR EQ t_zcust-fileid and
BUKRS EQ '1010' and
BLART EQ 'KR'.
endif.
The above select query is correct as per syntax but here my problem is
In where condition i am checking XBLNR with T_ZCUST-FILEID.
XBLNR is length of Char 16 and FILEID is length of NUMC 10.
and we can not change the T_ZCUST-FILEID field technical attributes
How to Map the above condition in the above select query , is there any alternative way is there.
Thanks
Sathish.
‎2008 Aug 13 7:52 AM
Hi,
Try this way:
Declare an internal table (itab) with fileid filed alone but with datatype as CHAR16.
types: begin of x_itab,
fileid1 of type c length 16,
endof x_itab.
data: itab type standard table of x_itab,
wa_itab type x_itab.
Loop at t_zcust into wa_zcust.
wa_itab-fileid1 = wa_zcus-fileid
append wa_itab-filedi1 to itab.
endloop.
Now change the select query as follow
If not t_zcust[] not initial.
select BUKRS BELNR GJAHR XBLNR BLART DMBTR WRBTR from BSIS
into corresponding fields of table t_bsis
for all entries in itab where
XBLNR EQ itab-fileid1 and
BUKRS EQ '1010' and
BLART EQ 'KR'.
endif.
Hope this will help.
Regards,
Swarna Munukoti
Edited by: Swarna Munukoti on Aug 13, 2008 8:52 AM
‎2008 Aug 13 7:56 AM
hi create another table t_zcust1[] ,inside the defination add one extra field..say FILEID1..of type
BSIS-XBLNR
now..
t_zcust1[ ] = t_zcust[ ].
loop at t_zcust1.
t_zcust1-filed1 = t_zcust1-filed.
modify t_zcust1 transpaorting filed1.
endloop.
then use the select query as below...replacing t_zcust by t_zcust1.
If not t_zcust1[] not initial.
select BUKRS BELNR GJAHR XBLNR BLART DMBTR WRBTR from BSIS
into corresponding fields of table t_bsis
for all entries in t_zcust1 where
XBLNR EQ t_zcust1-fileid1 and
BUKRS EQ '1010' and
BLART EQ 'KR'.
endif.
here field1 and XBLNR have same datatype...
hope it helps u out....
Edited by: Rudra Prasanna Mohapatra on Aug 13, 2008 8:56 AM
‎2008 Aug 13 8:03 AM
Hi,
While using FOR ALL ENTRIES, fields with different data types cannot be matched in where condition.
So, the options are
1. Inside the loop, select the fields. But performance wise it is not recommended..
2. Other option is :
Move the field FILEID to other dummy field which has CHAR16 in the same internal table. Then use the select statement as u wrote by changing t_zcust-fileid into t_zcust-dummy_field..
Regards,
Prem
‎2008 Aug 13 8:20 AM
hi,
just check out this program program and follow the same.
TABLES: KONV, EKPO.
TYPES: BEGIN OF G_EKPO,
EBELN type ekpo-EBELN,
ebelp type ekpo-ebelP, " numeric length 5
END OF g_ekpo.
TYPES: BEGIN OF G_EKPO1,
ebeln type ekpo-ebeln,
ebelP type KONV-KPOSN,
END OF g_ekpo1.
TYPES: BEGIN OF G_KONV,
KNUMV type konv-KNUMV,
KPOSN type KONV-KPOSN, "numeric length 6
END OF g_KONV.
types: begin of itab,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
KNUMV type konv-KNUMV,
kposn type konv-kposn,
end of itab.
DATA : IT_EKPO TYPE STANDARD TABLE OF G_EKPO,
WA_EKPO TYPE G_EKPO.
DATA : IT_EKPO1 TYPE STANDARD TABLE OF G_EKPO1,
WA_EKPO1 TYPE G_EKPO1.
DATA : IT_KONV TYPE STANDARD TABLE OF G_KONV,
WA_KONV TYPE G_KONV.
data : it_itab type standard table of itab,
wa_itab type itab.
SELECT-OPTIONS : S_EBELP FOR EKPO-EBELP.
SELECT ebeln
EBELP
FROM EKPO
INTO TABLE IT_EKPO
WHERE EBElP IN S_EBELP.
IF SY-SUBRC EQ 0.
LOOP AT IT_EKPO INTO WA_EKPO.
wa_ekpo1-ebeln = wa_ekpo-ebeln.
WA_EKPO1-EBELP = WA_EKPO-EBELP.
APPEND WA_EKPO1 TO IT_EKPO1.
CLEAR WA_EKPO1.
ENDLOOP.
ENDIF.
SELECT KNUMV
KPOSN
FROM KONV
INTO TABLE IT_KONV
FOR ALL ENTRIES in IT_EKPO1
WHERE KPOSN = IT_EKPO1-EBELP.
loop at it_ekpo1 into wa_ekpo1.
read table it_konv with key kposn = wa_ekpo1-ebelp into wa_konv.
wa_itab-ebeln = wa_ekpo1-ebeln.
wa_itab-ebelp = wa_ekpo1-ebelp.
wa_itab-knumv = wa_konv-knumv.
wa_itab-kposn = wa_konv-kposn.
append wa_itab to it_itab.
clear wa_itab.
endloop.
loop at it_itab into wa_itab.
write : /1 wa_itab-ebeln,
15 wa_itab-ebelp,
25 wa_itab-knumv,
38 wa_itab-kposn.
endloop.
hope this will solve ur problem.
‎2008 Aug 13 8:20 AM
Hi,
data : loc_var(16) char.
If not t_zcust[] not initial.
loc_var = t_zcust-fileid.
select BUKRS BELNR GJAHR XBLNR BLART DMBTR WRBTR from BSIS
into corresponding fields of table t_bsis
for all entries in t_zcust where
XBLNR EQ loc_var and
BUKRS EQ '1010' and
BLART EQ 'KR'.
endif.
I hope this will solve your problem.
Regards,
Harish
‎2008 Aug 13 9:11 AM
Hi Sateesh,
if your t_zcust is internal table..
then declare one variable with length 16 in that internal table declaration.
ex:-
data: begin of t_zcust occurs 0,
var(16) type c,
........
end of t_zcust.
now use this field in where conditon for XBLNR.
hope it will help you,
have a nice day,
venkat