Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7189498
  • 博文数量: 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


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

chinaunix网友2008-04-26 10:28:23

终于见到一个老白搞不定的问题,(*^__^*) 嘻嘻……