程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> Copy Customer-Material Info Record Data

Copy Customer-Material Info Record Data

編輯:C++入門知識

FORM frm_upload USING value(ps_i_tabindex) LIKE sy-tabix
                                value(pc_i_fieldname) TYPE slis_fieldname
                            CHANGING
                                 value(l_subrc) LIKE sy-subrc
                                 value(l_msgtx) TYPE msgtx.
  CLEAR:l_subrc,l_msgtx.

  DATA:BEGIN OF ls_knmt_key,
    vkorg LIKE knmt-vkorg,
    vtweg LIKE knmt-vtweg,
    kunnr LIKE knmt-kunnr,
    matnr LIKE knmt-matnr,
    END OF ls_knmt_key.
  DATA:BEGIN OF yknmt OCCURS 1.
          INCLUDE STRUCTURE knmt.
  DATA:updkz(1),
        END OF yknmt.
  DATA:BEGIN OF xknmt OCCURS 1.
          INCLUDE STRUCTURE knmt.
  DATA:updkz(1),
        END OF xknmt.

  DATA:
        lt_catalog  LIKE tcatalog OCCURS 0 WITH HEADER LINE,
        lv_tdname   LIKE thead-tdname.
  DATA:
        charx TYPE c VALUE 'X'.

  CONSTANTS:
        lc_tdname_knmt LIKE thead-tdobject VALUE 'KNMT'.

  READ TABLE gt_list WITH KEY sel = 'X'.
  IF sy-subrc <> 0.
    l_subrc = 4.
    l_msgtx = 'Please select one row at least!'.
    RETURN.
  ENDIF.

  LOOP AT gt_list WHERE sel = 'X'.
    CLEAR xknmt.
    MOVE-CORRESPONDING gt_list TO xknmt.
    xknmt-matnr = gt_list-newmt.
    xknmt-updkz = 'I'.

    xknmt-ernam = sy-uname.
    xknmt-erdat = sy-datum.
    xknmt-meins = gt_list-meins.
    APPEND xknmt.
  ENDLOOP.

  LOOP AT xknmt.
    ls_knmt_key-vkorg = xknmt-vkorg.
    ls_knmt_key-vtweg = xknmt-vtweg.
    ls_knmt_key-kunnr = xknmt-kunnr.
    ls_knmt_key-matnr = xknmt-matnr.

    lv_tdname = ls_knmt_key.

    CALL FUNCTION 'SD_TEXT_UPDKZ_GET_FROM_CATALOG'
      EXPORTING
        cat_tdobject = lc_tdname_knmt
        cat_tdname   = lv_tdname
        cat_refresh  = space
      TABLES
        cat_table    = lt_catalog
      EXCEPTIONS
        OTHERS       = 0.
  ENDLOOP.

*  LOOP AT yknmt WHERE updkz EQ updkz_delete.
*    ls_knmt_key-vkorg = yknmt-vkorg.
*    ls_knmt_key-vtweg = yknmt-vtweg.
*    ls_knmt_key-kunnr = yknmt-kunnr.
*    ls_knmt_key-matnr = yknmt-matnr.
*
*    lv_tdname = ls_knmt_key.
*    CALL FUNCTION 'SD_TEXT_UPDKZ_GET_FROM_CATALOG'
*      EXPORTING
*        cat_tdobject = lc_tdname_knmt
*        cat_tdname   = lv_tdname
*        cat_refresh  = space
*      TABLES
*        cat_table    = lt_catalog
*      EXCEPTIONS
*        OTHERS       = 0.
*  ENDLOOP.

  CALL FUNCTION 'RV_CUSTOMER_MATERIAL_UPDATE' IN UPDATE TASK
    TABLES
      xknmt_tab    = xknmt
      yknmt_tab    = yknmt
      tcatalog_tab = lt_catalog.

  LOOP AT lt_catalog WHERE tdobject = lc_tdname_knmt.
    CALL FUNCTION 'COMMIT_TEXT'
      EXPORTING
        object = lc_tdname_knmt
        name   = lt_catalog-tdname
        keep   = charx.
  ENDLOOP.

  COMMIT WORK.

  l_subrc = 0.
  l_msgtx = 'Upload successfully'.
ENDFORM.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved