Code: Alles auswählen.
APPEND INITIAL LINE TO LT_QUOTATION_ITEMS_IN ASSIGNING <QUOTATION_ITEMS_IN_LINE>.
<QUOTATION_ITEMS_IN_LINE>-PO_ITM_NO = '10'.
<QUOTATION_ITEMS_IN_LINE>-MATERIAL = 'A38'.
<QUOTATION_ITEMS_IN_LINE>-PLANT = '0020'.
<QUOTATION_ITEMS_IN_LINE>-ITEM_CATEG = 'AGC'.
<QUOTATION_ITEMS_IN_LINE>-TARGET_QTY = '1'.
<QUOTATION_ITEMS_IN_LINE>-TARGET_QU = 'ST'.
Code: Alles auswählen.
APPEND INITIAL LINE TO lt_quotation_schedules_in ASSIGNING <quotation_schedules_in_line>.
<quotation_schedules_in_line>-itm_number = '10'.
<quotation_schedules_in_line>-req_qty = '1'.
Code: Alles auswählen.
CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
EXPORTING
quotation_header_in = ls_quotation_header_in
TABLES
quotation_items_in = lt_quotation_items_in
quotation_partners = lt_quotation_partners
quotation_schedules_in = lt_quotation_schedules_in
Hi,carlie hat geschrieben:Hallo,
komme leider erst jetzt zum Antworten. Ich habe deinen vorschlag in meinen ABAP Code eingebaut. Die menge 1 wird jetzt im Angebot gesetzt. Also dieser Punkt ist erst mal für meinen Test erledigt.
Vielleicht kann mir jetzt noch jemand eine Tipp geben wie ich das Konfigurations problem in den Griff bekomme.
An der Stelle habe ich weiterhin das problem das die Konfigration nicht abgespeichert wird und keine COBJ nummer in der VBAP geschrieben wird.
Gruß,
Thorsten
Code: Alles auswählen.
* Holt den Request
data:
l_string type string,
lt_CONFIG_DATA type TIHTTPNVP.
l_string = server->request->GET_CDATA( ).
server->request->GET_FORM_FIELDS(
* exporting
* FORMFIELD_ENCODING = 0 " CO_FORMFIELD_ENCODING_RAW / _ENCODED
* SEARCH_OPTION = 3 " CO_BODY_BEFORE_QUERY_STRING or others
changing
FIELDS = lt_CONFIG_DATA " Form-Felder
).
Code: Alles auswählen.
* Aufbau Tabelle LT_QUOTATION_CFGS_REF
LOOP AT WA_QUOTATION_CFGS_REF ASSIGNING <LT_CONFIG_DATA_LINE>.
LV_STRING_PRUEFUNG = <LT_CONFIG_DATA_LINE>-NAME.
IF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-consistent[1]'.
lv_cfg_consistent = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-kbname[1]'.
lv_cfg_kbname = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-complete[1]'.
lv_cfg_complete = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-kbversion[1]'.
lv_cfg_kbversion = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-kblanguage[1]'.
lv_cfg_kblanguage = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-cfginfo[1]'.
lv_cfg_cfginfo = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-posex[1]'.
lv_cfg_posex = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-sce[1]'.
lv_cfg_sce = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-config_id[1]'.
lv_cfg_config_id = <LT_CONFIG_DATA_LINE>-VALUE.
* ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-kbbuild[1]'.
* lv_consistent = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-kbprofile[1]'.
lv_cfg_kbprofile = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'cfg-root_id[1]'.
lv_cfg_root_id = <LT_CONFIG_DATA_LINE>-VALUE.
ENDIF.
ENDLOOP.
APPEND INITIAL LINE TO LT_QUOTATION_CFGS_REF ASSIGNING <QUOTATION_CFGS_REF_LINE>.
<QUOTATION_CFGS_REF_LINE>-POSEX = LV_cfg_POSEX.
<QUOTATION_CFGS_REF_LINE>-CONFIG_ID = lv_cfg_config_id.
<QUOTATION_CFGS_REF_LINE>-ROOT_ID = lv_cfg_root_id.
<QUOTATION_CFGS_REF_LINE>-SCE = lv_cfg_sce.
<QUOTATION_CFGS_REF_LINE>-KBNAME = lv_cfg_kbname.
<QUOTATION_CFGS_REF_LINE>-KBVERSION = lv_cfg_kbversion.
<QUOTATION_CFGS_REF_LINE>-COMPLETE = lv_cfg_complete.
<QUOTATION_CFGS_REF_LINE>-CONSISTENT = lv_cfg_consistent.
<QUOTATION_CFGS_REF_LINE>-CFGINFO = lv_cfg_cfginfo.
<QUOTATION_CFGS_REF_LINE>-KBPROFILE = lv_cfg_kbprofile.
<QUOTATION_CFGS_REF_LINE>-KBLANGUAGE = lv_cfg_kblanguage.
* Aufbau Tabelle LT_ORDER_CFGS_INST
LOOP AT WA_ORDER_CFGS_INST ASSIGNING <LT_CONFIG_DATA_LINE>.
IF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-config_id[1]'.
lv_ins_config_id = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-inst_id[1]'.
lv_ins_INST_ID = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-obj_type[1]'.
lv_ins_OBJ_TYPE = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-class_type[1]'.
lv_ins_CLASS_TYPE = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-obj_key[1]'.
lv_ins_OBJ_KEY = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-obj_txt[1]'.
lv_ins_OBJ_TXT = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-quantity[1]'.
lv_ins_QUANTITY = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-author[1]'.
lv_ins_AUTHOR = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-quantity_unit[1]'.
lv_ins_QUANTITY_UNIT = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-complete[1]'.
lv_ins_COMPLETE = <LT_CONFIG_DATA_LINE>-VALUE.
ELSEIF <LT_CONFIG_DATA_LINE>-NAME EQ 'ins-consistent[1]'.
lv_ins_CONSISTENT = <LT_CONFIG_DATA_LINE>-VALUE.
ENDIF.
ENDLOOP.
APPEND INITIAL LINE TO LT_ORDER_CFGS_INST ASSIGNING <ORDER_CFGS_INST_LINE>.
<ORDER_CFGS_INST_LINE>-CONFIG_ID = lv_ins_config_id .
<ORDER_CFGS_INST_LINE>-INST_ID = lv_ins_INST_ID.
<ORDER_CFGS_INST_LINE>-OBJ_TYPE = lv_ins_OBJ_TYPE.
<ORDER_CFGS_INST_LINE>-CLASS_TYPE = lv_ins_CLASS_TYPE.
<ORDER_CFGS_INST_LINE>-OBJ_KEY = lv_ins_OBJ_KEY.
<ORDER_CFGS_INST_LINE>-OBJ_TXT = lv_ins_OBJ_TXT.
<ORDER_CFGS_INST_LINE>-QUANTITY = lv_ins_QUANTITY.
<ORDER_CFGS_INST_LINE>-AUTHOR = lv_ins_AUTHOR.
<ORDER_CFGS_INST_LINE>-QUANTITY_UNIT = lv_ins_QUANTITY_UNIT.
<ORDER_CFGS_INST_LINE>-COMPLETE = lv_ins_COMPLETE.
<ORDER_CFGS_INST_LINE>-CONSISTENT = lv_ins_CONSISTENT.
* Aufbau Tabelle LT_ORDER_CFGS_VALUE
* 1. Sortierung der Tabelle mit einer neuen Spalte ID
LOOP AT WA_ORDER_CFGS_VALUE ASSIGNING <LT_CONFIG_DATA_LINE>.
SPLIT <LT_CONFIG_DATA_LINE>-name at '[' INTO lv_split_string1 lv_split_string2.
SHIFT lv_split_string2 RIGHT DELETING TRAILING ']'.
lv_id = lv_split_string2.
APPEND INITIAL LINE TO LT_ORDER_CFGS_VALUE_ID ASSIGNING <ORDER_CFGS_VALUE_ID_LINE>.
<ORDER_CFGS_VALUE_ID_LINE>-NAME = <LT_CONFIG_DATA_LINE>-NAME.
<ORDER_CFGS_VALUE_ID_LINE>-VALUE = <LT_CONFIG_DATA_LINE>-VALUE.
<ORDER_CFGS_VALUE_ID_LINE>-ID = lv_id.
<ORDER_CFGS_VALUE_ID_LINE>-NAME1 = lv_split_string1.
ENDLOOP.
SORT LT_ORDER_CFGS_VALUE_ID DESCENDING BY ID .
LOOP AT LT_ORDER_CFGS_VALUE_ID ASSIGNING <ORDER_CFGS_VALUE_ID_LINE>.
lv_count = <ORDER_CFGS_VALUE_ID_LINE>-ID.
EXIT.
ENDLOOP.
SORT LT_ORDER_CFGS_VALUE_ID ASCENDING BY ID .
WHILE lv_count > 0.
LOOP AT LT_ORDER_CFGS_VALUE_ID ASSIGNING <ORDER_CFGS_VALUE_ID_LINE> WHERE ID = lv_count.
IF <ORDER_CFGS_VALUE_ID_LINE>-NAME1 EQ 'val-author'.
lv_val_AUTHOR = <ORDER_CFGS_VALUE_ID_LINE>-VALUE.
ELSEIF <ORDER_CFGS_VALUE_ID_LINE>-NAME1 EQ 'val-charc'.
lv_val_CHARC = <ORDER_CFGS_VALUE_ID_LINE>-VALUE.
ELSEIF <ORDER_CFGS_VALUE_ID_LINE>-NAME1 EQ 'val-charc_txt'.
lv_val_CHARC_TXT = <ORDER_CFGS_VALUE_ID_LINE>-VALUE.
ELSEIF <ORDER_CFGS_VALUE_ID_LINE>-NAME1 EQ 'val-inst_id'.
lv_val_INST_ID = <ORDER_CFGS_VALUE_ID_LINE>-VALUE.
ELSEIF <ORDER_CFGS_VALUE_ID_LINE>-NAME1 EQ 'val-value'.
lv_val_VALUE = <ORDER_CFGS_VALUE_ID_LINE>-value.
ELSEIF <ORDER_CFGS_VALUE_ID_LINE>-NAME1 EQ 'val-value_txt'.
lv_val_VALUE_TXT = <ORDER_CFGS_VALUE_ID_LINE>-VALUE.
ENDIF.
ENDLOOP.
APPEND INITIAL LINE TO LT_ORDER_CFGS_VALUE ASSIGNING <ORDER_CFGS_VALUE_LINE>.
<ORDER_CFGS_VALUE_LINE>-AUTHOR = lv_val_AUTHOR .
<ORDER_CFGS_VALUE_LINE>-CHARC = lv_val_CHARC.
<ORDER_CFGS_VALUE_LINE>-CHARC_TXT = lv_val_CHARC_TXT.
<ORDER_CFGS_VALUE_LINE>-INST_ID = lv_val_INST_ID.
<ORDER_CFGS_VALUE_LINE>-VALUE = lv_val_VALUE.
<ORDER_CFGS_VALUE_LINE>-VALUE_TXT = lv_val_VALUE_TXT.
lv_count = lv_count - 1.
ENDWHILE.
DATA: Lt_ORDER_CFGS_PART_OF TYPE TABLE OF BAPICUPRT.
Data: LS_ORDER_CFGS_PART_OF Type BAPICUPRT.
LS_ORDER_CFGS_PART_OF-CONFIG_ID = LV_INS_CONFIG_ID.
LS_ORDER_CFGS_PART_OF-PARENT_ID = lv_ins_INST_ID.
LS_ORDER_CFGS_PART_OF-INST_ID = lv_ins_INST_ID.
LS_ORDER_CFGS_PART_OF-OBJ_TYPE = lv_ins_obj_type.
LS_ORDER_CFGS_PART_OF-CLASS_TYPE = lv_ins_class_type.
LS_ORDER_CFGS_PART_OF-OBJ_KEY = lv_ins_obj_key.
LS_ORDER_CFGS_PART_OF-AUTHOR = lv_ins_author.
APPEND LS_ORDER_CFGS_PART_OF to Lt_ORDER_CFGS_PART_OF.
DATA: LT_ORDER_ITEMS_OUT TYPE TABLE OF BAPIITEMEX.
LS_QUOTATION_HEADER_IN-DOC_TYPE = 'YAG'.
LS_QUOTATION_HEADER_IN-SALES_ORG = 'ET01'.
LS_QUOTATION_HEADER_IN-DISTR_CHAN = 'GV'.
LS_QUOTATION_HEADER_IN-DIVISION = 'TD'.
LS_QUOTATION_HEADER_IN-SALES_OFF = 'VBZW'.
APPEND INITIAL LINE TO LT_QUOTATION_PARTNERS ASSIGNING <QUOTATION_PARTNERS_LINE>.
<QUOTATION_PARTNERS_LINE>-PARTN_ROLE = 'AG'.
<QUOTATION_PARTNERS_LINE>-PARTN_NUMB = '0000001019'.
* <QUOTATION_PARTNERS_LINE>-PARTN_NUMB = '0000882723'.
APPEND INITIAL LINE TO LT_QUOTATION_ITEMS_IN ASSIGNING <QUOTATION_ITEMS_IN_LINE>.
<QUOTATION_ITEMS_IN_LINE>-PO_ITM_NO = '10'.
<QUOTATION_ITEMS_IN_LINE>-MATERIAL = 'A38'.
<QUOTATION_ITEMS_IN_LINE>-PLANT = '0020'.
<QUOTATION_ITEMS_IN_LINE>-ITEM_CATEG = 'AGC'.
<QUOTATION_ITEMS_IN_LINE>-TARGET_QTY = '1'.
<QUOTATION_ITEMS_IN_LINE>-TARGET_QU = 'ST'.
* Neu hinzugefügt wegen dem Auftragsmenge.
DATA: lt_quotation_schedules_in TYPE TABLE OF BAPISCHDL.
FIELD-SYMBOLS <quotation_schedules_in_line> LIKE LINE OF lt_quotation_schedules_in.
APPEND INITIAL LINE TO lt_quotation_schedules_in ASSIGNING <quotation_schedules_in_line>.
<quotation_schedules_in_line>-itm_number = '10'.
<quotation_schedules_in_line>-req_qty = '1'.
CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
EXPORTING
* SALESDOCUMENTIN =
QUOTATION_HEADER_IN = LS_QUOTATION_HEADER_IN
* QUOTATION_HEADER_INX =
* SENDER =
* BINARY_RELATIONSHIPTYPE = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* BEHAVE_WHEN_ERROR = ' '
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = LV_RETURN_SD_NUMBER
TABLES
RETURN = LT_MEASSAGE
QUOTATION_ITEMS_IN = LT_QUOTATION_ITEMS_IN
* QUOTATION_ITEMS_INX =
QUOTATION_PARTNERS = LT_QUOTATION_PARTNERS
QUOTATION_SCHEDULES_IN = lt_quotation_schedules_in
* QUOTATION_SCHEDULES_INX =
* QUOTATION_CONDITIONS_IN =
* QUOTATION_CONDITIONS_INX =
QUOTATION_CFGS_REF = LT_QUOTATION_CFGS_REF
QUOTATION_CFGS_INST = LT_ORDER_CFGS_INST
QUOTATION_CFGS_PART_OF = LT_ORDER_CFGS_PART_OF
QUOTATION_CFGS_VALUE = LT_ORDER_CFGS_VALUE
* QUOTATION_CFGS_BLOB =
* QUOTATION_CFGS_VK =
* QUOTATION_CFGS_REFINST =
* QUOTATION_KEYS =
* QUOTATION_TEXT =
* EXTENSIONIN =
* PARTNERADDRESSES =
.
IF SY-SUBRC EQ '0'.
SET UPDATE TASK LOCAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'x'
IMPORTING
RETURN = LS_MASSAGE_COMMIT.
SET UPDATE TASK LOCAL.
ENDIF.
Code: Alles auswählen.
* CONFIG
APPEND INITIAL LINE TO lt_quotation_cfgs_ref ASSIGNING <quotation_cfgs_ref_line>.
<quotation_cfgs_ref_line>-posex = '000010'.
<quotation_cfgs_ref_line>-config_id = '000001'.
<quotation_cfgs_ref_line>-root_id = '00000001'.
APPEND INITIAL LINE TO lt_order_cfgs_inst ASSIGNING <order_cfgs_inst_line>.
<order_cfgs_inst_line>-config_id = '000001'.
<order_cfgs_inst_line>-inst_id = '00000001'.
<order_cfgs_inst_line>-obj_type = 'MARA'.
<order_cfgs_inst_line>-class_type = '300'.
<order_cfgs_inst_line>-obj_key = '12345678'.
<order_cfgs_inst_line>-quantity = '10'.
APPEND INITIAL LINE TO lt_order_cfgs_value ASSIGNING <order_cfgs_value_line>.
<order_cfgs_value_line>-config_id = '000001'.
<order_cfgs_value_line>-charc = 'KUNDE'.
<order_cfgs_value_line>-inst_id = '00000001'.
<order_cfgs_value_line>-value = '0'.
Code: Alles auswählen.
* <QUOTATION_ITEMS_IN_LINE>-TARGET_QTY = '1'.