2006 Dec 29 3:21 PM
Hi,
I need to create internal orders, but field COAS-ASTKZ must be filled with an 'X'.
I don´t find this field, or a similar one, in import parameters or talbes of BAPI_INTERNALORDER_CREATE.
Can any one help me?
thanks in advance!
2006 Dec 31 6:47 AM
Hello Pedro
It seems that you have to use the <b>EXTENSIONIN</b> parameter. Within the BAPI you will find the following coding after creating the order:
*--------------- handle customer extension CI_AUFK --------------------
* move fields from Extension to COAS
PERFORM map_user_fields TABLES extensionin
CHANGING coas. " contains new orderAnd here is the coding of the FORM routine (NOTE: coding from ECC 5.0):
*&---------------------------------------------------------------------*
*& Form MAP_USER_FIELDS
*&---------------------------------------------------------------------*
* -->PT_EXTENSIONIN
* <--PS_COAS including CI_AUFK
*----------------------------------------------------------------------*
FORM map_user_fields TABLES pt_extensionin STRUCTURE bapiparex
CHANGING ps_coas STRUCTURE coas.
DATA: ld_strlen TYPE i,
ld_lines TYPE i,
ls_bapi_te_aufk LIKE bapi_te_aufk.
* any table entries imported?
READ TABLE pt_extensionin INDEX 1.
CHECK sy-subrc = 0.
* only one table entry allowed
DESCRIBE TABLE pt_extensionin LINES ld_lines.
IF ld_lines > 1.
EXIT.
ENDIF.
* map data
LOOP AT pt_extensionin.
CASE pt_extensionin-structure.
WHEN 'BAPI_TE_AUFK'.
* map extension to coas fields
* >> UNICODE
* DESCRIBE FIELD pt_extensionin-structure LENGTH ld_strlen.
DESCRIBE FIELD pt_extensionin-structure
LENGTH ld_strlen IN CHARACTER MODE.
* << UNICODE
MOVE pt_extensionin+ld_strlen TO ls_bapi_te_aufk.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.<b> MOVE-CORRESPONDING ls_bapi_te_aufk TO ps_coas.</b>
ENDCATCH.
WHEN OTHERS.
* ignore others and do nothing
ENDCASE.
ENDLOOP.
ENDFORM. " MAP_USER_FIELDSStructure BAPI_TE_AUFK has the following structure:
ORDERID (type AUFNR)
.INCLUDE CI_AUFKThus, you have to create <b>CI-include CI_AUFK</b> and add the required field ASTKZ.
Since I am not that experienced with CI-includes please talk to an FI-consultant whether there may be any side-effects when creating the CI-include (check the where-used-list).
Regards
Uwe
2006 Dec 31 6:47 AM
Hello Pedro
It seems that you have to use the <b>EXTENSIONIN</b> parameter. Within the BAPI you will find the following coding after creating the order:
*--------------- handle customer extension CI_AUFK --------------------
* move fields from Extension to COAS
PERFORM map_user_fields TABLES extensionin
CHANGING coas. " contains new orderAnd here is the coding of the FORM routine (NOTE: coding from ECC 5.0):
*&---------------------------------------------------------------------*
*& Form MAP_USER_FIELDS
*&---------------------------------------------------------------------*
* -->PT_EXTENSIONIN
* <--PS_COAS including CI_AUFK
*----------------------------------------------------------------------*
FORM map_user_fields TABLES pt_extensionin STRUCTURE bapiparex
CHANGING ps_coas STRUCTURE coas.
DATA: ld_strlen TYPE i,
ld_lines TYPE i,
ls_bapi_te_aufk LIKE bapi_te_aufk.
* any table entries imported?
READ TABLE pt_extensionin INDEX 1.
CHECK sy-subrc = 0.
* only one table entry allowed
DESCRIBE TABLE pt_extensionin LINES ld_lines.
IF ld_lines > 1.
EXIT.
ENDIF.
* map data
LOOP AT pt_extensionin.
CASE pt_extensionin-structure.
WHEN 'BAPI_TE_AUFK'.
* map extension to coas fields
* >> UNICODE
* DESCRIBE FIELD pt_extensionin-structure LENGTH ld_strlen.
DESCRIBE FIELD pt_extensionin-structure
LENGTH ld_strlen IN CHARACTER MODE.
* << UNICODE
MOVE pt_extensionin+ld_strlen TO ls_bapi_te_aufk.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.<b> MOVE-CORRESPONDING ls_bapi_te_aufk TO ps_coas.</b>
ENDCATCH.
WHEN OTHERS.
* ignore others and do nothing
ENDCASE.
ENDLOOP.
ENDFORM. " MAP_USER_FIELDSStructure BAPI_TE_AUFK has the following structure:
ORDERID (type AUFNR)
.INCLUDE CI_AUFKThus, you have to create <b>CI-include CI_AUFK</b> and add the required field ASTKZ.
Since I am not that experienced with CI-includes please talk to an FI-consultant whether there may be any side-effects when creating the CI-include (check the where-used-list).
Regards
Uwe
2007 Jan 05 4:38 PM
Thanks for your answer, but I'm not trying to add a new field to the order.
ASTKZ is a standart field from AUFK I were O want to input value "X" with this BAPI.
description of field EXTENSIONIN is to use n user defined fields in table AUFK.
PA
2007 Jan 08 8:48 AM
Hello Pedro
Have you tried to use <b>BAPI_INTERNALORDER_SAVEREPLICA</b> instead of BAPI_INTERNALORDER_CREATE? The IMPORTING parameter <b>MASTERDATA </b>contains field <b>STATISTICAL</b> which likely corresponds to COAS-ASTKZ.
Regards
Uwe
2007 Oct 25 3:18 AM
If the cctr_posted IS not INITIAL, it default to 'X'.
in the BAPI_INTERNALORDER_CREATE
line 107
IF ( NOT i_master_data-cctr_posted IS INITIAL ).
orext-astkz = 'X'.
ENDIF.
rg
j
2007 Oct 26 3:33 AM
Hi Pedro,
there is a way you can do it. you copy BAPI_INTERNALORDER_CREATE to ZXX_BAPI_INTERNALORDER_CREATE,(you can copy function group completely)
then copy import parameter:bapi2075_7 to zxx_bapi2075_7.
In structure zxx_bapi2075_7 , you add a new field: ASTKZ-有关统计订单标志.
in ZXX_BAPI_INTERNALORDER_CREATE program . line 142. (before 'call function 'KAUF_ORDER_STORE' ' ) add following code:
store user fields in buffer
begin of 'add by huang huibin
coas-astkz = i_master_data-astkz.
end of 'add by huang huibin