2010 Aug 17 12:09 PM
Hi,
Problem code is Below...
select * from cdpos into table gt_cdpos for all entries in gt_likp
where objectid = gt_likp-vbeln.
In where clause objectid has data type Char and lenth 90 and for likp-vbeln (data type Char and lenth 10).Its giving
mismatch error.
Kindly give some solution on this.
Regards,
Shekhar
2010 Aug 17 1:01 PM
Hi Chandrashekhar,
Declare another internal table GT_LIKP1 with same ifelds as GT_LIKP but for field VEBLN declare it as TYPE CHAR & Length 90.
Then use below code :-
IF NOT GT_LIKP[] IS INITIAL
GT_LIKP1[] = GT_LIKP
ENDIF.then use GT_LIKP1 in the subsequent code.
select * from cdpos into table gt_cdpos for all entries in gt_likp
where objectid = gt_likp1-vbeln.Close the thread if this solves your question.
Regards
Abhii
Edited by: Abhii on Aug 17, 2010 2:01 PM
Hi,
Problem code is Below...
select * from cdpos into table gt_cdpos for all entries in gt_likp
where objectid = gt_likp-vbeln.
In where clause objectid has data type Char and lenth 90 and for likp-vbeln (data type Char and lenth 10).Its giving
mismatch error.
Kindly give some solution on this.
Regards,
Shekhar
2010 Aug 17 12:15 PM
delcare data variable of correct type. In needed, put it into an internal table and create that table with the content of your GT_LIKP, or set equal to a single value of vbeln. SELECT with the variable or the table containing the right data type.
2010 Aug 17 12:16 PM
hi
Change gt_likp-vbeln type to CDPOS-OBJECTID
regards
Deepak.
2010 Aug 17 12:28 PM
Hi,
To compare in where clause the fields should be of same data type and length.
Here objectid and gt_likp-vbeln should be same data type and length.
2010 Aug 17 12:34 PM
Hi,
Create a new field in the internal table gt_likp with the field defined as cdpos-objectid.
Loop at the table gt_likp and copy the contents to the new field.
Use for all entries using the new field.
Hope it helps.
Sujay
2010 Aug 17 12:53 PM
these techniques which u all suggested is not helpful.I am unable to get solution.Plz give some other solution.Can i do some data conversion at where clause?
Edited by: chandra shekhar dubey on Aug 17, 2010 1:54 PM
2010 Aug 17 1:01 PM
Hi Chandrashekhar,
Declare another internal table GT_LIKP1 with same ifelds as GT_LIKP but for field VEBLN declare it as TYPE CHAR & Length 90.
Then use below code :-
IF NOT GT_LIKP[] IS INITIAL
GT_LIKP1[] = GT_LIKP
ENDIF.then use GT_LIKP1 in the subsequent code.
select * from cdpos into table gt_cdpos for all entries in gt_likp
where objectid = gt_likp1-vbeln.Close the thread if this solves your question.
Regards
Abhii
Edited by: Abhii on Aug 17, 2010 2:01 PM
2010 Aug 18 6:00 AM
Hi Abhii,
Its still giving error.....gt_likp1 cannot be conveted to gt_likp.
2010 Aug 18 6:04 AM
Hi
Can you post the relevant code so that i will have a look.
Regards
Abhii
2010 Aug 18 6:06 AM
Hey
select * from cdpos into table gt_cdpos for all entries in gt_likp1
where objectid = gt_likp1-vbeln.
.
Change the code as above, this will definitely work.
And also
IF NOT GT_LIKP[] IS INITIAL
GT_LIKP1[] = GT_LIKP[]
ENDIF.
In the above code I had forgotten to mentiom [] for gt_likp
In the for all entries I had forgotten to mention gt_likp1 instead of gt_likp.
Regards
Abhii
2010 Aug 18 6:07 AM
Below is the code.......
report zsd_pod_rep.
type-pools : slis.
tables : vbrk,likp,vbpa,cdpos,cdhdr.
data : gt_fieldcat type slis_t_fieldcat_alv,
gs_fieldcat type slis_fieldcat_alv,
gs_layout type slis_layout_alv,
gs_variant like disvariant,
gv_repid like sy-repid,
gv_save.
data : objectid1 TYPE CDOBJECTV.
data : begin of gt_likp occurs 0,
vbeln like likp-vbeln,
erdat like likp-erdat,
vstel like likp-vstel,
trspg like likp-trspg,
bolnr like likp-bolnr,
traty like likp-traty,
end of gt_likp.
data : begin of gt_likp1 occurs 0,
vbeln(90) TYPE C,
erdat like likp-erdat,
vstel like likp-vstel,
trspg like likp-trspg,
bolnr like likp-bolnr,
traty like likp-traty,
end of gt_likp1.
gt_likp like likp occurs 0 with header line,
data : gt_cdpos like cdpos occurs 0 with header line,
gt_cdhdr like cdhdr occurs 0 with header line,
gt_vbfa like vbfa occurs 0 with header line,
gt_vbfa1 like vbfa occurs 0 with header line,
gt_vbpa like vbpa occurs 0 with header line,
gt_vbpa1 like vbpa occurs 0 with header line,
gt_vbrk like vbrk occurs 0 with header line,
gt_kna1 like kna1 occurs 0 with header line,
gt_vbak like vbak occurs 0 with header line,
gt_tvtyt like tvtyt occurs 0 with header line,
gt_ttsgt like ttsgt occurs 0 with header line,
gt_cust like gt_vbpa occurs 0 with header line.
data : begin of gt_output occurs 0,
vbeln like likp-vbeln,
erdat like likp-erdat,
vstel like likp-vstel,
vbeln1 like vbak-vbeln, "So No "VAR902035
vbeln1(10) TYPE c, "VAR902035
zauart like vbrk-zauart, "So type
inv_no like vbrk-vbeln, "VAR902035
inv_no(10) TYPE c, "VAR902035
inv_dt like vbrk-fkdat,
kunnr like vbpa-kunnr,
name2 like kna1-name1,
ort01 like kna1-ort01,
traty like likp-traty, "mode of dispatch
vtext like tvtyt-vtext,
trspg like likp-trspg, "status
bezei like ttsgt-bezei,
pod_no like likp-bolnr,
kunnr1 like vbpa-kunnr,
name1 like kna1-name1,
udate like cdhdr-udate,
objectid like cdpos-objectid,
changenr like cdpos-changenr,
end of gt_output.
selection-screen : begin of block blk1 with frame.
select-options : s_vbeln for likp-vbeln,
s_auart for vbrk-zauart no intervals,
s_erdat for likp-erdat,
s_vbeln1 for vbrk-vbeln,
s_kunnr for vbpa-kunnr, "ship to party
s_kunnr1 for vbpa-kunnr,
s_vstel for likp-vstel. "courier no
selection-screen : end of block blk1.
start-of-selection.
perform get_data.
perform disp_data.
&----
*& Form get_data
&----
form get_data .
select vbeln erdat vstel trspg bolnr
from likp
into table gt_likp
where vbeln in s_vbeln
and erdat in s_erdat
and vstel in s_vstel .
data : objectid1 like likp-vbeln.
move gt_likp-vbeln to objectid1.
if gt_likp-trspg = '01'.
IF NOT GT_LIKP[] IS INITIAL.
move gt_likp to gt_likp1.
GT_LIKP1[] = GT_LIKP.
move: gt_likp-vbeln to gt_likp1-vbeln.
gt_likp-erdat to gt_likp1-erdat,
gt_likp-vstel to gt_likp1-vstel,
gt_likp-trspg to gt_likp1-trspg,
gt_likp-bolnr to gt_likp1-bolnr.
ENDIF.
select * from cdpos into table gt_cdpos for all entries in gt_likp1
where objectid = gt_likp1-vbeln.
if gt_cdpos is not initial.
select * from cdhdr into table gt_cdhdr
for all entries in gt_cdpos
where objectid = gt_cdpos-objectid AND
changenr = gt_cdpos-changenr.
endif.
*
if gt_likp[] is not initial.
select *
from vbfa
into table gt_vbfa
for all entries in gt_likp
where vbelv = gt_likp-vbeln
and vbtyp_n = 'M'
and vbtyp_v = 'J'.
select *
from vbfa
into table gt_vbfa1
for all entries in gt_likp
where vbeln = gt_likp-vbeln
and vbtyp_n = 'J'
and vbtyp_v = 'C'.
select *
from vbpa
into table gt_vbpa
for all entries in gt_likp
where vbeln = gt_likp-vbeln
and parvw = 'WE'
and kunnr in s_kunnr.
select *
from vbpa
into table gt_vbpa1
for all entries in gt_likp
where vbeln = gt_likp-vbeln
and parvw = 'ZB'
and kunnr in s_kunnr1.
select *
from tvtyt
into table gt_tvtyt
for all entries in gt_likp
where spras = sy-langu
and traty = gt_likp-traty.
select *
from ttsgt
into table gt_ttsgt
for all entries in gt_likp
where spras = sy-langu
and trspg = gt_likp-trspg.
endif.
if gt_vbfa[] is not initial.
select *
from vbrk
into table gt_vbrk
for all entries in gt_vbfa
where vbeln = gt_vbfa-vbeln
and zauart in s_auart.
endif.
delete gt_vbrk where vbeln not in s_vbeln1.
if gt_vbfa1[] is not initial.
select *
from vbak
into table gt_vbak
for all entries in gt_vbfa1
where vbeln = gt_vbfa1-vbelv
and auart in s_auart.
endif.
append lines of gt_vbpa to gt_cust.
append lines of gt_vbpa1 to gt_cust.
if gt_cust[] is not initial.
select *
from kna1
into table gt_kna1
for all entries in gt_cust
where kunnr = gt_cust-kunnr.
endif.
sort gt_cdhdr descending.
loop at gt_likp.
gt_output-vbeln = gt_likp-vbeln.
gt_output-erdat = gt_likp-erdat.
gt_output-traty = gt_likp-traty.
gt_output-trspg = gt_likp-trspg.
gt_output-pod_no = gt_likp-bolnr.
gt_output-vstel = gt_likp-vstel.
if gt_likp-trspg = '01'.
data : objectid2 TYPE CDOBJECTV.
move : gt_likp to gt_likp1.
move gt_output-vbeln to objectid2.
read table gt_cdpos with key objectid = gt_likp1-vbeln.
if sy-subrc = 0.
gt_output-objectid = gt_cdpos-objectid.
gt_output-changenr = gt_cdpos-changenr.
endif.
read table gt_cdhdr with key OBJECTID = gt_output-objectid
changenr = gt_output-changenr.
if sy-subrc = 0.
gt_output-udate = gt_cdhdr-udate.
endif.
endif.
read table gt_tvtyt with key traty = gt_likp-traty.
if sy-subrc = 0.
gt_output-vtext = gt_tvtyt-vtext.
endif.
read table gt_ttsgt with key trspg = gt_likp-trspg.
if sy-subrc = 0.
gt_output-bezei = gt_ttsgt-bezei.
endif.
read table gt_vbfa with key vbelv = gt_likp-vbeln.
if sy-subrc = 0.
read table gt_vbrk with key vbeln = gt_vbfa-vbeln.
if sy-subrc = 0.
gt_output-inv_no = gt_vbrk-vbeln.
gt_output-inv_dt = gt_vbrk-fkdat.
endif.
endif.
read table gt_vbfa1 with key vbeln = gt_likp-vbeln.
if sy-subrc = 0.
gt_output-vbeln1 = gt_vbfa1-vbelv.
endif.
read table gt_vbak with key vbeln = gt_vbfa1-vbelv.
if sy-subrc = 0.
gt_output-zauart = gt_vbak-auart.
endif.
read table gt_vbpa with key vbeln = gt_likp-vbeln.
if sy-subrc = 0.
gt_output-kunnr = gt_vbpa-kunnr.
endif.
clear gt_kna1.
read table gt_kna1 with key kunnr = gt_output-kunnr.
if sy-subrc = 0.
gt_output-name2 = gt_kna1-name1.
gt_output-ort01 = gt_kna1-ort01.
endif.
read table gt_vbpa1 with key vbeln = gt_likp-vbeln.
if sy-subrc = 0.
gt_output-kunnr1 = gt_vbpa1-kunnr.
endif.
clear gt_kna1.
read table gt_kna1 with key kunnr = gt_output-kunnr1.
if sy-subrc = 0.
gt_output-name1 = gt_kna1-name1.
endif.
append gt_output.
clear gt_output.
endloop.
if s_auart is not initial.
delete gt_output where zauart not in s_auart.
endif.
if s_kunnr is not initial.
delete gt_output where kunnr not in s_kunnr.
endif.
if s_kunnr1 is not initial.
delete gt_output where kunnr1 not in s_kunnr1.
endif.
if s_vbeln1 is not initial.
delete gt_output where inv_no not in s_vbeln1.
endif.
endform. " get_data
&----
*& Form disp_data
&----
form disp_data .
perform build_fieldcat using :
"VAR902035 - Start
'VBELN' 'GT_OUTPUT' '10' 'Delivery No' '',
'ERDAT' 'GT_OUTPUT' '10' 'Delivery Date' '',
'VSTEL' 'GT_OUTPUT' '4' 'Plant' '',
'VBELN1' 'GT_OUTPUT' '10' 'SO No' '',
'ZAUART' 'GT_OUTPUT' '4' 'SO Type' '',
'INV_NO' 'GT_OUTPUT' '10' 'Inv No' '',
'INV_DT' 'GT_OUTPUT' '10' 'Inv Date' '',
'KUNNR' 'GT_OUTPUT' '10' 'Ship to Party' '',
'NAME2' 'GT_OUTPUT' '30' 'Ship to Party Name' '',
'ORT01' 'GT_OUTPUT' '25' 'Ship to Party City' '',
'TRATY' 'GT_OUTPUT' '' 'Mode of dispatch' '',
'VTEXT' 'GT_OUTPUT' '20' 'Mode of dispatch' '',
'TRSPG' 'GT_OUTPUT' '' 'Status' '',
'BEZEI' 'GT_OUTPUT' '25' 'Status' '',
'POD_NO' 'GT_OUTPUT' '35' 'POD No' '',
'KUNNR1' 'GT_OUTPUT' '10' 'Courier Code' '',
'NAME1' 'GT_OUTPUT' '30' 'Courier Name' ''.
'WERKS' 'GT_OUTPUT' '5' 'Plant' ''.
'VBELN' 'GT_OUTPUT' '' 'Delivery No' '',
'ERDAT' 'GT_OUTPUT' '' 'Delivery Date' '',
'VSTEL' 'GT_OUTPUT' '' 'Plant' '',
'VBELN1' 'GT_OUTPUT' '' 'SO No' '',
'ZAUART' 'GT_OUTPUT' '' 'SO Type' '',
'INV_NO' 'GT_OUTPUT' '' 'Inv No' '',
'INV_DT' 'GT_OUTPUT' '' 'Inv Date' '',
'KUNNR' 'GT_OUTPUT' '' 'Ship to Party' '',
'NAME2' 'GT_OUTPUT' '' 'Ship to Party Name' '',
'ORT01' 'GT_OUTPUT' '' 'Ship to Party City' '',
'TRATY' 'GT_OUTPUT' '' 'Mode of dispatch' '',
'VTEXT' 'GT_OUTPUT' '' 'Mode of dispatch' '',
'BEZEI' 'GT_OUTPUT' '' 'Status' '',
'POD_NO' 'GT_OUTPUT' '' 'POD No' '',
'KUNNR1' 'GT_OUTPUT' '' 'Courier Code' '',
'NAME1' 'GT_OUTPUT' '' 'Courier Name' '',
'TRSPG' 'GT_OUTPUT' '' 'POD Status' '',
'UDATE' 'GT_OUTPUT' '' 'POD Date' ''.
'WERKS' 'GT_OUTPUT' '5' 'Plant' ''.
"VAR902035 - End
gs_variant-report = sy-repid.
gv_repid = sy-repid.
gv_save = 'A'.
gs_layout-colwidth_optimize = 'X'. "VAR902035
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gv_repid
is_layout = gs_layout
i_save = gv_save
is_variant = gs_variant
it_fieldcat = gt_fieldcat[]
tables
t_outtab = gt_output
exceptions
program_error = 1
others = 2.
endform. " disp_data
&----
*& Form build_fieldcat
&----
form build_fieldcat using %fname
%tabname
%outputlen
%seltext
%sum.
gs_fieldcat-fieldname = %fname.
gs_fieldcat-tabname = %tabname.
gs_fieldcat-outputlen = %outputlen.
gs_fieldcat-seltext_l = %seltext.
gs_fieldcat-do_sum = %sum.
append gs_fieldcat to gt_fieldcat.
endform. " build_fieldcat
2010 Aug 18 6:08 AM
Hey
select * from cdpos into table gt_cdpos for all entries in gt_likp1
where objectid = gt_likp1-vbeln..
Change the code as above, this will definitely work.
And also
IF NOT GT_LIKP[] IS INITIAL
GT_LIKP1[] = GT_LIKP[]
ENDIF.In the above code I had forgotten to mentiom [] for gt_likp
In the for all entries I had forgotten to mention gt_likp1 instead of gt_likp.
Regards
Abhii
2010 Aug 18 6:09 AM
Its giving error for this line.............................
GT_LIKP1[] = GT_LIKP.
2010 Aug 18 6:13 AM
Hi
Amend it as
GT_LIKP1[] = GT_LIKP[]close the thread if this solves your query.
Regards
Abhii
2010 Aug 18 6:15 AM
Another proble is that while passing the data from gt_likp to gt_likp1 all data fron gt_likp is copied to gt_likp1-vbeln field only.
2010 Aug 18 6:16 AM
2010 Aug 18 6:23 AM
data : begin of gt_likp occurs 0,
vbeln like likp-vbeln,
erdat like likp-erdat,
vstel like likp-vstel,
trspg like likp-trspg,
bolnr like likp-bolnr,
traty like likp-traty,
end of gt_likp.
data : begin of gt_likp1 occurs 0,
vbeln(90) TYPE C,
erdat like likp-erdat,
vstel like likp-vstel,
trspg like likp-trspg,
bolnr like likp-bolnr,
traty like likp-traty,
end of gt_likp1.
select vbeln erdat vstel trspg bolnr
from likp
into table gt_likp
where vbeln in s_vbeln
and erdat in s_erdat
and vstel in s_vstel .
IF NOT GT_LIKP[] IS INITIAL.
GT_LIKP1[] = GT_LIKP[].
ENDIF.
select * from cdpos into table gt_cdpos for all entries in gt_likp1
where objectid = gt_likp1-vbeln.
2010 Aug 18 6:23 AM
Hi,
Replace
This
gt_likp1[] = gt_likp[].With this one
LOOP AT gt_likp.
MOVE-CORRESPONDING gt_likp TO gt_likp1.
APPEND gt_likp1 TO gt_likp1.
ENDLOOP.Regards,
Faisal
2010 Aug 18 6:56 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |