2016 Jun 30 2:53 PM
Hi,
My question is simple,Like
i have two select queries, in the first select query i am getting three fields -partner,taxtype,taxnum from a standard table and stored in IT1.
This it1 values are called through a custom function module in that we write another select query like as above
code :
--------
if it1 is not initial.
DELETE ADJACENT DUPLICATES FROM lt_dfkk[].
SELECT mc_name1 mc_name2 bu_sort1 bu_sort2 partner FROM but000
INTO CORRESPONDING FIELDS OF TABLE lt_result
UP TO callcontrol-maxrecords ROWS
FOR ALL ENTRIES IN lt_dfkk WHERE
partner = lt_dfkk-partner.
here i want to get taxtype taxnum in lt_result table.
What is the possible way to make it happen ???
2016 Jun 30 3:05 PM
You can make this:
SELECT mc_name1 mc_name2 bu_sort1 bu_sort2 partner FROM but000
INTO CORRESPONDING FIELDS OF TABLE lt_result
To
SELECT mc_name1 mc_name2 bu_sort1 bu_sort2 partner FROM but000
INTO TABLE lt_it2
Declare a result table with all fields required and move values from it1 and lt_it2 to lt_result.
Does this help?
Thanks,
Sowbhagya
2016 Jun 30 3:12 PM
If the OP has to merge the data, why he has to use another table?
He can do the select as he already does and then update LT_RESULT with data from IT1.
I do not see any benefit in using another internal table!
2016 Jun 30 3:09 PM
I do not understand your requirement or the issue you are facing and what you tried to solve.
If I understood well, you need to merge data from IT1 and LT_RESULT, correct?
2016 Jun 30 4:00 PM
Not sure If I understand your requirement correctly, but as Simone mentioned, you could do something like this:
Assuming your IT_RESULT already has both the taxtype and taxnum fields, Loop at IT_RESULT and read IT1 with key Partner and modify with those two field values. Hope it helps!!
2016 Jul 01 7:38 AM
2016 Jul 01 10:55 AM
Hi,
Declare work areas for the two internal table.
then.
data : idx type i.
Loop at lt_result into wa_result.
idx = sy-tabix.
Read table lt_dfkk into wa_dfkk with key partner = wa_result-partner
if sy-subrc = 0.
wa_result-taxtype = wa_dfkk-taxtype.
wa_result-taxnum = wa_dfkk-taxnum.
modify it_result from wa_result index idx transporting taxtype taxnum.
endif.
endloop.
Thanks.