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

SAP (CMD_API) is not returning the Partner functions!!

former_member202077
Participant
0 Likes
1,801

Hello,

I am trying to get get partner functions by using a API class as below,

  DATA:
    ls_head      TYPE cmds_ei_header,
    ls_cust      TYPE cmds_ei_extern,
    ls_cust_tmp  TYPE cmds_ei_extern,
    ls_e_main    TYPE cmds_ei_main,
    ls_i_main    TYPE cmds_ei_main,
    ls_sales     TYPE cmds_ei_sales,
    ls_sales_ori TYPE cmds_ei_sales,
    lt_sales     TYPE cmds_ei_sales_t,
    ls_functions TYPE cmds_ei_functions,
    lt_functions TYPE cmds_ei_functions_t.
    lt_custs     TYPE cmds_ei_extern_t,
    lv_task      TYPE cmd_ei_object_task.

    CONSTANTS:
    lc_cur_status TYPE cmd_ei_object_task VALUE 'M', "Create/Change
    lc_obj_create TYPE cmd_ei_object_task VALUE 'I', "Create
    lc_obj_change TYPE cmd_ei_object_task VALUE 'U'. "Change

      DATA: ls_sales_in     TYPE cmds_ei_sales,
                lt_sales_in     TYPE cmds_ei_sales_t.

    ls_sales_in-task = lc_cur_status.
    ls_sales_in-data_key-vkorg =  '1000'.
    ls_sales_in-data_key-vtweg =  '01'.
    ls_sales_in-data_key-spart =  '02'.
    APPEND ls_sales_in TO lt_sales_in.
    ls_cust-sales_data-sales = lt_sales_in.

    ls_head-object_instance = '103455'. "Customer number
    ls_head-object_task = lc_cur_status.
    ls_cust-header = ls_head.
    APPEND ls_cust TO lt_custs.
    ls_e_main-customers = lt_custs.


    CALL METHOD cmd_ei_api_extract=>get_data
      EXPORTING
        is_master_data = ls_e_main
      IMPORTING
        es_master_data = ls_i_main
        es_error       = les_error.

But, am not getting any PARTNER functions in import 'ls_i_main' parameter!! where as i am getting all the REST of the data, except partner functions data!

Pls. let me know what i am missing? Am i passing the sales area (VKORG / VTWEG / SPART) to the API under EXPORT param correctly? Pls. execute this code snippet in your system for more clarity of the issue, providing the Sales org, DC and division as per your system

Thank you

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,277

Did you tried commenting those SALES AREA related input parameters (LS_SALES_IN & LS_CUST-SALES_DATA-SALES) ?

Regards, Vinod

Hello,

I am trying to get get partner functions by using a API class as below,

  DATA:
    ls_head      TYPE cmds_ei_header,
    ls_cust      TYPE cmds_ei_extern,
    ls_cust_tmp  TYPE cmds_ei_extern,
    ls_e_main    TYPE cmds_ei_main,
    ls_i_main    TYPE cmds_ei_main,
    ls_sales     TYPE cmds_ei_sales,
    ls_sales_ori TYPE cmds_ei_sales,
    lt_sales     TYPE cmds_ei_sales_t,
    ls_functions TYPE cmds_ei_functions,
    lt_functions TYPE cmds_ei_functions_t.
    lt_custs     TYPE cmds_ei_extern_t,
    lv_task      TYPE cmd_ei_object_task.

    CONSTANTS:
    lc_cur_status TYPE cmd_ei_object_task VALUE 'M', "Create/Change
    lc_obj_create TYPE cmd_ei_object_task VALUE 'I', "Create
    lc_obj_change TYPE cmd_ei_object_task VALUE 'U'. "Change

      DATA: ls_sales_in     TYPE cmds_ei_sales,
                lt_sales_in     TYPE cmds_ei_sales_t.

    ls_sales_in-task = lc_cur_status.
    ls_sales_in-data_key-vkorg =  '1000'.
    ls_sales_in-data_key-vtweg =  '01'.
    ls_sales_in-data_key-spart =  '02'.
    APPEND ls_sales_in TO lt_sales_in.
    ls_cust-sales_data-sales = lt_sales_in.

    ls_head-object_instance = '103455'. "Customer number
    ls_head-object_task = lc_cur_status.
    ls_cust-header = ls_head.
    APPEND ls_cust TO lt_custs.
    ls_e_main-customers = lt_custs.


    CALL METHOD cmd_ei_api_extract=>get_data
      EXPORTING
        is_master_data = ls_e_main
      IMPORTING
        es_master_data = ls_i_main
        es_error       = les_error.

But, am not getting any PARTNER functions in import 'ls_i_main' parameter!! where as i am getting all the REST of the data, except partner functions data!

Pls. let me know what i am missing? Am i passing the sales area (VKORG / VTWEG / SPART) to the API under EXPORT param correctly? Pls. execute this code snippet in your system for more clarity of the issue, providing the Sales org, DC and division as per your system

Thank you

6 REPLIES 6
Read only

former_member202077
Participant
0 Likes
1,277

Any help pls?

Read only

Former Member
0 Likes
1,278

Did you tried commenting those SALES AREA related input parameters (LS_SALES_IN & LS_CUST-SALES_DATA-SALES) ?

Regards, Vinod

Read only

0 Likes
1,277

Thank you, yup, you are correct that, if i comment those (if i do not pass any SALES AREA (VKORG/VTWEG/SPART) as export param to API) then am getting the partner functions data.

But, partner functions are dependent on sales area (vkorg/vtweg/spart) right(Sorry if i am wrong)?

Each sales area has its own partner functions right? if i dont pass sales area How can i get partner funtions for a specified wanting sales area?

Thank you

Read only

0 Likes
1,277

Yes, you are right.  Partner functions are defined for each sales area combination.  Since this class is not returning the required information with sales area input parameter (do not know whether it is a bug),  solution left is to extract the data for all sales areas related to customer and filter the output as per your requirement. 

Regards, Vinod

Read only

0 Likes
1,277

Thank you for your quick reply. Ok, i will pull them from KNVP for wanting sales area.

I will keep open this thread for a while so that any other expert may respond.

Read only

Former Member
0 Likes
1,277

Hi,

I am trying to change customer partner functions. I am trying to add DEFPA field in Sales Area- Partner Functions.Let me know if there is any sample code.

Regards,

Prathima Talari.