首页 > 其他分享 >DEMO:VA01创建贷项订单SD_SALESDOCUMENT_CREATE

DEMO:VA01创建贷项订单SD_SALESDOCUMENT_CREATE

时间:2022-10-17 10:07:49浏览次数:50  
标签:partners inx SALESDOCUMENT DEMO CREATE lt ls conditions order

货铺QQ群号:834508274

进群统一修改群名片,例如BJ_ABAP_森林木。群内禁止发广告及其他一切无关链接,小程序等,进群看公告,谢谢配合
不修改昵称会被不定期踢除,谢谢配合


如果使用 BAPI_SALESORDER_CREATEFROMDAT2 创建,报错:

不允许业务对象 BUS2032 和销售凭证类别 K 的组合

DEMO:VA01创建贷项订单SD_SALESDOCUMENT_CREATE_微信

需要使用

SD_SALESDOCUMENT_CREATE

贷项凭证 发票过账日期

DEMO:VA01创建贷项订单SD_SALESDOCUMENT_CREATE_微信_02

如果VF01 如果不输入日期,默认是读取订单上的开票日期。

DEMO:VA01创建贷项订单SD_SALESDOCUMENT_CREATE_小程序_03




*&---------------------------------------------------------------------*
*& Report ZDEMO_VA01_D
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zdemo_va01_d.

