‎2008 Sep 02 12:54 PM
In my requirement I have fetched pspnr from prps table and have placed in a internal table in the same way fetched projn and placed in another internal table.
Have to combine both the internal table into a single table so used move codn
Move a to c
Move b to c
In this codn though the values are present in a and not b the values are getting overwritten and the table c doesnu2019t have any value.
How to code this part
‎2008 Sep 02 12:59 PM
Hi,
if all 3 tables have the same structure:
MOVE <itab1> TO <itab3>.
APPEND LINES OF <itab2> TO <itab3>.
if they have different structure:
LOOP AT <itab1>.
<itab3-field> = <itab1-field>.
READ TABLE <itab2> INTO... WITH KEY .....
<itab3-field> = <itab2-field>
ENDLOOP.
Regards
Indu.
‎2008 Sep 02 12:59 PM
Hi,
if all 3 tables have the same structure:
MOVE <itab1> TO <itab3>.
APPEND LINES OF <itab2> TO <itab3>.
if they have different structure:
LOOP AT <itab1>.
<itab3-field> = <itab1-field>.
READ TABLE <itab2> INTO... WITH KEY .....
<itab3-field> = <itab2-field>
ENDLOOP.
Regards
Indu.
‎2008 Sep 02 1:00 PM
Hi,
loop at itab1.
itab3 = itab1.
append itab3.
endloop.
loop at itab2.
itab3 = itab2.
append itab3.
endloop.
Regards,
Harish
Edited by: Harish Kumar on Sep 2, 2008 5:52 PM
‎2008 Sep 02 1:06 PM
Creat A internal table and fetch data from PRPS,
Create C internal Table and fetch data PROJN from second table for all interies in A internal table.
This way u can get all the records from both tables
or
INNER JOIN on both tables from where u r getting data of PSPNR and PROJN.
‎2008 Sep 02 1:17 PM
hi,
u need to fetch data by clubbing both the table. use for all entries or inner join, than only u will get proper data.
i am sending my sample code check it and
try to code like this :
TABLES: vbrk.
types: begin of gs_vbrk,
vbeln TYPE vbrk-vbeln,
waerk TYPE vbrk-waerk,
fkdat TYPE vbrk-fkdat,
kunag TYPE vbrk-kunag,
end of gs_vbrk.
data: it_vbrk type standard table of gs_vbrk,
wa_vbrk type gs_vbrk.
types: begin of gs_vbrp,
VBELN type vbrp-VBELN, "sales order
MATNR type vbrp-MATNR, "material no
ARKTX type vbrp-ARKTX, "material description
ntgew type vbrp-ntgew, "quantity
gewei type vbrp-gewei, "quantity unit
netwr type vbrp-netwr, "currency
WERKS type vbrp-WERKS, "plant
end of gs_vbrp.
data: it_vbrp type standard table of gs_vbrp,
wa_vbrp type gs_vbrp.
****************************************************
types: begin of gs_final0,
vbeln TYPE vbrk-vbeln,
waerk TYPE vbrk-waerk,
fkdat TYPE vbrk-fkdat,
kunag TYPE vbrk-kunag,
MATNR type vbrp-MATNR, "material no
ARKTX type vbrp-ARKTX, "material description
ntgew type vbrp-ntgew, "quantity
gewei type vbrp-gewei, "quantity unit
netwr type vbrp-netwr, "currency
WERKS type vbrp-WERKS, "plant
end of gs_final0.
data: it_final0 type standard table of gs_final0,
wa_final0 type gs_final0.
*******************************************************
*******************************************************
select-options: s_vbeln for vbrk-vbeln.
.
*****************************************************
select vbeln
waerk
fkdat
kunag from vbrk into table it_vbrk where vbeln in s_vbeln.
select VBELN
MATNR
ARKTX
ntgew
gewei
netwr
WERKS from vbrp into table it_vbrp for all entries in it_vbrk where vbeln eq it_vbrk-vbeln.
loop at it_vbrk into wa_vbrk.
move wa_vbrk-vbeln to wa_final0-vbeln.
move wa_vbrk-waerk to wa_final0-waerk.
move wa_vbrk-fkdat to wa_final0-fkdat.
move wa_vbrk-kunag to wa_final0-kunag.
read table it_vbrp into wa_vbrp with key wa_vbrk-vbeln.
move wa_vbrp-MATNR to wa_final0-MATNR.
move wa_vbrp-ARKTX to wa_final0-ARKTX.
move wa_vbrp-ntgew to wa_final0-ntgew.
move wa_vbrp-gewei to wa_final0-gewei.
move wa_vbrp-netwr to wa_final0-netwr.
move wa_vbrp-WERKS to wa_final0-WERKS.
append wa_final0 to it_final0.
clear wa_final0.
endloop.