‎2009 Apr 20 9:34 AM
Hello Friends,
I am trying to use the method MAINTAIN of class CMD_EI_API in order to update relations data of a customer. The import parameter IS_MASTER_DATA of the method has deep structures and I am really confused on how to write data to such a structure. Can anyone pls explain how to access such a deep structure?
thx in advance,
Ali
‎2009 Apr 20 11:00 AM
Hello Ali
There is nothing special about complex structures like CMDS_EI_MAIN. It contains a single field CUSTOMERS which has a table type CMDS_EI_EXTERN_T (line type CMDS_EI_EXTERN).
You need to start from the most "internal" structure backwards to the complex structure.
DATA:
ls_master_data TYPE cmds_ei_main,
ls_customer TYPE cmds_ei_extern,
ls_sales_data TYPE CMDS_EI_CMD_SALES, " (ls_customer-sales_data)
ls_sale TYPE CMDS_EI_SALES,
ls_datakey TYPE CMDS_EI_SALES_KEY.
LOOP AT gt_vbak INTO ls_vbak.
ls_datakey-vkorg = ls_vbak-vkorg.
ls_datakey-vtweg = ls_vbak-vtweg.
ls_datakey-spart = ls_vbak-spart.
ls_sale-datakey = ls_datakey.
APPEND ls_sale TO ls_sales_data-sales.
ls_customer-sales_data = ls_sales_data.
APPEND ls_customer to ls_master_data-customers.
ENDLOOP.
Regards
Uwe
‎2009 Apr 20 11:00 AM
Hello Ali
There is nothing special about complex structures like CMDS_EI_MAIN. It contains a single field CUSTOMERS which has a table type CMDS_EI_EXTERN_T (line type CMDS_EI_EXTERN).
You need to start from the most "internal" structure backwards to the complex structure.
DATA:
ls_master_data TYPE cmds_ei_main,
ls_customer TYPE cmds_ei_extern,
ls_sales_data TYPE CMDS_EI_CMD_SALES, " (ls_customer-sales_data)
ls_sale TYPE CMDS_EI_SALES,
ls_datakey TYPE CMDS_EI_SALES_KEY.
LOOP AT gt_vbak INTO ls_vbak.
ls_datakey-vkorg = ls_vbak-vkorg.
ls_datakey-vtweg = ls_vbak-vtweg.
ls_datakey-spart = ls_vbak-spart.
ls_sale-datakey = ls_datakey.
APPEND ls_sale TO ls_sales_data-sales.
ls_customer-sales_data = ls_sales_data.
APPEND ls_customer to ls_master_data-customers.
ENDLOOP.
Regards
Uwe
‎2009 Apr 20 12:19 PM
Dear Uwe,
Thx for the answer. I was really confused but your answer solved my problem
Ali