PARAMETERS p_kunnr TYPE kunnr DEFAULT '1004615'.
PARAMETERS p_vkorg TYPE vkorg DEFAULT 'S600'.
PARAMETERS p_vtweg TYPE vtweg DEFAULT '10'.
PARAMETERS p_spart TYPE spart DEFAULT '00'.
PARAMETERS p_werks TYPE werks_d DEFAULT 'S600'.
PARAMETERS p_lgort TYPE lgort_d DEFAULT '6001'.
PARAMETERS p_vstel TYPE vstel DEFAULT 'S600'.
PARAMETERS p_matnr TYPE matnr DEFAULT 'XSWPTEST'.
DATA:ls_order_header_in LIKE bapisdhd1.
DATA:ls_order_header_inx LIKE bapisdhd1x.
DATA:lt_order_items_in LIKE TABLE OF bapisditm.
DATA:lt_order_items_inx LIKE TABLE OF bapisditmx.
DATA:ls_order_items_in LIKE bapisditm.
DATA:ls_order_items_inx LIKE bapisditmx.
DATA:lt_order_partners LIKE TABLE OF bapiparnr.
DATA:ls_order_partners LIKE LINE OF lt_order_partners.
DATA:lt_schedules_in LIKE TABLE OF bapischdl .
DATA:lt_schedules_inx LIKE TABLE OF bapischdlx .
DATA:ls_schedules_in LIKE bapischdl .
DATA:ls_schedules_inx LIKE bapischdlx .
DATA:lt_order_conditions_in LIKE TABLE OF bapicond .
DATA:lt_order_conditions_inx LIKE TABLE OF bapicondx .
DATA:ls_order_conditions_in LIKE bapicond .
DATA:ls_order_conditions_inx LIKE bapicondx .
DATA: lt_return LIKE TABLE OF bapiret2.
DATA: ls_return LIKE bapiret2.
DATA:lv_salesdocument LIKE bapivbeln-vbeln.
CLEAR ls_order_header_in.
ls_order_header_in-doc_type = 'ZDCR'."订单类型
ls_order_header_in-sales_org = p_vkorg.
ls_order_header_in-distr_chan = p_vtweg."分销渠道
ls_order_header_in-division = p_spart."产品组
* ls_order_header_in-sales_off = . "销售部门
ls_order_header_in-purch_no_c = 'test'.
ls_order_header_in-bill_date = '20181220'."开具发票日期
CLEAR ls_order_header_inx.
ls_order_header_inx-doc_type = 'X'.
ls_order_header_inx-sales_org = 'X'.
ls_order_header_inx-distr_chan = 'X'.
ls_order_header_inx-division = 'X'.
*ls_order_header_inx-sales_off = 'X'.
ls_order_header_inx-ass_number = 'X'.
ls_order_header_inx-updateflag = '1'.
ls_order_header_inx-purch_no_c = 'X'.
ls_order_header_inx-bill_date = 'X'.
CLEAR ls_order_items_in.
CLEAR lt_order_items_in[].
ls_order_items_in-itm_number = '10'."只有一个行项目
ls_order_items_in-material = p_matnr.
ls_order_items_in-plant = p_werks.
ls_order_items_in-store_loc = p_lgort.
ls_order_items_in-target_qty = 1.
ls_order_items_in-ship_point = p_vstel."装运点
ls_order_items_in-target_qu = 'EA'.
ls_order_items_in-sales_unit = 'EA'.
APPEND ls_order_items_in TO lt_order_items_in.
CLEAR lt_schedules_in[].
CLEAR ls_schedules_in.
ls_schedules_in-itm_number = '10'."只有一个行项目
ls_schedules_in-req_qty = 1.
APPEND ls_schedules_in TO lt_schedules_in.
CLEAR ls_schedules_inx.
CLEAR lt_schedules_inx[].
ls_schedules_inx-updateflag = 'X'.
ls_schedules_inx-itm_number = 'X'.
ls_schedules_inx-req_qty = 'X'.
APPEND ls_schedules_inx TO lt_schedules_inx.
"售达方默认
CLEAR ls_order_partners.
ls_order_partners-partn_role = 'AG'.
ls_order_partners-partn_numb = p_kunnr.
APPEND ls_order_partners TO lt_order_partners.
*&-------------------------------------
"送达方 使用一次性客户
*&-------------------------------------
CLEAR ls_order_partners.
*ls_order_partners-partn_role = 'WE'.
*ls_order_partners-partn_numb = '1'.
*
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
* EXPORTING
* input = ls_order_partners-partn_numb
* IMPORTING
* output = ls_order_partners-partn_numb.
*
*ls_order_partners-name = '一次性客户测试'.
*ls_order_partners-country = 'CN'.
*APPEND ls_order_partners TO lt_order_partners.
"送达方
CLEAR ls_order_partners.
ls_order_partners-partn_role = 'WE'.
ls_order_partners-partn_numb = p_kunnr.
APPEND ls_order_partners TO lt_order_partners.
*&---------------------------------------------------------------
"付款方
CLEAR ls_order_partners.
ls_order_partners-partn_role = 'RE'.
ls_order_partners-partn_numb = p_kunnr.
APPEND ls_order_partners TO lt_order_partners.
"收票方
CLEAR ls_order_partners.
ls_order_partners-partn_role = 'RG'.
ls_order_partners-partn_numb = p_kunnr.
APPEND ls_order_partners TO lt_order_partners.
CLEAR lt_order_conditions_in[].
CLEAR lt_order_conditions_inx[].
CLEAR ls_order_conditions_in.
ls_order_conditions_in-itm_number = '10'.
ls_order_conditions_in-cond_st_no = ''.
ls_order_conditions_in-cond_count = ''.
ls_order_conditions_in-cond_type = 'ZP32'. "定价条件
ls_order_conditions_in-cond_value = 1000.
ls_order_conditions_in-currency = 'RMB'. "币别
APPEND ls_order_conditions_in TO lt_order_conditions_in.
CLEAR ls_order_conditions_inx.
ls_order_conditions_inx-itm_number = '10'.
ls_order_conditions_inx-cond_st_no = ''.
ls_order_conditions_inx-cond_count = ''.
ls_order_conditions_inx-updateflag = 'X'.
ls_order_conditions_inx-cond_type = 'ZP32'. "定价条件
ls_order_conditions_inx-cond_value = 'X'. "价格
IF ls_order_conditions_in-currency IS NOT INITIAL.
ls_order_conditions_inx-currency = 'X'. "币别
ENDIF.
APPEND ls_order_conditions_inx TO lt_order_conditions_inx.
CLEAR lv_salesdocument.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = ls_order_header_in
sales_header_inx = ls_order_header_inx
IMPORTING
salesdocument_ex = lv_salesdocument
TABLES
return = lt_return
sales_items_in = lt_order_items_in
sales_items_inx = lt_order_items_inx
sales_partners = lt_order_partners
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_conditions_in = lt_order_conditions_in
sales_conditions_inx = lt_order_conditions_inx.
**&不能使用 BAPI_SALESORDER_CREATEFROMDAT2
*CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
* EXPORTING
* order_header_in = ls_order_header_in
* order_header_inx = ls_order_header_inx
* IMPORTING
* salesdocument = lv_salesdocument
* TABLES
* return = lt_return
* order_items_in = lt_order_items_in
* order_items_inx = lt_order_items_inx
* order_partners = lt_order_partners
* order_schedules_in = lt_schedules_in
* order_schedules_inx = lt_schedules_inx
* order_conditions_in = lt_order_conditions_in
* order_conditions_inx = lt_order_conditions_inx.
IF lv_salesdocument IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
WRITE lv_salesdocument.


标签:partners,inx,SALESDOCUMENT,DEMO,CREATE,lt,ls,conditions,order
From: https://blog.51cto.com/u_15680210/5761225

相关文章

  • DEMO:BAPI_CUSTOMERRETURN_CREATE创建退货单
    ​*&---------------------------------------------------------------------**& Report  ZDEMO_VA01*&*&----------------------------------------------------------......
  • 65、记录使用科大讯飞的声纹识别从官方的Python Demo转C++ Demo路程
    基本思想:需要将声纹识别的demo集成到项目中,奈何官方只提供了py版本和java版本,需要c++版本,逐开发和记录一下,只是简单复现其py代码一、官方代码的和手册的地址 这里将py代码......
  • ALV demo 01:cl_salv_table 简单输出
    以下是纯顾问群~QQ群 :SAP干货铺,  群号:775662808所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!直接上干货吧~首先写个最简单的看看参考代码:REPORTZLM_ALV0......
  • ALV demo 03:cl_salv_table :Add Header (Top of page)
    以下是纯顾问群~QQ群 :SAP干货铺,  群号:775662808所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!直接上干货了。效果图:code:*&------------------------------......
  • ALV demo 07: CL_SALV_TABLE 设置可编辑
    以下是纯顾问群~QQ群:SAP干货铺, 群号:775662808所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!效果:点test按钮切换到可编辑状态建status代码REPORTZLM_ALV0......
  • DEMO: MIRO 根据物料创建贷项凭证BAPI_INCOMINGINVOICE_CREATE
    QQ群:SAP干货铺, 群号:775662808所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!MIRODemo*&---------------------------------------------------------------......
  • DEMO: MIRO 根据退货PO创建贷项凭证BAPI_INCOMINGINVOICE_CREATE
    QQ群:SAP干货铺, 群号:775662808所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!POMIRO或者不勾选计算税额,手动输入税额。demo*&-----------------------------......
  • 忙完了camunda这个框架的一个运行demo
    这周把企业微信和camunda这个的大概都看了下感觉时间逐渐掌控了起来了不过还有很多事情没有安排去做现在刷了下统计学听了前辈的忠告要把学到的都融合起来比如我学统......
  • Demo27 比较大小
    /比较大小_方法的调用packagecom.HuanXin.Fan_Fa_5;publicclassDemo03{publicstaticvoidmain(String[]args){intXX=max(10,20);//调用下文的比较......
  • Demo29_方法的重载02
    //关于方法名相同时,可通过改变参数类型继续使用此方法典例packagecom.HuanXin.Fan_Fa_5;publicclassDemo04_方法重载{publicstaticvoidmain(String[]args){......