‎2011 Nov 23 9:39 AM
Hello!
I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating the Sales order. But I have a problem when Iu2019m trying to create configuration. I think that parameter order_items_in-material should be generated before calling BAPI described above. I try to use order_items_in-mat_entrd, but BAPI return error message id = V1, number = 320 (No item category available (Table T184 ZAPC TEXT )).
Help me please, How I can solve this problem?
‎2011 Nov 23 12:15 PM
You can solve it by understanding the error message you mentioned.
‎2011 Nov 23 12:27 PM
I checked this entry "ZAPC" in the table t184. This entry exists. Moreover, When I create sales order with the same parameters from VA01 this message didn't appear.
‎2011 Nov 23 12:34 PM
‎2011 Nov 23 1:07 PM
Yes, I checked long text. But when I'm trying to use the field order_items_in-material instead order_items_in-mat_entrd this message didn't display. But in this case, configuration is not created.
‎2011 Nov 23 1:42 PM
So in fact you have a totally different problem? You're not able to asve the configuration? In that case check the documentation on the function. There is a areference to an OSS note.
‎2011 Nov 24 6:50 AM
I read note 93091 but I didn't get any useful information. May be you know FM which gets the configuration on the entered criteria.
‎2011 Nov 24 6:53 AM
Hi Sergey,
Are you creating a sales order with configurable item.Give me more details in this.
Regards,
Madhu.
‎2011 Nov 24 7:00 AM
I use the follow code:
Unformatted code removed.
Edited by: Rob Burbank on Nov 24, 2011 10:19 AM
‎2011 Nov 24 7:04 AM
I read note 93091 but I didn't get any useful information. May be you know FM which gets the configuration on the entered criteria.
Ok.. are you creating the configuration or are you retrieving the configuration.
As for the note: it clearly describes (under section II) how to populate the internal tables to pass the configuration data. So.. unless you forgot your glasses when reading the note or were blinded by the sun reflection on your screen, i guess you didn't even read the note.
edit: i used that same note to find out how to pass the proper contents to the BAPI for the configuration.
Edited by: Maen Anachronos on Nov 24, 2011 8:05 AM
‎2011 Nov 24 7:05 AM
Hi Sergey,
Please paste your code in code format.If it is a configurable material where is the characteristics and its values .
wa_order_ref-posex = '000010'.
wa_order_ref-root_id = inst_id.
wa_order_ref-config_id = conf_id.
INSERT wa_order_ref INTO TABLE tab_order_ref
Regards,
Madhu.
Edited by: madhurao123 on Nov 24, 2011 12:37 PM
Edited by: madhurao123 on Nov 24, 2011 12:38 PM
‎2011 Nov 24 7:08 AM
What is even worse: if you scroll down that OSS note, you'll see another OSS note with a fully written out example how to build your configuration tables.
‎2011 Nov 24 7:14 AM
Unformatted code removed.
Edited by: Rob Burbank on Nov 24, 2011 10:19 AM
‎2011 Nov 24 7:22 AM
<P><STRONG>FUNCTION Z_SD_GET_TEH_COST.<BR>"----
</STRONG></P>
<P><STRONG> DEFINE fill_prizn.<BR> IF is_cost_order-&1 IS NOT INITIAL.<BR> CLEAR: ls_cfgs_value-charc,<BR> ls_cfgs_value-value.<BR> ls_cfgs_value-charc = &2.<BR> ls_cfgs_value-value = is_cost_order-&1.<BR>* ls_cfgs_value-valcode = '1'.<BR> APPEND ls_cfgs_value TO lt_cfgs_value.<BR> ENDIF.<BR> END-OF-DEFINITION.</STRONG></P>
<P><STRONG>DATA: ls_header_in TYPE bapisdhd1,<BR> ls_header_inx TYPE bapisdhd1x,</STRONG></P>
<P><STRONG> lt_partners TYPE TABLE OF bapiparnr,<BR> ls_partners TYPE bapiparnr,</STRONG></P>
<P><STRONG> lt_items_in TYPE TABLE OF bapisditm,<BR> lt_items_inx TYPE TABLE OF bapisditmx,</STRONG></P>
<P><STRONG> ls_items_in TYPE bapisditm,<BR> ls_items_inx TYPE bapisditmx,</STRONG></P>
<P><STRONG> ls_cfgs_ref TYPE bapicucfg,<BR> lt_cfgs_ref TYPE TABLE OF bapicucfg,</STRONG></P>
<P><STRONG> lt_cfgs_value TYPE TABLE OF bapicuval,<BR> ls_cfgs_value TYPE bapicuval,</STRONG></P>
<P><STRONG> lt_schedules_in TYPE TABLE OF bapischdl,<BR> ls_schedules_in TYPE bapischdl,</STRONG></P>
<P><STRONG> lt_schedules_inx TYPE TABLE OF bapischdlx,<BR> ls_schedules_inx TYPE bapischdlx,</STRONG></P>
<P><STRONG> lt_cfgs_inst TYPE TABLE OF bapicuins,<BR> ls_cfgs_inst TYPE bapicuins,<BR> lt_cfgs_partof TYPE TABLE OF bapicuprt,<BR> ls_cfgs_partof TYPE bapicuprt,</STRONG></P>
<P><STRONG> lv_vbeln TYPE bapivbeln-vbeln,<BR> lt_return TYPE TABLE OF bapiret2.</STRONG></P>
<P><STRONG>* fill header<BR> ls_header_in-doc_type = 'ZAPC'.<BR> ls_header_in-sales_org = is_cost_order-vkorg.<BR> ls_header_in-distr_chan = is_cost_order-vtweg.<BR> ls_header_in-division = '01'.<BR> ls_header_in-sales_off = '1011'.</STRONG></P>
<P><STRONG> ls_header_inx-updateflag = 'I'.<BR> ls_header_inx-doc_type = 'X'.<BR> ls_header_inx-sales_org = 'X'.<BR> ls_header_inx-distr_chan = 'X'.<BR> ls_header_inx-division = 'X'.<BR> ls_header_inx-sales_off = 'X'.</STRONG></P>
<P><STRONG>* fill partners<BR> ls_partners-partn_role = 'AG'.<BR> ls_partners-partn_numb = '1000000031'. " фиктивный заказчик<BR> APPEND ls_partners TO lt_partners.</STRONG></P>
<P><STRONG>* ls_items_in-material = is_cost_order-matnr.<BR> ls_items_in-mat_entrd = is_cost_order-matnr.<BR> ls_items_in-target_qty = '1'.<BR> ls_items_in-itm_number = '000001'.<BR> ls_items_in-po_itm_no = '000001'.<BR> ls_items_in-item_categ = 'ZCRM'.<BR> SELECT SINGLE meins INTO ls_items_in-target_qu<BR> FROM mara<BR> WHERE matnr = is_cost_order-matnr.<BR> APPEND ls_items_in TO lt_items_in.</STRONG></P>
<P><STRONG> ls_items_inx-itm_number = '000001'.<BR> ls_items_inx-item_categ = 'X'.<BR> ls_items_inx-po_itm_no = 'X'.<BR>* ls_items_inx-material = 'X'.<BR> ls_items_inx-mat_entrd = 'X'.<BR> ls_items_inx-target_qty = 'X'.<BR> ls_items_inx-target_qu = 'X'.<BR> ls_items_inx-updateflag = 'I'.<BR> APPEND ls_items_inx TO lt_items_inx.</STRONG></P>
<P><STRONG>* fill configuration<BR> ls_cfgs_ref-posex = '000001'.<BR> ls_cfgs_ref-config_id = '000001'.<BR> ls_cfgs_ref-root_id = '00000001'.<BR> APPEND ls_cfgs_ref TO lt_cfgs_ref.</STRONG></P>
<P><STRONG> ls_cfgs_value-config_id = '000001'.<BR> ls_cfgs_value-inst_id = '00000001'.</STRONG></P>
<P><STRONG> fill_prizn kod_prod 'KOD_PROD'.<BR> fill_prizn tlot_min 'TLOT_MIN'.<BR> fill_prizn tlot_max 'TLOT_MAX'.<BR> fill_prizn shot_min 'SHOT_MIN'.<BR> fill_prizn shot_max 'SHOT_MAX'.<BR> fill_prizn dlot_min 'DLOT_MIN'.<BR> fill_prizn dlot_max 'DLOT_MAX'.<BR> fill_prizn marka 'MARKA'.<BR> fill_prizn stndrt_marka 'STNDRT_MARKA'.<BR> fill_prizn stndrt_prod 'STNDRT_PROD'.<BR> fill_prizn tprk 'TPRK'.<BR> fill_prizn grot 'GROT'.<BR> fill_prizn vityazhka 'VITYAZHKA'.<BR> fill_prizn krom 'KROM'.<BR> fill_prizn chisl_st_pokr 'CHISL_ST_POKR'.<BR> fill_prizn kls_tol_pokr 'KLS_TOL_POKR'.<BR> fill_prizn proch_izg_t_lic_max 'PROCH_IZG_T_LIC_MAX'.<BR> fill_prizn priz_zasch_pov 'PRIZ_ZASCH_POV'.<BR> fill_prizn vid_pokr 'VID_POKR'.<BR> fill_prizn mark_pokr 'MARK_POKR'.<BR> fill_prizn mat_pokr_lic 'MAT_POKR_LIC'.<BR> fill_prizn plsk 'PLSK'.<BR> fill_prizn vid_postavki 'VID_POSTAVKI'.<BR> fill_prizn dressir 'DRESSIR'.<BR> fill_prizn travl 'TRAVL'.<BR> fill_prizn fsfr_min 'FSFR_MIN'.<BR> fill_prizn fsfr_max 'FSFR_MAX'.<BR> fill_prizn krmn_min 'KRMN_MIN'.<BR> fill_prizn krmn_max 'KRMN_MAX'.<BR> fill_prizn mrgn_min 'MRGN_MIN'.<BR> fill_prizn mrgn_max 'MRGN_MAX'.<BR> fill_prizn almn_min 'ALMN_MIN'.<BR> fill_prizn almn_max 'ALMN_MAX'.<BR> fill_prizn cugl_min 'CUGL_MIN'.<BR> fill_prizn cugl_max 'CUGL_MAX'.</STRONG></P>
<P><STRONG> ls_schedules_in-itm_number = '000001'.<BR>* ls_schedules_in-req_date = sy-datum.<BR> ls_schedules_in-sched_line = '0001'.<BR> ls_schedules_in-req_qty = '1'.<BR> APPEND ls_schedules_in TO lt_schedules_in.</STRONG></P>
<P><STRONG> ls_schedules_inx-itm_number = '000001'.<BR> ls_schedules_inx-sched_line = '0001'.<BR>* ls_schedules_inx-req_date = 'X'.<BR> ls_schedules_inx-req_qty = 'X'.<BR> ls_schedules_inx-updateflag = 'I'.<BR> APPEND ls_schedules_inx TO lt_schedules_inx.</STRONG></P>
<P><STRONG> ls_cfgs_partof-parent_id = '00000001'.<BR> ls_cfgs_partof-inst_id = '00000001'.<BR> ls_cfgs_partof-class_type = '300'.<BR> ls_cfgs_partof-obj_type = 'MARA'.<BR> ls_cfgs_partof-obj_key = is_cost_order-matnr.<BR> APPEND ls_cfgs_partof TO lt_cfgs_partof.</STRONG></P>
<P><STRONG> ls_cfgs_inst-config_id = '000001'.<BR> ls_cfgs_inst-inst_id = '00000001'.<BR> ls_cfgs_inst-obj_type = 'MARA'.<BR> ls_cfgs_inst-class_type = '300'.<BR> ls_cfgs_inst-obj_key = is_cost_order-matnr.<BR> APPEND ls_cfgs_inst TO lt_cfgs_inst.</STRONG></P>
<P><STRONG> CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'<BR> EXPORTING<BR> order_header_in = ls_header_in<BR> order_header_inx = ls_header_inx<BR>* testrun =<BR> IMPORTING<BR> salesdocument = lv_vbeln<BR> TABLES<BR> return = lt_return<BR> order_items_in = lt_items_in<BR> order_items_inx = lt_items_inx<BR> order_partners = lt_partners<BR> order_schedules_in = lt_schedules_in<BR> order_schedules_inx = lt_schedules_inx<BR> order_cfgs_ref = lt_cfgs_ref<BR> order_cfgs_inst = lt_cfgs_inst<BR> order_cfgs_part_of = lt_cfgs_partof<BR> order_cfgs_value = lt_cfgs_value<BR> .</STRONG></P>
<P><STRONG> READ TABLE lt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'.<BR> IF sy-subrc = 0.<BR> CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'<BR> .<BR> ELSE.<BR> CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'<BR> EXPORTING<BR> wait = 'X'<BR> .<BR> ENDIF.</STRONG></P>
<P><STRONG>ENDFUNCTION.</STRONG></P>
<P><STRONG></STRONG> </P>
<P><STRONG></STRONG> </P>
‎2011 Nov 24 7:23 AM
Hi Sergey,
DATA: conf_id TYPE char6 VALUE '000010', "changed
inst_id TYPE char8 VALUE '00000001',
configuration
wa_order_ref-posex = '000010'.
wa_order_ref-root_id = inst_id.
wa_order_ref-config_id = conf_id.
INSERT wa_order_ref INTO TABLE tab_order_ref. "BAPICUCFG
*Refinst
wa_order_refinst-posex = '000010'.
wa_order_refinst-config_id = conf_id.
wa_order_refinst-inst_id = inst_id.
INSERT wa_order_refinst INTO TABLE tab_order_refinst. "BAPICURE
*Attribute values
wa_order_value-config_id = conf_id.
wa_order_value-inst_id = inst_id. "changed
wa_order_value-charc = 'COOLANT_CHIP_DX200'. "cawn-atwrt
"wa_order_value-charc = '0000000004'.
wa_order_value-value = '2'. "cawn-atinn
INSERT wa_order_value INTO TABLE tab_order_value. "BAPICUVAL
CLEAR wa_order_value
Regards,
Madhu.
Edited by: madhurao123 on Nov 24, 2011 12:56 PM
‎2011 Nov 24 7:30 AM
Hi, Madhu.
You wrote:
wa_order_ref-root_id = inst_id.
wa_order_ref-config_id = conf_id.
Say me please, how I get inst_id and conf_id?
‎2011 Nov 24 7:34 AM
Hi Sergey,
These values i hard coded and created sales order with the required variants and its characteristics and it is working.Can you explain how you are going to pass these characteristics.You take the bapi and create a sales order from se38 by using all the parameters.
Regards,
Madhu.
‎2011 Nov 24 9:28 AM
Madhu,
I tried to do this way. This error was repeated.
No item category available (Table T184 ZAPC TEXT )
May be required to fill ls_items_inx-material instead ls_items_inx-mat_entrd? But I tried that too without result.
P.S. Did you see my code in code format?
‎2011 Nov 24 9:40 AM
I take my function module Z_SD_GET_TEH_COST and create a sales order from se37 by using follow parameters
AUART= ZAPC
VKORG= 1010
VTWEG= 02
SPART= 01
VKBUR= 1011
KUNNR = 1000000031
MATNR= HR_0103100
KWMENG= 1
KOD_PROD= Ð’Ð _971
TLOT_MIN =5
TLOT_MAX
SHOT_MIN= 1500
SHOT_MAX
DLOT_MIN =6000
DLOT_MAX
MARKA =B
STNDRT_MARKA
STNDRT_PROD= ГОСТ Р52927-2008
TPRK =Б
GROT
VITYAZHKA
KROM =О
CHISL_ST_POKR
KLS_TOL_POKR
PROCH_IZG_T_LIC_MAX
PRIZ_ZASCH_POV
VID_POKR
MARK_POKR
MAT_POKR_LIC
PLSK
VID_POSTAVKI
DRESSIR
TRAVL
FSFR_MIN
FSFR_MAX
KRMN_MIN
KRMN_MAX
MRGN_MIN
MRGN_MAX
ALMN_MIN
ALMN_MAX
CUGL_MIN
CUGL_MAX
‎2011 Nov 24 9:49 AM
Hi Sergey,
Keep your details here.I will send you the code to create sales order with this bapi.
Regards,
Madhu.
‎2011 Nov 24 9:59 AM
‎2011 Nov 24 10:11 AM
Hi Sergey,
I do not know whether it is against forum rules.Send me a test mail to me.I will send the code.
Regards,
Madhu
‎2011 Nov 24 10:29 AM
‎2011 Nov 24 10:43 AM
Hi Sergey,
It is fine.Can you pass simple header data,item data,customer and see.Check with any material whicc is already used in existed sales order.
Regards,
Madhu.
‎2011 Nov 24 11:12 AM
When I create sales order from VA01 I see that field vbap-matnr = 'MAT1_1', vbap-matwa = 'MAT1'. Therefore 'MAT1_1' is already configurated material. When I'm using VA01 I enter 'MAT1'. Then I fill configuration parameters. As result I get sales order with 'MAT1_1'.
If I pass simple header data,item data (where item-material = 'MAT1'),customer, a sales order will create. But I want to get sales order with 'MAT1_1'. How to do this?
‎2011 Nov 24 11:19 AM
Hi ,
I did not understand your business requirement.Are you creating sales order with material and what is this MATWA.
Regards,
Madhu.
‎2011 Nov 24 11:27 AM
Hi Mudhu,
See my alternative e-mail in my business card. Can you send the code in this mail?
‎2011 Nov 24 11:31 AM
MATWA is the field of the table VBAP. In my case the fields VBAP-MATNR and VBAP-MATWA are different.
‎2011 Nov 24 1:02 PM
I try to do your way, in result I get follow return message:
S V4 233 SALES_HEADER_IN has been processed successfully
A CU 13 Internal error: 000010, 000010, NOT_ALL_INPUT_DATA_PROCESSED,
E V4 248 Error in SALES_ITEM_IN 000010
‎2011 Nov 25 4:04 AM
Hi Sergey,
Did you pass all the characteristics.Using the same code i am able to create sales order successfully.
Regards,
Madhu.
‎2011 Nov 25 5:58 AM
Hi Mudhu,
I pass all the characteristics. Say me please, in VBAP table the field matnr = matwa = 'C100000' after create sales order?.
‎2011 Nov 25 6:22 AM
Hi Sergey,
I do not know the importance of this field.I did not pass that and i am able to create it.You also try with out that field and see.
Regards,
Madhu.
Edited by: madhurao123 on Nov 25, 2011 11:52 AM
‎2011 Nov 25 6:46 AM
Hi Madhu,
I tried to fill parameters BAPI as you advised.
Can you see VBAP table and say me please values of fields MATWA and MATNR after creating your sales order?
‎2011 Nov 25 6:50 AM
Hi Sergey,
I have seen this.The file filled automatically in vbap with the same material.I think you can also see by leaving that field.
Regards,
Madhu.
‎2011 Nov 26 7:45 AM
Thank you Madhu!
May be our business requirements do not allow to create sales order in this way.
‎2011 Nov 28 6:09 AM
Hi Sergey,
That is fine.Please check once again and see.
Regards,
Madhu.
‎2011 Dec 05 6:17 AM
‎2011 Dec 05 6:22 AM
Hi,
I did not use before but we can get all characteristics and it is values from there.
Regards,
Madhu.