问题描述
*&---------------------------------------------------------------------**&ReportZSD_TEST*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------*REPORTzsd_test.DATA:headerLIKEbapisdhd1,headerxLIKEbapisdhd1x,g_vbelnLIKEvbak-vbeln,it_retmsgLIKETABLEOFbapiret2WITHHEADERLINE,it_itemLIKETABLEOFbapisditmWITHHEADERLINE,it_itemxLIKETABLEOFbapisditmxWITHHEADERLINE,it_partnersLIKETABLEOFbapiparnrWITHHEADERLINE,it_schLIKETABLEOFbapischdlWITHHEADERLINE,it_conditionLIKETABLEOFbapicondWITHHEADERLINE.headerx-updateflag='I'.headerx-doc_type='X'.headerx-sales_org='X'.headerx-distr_chan='X'.headerx-division='X'.headerx-req_date_h='X'.headerx-qt_valid_f='X'.headerx-qt_valid_t='X'.header-doc_type='ZQTC'.header-sales_org='1060'.header-distr_chan='ET'.header-division='60'.*header-war_date=sy-datum."销售里担保.header-req_date_h=sy-datum+15."请求交货日期header-qt_valid_f=sy-datum."报价/询价有效从header-qt_valid_t='99991231'."投标/报价截止的日期(有效日)*header-ref_1='货到付款'.*header-telephone='110'.*header-pmnttrms='Y000'.*header-currency='CNY'.*header-price_date=sy-datum+2.it_partners-partn_role='AG'.it_partners-partn_numb='0000000086'."售达方APPENDit_partners.*&初始化项目it_itemx-updateflag='I'.it_itemx-itm_number=10.it_itemx-material='X'.it_itemx-plant='X'.it_itemx-target_qty='X'.it_itemx-target_qu='X'.it_item-itm_number='10'.it_item-material='12303700370000000D'.it_item-plant='1000'.it_item-target_qty='11'.it_item-target_qu='PCS'.*it_item-store_loc='R950'.APPENDit_item.*it_itemx-updateflag='I'.*it_itemx-itm_number=20.*it_itemx-material='X'.*it_itemx-plant='X'.*it_itemx-target_qty='X'.*it_itemx-target_qu='X'.**it_item-itm_number='20'.*it_item-material='123070204600000010'.*it_item-plant='1000'.*it_item-target_qty='21'.**it_item-target_qu='PCS'.**it_item-store_loc='R950'.*APPENDit_item.**&首日起,订单数量*it_sch-itm_number='000010'.*it_sch-req_date=sy-datum.*it_sch-dlv_date=sy-datum.*it_sch-req_qty='11'."数量*APPENDit_sch.**it_sch-itm_number='000020'.*it_sch-req_date=sy-datum.*it_sch-dlv_date=sy-datum.*it_sch-req_qty='21'."数量*APPENDit_sch.***&抬头的条件价格*it_condition-currency='CNY'.*it_condition-cond_type='ZP00'.*it_condition-cond_value='11'.*APPENDit_condition.***&项目的金额,一定要加上货币,否则会乘以10倍*it_condition-itm_number='000010'.*it_condition-cond_type='ZP00'.*it_condition-roundoffdi='1.000'.*it_condition-currency='CNY'.*APPENDit_condition.**it_condition-itm_number='000020'.*it_condition-cond_type='ZP00'.*it_condition-roundoffdi='22.000'.*it_condition-currency='CNY'.*APPENDit_condition.CALLFUNCTION'BAPI_QUOTATION_CREATEFROMDATA2'EXPORTINGquotation_header_in=headerquotation_header_inx=headerxIMPORTINGsalesdocument=g_vbelnTABLESreturn=it_retmsgquotation_items_in=it_itemquotation_items_inx=it_itemxquotation_partners=it_partners*quotation_schedules_in=it_sch*quotation_conditions_in=it_condition.IFsy-subrc=0.READTABLEit_retmsgWITHKEYtype='E'.IFsy-subrc<>0.CALLFUNCTION'BAPI_TRANSACTION_COMMIT'.WRITE:'saleorderdocument:',g_vbeln.*取意向订单对应的状态对象编号DATA:g_objnrLIKEvbak-objnr.SELECTSINGLEobjnrINTOg_objnrFROMvbakWHEREvbeln=g_vbeln.*IFsy-subrc=0.**CALLFUNCTION'STATUS_CHANGE_EXTERN'*EXPORTING*objnr=g_objnr*user_status='E0004'.*ENDIF.CALLFUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait='X'.ENDIF.ENDIF.详细内容请看:http://blog.csdn.net/ericdzhang/archive/2009/12/07/4958341.aspx
解决方案
解决方案二:
各位,我用上面的程序导入报价(VA21)数据时已经导入了。但是报价的数量为0.不知是哪里没有传递参数?还是缺少什么条件??
解决方案三:
这个问题搞定了。具体原因是一定需要it_sch这个数据。*&---------------------------------------------------------------------**&ReportZSD_TEST*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------*REPORTzsd_test.DATA:headerLIKEbapisdhd1,*headerxLIKEbapisdhd1x,g_vbelnLIKEvbak-vbeln,it_retmsgLIKETABLEOFbapiret2WITHHEADERLINE,it_itemLIKETABLEOFbapisditmWITHHEADERLINE,*it_itemxLIKETABLEOFbapisditmxWITHHEADERLINE,it_partnersLIKETABLEOFbapiparnrWITHHEADERLINE,it_schLIKETABLEOFbapischdlWITHHEADERLINE,it_conditionLIKETABLEOFbapicondWITHHEADERLINE.*headerx-updateflag='I'.*headerx-doc_type='X'.*headerx-sales_org='X'.*headerx-distr_chan='X'.*headerx-division='X'.*headerx-req_date_h='X'.*headerx-qt_valid_f='X'.*headerx-qt_valid_t='X'.header-doc_type='ZQTC'.header-sales_org='1060'.header-distr_chan='ET'.header-division='60'.header-req_date_h=sy-datum+2."请求交货日期header-qt_valid_f=sy-datum."报价/询价有效从header-qt_valid_t='99991231'."投标/报价截止的日期(有效日)it_partners-partn_role='AG'.it_partners-partn_numb='0000000086'."售达方APPENDit_partners.it_partners-partn_role='WE'.it_partners-partn_numb='0000000086'."售达方APPENDit_partners.*&初始化项目*it_itemx-updateflag='I'.*it_itemx-itm_number='000010'.*it_itemx-material='X'.*it_itemx-plant='X'.*it_itemx-target_qty='X'.*it_itemx-target_qu='X'.*it_itemx-salqtynum='X'.*it_itemx-salqtyden='X'.*APPENDit_itemx.it_item-itm_number='000010'.it_item-material='12303700370000000D'.it_item-plant='1000'.*it_item-target_qty='1100'."这个数量可以不要传递*it_item-target_qu='PCS'.*it_item-salqtynum='1'.*it_item-salqtyden='1'.*&计划行数量it_sch-itm_number='000010'.*it_sch-req_date=sy-datum.*it_sch-dlv_date=sy-datum.it_sch-req_qty='11000'."数量这个数量一定要有,否则报价单上的"订单数量"为0APPENDit_sch."这里的Append的顺序不知是否有影响,原来APPENDit_item.是在it_item后就新增了APPENDit_item.**&抬头的条件价格**it_condition-currency='HKD'.**it_condition-cond_type='ZP00'.**it_condition-cond_value='12'.**APPENDit_condition.***&项目的金额,一定要加上货币,否则会乘以10倍*it_condition-itm_number='000010'.*it_condition-cond_type='ZP00'.*it_condition-roundoffdi='1.000'.*it_condition-currency='HKD'.*APPENDit_condition.**it_condition-itm_number='000020'.**it_condition-cond_type='ZP00'.**it_condition-roundoffdi='22.000'.**it_condition-currency='CNY'.**APPENDit_condition.CALLFUNCTION'BAPI_QUOTATION_CREATEFROMDATA2'EXPORTINGquotation_header_in=header*quotation_header_inx=headerxtestrun=''IMPORTINGsalesdocument=g_vbelnTABLESreturn=it_retmsgquotation_items_in=it_item*quotation_items_inx=it_itemxquotation_partners=it_partnersquotation_schedules_in=it_sch"这里一定要传递,否则数量为0*quotation_conditions_in=it_condition.IFsy-subrc=0.READTABLEit_retmsgWITHKEYtype='E'.IFsy-subrc<>0.CALLFUNCTION'BAPI_TRANSACTION_COMMIT'.WRITE:'saleorderdocument:',g_vbeln.*取意向订单对应的状态对象编号DATA:g_objnrLIKEvbak-objnr.SELECTSINGLEobjnrINTOg_objnrFROMvbakWHEREvbeln=g_vbeln.*IFsy-subrc=0.**CALLFUNCTION'STATUS_CHANGE_EXTERN'*EXPORTING*objnr=g_objnr*user_status='E0004'.*ENDIF.*CALLFUNCTION'BAPI_TRANSACTION_COMMIT'*EXPORTING*wait='X'.ENDIF.ENDIF.