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

BAPI Return table is empty

Former Member
0 Likes
2,867

Hi,

I am using the BAPI   ' BAPI_CUSTOMER_HIERARCHIE_INS' to insert Customer node.

the node is getting added but i am not getting any values in RETURN table.

Please help.

Thanks,

Rashmi

  
6 REPLIES 6
Read only

yogendra_bhaskar
Contributor
0 Likes
1,235

Hi Rashmi ,

Could You provide the code .

Regards ,

Yogendra Bhaskar

Read only

0 Likes
1,235

Hi,

Please find the code.

select single kunnr

ktokd

from kna1

into ls_kna1

where kunnr eq i_p_kunnr.

if sy-subrc eq 0.

ls_insert-customer               = i_kunnr.

ls_insert-salesorg                =  i_vkorg.

ls_insert-distr_chan             = c_01.

ls_insert-division                  = i_spart.

ls_insert-valid_from              = sy-datum.

ls_insert-custhityp               = c_a.

ls_insert-parent_customer    = i_p_kunnr.

ls_insert-parent_sales_org   = i_hvkorg.

ls_insert-parent_distr_chan  = c_01.

ls_insert-parent_division       = i_hspart.

ls_insert-valid_to                 = c_validto.

ls_insert-routine                  = c_z1.

ls_insert-rebate_rel             = c_x.

ls_insert-pric_rel                 = c_x.

ls_insert-assign_hi             = c_z2.

append ls_insert to lt_insert.

call function 'BAPI_CUSTOMER_HIERARCHIE_INS'

tables

node_list = lt_insert.

return = return.

This return has no value even if record is inserted.

Regards,

Rashmi

Read only

0 Likes
1,235

HI Rashmi,

I Found two mistakes in the code.

First:  Missing Table Keyword in the Select Statement.

select single kunnr

ktokd

from kna1

into TABLE ls_kna1

where kunnr eq i_p_kunnr.

Second: BapiReturn is to be assigned to return parameter.

CALL FUNCTION 'BAPI_CUSTOMER_HIERARCHIE_INS'

RETURN          = bapiret2.

Then only the two entries will be entered into the table.

  

Read only

0 Likes
1,235

hi Rashmi ,

Check for a wrong entry , if it returning error message , then its working fine .

regards ,

Yogendra Bhaskar

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,235

(FAQ) Not every BAPI returns success message, their only obligation is to return error and abort messages. They mostly return success message when a "number range" is involved (e.g. Document XXXX created/updated)

Ref. Return Parameters (Error Handling)

If the return parameter is not set or is set to an initial value this means that no error has occurred.

Regards,

Raymond

Read only

Aashish28
Contributor
0 Likes
1,235

Hiii,

        Every BAPI not returns message for successful processing of data.

you can check if you put wrong code you will definitely get error see below code  .

      DATA : wa TYPE  BAPIKNA1_KNVH_PROCESS.

DATA : BAPIKNA1_KNVH_PROCESS TYPE STANDARD TABLE OF BAPIKNA1_KNVH_PROCESS,
         bapiret2 TYPE STANDARD TABLE OF  bapiret2.

wa-SALESORG = 'ABCD'. " dummy
wa-CUSTOMER = '123456'. " dummy

APPEND wa to BAPIKNA1_KNVH_PROCESS.

CALL FUNCTION 'BAPI_CUSTOMER_HIERARCHIE_INS'
   TABLES
     NODE_LIST       = BAPIKNA1_KNVH_PROCESS
    RETURN          = bapiret2.
           .