Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7185552
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

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


 
阅读(7055) | 评论(6) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-10-29 15:26:04

用CALL BAPI的方式寫外挂欄位的值,需要改Config的設置: SPRO -- > Logistics-General --> Material Master --> Field Selection --> Assign Field TO Field Selections Groups

chinaunix网友2009-05-07 17:24:42

我也碰到此问题,可以问一下问题出在哪里吗?

qdbarry2008-12-03 12:16:52

好像还要搞一个东西,但是我忘了。。

chinaunix网友2008-12-01 14:49:51

老大能不能说说步骤? 我现在是在MARA,bapi_te_mara,bapi_te_marax里面增强了字段,按照你的代码就是更新不进自定义字段呀。

qdbarry2008-04-26 10:53:40

额。。。。。。