Application Development 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: 

BAPI not returning values when used in ABAP code

Former Member
0 Kudos

Hello Gurus,

I am using BAPISDORD_GETDETAILEDLIST in my code to fetch Partner Address and Name. For that, I have passed values as below:

ls_bapi_view-PARTNER = 'X'.

ls_sales_documents-VBELN = Sales order number.

Append ls_sales_documents to lt_sales_documents.

And then execute the function in SE37, it returns value in order_partners_out and order_address_out.

But when I am calling this FM in my code and passing same values, it is not returning anything. Below are the declarations, I have written:

        ls_bapi_view   LIKE order_view,

        lt_sales_documents      TYPE STANDARD TABLE OF sales_key,

        ls_sales_documents      like LINE OF lt_sales_documents,

        lt_order_partners_out   TYPE STANDARD TABLE OF bapisdpart,

        ls_order_partners_out   like LINE OF lt_order_partners_out,

        ls_order_address_out    like bapisdcoad,

        lt_order_address_out    TYPE STANDARD TABLE OF bapisdcoad.

I somehow feel the problem is with the declarations. Please anyone can just try it, it is very easy and put some light on the resolution.

Thanks,

Maninder SA

1 ACCEPTED SOLUTION

nabheetscn
Active Contributor
0 Kudos


Hi Maninder

Did you add leading zero's to sales document...? I passed without leading zero's it did not work but with Zeros iot worked.

check the attached sample code

Nabheet

5 REPLIES 5

former_member219762
Contributor
0 Kudos

Hi,

Check BAPI Return parameter.It will give what is error.

Regards,

Sreenivas.

nabheetscn
Active Contributor
0 Kudos


Hi Maninder

Did you add leading zero's to sales document...? I passed without leading zero's it did not work but with Zeros iot worked.

check the attached sample code

Nabheet

0 Kudos

Yes, Nabheet, It was leading zeroes which made BAPI worked.

Thanks!!!

0 Kudos

Hello Maninder Singh Arora.

     This issue you will generally face when you pass a hard-coded value / when its declaration is not done properly with reference to its standard table.

     If you declare the variable correctly with reference to its standard table (viz.,VBAK-vbeln) and fetched its value,automatically the data will be in right format.

     For your information.

Regards.

Former Member
0 Kudos

Hi Maninder,

I used same BAPi in program. Just i am fetching item details . Hope my code will help you.

parameters: p_vbeln type VBELN_VA.
           data: p_I_BAPI_VIEW like ORDER_VIEW.
           data: p_SALES_DOCUMENTS type standard table of SALES_KEY,
                   p_sales type SALES_KEY.

data: p_ORDER_ITEMS_OUT type standard table of BAPISDIT,
         wa_order_items_out type BAPISDIT.

data : begin of p_ORDER_BUSINESS_OUT occurs 100.
          include structure BAPISDBUSI.
data : end of p_ORDER_BUSINESS_OUT.

data : begin of p_ORDER_PARTNERS_OUT occurs 100.
         include structure BAPISDPART.
data : end of p_ORDER_PARTNERS_OUT.

data : i_SALESDOCUMENT LIKE  BAPIVBELN-VBELN,
          i_ORDER_HEADER_IN like BAPISDHD1,
          i_ORDER_HEADER_INX like BAPISDHD1X.

data : begin of i_return occurs 100.
          include STRUCTURE BAPIRET2.
data : end of i_return.

p_I_BAPI_VIEW-HEADER = 'X'.
p_I_BAPI_VIEW-ITEM = 'X'.
p_I_BAPI_VIEW-BUSINESS = 'X'.
p_I_BAPI_VIEW-PARTNER = 'X'.
p_sales-vbeln = p_vbeln.
append p_sales to p_SALES_DOCUMENTS.

CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
  EXPORTING
    I_BAPI_VIEW                   = p_I_BAPI_VIEW
*   I_MEMORY_READ                 =
  TABLES
    SALES_DOCUMENTS               = p_SALES_DOCUMENTS
*    ORDER_HEADERS_OUT             = p_ORDER_HEADERS_OUT
    ORDER_ITEMS_OUT               = p_ORDER_ITEMS_OUT
    "ORDER_SCHEDULES_OUT           =
*    ORDER_BUSINESS_OUT            = p_ORDER_BUSINESS_OUT
*    ORDER_PARTNERS_OUT            = p_ORDER_PARTNERS_OUT
*   ORDER_ADDRESS_OUT             =
*   ORDER_STATUSHEADERS_OUT       =
*   ORDER_STATUSITEMS_OUT         =
*   ORDER_CONDITIONS_OUT          =
*   ORDER_COND_HEAD               =
*   ORDER_COND_ITEM               =
*   ORDER_COND_QTY_SCALE          =
*   ORDER_COND_VAL_SCALE          =
*   ORDER_CONTRACTS_OUT           =
*   ORDER_TEXTHEADERS_OUT         =
*   ORDER_TEXTLINES_OUT           =
*   ORDER_FLOWS_OUT               =
*   ORDER_CFGS_CUREFS_OUT         =
*   ORDER_CFGS_CUCFGS_OUT         =
*   ORDER_CFGS_CUINS_OUT          =
*   ORDER_CFGS_CUPRTS_OUT         =
*   ORDER_CFGS_CUVALS_OUT         =
*   ORDER_CFGS_CUBLBS_OUT         =
*   ORDER_CFGS_CUVKS_OUT          =
*   ORDER_BILLINGPLANS_OUT        =
*   ORDER_BILLINGDATES_OUT        =
*   ORDER_CREDITCARDS_OUT         =
*   EXTENSIONOUT                  =
    .
LOOP AT p_ORDER_ITEMS_OUT into wa_order_items_out .
write 😕 wa_order_items_out-ITM_NUMBER, wa_order_items_out-material, wa_order_items_out-REQ_QTY , wa_order_items_out-net_price,
          wa_order_items_out-TARGET_QTY, wa_order_items_out-net_value.
ENDLOOP.

Regards,

Meenachi.R