ABAP顾问
分类:
2008-04-25 23:02:51
做了一天,MARA内原有的字段可以了,但是Append的字段怎么也搞不成功,NND
哪位兄弟如果做成了,希望留言,谢谢!
已经搞定!
*&---------------------------------------------------------------------*
*& Report Z_BARRY_TEST_BAPI
*&
*&---------------------------------------------------------------------*
*& 使用BAPI创建或者修改物料,修改Appendd的字段
*& 或者在BAPI参数内内找不到的透明表字段
*&---------------------------------------------------------------------*
REPORT z_barry_test_bapi.
DATA: head LIKE bapimathead ,
w_clientdata LIKE bapi_mara,
w_clientdatax LIKE bapi_marax,
return LIKE bapiret2 .
DATA: makttab LIKE bapi_makt OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF w_extensionin OCCURS 0.
INCLUDE STRUCTURE bapiparex.
DATA: END OF w_extensionin.
DATA: BEGIN OF w_extensioninx OCCURS 0.
INCLUDE STRUCTURE bapiparexx.
DATA: END OF w_extensioninx.
DATA zzbapi_te_mara LIKE bapi_te_mara.
DATA zzbapi_te_marax LIKE bapi_te_marax.
START-OF-SELECTION.
head-material = '000000000000001227'.
head-basic_view = 'X'.
w_clientdata-base_uom = 'EA'.
w_clientdatax-base_uom = 'X'.
makttab-langu = sy-langu.
makttab-matl_desc = 'BarryTest'.
APPEND makttab.
zzbapi_te_mara-material = head-material.
zzbapi_te_mara-zzextwg = '123456'.
zzbapi_te_marax-material = head-material.
zzbapi_te_marax-zzextwg = 'X'.
w_extensionin-structure = 'BAPI_TE_MARA'.
w_extensionin-valuepart1 = zzbapi_te_mara.
APPEND w_extensionin.
w_extensioninx-structure = 'BAPI_TE_MARAX'.
w_extensioninx-valuepart1 = zzbapi_te_marax.
APPEND w_extensioninx.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = head
clientdata = w_clientdata
clientdatax = w_clientdatax
* PLANTDATA =
* PLANTDATAX =
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA =
* VALUATIONDATAX =
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA =
* SALESDATAX =
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
* FLAG_ONLINE = ' '
* FLAG_CAD_CALL = ' '
* NO_DEQUEUE = ' '
IMPORTING
return = return
TABLES
materialdescription = makttab[]
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
extensionin = w_extensionin
extensioninx = w_extensioninx
.
COMMIT WORK AND WAIT.
PERFORM write_wa USING return 'XXXXXXXXXXXXXX' 'X'.
*&---------------------------------------------------------------------*
*& Form write_wa
*&---------------------------------------------------------------------*
FORM write_wa USING wa fieldmask newline.
DATA: str TYPE string ,
str_idx TYPE string ,
f_index TYPE i ,
f_len TYPE i .
FIELD-SYMBOLS:
f_len = STRLEN( fieldmask ).
IF newline = 'X'. WRITE / ''.ENDIF.
POSITION 1 .
DO .
ASSIGN COMPONENT sy-index OF STRUCTURE wa TO
IF sy-subrc <> 0 OR sy-index > f_len.
EXIT.
ELSE.
str_idx = sy-index .
CONDENSE str_idx.
f_index = sy-index - 1.
IF fieldmask+f_index(1) = 'X'.
str =
WRITE str.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. "write_wa
chinaunix网友2009-10-29 15:26:04
用CALL BAPI的方式寫外挂欄位的值,需要改Config的設置: SPRO -- > Logistics-General --> Material Master --> Field Selection --> Assign Field TO Field Selections Groups
chinaunix网友2008-12-01 14:49:51
老大能不能说说步骤? 我现在是在MARA,bapi_te_mara,bapi_te_marax里面增强了字段,按照你的代码就是更新不进自定义字段呀。