Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Customer fields in BAPI for create internal order

Former Member
0 Kudos

Dear all,

I had been created a user-defined field in structure CI_AUFK( the field name 'ZZTYPE', charater type and 4 length), now, I want to create internal order by BAPI 'BAPI_INTERNALORDER_CREATE', the problem is I cannot save the user-defined data ZZTYPE in database.

The source code as below:

FORM create_io CHANGING c_succeed TYPE flag

c_order_id TYPE aufnr.

DATA: ls_master_i TYPE bapi2075_7,

ls_master_e TYPE bapi2075_2,

l_order_id TYPE bapi2075_2-order,

lt_rule TYPE STANDARD TABLE OF bapi2075_6 WITH HEADER LINE INITIAL SIZE 0,

lt_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE INITIAL SIZE 0,

lt_extension TYPE STANDARD TABLE OF bapiparex.

CLEAR c_succeed.

ls_master_i-order_type = '0600'.

ls_master_i-co_area = '1000'.

ls_master_i-comp_code = '1000'.

ls_master_i-bus_area = '1000'.

PERFORM get_extension USING lt_extension.

CALL FUNCTION 'BAPI_INTERNALORDER_CREATE'

EXPORTING

i_master_data = ls_master_i

IMPORTING

e_master_data = ls_master_e

orderid = l_order_id

TABLES

srules = lt_rule

return = lt_return

extensionin = lt_extension.

IF sy-subrc EQ 0.

c_succeed = 'X'.

LOOP AT lt_return WHERE type EQ 'E'.

c_succeed = ''.

MESSAGE lt_return-message TYPE lt_return-type.

ENDLOOP.

ENDIF.

IF c_succeed = 'X'.

COMMIT WORK.

c_order_id = l_order_id.

ELSE.

ROLLBACK WORK.

ENDIF.

ENDFORM.

FORM get_extension CHANGING ct_extention LIKE gt_extensionin.

DATA: ls_ci_aufk TYPE STANDARD TABLE OF ci_aufk WITH HEADER LINE.

DATA: ls_extension TYPE bapiparex,

ls_bapi_te_aufk TYPE bapi_te_aufk.

CLEAR ct_extention.

CLEAR ls_bapi_te_aufk-orderid.

ls_ci_aufk-zztype = 'tes4'.

MOVE-CORRESPONDING ls_ci_aufk TO ls_bapi_te_aufk.

MOVE 'BAPI_TE_AUFK' TO ls_extension-structure.

MOVE ls_bapi_te_aufk TO ls_extension-valuepart1.

APPEND ls_extension TO ct_extention.

ENDFORM.

1 REPLY 1

Former Member
0 Kudos

I don't know if MOVE ls_bapi_te_aufk TO ls_extension-valuepart1 will work. looks like you are also clearing order no.

In the ls_extension-valuepart1 first 12 character should be order no. if order no is smaller then append with spaces.

then 13 to 16 char should be value of your custom field.