cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to fill item navigation property of standard API to create Supplier Invoice in S4 HANA CLoud

VB_devloper
Discoverer
0 Kudos
404

Hi All,

I am working in S4 HANA public cloud and my requirement is to create Supplier Invoice by passing header data and navigation property "to_SelectedServiceEntrySheets" of API "/sap/opu/odata/sap/API_SUPPLIERINVOICE_PROCESS_SRV/A_SupplierInvoice".

I have created service consumption model for this API in eclipse. But, in the CREATE operation of consumption model no code generated to navigate to "to_SelectedServiceEntrySheets" as I need to supply two fields here "ServiceEntrysheet" and ServiceEntryItem" as this is mandatory to POST supplier invoice.

I have successfully supplied the header data and when I execute the code, I am getting message "No Item data supplied to post invoice". This is because above navigation property is not supplied in the payload.

Kindly suggest how I can supply the data into "to_SelectedServiceEntrySheets" of this API.

I have attached my code for reference.

Many Thanks In advance!

 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi VB_developer,

your request should look similar like the following that i used to call the Salesorder A2X API:  

    DATA deep_busi_data TYPE tys_a_sales_order_simulation_t.
    DATA error_message TYPE string.

    deep_busi_data    =    VALUE #(
                       sales_order_type            = 'OR'
                       sales_organization          = '1010'
                       distribution_channel        = '10'
                       organization_division       = '00'
                       sold_to_party               = '10100001'
                       purchase_order_by_customer  = 'SalesOrder Simulation'
                       to_item = VALUE #( (
                          sales_order_item = '1'
                          material = 'TG11' "'TG122'
                          requested_quantity = '5'
                          ) )
                       ).


    DATA(response) = simulatesalesorder(
                       EXPORTING
                         i_salesorderdata = deep_busi_data
                       IMPORTING
                         r_error_message  = error_message
                     ).

 

Where the type is a deep structure as follows:

 TYPES:
      "! <p class="shorttext synchronized">A_SalesOrderSimulationType</p>
      BEGIN OF tys_a_sales_order_simulation_t,
        "! <em>Key property</em> SalesOrder
        sales_order                TYPE c LENGTH 10,
        "! SalesOrderType
        sales_order_type           TYPE c LENGTH 4,
        "! SalesOrganization
        sales_organization         TYPE c LENGTH 4,
        "! DistributionChannel
      ....
        customer_payment_terms     TYPE c LENGTH 4,
        "! PaymentMethod
        payment_method             TYPE c LENGTH 1,

        to_item                    TYPE tyt_a_sales_order_item_simul_2,

      END OF tys_a_sales_order_simulation_t,
      "! <p class="shorttext synchronized">List of A_SalesOrderSimulationType</p>
      tyt_a_sales_order_simulation_t TYPE STANDARD TABLE OF tys_a_sales_order_simulation_t WITH DEFAULT KEY.