Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

use deep structure in method

Former Member
0 Likes
912

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

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
597

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

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
598

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

Read only

0 Likes
597

Dear Uwe,

Thx for the answer. I was really confused but your answer solved my problem

Ali