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: 

create multiple line item contact order (va41) using bapi

Former Member
0 Kudos

Req is : To upload multiple line item using bapi BAPI_SALESORDER_CREATEFROMDAT2

i want to create contract order with multiple line item , using transaction va41 , so i am passing one excel file which contains header data , how i will handle multiple line item data to pass to create contact order

Ankesh

1 ACCEPTED SOLUTION

vinod_vemuru2
Active Contributor
0 Kudos

Hi Ankesh,

The BAPI u told is for sales order creation. Use BAPI BAPI_CONTRACT_CREATEFROMDATA for contract creation.

Pass all ur item details to the tables parameter CONTRACT_ITEMS_IN. i.e. APPEND all the line items to this table. If u have 10 line items then u should append 10 rows to this table. Let me know if u face any problems.

Thanks,

Vinod.

6 REPLIES 6

vinod_vemuru2
Active Contributor
0 Kudos

Hi Ankesh,

The BAPI u told is for sales order creation. Use BAPI BAPI_CONTRACT_CREATEFROMDATA for contract creation.

Pass all ur item details to the tables parameter CONTRACT_ITEMS_IN. i.e. APPEND all the line items to this table. If u have 10 line items then u should append 10 rows to this table. Let me know if u face any problems.

Thanks,

Vinod.

0 Kudos

Vinod , Thanks for your reply , 1stly i am using wrong bapi thx for correcting it 2ndly my question is

what is the methodology of taking item into internal table , means

i am making one excel sheet and in that i am preparing header and taking that file in to my program through which my number is generated successfully , uptill i am passing item hard code in my program now i want to take multiple line item , so

1 thing that come to my mind is , i will create one more excel sheet , In header excel sheet i have given s.no and corresponding to that s.no i will create multiple line item into 2nd excel sheet and when executing i will read both the excel sheet ( header & item ) and read s.no of item according to header one

what should u refer ??

0 Kudos

Hi Ankesh,

I don't think u need two excels. U can upload by one excel itself. It is up to u on how to upload.

Check belwo sample code. U no need to pass item number while creation of contract. U have to pass this only while changing.


"Here i am appending all the line items.
"Apart from this u have to populate header and partner details.
"Read the FM documentation once. It is very clearly explained.
LOOP AT i_items INTO lwa_createint.
"Item details
          lwa_createint-matnr  TO lwa_contractitemsin-material,
          lwa_createint-kwmeng TO lwa_contractitemsin-target_qty.
    APPEND lwa_contractitemsin TO li_contractitemsin.
ENDLOOP.

Thanks,

Vinod.

0 Kudos

from where i get its documentation ??

0 Kudos

Hi Ankesh,

Just go to SE37 transaction, Open above BAPI in display mode.

In tool bar u can see one push button Function module documentation(Last one). Click on that. It opens a popup explaining every thing about this BAPI.

U can follow the same for any function module/BAPI.

But for some FMs u may not found the documentation in English. In this case only way to know on how to use is check the where used list/ search in net for sample codes.

Thanks,

Vinod.

0 Kudos

Vinod very much thx for the information , i m closing this thread and will do rnd on this whole concept and then i will need ur help if i trap while creating this n other concepts thx buddy.!!!!!