11-21-2007 6:39 AM
Hi,
I want to create the sales order programatically such that i will enter order type, plant, division, distribution channel, and sold to party, ship to party in the header level and item, quantity units and plant in the item level information then i want to pick item category automatically can any one help me regarding this
rewarding points guaranteed.....
11-21-2007 6:55 AM
11-21-2007 7:02 AM
no actually i am using the function module BAPI_SALESDOCU_CREATEFROMDATA1
in that FM in tables sales_items_in i need to enter item_cate so i want to write a query to get item category so please help in this regard
11-21-2007 7:23 AM
Hi Sunil,
U can get item catogory from VBAP table by passing VBELN in u r querry. if not please clrify me how u r populating the data into u r internal tables before passing it to BAPI
Regards,
WooD
11-21-2007 7:28 AM
Hi sunil,
before passing data to FM BAPI_SALESDOCU_CREATEFROMDATA1.
U have get item catogory PSTYV from VBAP table by passing VBELN .
Then pass that in FM.
If it is helpfull do reward.
Regards
Srimanta
11-21-2007 7:38 AM
no we cant fetch the item category from vbap as we are creating sales order itself after complete completion of the creation only tht data will be saved in vbap but here we want item category to create a sales order it self
here i am giving how am i fetching the data i am using one subroutine
FORM sales_fill_data changing P_HEADER like fs_header
P_HEADERX like fs_headerx
Pt_ITEM like t_item[]
Pt_ITEMX like t_itemx[]
P_LT_SCHEDULES_IN like t_schedules_in[]
P_LT_SCHEDULES_INX like t_schedules_inx
Pt_PARTNER like t_partner[].
p_header-doc_type = w_auart.
p_headerx-doc_type = c_x.
p_header-sales_org = w_vkorg.
p_headerx-sales_org = c_x.
p_header-distr_chan = w_vtweg.
p_headerx-distr_chan = c_x.
p_header-division = w_spart.
p_headerx-division = c_x.
p_headerx-updateflag = c_i.
fs_patnr-partn_role = c_ship.
fs_patnr-partn_numb = w_sold.
APPEND fs_patnr to pt_partner.
fs_patnr-partn_role = c_sold.
fs_patnr-partn_numb = w_ship.
APPEND fs_patnr to pt_partner.
loop at it_item.
CLEAR fs_ITEM.
fs_item-material = it_item-matnr.
fs_item-plant = it_item-plant.
fs_item-target_qty = it_item-menge.
fs_item-target_qu = c_quant.
fs_item-item_categ = it_item-itcat.
Updating the x tables .
fs_itemx-updateflag = c_i.
fs_itemx-material = c_x.
fs_itemx-plant = c_x.
fs_itemx-target_qty = c_x.
fs_itemx-target_qu = c_x.
fs_itemx-item_categ = c_x.
APPEND fs_itemx to pt_itemx.
APPEND fs_item to pt_item.
W_COUNTER = W_COUNTER + 1.
CLEAR fs_sin.
fs_sin-itm_number = w_num.
fs_sin-sched_line = w_LINE.
fs_sin-req_qty = it_item-menge.
APPEND fs_sin to p_lt_schedules_in.
CLEAR fs_sinx.
fs_sinx-itm_number = w_num.
fs_sinx-sched_line = w_line.
fs_sinx-updateflag = c_x.
fs_sinx-req_qty = c_x.
APPEND fs_sinx to p_lt_schedules_inx.
w_num = w_num + 10.
w_line = w_line + 1.
endloop. " Loop at it_item
ENDFORM. " sales_fill_data
here i want it-cat to be filled automatically so tht in the selection screen i dont want to enter the item category just in transaction VA01 we will not enter it-cat but it will be taken auotmatically in the same way i want to do it
thanks and regards
sunil kumar mutyala
11-21-2007 7:01 AM
Hi Sunil,
There are different types of methodology to create an sales order by passing u r mentioned things. U can use BAPI_SALESORDER_CREATEFROMDAT1 for u r requirement or u can write a BDC program to do this.
Regards