Hi abapers,
I ahve an requiremnet to fetch data from table LTAK for the entries fetched from VBFA.the thing is i need to pass VBFA-VBELN to LTAK-TANUM to fetch the records.
Both are of different types and different length .so is it possible to compare these fields.the following is the piece of code for your reference.
SELECT vbelv vbeln vbtyp_n lgnum FROM vbfa INTO TABLE i_vbfa WHERE vbelv EQ p_del AND vbtyp_n EQ 'Q'. IF sy-subrc EQ 0. SORT i_vbfa BY vbelv. DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv. SELECT lgnum tanum kquit FROM ltak INTO TABLE i_ltak FOR ALL ENTRIES IN i_vbfa WHERE lgnum EQ i_vbfa-lgnum AND *tanum EQ i_vbfa-vbeln *
So please help me in solving this issue.
Thanks in Advance.
Balaji
Hi,
try this:
SELECT vbelv vbeln vbtyp_n lgnum FROM vbfa INTO TABLE i_vbfa WHERE vbelv EQ p_del AND vbtyp_n EQ 'Q'. IF sy-subrc EQ 0. SORT i_vbfa BY vbelv. DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv. call function 'CONVERSIO_EXIT_ALPHA_INPUT' exporting input = i_vbfa-vbeln importing output = lv_tanum SELECT lgnum tanum kquit FROM ltak INTO TABLE i_ltak FOR ALL ENTRIES IN i_vbfa WHERE lgnum EQ i_vbfa-lgnum AND tanum EQ lv_tanum
with lv_tanum of type tanum
grtz,
Koen
Hi,
Please use the code,
data : tanum like ltak-tanum.
SELECT vbelv vbeln vbtyp_n lgnum FROM vbfa
INTO TABLE i_vbfa
WHERE vbelv EQ p_del
AND vbtyp_n EQ 'Q'.
IF sy-subrc EQ 0.
SORT i_vbfa BY vbelv.
DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv.
clear tanum.
tanum = i_vbfa-vbeln.
SELECT lgnum tanum kquit FROM ltak
INTO TABLE i_ltak
FOR ALL ENTRIES IN i_vbfa
WHERE lgnum EQ i_vbfa-lgnum
AND *tanum EQ tanum*
Regards,
Sankar.
For all entries will not allow to compare fields of different types ..
create your internal table 'i_vbfa' as
data : begin of i_vbfa occurs 0,
vbelv like vbfa-vbelv
vbeln like ltak-tanum,
vbtyp_n like vbfa-vbtyp_n
lgnum like vbfa-lgnum
end of i_vbfa.
Add a comment