2022 Sep 25 2:04 PM
Hello SAP Devs,
As the title states I want to know if it is possible within abap to copy the content of an internal table into another one even if the second IT has a slightly different structure (lesser columns ) ?
The reason am asking is that I'm trying to use 'BAPI_PO_GETDETAIL' to retrieve purchase order items.
The above mentioned function expects an internal table 'it_po_items' which apparently should be of a structure 1x187 ( all columns of bapiekpo) otherwise I get a runtime error.
Doing so I can't later transfer part of the content of it_po_items (11 columns only ) into et_entityset / workarea ( not mutually convertible) .
CALL FUNCTION 'BAPI_PO_GETDETAIL'
exporting
purchaseorder = p_ebeln
items = 'X'
TABLES
* return = lt_return
po_items = it_po_items .
TYPES:
BEGIN of line_01,
po_number TYPE ebeln ,
po_item TYPE ebelp ,
SHORT_TEXT TYPE TXZ01 ,
MATERIAL TYPE MATNR ,
CO_CODE TYPE BUKRS ,
PLANT TYPE EWERK ,
STORE_LOC TYPE LGORT_D ,
MAT_GRP TYPE MATKL ,
TARGET_QTY TYPE KTMNG ,
NET_PRICE TYPE BPREIBAPI,
NET_VALUE TYPE NWERTBAPI ,
END OF line_01 .
DATA:
it_po_items TYPE STANDARD TABLE OF bapiekpo , " internal table declaration
wa_po_items type line_01 ,
p_ebeln type ekko-ebeln .
Hello SAP Devs,
As the title states I want to know if it is possible within abap to copy the content of an internal table into another one even if the second IT has a slightly different structure (lesser columns ) ?
The reason am asking is that I'm trying to use 'BAPI_PO_GETDETAIL' to retrieve purchase order items.
The above mentioned function expects an internal table 'it_po_items' which apparently should be of a structure 1x187 ( all columns of bapiekpo) otherwise I get a runtime error.
Doing so I can't later transfer part of the content of it_po_items (11 columns only ) into et_entityset / workarea ( not mutually convertible) .
CALL FUNCTION 'BAPI_PO_GETDETAIL'
exporting
purchaseorder = p_ebeln
items = 'X'
TABLES
* return = lt_return
po_items = it_po_items .
TYPES:
BEGIN of line_01,
po_number TYPE ebeln ,
po_item TYPE ebelp ,
SHORT_TEXT TYPE TXZ01 ,
MATERIAL TYPE MATNR ,
CO_CODE TYPE BUKRS ,
PLANT TYPE EWERK ,
STORE_LOC TYPE LGORT_D ,
MAT_GRP TYPE MATKL ,
TARGET_QTY TYPE KTMNG ,
NET_PRICE TYPE BPREIBAPI,
NET_VALUE TYPE NWERTBAPI ,
END OF line_01 .
DATA:
it_po_items TYPE STANDARD TABLE OF bapiekpo , " internal table declaration
wa_po_items type line_01 ,
p_ebeln type ekko-ebeln .
2022 Sep 25 3:01 PM
2022 Sep 26 10:17 AM
Hi ihebdhouibi,
You can use Component operator - CORRESPONDING, which makes it possible to define separate mapping rules statically. Refer the following link to know more about it.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |