on 10-16-2007 4:36 PM
Dear experts,
I need to create Customer Indep. Requirements(MD81) from background using ABAP program.
Could you give a function module or some code sample for it?
Best wishes,
Trey
It's solved by myself using below code.
REPORT ZTY_TEST_MD81.
data: ls_head type vbakkom,
ls_headx type vbakkomx,
lt_vbap type table of vbapkom with header line,
lt_vbapx type table of vbapkomx with header line,
lt_cfgs_value type table of cuxe1cuval with header line,
lt_vbxdata type table of vbx_s_data with header line,
lt_cuval type table of BAPICUVAL with header line,
ls_result type vbak,
lt_return type table of bapiret2,
lt_curef type table of CUXE1CUCFG with header line.
Data: lt_sched type table of VBEPKOM with header line.
ls_head-auart = '01'.
lt_vbap-POSEX = '000010'.
lt_vbap-POSNR = '000010'.
lt_vbap-matnr = 'P-501'.
lt_vbap-werks = '1000'.
lt_vbap-zieme = 'ST'.
lt_vbap-bedae = 'KEK'.
lt_vbap-CONFIG_ID = '000001'.
*lt_vbap-INST_ID = '00000001'.
append lt_vbap.
lt_sched-POSNR = '000010'.
lt_sched-WMENG = 10.
Append lt_sched.
lt_cfgs_value-config_id = '000001'.
*lt_cfgs_value-INST_ID = '00000001'.
lt_cfgs_value-charc = 'P_01'.
lt_cfgs_value-value = '01'.
lt_cfgs_value-VALCODE = '1'.
append lt_cfgs_value.
lt_cfgs_value-config_id = '000001'.
*lt_cfgs_value-INST_ID = '00000001'.
lt_cfgs_value-charc = 'P_02'.
lt_cfgs_value-value = '01'.
lt_cfgs_value-VALCODE = '1'.
append lt_cfgs_value.
*lt_cuval-CONFIG_ID = '000001'.
*lt_cuval-INST_ID = '00000001'.
*lt_cuval-CHARC = 'P_01'.
*lt_cuval-VALUE = '01'.
*lt_cuval-VALCODE = '1'.
*Append lt_cuval.
lt_curef-POSEX = '000010'.
lt_curef-config_id = '000001'.
Append lt_curef.
call function 'DIALOG_SET_NO_DIALOG'.
call function 'SD_SALES_DOCU_MAINTAIN'
exporting
i_vbakkom = ls_head
i_vbakkomx = ls_headx
SIMULATION = ' '
with_commit = 'X'
I_VBAKKOM_REF =
I_POSNR = ' '
I_BWE = ' '
I_LOGIC_SWITCH = ' '
I_CALL_BAPI = ' '
I_WITHOUT_INIT = ' '
suppress_availibility_dia = 'X'
I_LOGSYS =
STATUS_BUFFER_REFRESH = 'X'
I_CRM_LOCK_MODE = ' '
I_CALLER = ' '
importing
e_vbak = ls_result
E_VBUK =
tables
ix_vbapkom = lt_vbap
ix_vbapkomx = lt_vbapx
IX_VBPAKOM =
IX_VBPA2KOM =
IX_BAPIADDR1 =
IX_VBEPKOM = lt_sched
IX_VBEPKOMX =
IX_KONVKOM =
IX_KONVKOMX =
IX_KOMFKZM =
SALES_CFGS_REF = lt_curef
SALES_CFGS_INST =
SALES_CFGS_PART_OF =
sales_cfgs_value = lt_cfgs_value
SALES_CFGS_BLOB =
SALES_CFGS_VK =
SALES_CFGS_REFINST =
return = lt_return
IX_TEXT_HEADER =
IX_TEXT_ITEM =
KEY_TABLE =
VBUVKOM_OUT =
IX_MDVU =
EX_VBKD =
EX_VBAP =
EX_VBEP =
IX_ATPCS_RET =
IX_MDVE =
IX_ATPTERM =
IX_QTVB =
EX_KONV =
IX_CUBLB =
IX_CUCFG =
IX_CUINS =
IX_CUPRT =
ix_cuval =
IX_CUVK =
IX_VBXDATA =
IX_VBXHEAD =
IX_BOP_XVBEP =
IX_VBLBKOM =
IX_VBLBKOMX =
EX_VBLB =
IX_VBKFZKOM =
IX_VBKFZKOMX =
EX_VBKFZ =
EX_VBPA =
EX_THEADVB =
EX_BAPITEXTLI =
BATCH_CHARC =
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Roberto,
I think you are right. The only concern is when I look at the BAPI documentation, I get following notes. It seems that customer number is mandatory and I do not have it for Customer Indep. Requirements.
Notes
Mandatory entries:
ORDER_HEADER_IN : DOC_TYPE Sales document type
SALES_ORG Sales organization
DISTR_CHAN Distribution channel
DIVISION Division
ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number
.........
But anyway, I will try it and let you know the result.
Best wishes,
Trey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello All,
I used function module 'SD_SALES_DOCU_MAINTAIN' inside "BAPI_SALESORDER_CREATEFROMDAT2" to create customer requirement and it's OK! I think it bypass some checks there.
Now the problem become how to set "Configuration Variant" for a sales order item.
Is their any idea or sample code from your side to set "Configuration Variant" using BAPI_SALESORDER_CREATEFROMDAT2.
Best wishes,
Trey
When we refer to the above method to assign a characteristic value to the independent requirement, the independent requirement number is generated, the line item content is empty, request guidance, the following is the code:
*&---------------------------------------------------------------------*
*& Report Z202030825
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zty_test_md81.
DATA: ls_head TYPE vbakkom,
ls_headx TYPE vbakkomx,
lt_vbap TYPE TABLE OF vbapkom WITH HEADER LINE,
lt_vbapx TYPE TABLE OF vbapkomx WITH HEADER LINE,
lt_cfgs_value TYPE TABLE OF cuxe1cuval WITH HEADER LINE,
lt_vbxdata TYPE TABLE OF vbx_s_data WITH HEADER LINE,
lt_cuval TYPE TABLE OF bapicuval WITH HEADER LINE,
ls_result TYPE vbak,
lt_return TYPE TABLE OF bapiret2,
lt_curef TYPE TABLE OF cuxe1cucfg WITH HEADER LINE.
DATA: lt_sched TYPE TABLE OF vbepkom WITH HEADER LINE.
ls_head-auart = '01'.
lt_vbap-posex = '000010'.
lt_vbap-posnr = '000010'.
lt_vbap-matnr = 'A141110T1X3D330B01'.
lt_vbap-werks = '2000'.
*lt_vbap-zieme = 'ST'.
lt_vbap-bedae = 'KMSE'.
lt_vbap-config_id = '000001'.
lt_vbap-INST_ID = '00000001'.
APPEND lt_vbap.
lt_sched-posnr = '000010'.
lt_sched-wmeng = '10'.
APPEND lt_sched.
lt_cfgs_value-config_id = '000001'.
lt_cfgs_value-INST_ID = '00000001'.
lt_cfgs_value-charc = 'BBF'.
*
lt_cfgs_value-value = 'BBF001'.
*
lt_cfgs_value-valcode = '1'.
APPEND lt_cfgs_value.
*lt_cfgs_value-config_id = '000001'.
*
*lt_cfgs_value-INST_ID = '00000001'.
*
*lt_cfgs_value-charc = 'BBL_S'.
*
*lt_cfgs_value-value = 'BBL002'.
*
*lt_cfgs_value-valcode = '1'.
*
*APPEND lt_cfgs_value.
lt_cuval-CONFIG_ID = '000001'.
lt_cuval-INST_ID = '00000001'.
lt_cuval-CHARC = 'BBF'.
lt_cuval-VALUE = 'BBF001'.
lt_cuval-VALCODE = '1'.
Append lt_cuval.
*
lt_curef-posex = '000010'.
*
lt_curef-config_id = '000001'.
*
APPEND lt_curef.
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'SD_SALES_DOCU_MAINTAIN'
EXPORTING
i_vbakkom = ls_head
i_vbakkomx = ls_headx
simulation = ' '
with_commit = 'X'
* i_vbakkom_ref =
* i_posnr = ' '
* i_bwe = ' '
* i_logic_switch = ' '
* i_call_bapi = ' '
* i_without_init = ' '
suppress_availibility_dia = 'X'
* i_logsys =
status_buffer_refresh = 'X'
* i_crm_lock_mode = ' '
* i_caller = ' '
IMPORTING
e_vbak = ls_result
*E_VBUK =
TABLES
ix_vbapkom = lt_vbap
ix_vbapkomx = lt_vbapx
*IX_VBPAKOM =
*IX_VBPA2KOM =
*
*IX_BAPIADDR1 =
ix_vbepkom = lt_sched
*IX_VBEPKOMX =
*
*IX_KONVKOM =
*
*IX_KONVKOMX =
*
*IX_KOMFKZM =
sales_cfgs_ref = lt_curef
*SALES_CFGS_INST =
*
*SALES_CFGS_PART_OF =
sales_cfgs_value = lt_cfgs_value
*SALES_CFGS_BLOB =
*
*SALES_CFGS_VK =
*
*SALES_CFGS_REFINST =
*
*return = lt_return
*
*IX_TEXT_HEADER =
*
*IX_TEXT_ITEM =
*
*KEY_TABLE =
*
*VBUVKOM_OUT =
*
*IX_MDVU =
*
*EX_VBKD =
*
*EX_VBAP =
*
*EX_VBEP =
*
*IX_ATPCS_RET =
*
*IX_MDVE =
*
*IX_ATPTERM =
*
*IX_QTVB =
*
*EX_KONV =
*
*IX_CUBLB =
*
*IX_CUCFG =
*
*IX_CUINS =
*
*IX_CUPRT =
*
ix_cuval = lt_cuval
*
*IX_CUVK =
*
*IX_VBXDATA =
*
*IX_VBXHEAD =
*
*IX_BOP_XVBEP =
*
*IX_VBLBKOM =
*
*IX_VBLBKOMX =
*
*EX_VBLB =
*
*IX_VBKFZKOM =
*
*IX_VBKFZKOMX =
*
*EX_VBKFZ =
*
*EX_VBPA =
*
*EX_THEADVB =
*
*EX_BAPITEXTLI =
*
*BATCH_CHARC =
.
WRITE: '1'.
I think you can use BAPI_SALESORDERCREATEFROMDAT2.
Roberto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.