MATERIAL_MAINTAIN_DARK

Hi folks,
I am using this Funtion module  MATERIAL_MAINTAIN_DARK.
But i am getting a error of No description transferred.
Can any body give me sample code that uses this Function module.

REPORT  ZSSS.
INCLUDES                                                             *
Definition data include
INCLUDE ZPROGRAM_TOP.
Forms definition include
INCLUDE ZPROGRAM_SUB.
Tables                                                               *
TABLES: lfa1, LFB1,LFB5, lfm1,
        mara, marc, mbew, steu, mvke, mard.
Types                                                                *
Predefine classes                                                    *
CLASS XXX.
Data                                                                 *
Data - Internal Tables
Data - Structures
Data - Variables and flags
DATA:
  gt_errs       TYPE merrdat OCCURS 0 WITH HEADER LINE,
  gt_mara_ueb   TYPE mara_ueb OCCURS 0 WITH HEADER LINE,
  gt_marc_ueb   TYPE marc_ueb OCCURS 0 WITH HEADER LINE,
  gt_mard_ueb   TYPE mard_ueb OCCURS 0 WITH HEADER LINE,
  gt_mbew_ueb   TYPE mbew_ueb OCCURS 0 WITH HEADER LINE,
  gt_mvke_ueb   TYPE mvke_ueb OCCURS 0 WITH HEADER LINE.
types: begin of g_ty_s_test,
         select_amount      type i,
         no_info_popup      type char1,
         info_popup_once    type char1,
         events             type lvc_fname occurs 0,
         events_info_popup  type lvc_fname occurs 0,
         bypassing_buffer   type char1,
         buffer_active      type char1,
       end   of g_ty_s_test,
  BEGIN OF tlfa1,
    lifnr LIKE lfa1-lifnr,
  AKONT LIKE LFB1-AKONT,
  ZUAWA LIKE LFB1-ZUAWA,
  FDGRV LIKE LFB1-FDGRV,
  VZSKZ LIKE LFB1-VZSKZ,
  ZINDT(10),
  ZINRT LIKE LFB1-ZINRT,
  DATLZ(10),
  ALTKN LIKE LFB1-ALTKN,
qsskz like LFB1-qsskz,
  ZTERM LIKE LFB1-ZTERM,
  TOGRU LIKE LFB1-TOGRU,
XVERR LIKE LFB1-XVERR,
URLID LIKE LFB1-URLID,
reprf like LFB1-reprf,
  ZWELS LIKE LFB1-ZWELS,
  ZAHLS LIKE LFB1-ZAHLS,
  XPORE LIKE LFB1-XPORE,
  XVERR LIKE LFB1-XVERR,
  HBKID LIKE LFB1-HBKID,
  ZGRUP LIKE LFB1-ZGRUP,
  KVERM LIKE LFB1-KVERM,
  busab LIKE LFB1-busab,
  BUKRS LIKE LFB1-BUKRS,
  END OF tlfa1.
data: pol(2) type n, cnt1 type i, cnt2 type i.
data: kostl1(10) type n.
DATA: BEGIN OF ilfa1 OCCURS 100,
        lifnr LIKE lfa1-lifnr,
        bukrs LIKE LFB1-bukrs,
      END OF ilfa1.
DATA: BEGIN OF tab OCCURS 500,
        text(500),
      END OF tab.
DATA: BEGIN OF bdcdata OCCURS 500.
        INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
data: plus(2), minus(2).
type-pools: slis.
constants: con_true     type char1 value 'X',
           con_event_05 type lvc_fname value 'BEFORE_LINE_OUTPUT'.
data: gs_test type g_ty_s_test.
data: layout        type slis_layout_alv,
      s_fieldcat    type slis_fieldcat_alv,
      it_fieldcat   type slis_t_fieldcat_alv,
      s_event       type slis_alv_event,
      it_event      type slis_t_event,
      s_sort        type slis_sortinfo_alv,
      it_sort       type slis_t_sortinfo_alv,
      keyinfo       type slis_keyinfo_alv,
      s_lineinfo    type slis_lineinfo,
      printinfo     type slis_print_alv,
      xlfa1 TYPE tlfa1 OCCURS 100 WITH HEADER LINE,
      TABPOOL LIKE TEXTPOOL OCCURS 50 WITH HEADER LINE,
      workdays type p,
      g_repid       like sy-repid.
data: hodnota1 LIKE ANLC-KANSW.
data: hodnota2 LIKE ANLC-KANSW.
Ranges                                                               *
Field Groups                                                         *
Field Symbols                                                        *
Parameters and select options                                        *
PARAMETERS:
WERKS1   LIKE marc-werks  DEFAULT 'Z621',
WERKS2   LIKE LFB1-bukrs DEFAULT 'Z605',
vkorg1   LIKE knvv-vkorg DEFAULT 'Z004',
vkorg2   LIKE knvv-vkorg DEFAULT 'Z001',
ekorg(4) DEFAULT 'CE01'.
MAPA  LIKE APQI-GROUPID DEFAULT 'importdod'.
kostl LIKE anlz-kostl DEFAULT '0000011101'.
select-options:
  material for marc-matnr.
parameters:
test as checkbox.
Define classes                                                       *
CLASS XXX DEFINITION.
EVENTS                                                               *
INITIALIZATION
INITIALIZATION.
======================================================================
                              Macros
======================================================================
define addfc.
    s_fieldcat-fieldname      = &1.
    s_fieldcat-ref_fieldname  = &2.
    s_fieldcat-ref_tabname    = &3.
    s_fieldcat-key            = &4.
    s_fieldcat-icon           = &6.
    s_fieldcat-reptext_ddic   = &7.
    s_fieldcat-seltext_l      = &7.
    s_fieldcat-seltext_m      = &7.
    s_fieldcat-seltext_s      = &7.
    s_fieldcat-do_sum         = &8.
    s_fieldcat-no_out         = &5.
    append s_fieldcat to it_fieldcat.
end-of-definition.
START-OF-SELECTION
START-OF-SELECTION.
*PERFORM upload_from_disk USING sub.
clear: cnt1, cnt2.
select  * from marc
  where
    werks eq werks1
and matnr in material.
CLEAR: gt_mara_ueb,gt_marc_ueb, gt_mard_ueb, gt_mbew_ueb, gt_mvke_ueb.
REFRESH: gt_mara_ueb,gt_marc_ueb, gt_mard_ueb, gt_mbew_ueb, gt_mvke_ueb.
MOVE-CORRESPONDING marc TO gt_marc_ueb.
select  single * from marc
  where matnr eq marc-matnr
    and werks eq werks2.
check  sy-subrc ne 0.
gt_marc_ueb-werks = werks2.
if gt_marc_ueb-prctr(1) eq 'Z'.
  gt_marc_ueb-prctr(4) = werks2.
endif.
append gt_marc_ueb.
  SELECT SINGLE * FROM mara WHERE matnr = gt_marc_ueb-matnr.
  IF sy-subrc = 0.
    MOVE-CORRESPONDING mara TO gt_mara_ueb.
    gt_mara_ueb-tcode = 'MM01'.
    append gt_mara_ueb.
  ENDIF.
select  single * from mard
  where matnr eq gt_marc_ueb-matnr
    and werks eq werks1.
MOVE-CORRESPONDING mard TO gt_mard_ueb.
select  single * from mard
  where matnr eq gt_marc_ueb-matnr
    and werks eq werks2.
if sy-subrc ne 0.
gt_mard_ueb-werks = werks2.
append gt_mard_ueb.
endif.
select  single * from mbew
  where matnr eq gt_marc_ueb-matnr
    and bwkey eq werks1.
MOVE-CORRESPONDING mbew TO gt_mbew_ueb.
select  single * from mbew
  where matnr eq gt_marc_ueb-matnr
    and bwkey eq werks2.
if sy-subrc ne 0.
gt_mbew_ueb-bwkey = werks2.
append gt_mbew_ueb.
endif.
select  single * from mvke
  where matnr eq gt_marc_ueb-matnr
    and vkorg eq vkorg1.
MOVE-CORRESPONDING mvke TO gt_mvke_ueb.
select  single * from mvke
  where matnr eq gt_marc_ueb-matnr
    and vkorg eq vkorg2.
if sy-subrc ne 0.
gt_mvke_ueb-vkorg = vkorg2.
append gt_mvke_ueb.
endif.
*write:/ gt_marc_ueb-matnr, gt_marc_ueb-werks, gt_mvke_ueb-vkorg.
if test ne space.
  write:/ gt_marc_ueb-matnr, gt_marc_ueb-werks, gt_mvke_ueb-vkorg.
else.
  CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
    EXPORTING
    FLAG_MUSS_PRUEFEN               = 'X'
    SPERRMODUS                      = 'E'
      max_errors                      = 0
      p_kz_no_warn                    = 'X'
      kz_prf                          = ''
    KZ_VERW                         = 'X'
    KZ_AEND                         = 'X'
    KZ_DISPO                        = 'X'
      kz_test                         = TEST
    NO_DATABASE_UPDATE              = ' '
    CALL_MODE                       = ' '
    CALL_MODE2                      = ' '
      user                            = sy-uname
    SUPPRESS_ARRAY_READ             = ' '
    FLG_MASS                        = ' '
    IMPORTING
      matnr_last                      = gt_marc_ueb-matnr
     number_errors_transaction       = g_trnerr
    TABLES
      amara_ueb                       = gt_mara_ueb
    AMAKT_UEB                       =
      amarc_ueb                       = gt_marc_ueb
      AMARD_UEB                       = gt_mard_ueb
    AMFHM_UEB                       =
    AMARM_UEB                       =
    AMEA1_UEB                       =
      ambew_ueb                       = gt_mbew_ueb
    ASTEU_UEB                       =
    ASTMM_UEB                       =
    AMLGN_UEB                       =
    AMLGT_UEB                       =
    AMPGD_UEB                       =
    AMPOP_UEB                       =
    AMVEG_UEB                       =
    AMVEU_UEB                       =
      amvke_ueb                       = gt_mvke_ueb
    ALTX1_UEB                       =
    AMPRW_UEB                       =
    AE1CUCFG_UEB                    =
    AE1CUINS_UEB                    =
    AE1CUVAL_UEB                    =
    AE1CUCOM_UEB                    =
     amfieldres                      = gt_fieldres
      amerrdat                        = gt_errs
    EXCEPTIONS
      kstatus_empty                   = 1
      tkstatus_empty                  = 2
      t130m_error                     = 3
      internal_error                  = 4
      too_many_errors                 = 5
      update_error                    = 6
      OTHERS                          = 7
  loop at gt_errs.
  if gt_marc_ueb-matnr ne space.
    format color col_group.
    write:/ gt_marc_ueb-matnr, gt_marc_ueb-werks, gt_mvke_ueb-vkorg.
  else.
    format color col_negative.
    write:/ gt_marc_ueb-matnr,gt_errs.
  endif.
  endloop.
if sy-subrc eq 0.
  if gt_marc_ueb-matnr ne space.
    cnt1 = cnt1 + 1.
  else.
    cnt2 = cnt2 + 1.
  endif.
endif.
endselect.
*perform prepare_alv_grid_data.
uline.
  format color col_total.
write: / poc, ilfa1-anlkl, ilfa1-txt50,  ilfa1-aktiv, ilfa1-afasl01,
*skansw, slfafa.
  if test eq space.
  format color col_group.
  write: / 'Poèet správnych:', cnt1.
  format color col_negative.
  write: / 'Poèet chybných:', cnt2.
  else.
  write: / 'Testovací re¾im'.
endif.
======================================================================
                             Top of Page
======================================================================
form f01_alv_event_top_of_page.
write:/ 'Business pipeline'(020).
write: 40 'Pracovné dni:'(021), workdays.
perforM VYPIS_SEL_OPT.
endform.
form f01_alv_event_END_OF_LIST.
perform prepare_alv_grid_data1.
endform.
      FORM DYNPRO                                                   *
-->  PROGRAM                                                       *
-->  DYNPRO                                                        *
FORM dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program = program.
  bdcdata-dynpro = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.
      FORM PRG                                                      *
-->  FNAM                                                          *
-->  FVAL                                                          *
FORM prg USING fnam fval.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
ENDFORM.
FORM prg1 USING fnam fval.
if fval ne space.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
endif.
ENDFORM.
FORM prg2 USING fnam fval.
data: hodn like anlc-kansw.
perform hodnota using fval hodn.
if hodn ne 0.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
endif.
ENDFORM.
FORM prg3 USING fnam fval.
data: hodn like anlc-kansw.
perform hodnota using fval hodn.
if hodn eq 0.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = '0'.
  APPEND bdcdata.
endif.
ENDFORM.
FORM prg4 USING fnam fval.
data: hodn like anlc-kansw.
data: txt(30).
perform hodnota using fval hodn.
if hodn ne 0.
  if hodn lt 0.
    concatenate fnam '(' minus ')' into txt.
  else.
    concatenate fnam '(' plus ')' into txt.
  endif.
  CLEAR bdcdata.
  bdcdata-fnam = txt.
  bdcdata-fval = fval.
  APPEND bdcdata.
else.
  CLEAR bdcdata.
  bdcdata-fnam = txt.
  bdcdata-fval = fval.
  APPEND bdcdata.
endif.
ENDFORM.
FORM prg5 USING fnam pol.
data: txt(30).
    concatenate fnam '(' pol ')' into txt.
  CLEAR bdcdata.
  bdcdata-fnam = txt.
  bdcdata-fval = '0'.
  APPEND bdcdata.
ENDFORM.
FORM prg6 USING fnam pol fval.
data: txt(30).
    concatenate fnam '(' pol ')' into txt.
  CLEAR bdcdata.
  bdcdata-fnam = txt.
  bdcdata-fval = fval.
  APPEND bdcdata.
ENDFORM.
FORM prg7 USING fnam fval pol.
data: txt(30).
  concatenate fval '(' pol ')' into txt.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = txt.
  APPEND bdcdata.
ENDFORM.
-->  FILENAME                                                      *
FORM upload_from_disk USING filename.
  DATA: name(80).
  REFRESH: tab.
  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            filename        = filename
            filetype        = 'ASC'
       TABLES
            data_tab        = tab
       EXCEPTIONS
            file_open_error = 1
            file_read_error = 2.
  name = filename.
  CASE sy-subrc.
    WHEN 1.
     MESSAGE e704 WITH name3 name0(2).
    WHEN 2.
     MESSAGE e705 WITH name3 name0(2).
    WHEN OTHERS.
  ENDCASE.
ENDFORM.
FORM WRITE_BTR USING P_BTR P_EXCEL.
  if p_btr eq 0. clear P_EXCEL. exit. endif.
  WRITE P_BTR TO P_EXCEL.
  TRANSLATE P_EXCEL USING '. '.
TRANSLATE P_EXCEL USING '.,'.
  CONDENSE P_EXCEL NO-GAPS.
  SHIFT P_EXCEL RIGHT CIRCULAR.
ENDFORM.                               " WRITE_BTR
form hodnota using hodntext hodn.
data: text(18).
  text = hodntext.
replace '-' with ' ' into text.
  replace ',' with '.' into text.
  condense text no-gaps.
  hodn = text.
endform.
*&      Form  prepare_alv_grid_data
      text
-->  p1        text
<--  p2        text
form prepare_alv_grid_data.
  clear: s_fieldcat,
         keyinfo,
         s_event,
         layout,
         s_sort.
  refresh: it_fieldcat,
           it_sort,
           it_event.
  s_fieldcat-tabname   = 'ilfa1'.
Data: txt(100).
  addfc:
    POLE, REF_TAB, KEY, NO-OUT, ICON, TEXT, DO-SUM
     'LIFNR' 'LIFNR'   'LFB1' '' '' ''  'Dodávateµ'(001)      '',
     'BUKRS' 'BUKRS'   'LFB1' '' '' ''  'Úèt. okruh'(001)      ''.
   s_sort-spos           = 1.
   s_sort-fieldname      = 'BEZEI'.
   s_sort-tabname      = 'IT_SUMM'.
   s_sort-up             = 'X'.
   s_sort-subtot         = 'X'.
   append s_sort to it_sort.
  layout-zebra             =  'X'.
  layout-totals_text       = 'Súetový riadok'.
  layout-NUMC_SUM          =  'X'.
  layout-colwidth_optimize =  'X'.
  layout-window_titlebar   =
  'Inv. majetok'(020).
  clear s_event.
  s_event-form = 'TOP_OF_PAGE'.
  s_event-name =  slis_ev_top_of_page.
  append s_event to gs_test-events.
  s_event-form = 'END_OF_LIST'.
  s_event-name =  SLIS_EV_END_OF_LIST.
  append s_event to gs_test-events.
  perform f01_alv_set_events changing it_event.
  g_repid = sy-repid.
  printinfo-no_print_selinfos  = 'X'.
  printinfo-no_print_listinfos = 'X'.
call function 'REUSE_ALV_LIST_DISPLAY'
   call function 'REUSE_ALV_GRID_DISPLAY'
   exporting
     i_callback_program             = g_repid
     I_GRID_TITLE                   = 'Inv. majetok ASO'(020)
     is_layout                      = layout
     it_fieldcat                    = it_fieldcat
    i_default                      = space  "'X'
      i_save                         = 'A'
     it_sort                        = it_sort
    it_events                      = it_event
    i_screen_start_line            = 0
    is_print                       = printinfo
     I_STRUCTURE_NAME               = 'ilfa1'
    tables
      t_outtab                      = ilfa1
   exceptions
     program_error                  = 1
     others                         = 2.
endform.                    " prepare_alv_grid_data
form prepare_alv_grid_data1.
  clear: s_fieldcat,
         keyinfo,
         s_event,
         layout,
         s_sort.
  refresh: it_fieldcat,
           it_sort,
           it_event.
  s_fieldcat-tabname   = 'ilfa1'.
Data: txt(100).
  addfc:
    POLE, REF_TAB, KEY, NO-OUT, ICON, TEXT, DO-SUM
     'ANLKL' 'ANLKL'   'ANLA' '' '' ''  'Trieda IM'(001)      '',
     'ANLN1' 'ANLN1'   'ANLA' '' '' ''  'Hlavné èíslo IM'(002)      '',
     'TXT50' 'TXT50'   'ANLA' '' '' ''  'Oznaèenie'(015) '',
    'INVNR' 'INVNR'   'ANLA' '' '' ''  'Inventárne èíslo'(003) '',
     'KOSTL' 'KOSTL'   'ANLA' '' '' ''  'Náklad. stredisko'(004) '',
     'LIFNR' 'LIFNR'   'ANLA' '' '' ''  'Dodavatel'(004) ''.
   s_sort-spos           = 1.
   s_sort-fieldname      = 'BEZEI'.
   s_sort-tabname      = 'IT_SUMM'.
   s_sort-up             = 'X'.
   s_sort-subtot         = 'X'.
   append s_sort to it_sort.
  layout-zebra             =  'X'.
  layout-totals_text       = 'Súetový riadok'.
  layout-NUMC_SUM          =  'X'.
  layout-colwidth_optimize =  'X'.
  layout-window_titlebar   =
  'Inv. majetok'(020).
  clear s_event.
  s_event-form = 'TOP_OF_PAGE'.
  s_event-name =  slis_ev_top_of_page.
  append s_event to gs_test-events.
  s_event-form = 'END_OF_LIST'.
  s_event-name =  SLIS_EV_END_OF_LIST.
  append s_event to gs_test-events.
  perform f01_alv_set_events changing it_event.
  g_repid = sy-repid.
  printinfo-no_print_selinfos  = 'X'.
  printinfo-no_print_listinfos = 'X'.
call function 'REUSE_ALV_LIST_DISPLAY'
   call function 'REUSE_ALV_GRID_DISPLAY'
   exporting
     i_callback_program             = g_repid
     I_GRID_TITLE                   = 'Inv. majetok - odavatele'(020)
     is_layout                      = layout
     it_fieldcat                    = it_fieldcat
    i_default                      = space  "'X'
      i_save                         = 'A'
     it_sort                        = it_sort
    it_events                      = it_event
    i_screen_start_line            = 0
    is_print                       = printinfo
     I_STRUCTURE_NAME               = 'ilfa1'
    tables
      t_outtab                      = ilfa1
   exceptions
     program_error                  = 1
     others                         = 2.
endform.                    " prepare_alv_grid_data
form f01_alv_event_before_line_outp
                      using rs_lineinfo type slis_lineinfo. "#EC *
  data: l_event type lvc_fname. "#EC NEEDED
          it_summ-hl_fu = it_summ-volum / it_summ-cntf.
if pa_brand ne space.
perform compute_averageb using it_sumb.
if it_sumb-volum ne 0.
   it_sumb-sk_hl = it_sumb-netwr / it_sumb-volum.
else.
   it_sumb-sk_hl = 0.
endif.
else.
perform compute_average using it_summ.
endif.
  if rs_lineinfo-endsum ne space.
   perform prepare_alv_grid_data1.
  endif.
if rs_lineinfo-tabindex eq 0.
  if rs_lineinfo-sumindex ne 0.
     uline.
    it_summ-tonaz = wa_summ-bezei.
  endif.
else.
  wa_summ = it_summ.
endif.
if s_lineinfo-tabindex eq 0.
  if s_lineinfo-sumindex ne 0.
     uline.
  endif.
endif.
s_lineinfo = rs_lineinfo.
  if gs_test-info_popup_once eq con_true.
    read table gs_test-events_info_popup into l_event
               with key table_line = 'BEFORE_LINE_OUTPUT'.
    if sy-subrc ne 0.
      insert 'BEFORE_LINE_OUTPUT' into gs_test-events_info_popup
                                  index 1.
      message i000(0k) with text-t05.
    endif.
  elseif gs_test-no_info_popup eq space.
    message i000(0k) with text-t05.
  endif.
endform.                               " F01_ALV_EVENT_BEFORE_LINE_OUTP
form f01_alv_set_events changing ct_events type slis_t_event.
  field-symbols: -form.
      endif.
    endloop.
  endif.
endform.                    " f01_alv_set_events
Reward points..

Similar Messages

  • Creation of Materials Using MATERIAL_MAINTAIN_DARK

    Hello All,
    Im trying to create Materials using the Function Module MATERIAL_MAINTAIN_DARK in program. Problem is that, In tables of the fuction module amarc_ueb, amakt_ueb and amard_ueb , Im passing 2 records in each tables. But the MARC, MAKT and MARD tables are populated with only one record in each loop pass.
    Please give me suggessions to solve this problem.
    Good answers will be appreciated.
    Thanks in advance.
    Best Regards,
    Sasidhar Reddy Matli.

    Hello Ajay,
    Please find my code below..
    * Create Material - Check for KZ_TEST for test
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
       EXPORTING
        flag_muss_pruefen               = 'X'
    *    SPERRMODUS                      = 'E'
        max_errors                      = 0
        p_kz_no_warn                    = 'E'
        kz_prf                          = ' '
        kz_verw                         = 'X'
        kz_aend                         = 'X'
        kz_dispo                        = 'X'
        kz_test                         =  kz_test
        no_database_update              = ' '
        call_mode                       = 'ACT'
    *   CALL_MODE2                      = ' '
        user                            = sy-uname
    *   SUPPRESS_ARRAY_READ             = ' '
    *   FLG_MASS                        = 'X'
    *   DONT_PROCESS_HEADERS            =
    IMPORTING
        matnr_last                      = g_f_matnr_last
        number_errors_transaction       = g_f_number_err
       TABLES
         amara_ueb                       = gt_mara_ueb
         amakt_ueb                       = gt_makt_ueb
         amarc_ueb                       = gt_marc_ueb
         amard_ueb                       = gt_mard_ueb
    *   AMFHM_UEB                       =
    *   AMARM_UEB                       =
    *   AMEA1_UEB                       =
         ambew_ueb                      = gt_mbew_ueb
         asteu_ueb                      = gt_steu_ueb
    *   ASTMM_UEB                       =
    *   AMLGN_UEB                       =
         amlgt_ueb                       = gt_mlgt_ueb
    *   AMPGD_UEB                       =
    *   AMPOP_UEB                       =
    *   AMVEG_UEB                       =
    *   AMVEU_UEB                       =
         amvke_ueb                       = gt_mvke_ueb
    *   ALTX1_UEB                       =
    *   AMPRW_UEB                       =
    *   AMFIELDRES                      =
         amerrdat                        = gt_errs
    EXCEPTIONS
       kstatus_empty                   = 1
       tkstatus_empty                  = 2
       t130m_error                     = 3
       internal_error                  = 4
       too_many_errors                 = 5
       update_error                    = 6
       error_propagate_header          = 7
       OTHERS                          = 8.
      IF NOT ( sy-subrc IS INITIAL ).
        ROLLBACK WORK.
      ELSE.
        COMMIT WORK.
    Best Regards,
    Sasidhar Reddy matli.

  • To Extend material to plant using MATERIAL_MAINTAIN_DARK .

    I am tryin to extend material into plants using MATERIAL_MAINTAIN_DARK  function module.Can someone please check the code below and tell me how i should modify it to work.Is BDC a better option?
    DATA: t_amara_ueb LIKE mara_ueb OCCURS 0 WITH HEADER LINE.
    DATA: t_amarc_ueb LIKE marc_ueb OCCURS 0 WITH HEADER LINE.
    t_amara_ueb-mandt = sy-mandt.
    t_amara_ueb-matnr = it_reqdata-material.
    t_amara_ueb-tcode = 'MM01'.
    t_amara_ueb-tranc = 1.
    APPEND t_amara_ueb.
    CLEAR t_amara_ueb.
    t_amarc_ueb-mandt = sy-mandt.
    t_amarc_ueb-matnr = it_reqdata-material.
    t_amarc_ueb-werks = it_reqdata-plant.
    t_amarc_ueb-tranc = 1.
    t_amarc_ueb-KZKRI = 'X'.
    APPEND t_amarc_ueb.
    CLEAR t_amarc_ueb.
    call function 'MATERIAL_MAINTAIN_DARK'
      exporting
      flag_muss_pruefen = 'X'
    p_kz_no_warn = 'N'
    kz_prf = space
    kz_verw = 'X'
    kz_aend = 'X'
    kz_dispo = 'X'
      tables
       amara_ueb                       = t_amara_ueb
       AMARC_UEB                       = t_AMARC_UEB
    EXCEPTIONS
       KSTATUS_EMPTY                   = 1
       TKSTATUS_EMPTY                  = 2
       T130M_ERROR                     = 3
       INTERNAL_ERROR                  = 4
       TOO_MANY_ERRORS                 = 5
       UPDATE_ERROR                    = 6
       OTHERS                          = 7
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
    COMMIT WORK.
    ENDIF.
    Thanks and Regards,
    Pratima.

    Hi ,
    Use the below code.
    DATA : lt_mara_ueb TYPE TABLE OF mara_ueb INITIAL SIZE 0,
           lt_marc_ueb TYPE TABLE OF marc_ueb INITIAL SIZE 0,
           lt_errors TYPE TABLE OF merrdat INITIAL SIZE 0.
    DATA : wa_mara_ueb TYPE mara_ueb,
           wa_marc_ueb TYPE marc_ueb,
           wa_messtab TYPE merrdat.
    DATA : l_mstring(480).
    parameters: l_matnr like mara-matnr.
    * Set up I_MARA
    REFRESH lt_mara_ueb.
    wa_mara_ueb-mandt = sy-mandt.
    wa_mara_ueb-tcode = 'MM01'.
    wa_mara_ueb-matnr = l_matnr.
    wa_mara_ueb-tranc = '0000000001'.
    APPEND wa_mara_ueb TO lt_mara_ueb.
    CLEAR wa_mara_ueb.
    SELECT SINGLE * FROM marc INTO CORRESPONDING FIELDS OF wa_marc_ueb
    WHERE matnr EQ l_matnr AND werks EQ '01FC'.
      IF sy-subrc EQ 0.
        MOVE '01BV' TO wa_marc_ueb-werks.
        wa_marC_ueb-tranc = '0000000001'.
        WA_MARC_UEB-PSTAT = SPACE.
        APPEND wa_marc_ueb TO lt_marc_ueb.
      ENDIF.
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
        EXPORTING
    *   FLAG_MUSS_PRUEFEN               = 'X'
    *   SPERRMODUS                      = 'E'
    *   MAX_ERRORS                      = 0
          p_kz_no_warn                    = 'N'
          kz_prf                          = 'W'
    *   KZ_VERW                         = 'X'
    *   KZ_AEND                         = 'X'
    *   KZ_DISPO                        = 'X'
    *   KZ_TEST                         = ' '
    *   NO_DATABASE_UPDATE              = ' '
    *   CALL_MODE                       = ' '
    *   CALL_MODE2                      = ' '
    *   USER                            = SY-UNAME
    *   SUPPRESS_ARRAY_READ             = ' '
    *   FLG_MASS                        = ' '
    * IMPORTING
    *   MATNR_LAST                      =
    *   NUMBER_ERRORS_TRANSACTION       =
        TABLES
          amara_ueb                       = lt_mara_ueb
    *   AMAKT_UEB                       =
          amarc_ueb                       = lt_marc_ueb
    *   AMARD_UEB                       =
    *   AMFHM_UEB                       =
    *   AMARM_UEB                       =
    *   AMEA1_UEB                       =
    *   AMBEW_UEB                       =
    *   ASTEU_UEB                       =
    *   ASTMM_UEB                       =
    *   AMLGN_UEB                       =
    *   AMLGT_UEB                       =
    *   AMPGD_UEB                       =
    *   AMPOP_UEB                       =
    *   AMVEG_UEB                       =
    *   AMVEU_UEB                       =
    *   AMVKE_UEB                       =
    *   ALTX1_UEB                       =
    *   AMPRW_UEB                       =
    *   AMFIELDRES                      =
    *   AMERRDAT                        =
    EXCEPTIONS
       KSTATUS_EMPTY                   = 1
       TKSTATUS_EMPTY                  = 2
       T130M_ERROR                     = 3
       INTERNAL_ERROR                  = 4
       TOO_MANY_ERRORS                 = 5
       UPDATE_ERROR                    = 6
       OTHERS                          = 7
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      COMMIT WORK.
    Regards,
    Raghav

  • Create material view with MATERIAL_MAINTAIN_DARK

    Hello !
    I have done a material migration program with FM MATERIAL_MAINTAIN_DARK. The program integrate the basic data, and then each view one by one.
    It works fine except with material with internal number. It creats the basic data but when i use the number generated to create the other view i get this message :
    No external number assignment possible for mat. type GENERIC MATERIALS
    I found this field in mara_ueb : KZ_MAT_RES
    But when i put X in it, it returns that i forgot mandatory data. So I tried to select the data already in MARA and MAKT, but now the message is that the material already exist ! It is true but I want to create another view.
    Here's a piece of my code to help you to understand, the commentary part is what I tried to do to resolved my problem :
      ADD 1 TO v_count.
      ADD 1 TO v_line.
      MOVE v_line TO v_line_c.
    *---MARA
      MOVE sy-mandt TO t_mara_ueb-mandt.
      MOVE 'MM01' TO t_mara_ueb-tcode.
      MOVE v_count TO t_mara_ueb-tranc.
      MOVE k_purcha TO t_mara_ueb-vpsta.
      SELECT COUNT(*) FROM t134 WHERE mtart = t_data_pur-mtart
                                   AND envop = space.
      IF sy-subrc = 0.
        TABLES : mara, makt.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
         EXPORTING
           input         = t_data_pur-matnr
        IMPORTING
          OUTPUT        = t_data_pur-matnr.
       SELECT SINGLE * FROM mara WHERE matnr = t_data_pur-matnr.
       MOVE-CORRESPONDING mara TO t_mara_ueb.
       SELECT SINGLE * FROM makt WHERE matnr = t_data_pur-matnr.
       MOVE-CORRESPONDING makt TO t_makt_ueb.
         MOVE 'X' TO t_mara_ueb-KZ_MAT_RES.
      ENDIF.
      MOVE t_data_pur-matnr TO t_mara_ueb-matnr.
      MOVE t_data_pur-mbrsh TO t_mara_ueb-mbrsh.
      MOVE t_data_pur-mtart TO t_mara_ueb-mtart.
      MOVE t_data_pur-ekwsl TO t_mara_ueb-ekwsl.
      APPEND t_mara_ueb.
    *---MARC
      MOVE sy-mandt TO t_marc_ueb-mandt.
      MOVE v_count TO t_marc_ueb-tranc.
      MOVE t_data_pur-matnr TO t_marc_ueb-matnr.
      MOVE t_data_pur-werks TO t_marc_ueb-werks.
      MOVE t_data_pur-ekgrp TO t_marc_ueb-ekgrp.
      MOVE t_data_pur-mmsta TO t_marc_ueb-mmsta.
      MOVE t_data_pur-mmstd TO t_marc_ueb-mmstd.
      MOVE t_data_pur-webaz TO t_marc_ueb-webaz.
      MOVE t_data_pur-kordb TO t_marc_ueb-kordb.
      MOVE t_data_pur-usequ TO t_marc_ueb-usequ.
      APPEND t_marc_ueb.
    *---!!! Call FUNCTION MODULE !!!
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
        EXPORTING
        FLAG_MUSS_PRUEFEN               = 'X'
        SPERRMODUS                      = 'E'
        MAX_ERRORS                      = 0
         p_kz_no_warn                    = 'X'
         kz_prf                          = space
        KZ_VERW                         = 'X'
        KZ_AEND                         = 'X'
        KZ_DISPO                        = 'X'
         kz_test                         = lv_test
        NO_DATABASE_UPDATE              = ' '
         call_mode                       = ' '   "OR RMD OR space OR BAP
        CALL_MODE2                      = ' '
         user                            = sy-uname
        SUPPRESS_ARRAY_READ             = ' '
        FLG_MASS                        = ' '
        IMPORTING
         matnr_last                      = lv_matnr
         number_errors_transaction       = lv_nb_error
        TABLES
         amara_ueb                       = t_mara_ueb
         amakt_ueb                       = t_makt_ueb
         amarc_ueb                       = t_marc_ueb
         amard_ueb                       = t_mard_ueb
        AMFHM_UEB                       =
        AMARM_UEB                       =
        AMEA1_UEB                       =
         ambew_ueb                       = t_mbew_ueb
         asteu_ueb                       = t_steu_ueb
        ASTMM_UEB                       =
         amlgn_ueb                       = t_mlgn_ueb
         amlgt_ueb                       = t_mlgt_ueb
        AMPGD_UEB                       =
         ampop_ueb                       = t_mpop_ueb
        AMVEG_UEB                       =
        AMVEU_UEB                       =
         amvke_ueb                       = t_mvke_ueb
        ALTX1_UEB                       =
        AMPRW_UEB                       =
        AMFIELDRES                      =
         amerrdat                        = t_amerrdat
       EXCEPTIONS
         kstatus_empty                   = 1
         tkstatus_empty                  = 2
         t130m_error                     = 3
         internal_error                  = 4
         too_many_errors                 = 5
         update_error                    = 6
         OTHERS                          = 7.
    I really need you help !
    thank you in advance.

    OK I found the answer !
    It is because the matnr generate add 00000... before the number. So I have to add it for the other view. But it is not the case for material number define externally. And the message was not comprensive.
    *---MARA
      MOVE sy-mandt TO t_mara_ueb-mandt.
      MOVE 'MM01' TO t_mara_ueb-tcode.
      MOVE v_count TO t_mara_ueb-tranc.
      MOVE k_purcha TO t_mara_ueb-vpsta.
      SELECT COUNT(*) FROM t134 WHERE mtart = t_data_pur-mtart
                                  AND envop = space.
      IF sy-subrc = 0.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  input  = t_data_pur-matnr
             IMPORTING
                  output = t_data_pur-matnr.
      ENDIF.
      MOVE t_data_pur-matnr TO t_mara_ueb-matnr.
      MOVE t_data_pur-mbrsh TO t_mara_ueb-mbrsh.
      MOVE t_data_pur-mtart TO t_mara_ueb-mtart.
      MOVE t_data_pur-ekwsl TO t_mara_ueb-ekwsl.
      APPEND t_mara_ueb.
    *---MARC
      MOVE sy-mandt TO t_marc_ueb-mandt.
      MOVE v_count TO t_marc_ueb-tranc.
      MOVE t_data_pur-matnr TO t_marc_ueb-matnr.
      MOVE t_data_pur-werks TO t_marc_ueb-werks.
      MOVE t_data_pur-ekgrp TO t_marc_ueb-ekgrp.
      MOVE t_data_pur-mmsta TO t_marc_ueb-mmsta.
      MOVE t_data_pur-mmstd TO t_marc_ueb-mmstd.
      MOVE t_data_pur-webaz TO t_marc_ueb-webaz.
      MOVE t_data_pur-kordb TO t_marc_ueb-kordb.
      MOVE t_data_pur-usequ TO t_marc_ueb-usequ.
      APPEND t_marc_ueb.
    Edited by: Louis-Arnaud Bouquin on Mar 5, 2008 3:04 PM

  • Updating problem in material_maintain_dark

    Hi All,
    I am trying to use FM  Material_maintain_dark to update Marm-umrez.But now it is not updating any table values.
    Can any one suggest me what to do in this case.Please find the code that is used below in my program.
    t_mara-mandt = sy-mandt.
      t_mara-matnr = p_material.
      t_mara-mbrsh = 'S'.
      t_mara-tcode = 'MM02'.
      t_mara-tranc = h_tranc.
      APPEND t_mara.
       t_marm-mandt = sy-mandt.
       t_marm-matnr = p_material.
       t_marm-meinh = p_meinh.
       t_marm-umrez = p_moq.
       t_marm-tranc = h_tranc.
       append t_marm.
       call function 'MATERIAL_MAINTAIN_DARK'
         exporting
           p_kz_no_warn                   = 'N'
           kz_prf                         = 'S'
         tables
          amara_ueb                       =  t_mara
          AMARM_UEB                       =  t_marm
          AMERRDAT                        =  t_amerrdat
        EXCEPTIONS
          KSTATUS_EMPTY                   = 1
          TKSTATUS_EMPTY                  = 2
          T130M_ERROR                     = 3
          INTERNAL_ERROR                  = 4
          TOO_MANY_ERRORS                 = 5
          UPDATE_ERROR                    = 6
          OTHERS                          = 7
       if sy-subrc <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       endif.
    Please help me out in this case ,
    Thanks ,
    Suman

    Hi Suman,
    t_mara-mandt = sy-mandt.
    t_mara-matnr = p_material.
    t_mara-mbrsh = 'S'.
    t_mara-tcode = 'MM02'.
    t_mara-tranc = h_tranc.
    APPEND t_mara.
    t_marm-mandt = sy-mandt.
    t_marm-matnr = p_material.
    t_marm-meinh = p_meinh.
    t_marm-umrez = p_moq.
    t_marm-tranc = h_tranc.
    append t_marm.
    call function 'MATERIAL_MAINTAIN_DARK'
    exporting
    p_kz_no_warn = 'N'
    kz_prf = 'S'
    tables
    amara_ueb = t_mara
    AMARM_UEB = t_marm
    AMERRDAT = t_amerrdat
    EXCEPTIONS
    KSTATUS_EMPTY = 1
    TKSTATUS_EMPTY = 2
    T130M_ERROR = 3
    INTERNAL_ERROR = 4
    TOO_MANY_ERRORS = 5
    UPDATE_ERROR = 6
    OTHERS = 7
    if sy-subrc &lt;&gt; 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    COMMIT WORK.
    COMMIT WORK
    should be the last statement of your program/transaction.
    Regards,
    Clemens

  • MATERIAL_MAINTAIN_DARK background

    Hi ,
    I want to use mass update , for material in back ground. If i use the FM 'MATERIAL_MAINTAIN_DARK'. I will not have any return parameters. Is there any place where , i can get the update log. or any other way to get the update details.
    jaffer vali shaik

    Hi Suresh,
    I know that there are return parameters , But i want to execute this FM in <b>background</b> . In Background we can not access any of these return or import parameters.
    jaffer vali shaik

  • MATERIAL_MAINTAIN_DARK no mara append table update

    Hello,
    I've a little problem using MATERIAL_MAINTAIN_DARK to modify some materials.
    I have to update fields in two append structures (one in mara, one in marm)
    when I use this function module, the update is ok on marm but not on mara
    if anyone have an idea ??
    Thanks in advance

    Hai Fabrice
    check the following Code
    DATA: h_anzfehler LIKE  tbist-numerror.
    DATA: BEGIN OF t_mara_ueb OCCURS 1.
            INCLUDE STRUCTURE mara_ueb.
    DATA: END OF t_mara_ueb.
    DATA: BEGIN OF t_mbew_ueb OCCURS 1.
            INCLUDE STRUCTURE mbew_ueb.
    DATA: END OF t_mbew_ueb.
    DATA: t_merrdat TYPE merrdat OCCURS 0 WITH HEADER LINE.
    aufbauen T_MARA_UEB
              CLEAR:    t_mara_ueb.
              REFRESH:  t_mara_ueb.
              t_mara_ueb-mandt = sy-mandt.
              t_mara_ueb-matnr = t_mbew-matnr.
              t_mara_ueb-tcode = 'MM02'.
              t_mara_ueb-tranc = h_tranc.  "Transaktionszähler
              APPEND t_mara_ueb.
    aufbauen T_MBEW_UEB
              CLEAR:    t_mbew_ueb.
              REFRESH:  t_mbew_ueb.
              t_mbew_ueb-mandt = sy-mandt.
              t_mbew_ueb-matnr = t_mbew-matnr.
              t_mbew_ueb-bwkey = t_mbew-bwkey.
              t_mbew_ueb-bwtar = t_mbew-bwtar.
              t_mbew_ueb-tranc = h_tranc.  "Transaktionszähler
    Änderung der Preissteuerung in der lfd. Periode
              IF t_mbew-vprsv NE p_vprsvn.
                t_mbew_ueb-vprsv = p_vprsvn. "neue Preissteuerung->lfd.Per.
              ENDIF.
    Änderung der Preissteuerung in der Vorperiode
              IF t_mbew-vmvpr NE p_vprsvn.
                t_mbew_ueb-vmvpr = p_vprsvn. "neue Preissteuerung-> Vorper.
              ENDIF.
    Änderung der Preissteuerung in der letzten Periode des Vorjahres
              IF flag_vm_eq_vj = 'X'.      "Vorperiode = Vorjahr
                IF t_mbew-vjvpr NE p_vprsvn.
                  t_mbew_ueb-vjvpr = p_vprsvn. "neue Preissteuerung-> Vorjahr
                ENDIF.
              ENDIF.
              APPEND t_mbew_ueb.
              CLEAR:    t_merrdat.
              REFRESH:  t_merrdat.
              CLEAR:    h_anzfehler.
              CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
                   EXPORTING
                    FLAG_MUSS_PRUEFEN         = 'X'
                    SPERRMODUS                = 'E'
                    MAX_ERRORS                = 0
                        p_kz_no_warn              = 'N'
                        kz_prf                    = 'E'
                        kz_aend                   = 'X'
                        kz_dispo                  = ' '
                   IMPORTING
                        number_errors_transaction = h_anzfehler
                   TABLES
                        amara_ueb                 = t_mara_ueb
                        ambew_ueb                 = t_mbew_ueb
                        amerrdat                  = t_merrdat
                   EXCEPTIONS
                        kstatus_empty             = 1
                        tkstatus_empty            = 2
                        t130m_error               = 3
                        internal_error            = 4
                        too_many_errors           = 5
                        update_error              = 6
                        OTHERS                    = 7.
              IF NOT h_anzfehler IS INITIAL.
                PERFORM build_message.
                EXIT.                   "Abbruch Form-Verarbeitung
              ELSE.
                flag_vprsv_upd = 'X'.
              ENDIF.
    Thanks & Regards
    Sreenivasulu P

  • MATERIAL_MAINTAIN_DARK via dialog

    Hello everyone,
    I'm trying to use <b>MATERIAL_MAINTAIN_DARK</b> to create/change a material master record with data coming from a MATMAS idoc in <b>foreground(dialog mode)</b>, thus allowing the user to see the fields populated with the data, but so far I haven't been able to put it to work.
    Does anyone knows how to do it?
    I'm currently working with 4.0B
    Thanks in advance,
    Tiago.

    Hi Tiago,
    The purpose of MATERIAL_MAINTAIN_DARK is to create/change the material in background (atleast that is what I can understand from the function module documentation).
    I think the fm that you can try is MATERIAL_BDCDATA (I am not sure if it exists in 40B, please check). If it exists then take a look at where-used list of the fm particularly at report RMMMBIM0.
    MATERIAL_BDCDATA basically will prepare necessary screen logic for you and then you can do a CALL TRANSACTION in dialog mode to take the user into material master.
    Hope this helps..
    Sri

  • MATERIAL_MAINTAIN_DARK Lock not funktion

    Hallo
    I am working with MATERIAL_MAINTAIN_DARK every thing is working ok. Only it not locking the Transaction
    which I have given in Tcode. Can some tell me about it.
    Thanks a lot

    Hi Suresh,
    I know that there are return parameters , But i want to execute this FM in <b>background</b> . In Background we can not access any of these return or import parameters.
    jaffer vali shaik

  • In FM - MATERIAL_MAINTAIN_DARK -- field TRANC

    Hi All,
    I am using MATERIAL_MAINTAIN_DARK fm To upload material storage location.
    I am passing '000000001' to TRANC fields in mard_ueb table.
    What is TRANC field what is the meaning of 0000000001.
    Can i pass 000000000002 or 0000000003?
    Moderator message: please search for information and try yourself before asking.
    Edited by: Thomas Zloch on Feb 21, 2011 11:40 AM

    Hi,
    Can you tell me why you are using this Fm. Are  you using this to extend the material.If it is for extension do not use that Fm. instead of that  BAPI_MATERIAL_SAVEDATA.
    http://www.sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm.
    Regards,
    Madhu.
    Edited by: madhurao123 on Feb 21, 2011 6:33 AM
    Edited by: madhurao123 on Feb 21, 2011 6:35 AM

  • Problems with update, material_maintain_dark

    Hi everybody,
    i have a minor Problem with the FM mentioned above.
    I have to update the MBEW (ZPLP2 and ZPLD2)
    in the end i  get the return-code '0', but the material (price in MBEW) is still not changed.
    Pleas have a look at the following code, maybe you have an answer for me
    LOOP AT xl_marc INTO wa_marc WHERE nplpr  GT '0.00' AND hknpr NE space.
        wa_mara-matnr = wa_marc-matnr.
        wa_mara-pstat = 'G'.
        wa_mara-tranc = 0000000001.
        wa_mara-tcode = 'MM02'.
        APPEND wa_mara TO xl_mara.
        wa_marc1-matnr = wa_marc-matnr.
        wa_marc1-werks = xs_00002-low.
        wa_marc1-tranc = 0000000001.
        APPEND wa_marc1 TO xl_marc1.
        wa_mbew-mandt = sy-mandt.
        wa_mbew-matnr = wa_marc-matnr.
        wa_mbew-zplp2 = wa_marc-nplpr.
        wa_mbew-bwkey = xs_00002-low.
        wa_mbew-zpld2 = sy-datum.
        wa_mbew-tranc = 0000000001.
        APPEND wa_mbew TO xl_mbew.
        CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
          EXPORTING
           flag_muss_pruefen               = 'X'
          sperrmodus                      = 'E'
           max_errors                      = 9999
            p_kz_no_warn                    = 'N'
            kz_prf                          = ' '
      KZ_VERW                         = 'X'
       kz_aend                         = 'X'
      KZ_DISPO                        = 'X'
      KZ_TEST                         = ' '
       NO_DATABASE_UPDATE              = ' '
      CALL_MODE                       = ' '
      CALL_MODE2                      = ' '
            user                            = sy-uname
      SUPPRESS_ARRAY_READ             = ' '
      FLG_MASS                        = ' '
        IMPORTING
           matnr_last                      = wa_marc-matnr
           number_errors_transaction       = numerror
        TABLES
            amara_ueb                       = xl_mara
            amarc_ueb                       = xl_marc1
            ambew_ueb                       =   xl_mbew
         EXCEPTIONS
           kstatus_empty                   = 1
           tkstatus_empty                  = 2
           t130m_error                     = 3
           internal_error                  = 4
           too_many_errors                 = 5
           update_error                    = 6
           OTHERS                          = 7
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDLOOP.
    Thanks for any help!
    regards
    Thomas

    Sorry to bother you again,
    okay i implemented this bapi.
    But the MBEW is still not updated
    Any solutions?
    regards
    Thomas

  • BAPI_MATERIAL_SAVEDATA not updating the materials

    Hi Folks,
    I am trying using the BAPI_MATERIAL_SAVEDATA to change the MRP Type of the existing articles. Basically to mass update the articles.I am passing the Material only to the BAPIMATHEAD parameter and also populating the BAPI_MARC where the MRP type has to be changed and I also populate the corresponding BAPI_MARCX with 'X' that has to be changed to the Function Module. I could find when debugging the error message E 091 MH 'You must use retail functions to process the article' that is generated from another function module MATERIAL_MAINTAIN_DARK 'within BAPI_MATERIAL_SAVEDATA. I am using the FM as given below.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata                   = i_bapimathead
      CLIENTDATA                 = i_bapimara
      CLIENTDATAX                = i_bapimarax
        PLANTDATA                  = i_bapimarc
        PLANTDATAX                 = i_bapimarcx
    IMPORTING
       RETURN                     = i_bapireturn.
    TABLES
      MATERIALDESCRIPTION        =
      UNITSOFMEASURE             =
      UNITSOFMEASUREX            =
      INTERNATIONALARTNOS        =
      MATERIALLONGTEXT           =
      TAXCLASSIFICATIONS         =
      RETURNMESSAGES             =
      PRTDATA                    =  i_BAPIHM
      PRTDATAX                   =  i_BAPIHMX.
      EXTENSIONIN                =
      EXTENSIONINX               =
    Please help me understand if I have missed anything as why I am getting this error message. Many thanks.
    Regards,
    Tim

    REPORT Z_NEW_PROGRAM .
    *                STRUCTURE  DECLARATIONS                             *
    TABLES: BAPIMATHEAD,  "Headerdata
            BAPI_MARA,    "Clientdata
            BAPI_MARAX,   "Clientdatax
            BAPI_MARC,    "Plantdata
            BAPI_MARCX,   "Plantdatax
            BAPI_MAKT,    "Material description
            BAPIRET2.     "Return messages
    DATA:V_FILE TYPE STRING.
    DATA:
      BEGIN OF LSMW_MATERIAL_MASTER,
        MATNR(018) TYPE C,  "Material number
        MTART(004) TYPE C,  "Material type
        MBRSH(001) TYPE C,  "Industry sector
        WERKS(004) TYPE C,  "Plant
        MAKTX(040) TYPE C,  "Material description
        DISMM(002) TYPE C,  "Extra Field Added In the Program as itsrequired
        MEINS(003) TYPE C,  "Base unit of measure
        MATKL(009) TYPE C,  "Material group
        SPART(002) TYPE C,  "Division
        LABOR(003) TYPE C,  "Lab/office
        PRDHA(018) TYPE C,  "Product hierarchy
        MSTAE(002) TYPE C,  "X-plant matl status
        MTPOS_MARA(004) TYPE C,  "Gen item cat group
        BRGEW(017) TYPE C,  "Gross weight
        GEWEI(003) TYPE C,  "Weight unit
        NTGEW(017) TYPE C,  "Net weight
        GROES(032) TYPE C,  "Size/Dimensions
        MAGRV(004) TYPE C,  "Matl grp pack matls
        BISMT(018) TYPE C,  "Old material number
        WRKST(048) TYPE C,  "Basic material
        PROFL(003) TYPE C,  "DG indicator profile
        KZUMW(001) TYPE C,  "Environmentally rlvt
        BSTME(003) TYPE C,  "Order unit
        VABME(001) TYPE C,
        EKGRP(003) TYPE C,  "Purchasing group
        XCHPF(001) TYPE C,  "Batch management
        EKWSL(004) TYPE C,  "Purchasing key value
        WEBAZ(003) TYPE C,  "GR processing time
        MFRPN(040) TYPE C,  "Manufacturer part number
        MFRNR(010) TYPE C,  "Manufacturer number
        VPRSV(001) TYPE C,  "Price control indicator
        STPRS(015) TYPE C,  "Standard price
        BWPRH(014) TYPE C,  "Commercial price1
        BKLAS(004) TYPE C,  "Valuation class
      END OF LSMW_MATERIAL_MASTER.
    *                INTERNAL TABLE DECLARATIONS                         *
    *to store the input data
    DATA:
      BEGIN OF it_matmaster OCCURS 0.
            INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
    DATA:
      END OF it_matmaster.
    *for material description
    DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
         INCLUDE STRUCTURE BAPI_MAKT .
    DATA:END OF IT_MATERIALDESC.
    *to return messages
    DATA:BEGIN OF IT_RETURN OCCURS 0.
         INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF IT_RETURN.
    *  SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
    PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1 .
    * AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE'
        IMPORTING
          FILE_NAME     = P_FILE.
    *                TO UPLOAD THE DATA                                  *
    START-OF-SELECTION.
    V_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = V_FILE
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      tables
        data_tab                      =  IT_MATMASTER
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *                DATA POPULATIONS                                    *
    LOOP AT  IT_MATMASTER.
      BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
      BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
      BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
      BAPIMATHEAD-BASIC_VIEW = 'X'.
      BAPIMATHEAD-PURCHASE_VIEW = 'X'.
      BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
      BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
      BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
      BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
      BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
      BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
      BAPI_MARAX-MATL_GROUP = 'X'.
      BAPI_MARAX-OLD_MAT_NO = 'X'.
      BAPI_MARAX-BASE_UOM = 'X'.
      BAPI_MARAX-BASIC_MATL = 'X'.
      BAPI_MARAX-MFR_NO = 'X'.
      BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
      BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
      BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
      BAPI_MARCX-PUR_GROUP = 'X'.
      IT_MATERIALDESC-LANGU = 'EN'.
      IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
      append IT_materialdesc.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          headdata                   = BAPIMATHEAD
          CLIENTDATA                 = BAPI_MARA
          CLIENTDATAX                = BAPI_MARAx
         PLANTDATA                  = BAPI_MARc
         PLANTDATAX                 = BAPI_MARcx
    *     FORECASTPARAMETERS         =
    *     FORECASTPARAMETERSX        =
    *     PLANNINGDATA               =
    *     PLANNINGDATAX              =
    *     STORAGELOCATIONDATA        =
    *     STORAGELOCATIONDATAX       =
    *     VALUATIONDATA              =
    *     VALUATIONDATAX             =
    *     WAREHOUSENUMBERDATA        =
    *     WAREHOUSENUMBERDATAX       =
    *     SALESDATA                  =
    *     SALESDATAX                 =
    *     STORAGETYPEDATA            =
    *     STORAGETYPEDATAX           =
    *     FLAG_ONLINE                = ' '
    *     FLAG_CAD_CALL              = ' '
       IMPORTING
         RETURN                     = IT_RETURN
       TABLES
         MATERIALDESCRIPTION        = IT_MATERIALDESC
    *     UNITSOFMEASURE             =
    *     UNITSOFMEASUREX            =
    *     INTERNATIONALARTNOS        =
    *     MATERIALLONGTEXT           =
    *     TAXCLASSIFICATIONS         =
    *     RETURNMESSAGES             =
    *     PRTDATA                    =
    *     PRTDATAX                   =
    *     EXTENSIONIN                =
    *     EXTENSIONINX               =
    WRITE:/    IT_RETURN-TYPE,
            2   IT_RETURN-ID,
            22  IT_RETURN-NUMBER,
            25  IT_RETURN-MESSAGE.
    *            IT_RETURN-LOG_NO,
    *            IT_RETURN-LOG_MSG_NO,
    *            IT_RETURN-MESSAGE_V1,
    *            IT_RETURN-MESSAGE_V2,
    *            IT_RETURN-MESSAGE_V3,
    *            IT_RETURN-MESSAGE_V4,
    *            IT_RETURN-PARAMETER,
    *            IT_RETURN-ROW,
    *            IT_RETURN-FIELD,
    *            IT_RETURN-SYSTEM.
    ENDLOOP.
    are you using this bapi BAPI_TRANSACTION_COMMIT,
    after calling the BAPI_MATERIAL_SAVEDATA .
    if not use that and check it.
    thanks
    vijay

  • Error while creation of Accounting view in background

    Hi Experts,
    I am creating the Materials using the Function MATERIAL_MAINTAIN_DARK in my program.
    I am passing the pstat as appropriate for the views to be created.
    Now, my problem comes When i am creating a Plant view and dont require an Accounting view.
    Even if I dont pass the PSTAT for the Accounting view, it gives me an exit message saying 'MBEW-BKLAS is defined as a required field.'.
    Please help me solve the issue.
    Any helpful answer will surely be rewarded.
    Thanks in Advance.
    Regards,
    Himanshu

    Hi,
      Please follow the below steps.
    Creating the Classification View using the Function module 'BAPI_OBJCL_CREATE'.
    Check the Class Type and Class Number which you are passing.
    Generally it will be Class type - 001 (Material Class) and Number will be ENGINEERING.
    It depends.
    But, what you can do is, Check material which has classification data filled.
    And just use the same class Type and Class Number Details.
    Try this way.It should work.
    To know the Available Class Types refer to table TCLA.
    Please let me know, if you want further help.
    Thanks & Regards,
    Vamsi.

  • BAPI or FM Required to create Material Master

    IS there any BAPI or Function module avaiable in SAP to create Material Master.
    The following Two BAPIs uses Call transaction, which I dont want.
    BAPI_RETAILMATERIAL_CREATE 
    BAPI_STANDARDMATERIAL_CREATE
    Please let me know if any other Function module or BAPI Avaiable in the system.
    Thanks
    Aman

    Yep,  this one works pretty good.
    call function 'MATERIAL_MAINTAIN_DARK'
             exporting
                  sperrmodus                = ' '
                  kz_prf                    = 'W'
                  max_errors                = ' '
                  p_kz_no_warn              = 'X'
                  kz_verw                   = 'X'
                  kz_aend                   = 'X'
                  kz_dispo                  = 'X'
                  kz_test                   = ' '
                  flag_muss_pruefen         = ' '
                  call_mode                 = 'ACT'
             importing
                  number_errors_transaction = numerror
                  matnr_last     = last_matnr
             tables
                 amara_ueb      = i_mara    "Basic Data
    *             amakt_ueb      = i_makt    "Descriptions
                 amarc_ueb      = i_marc    "Plant
    *             amard_ueb      = i_mard    "Storage Location
    *            AMFHM_UEB      = I_MFHM    "Production Tools
    *             amarm_ueb      = i_marm    "Units of Measure
    *            AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
    *             ambew_ueb      = i_mbew    "Accounting/Costing
    *             asteu_ueb      = i_steu    "Tax Data
    *             astmm_ueb      = i_steumm  "Tax Data
    *            AMLGN_UEB      = I_MLGN    "Warehouse Data
    *            AMLGT_UEB      = I_MLGT    "Storage Type Data
    *            AMPGD_UEB      = I_MPGD    "Change Documents
    *            AMPOP_UEB      = I_MPOP    "Forcast Parameters
    *            AMVEG_UEB      = I_MVEG    "Total Consumption Data
    *            AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
    *             amvke_ueb      = i_mvke    "Sales Data
    *             altx1_ueb      = i_ltx1    "Sales Text
    *            AMPRW_UEB      = I_MPRW    "Forcast Values
                 amfieldres     = i_delfields
                 amerrdat       = i_errors
             exceptions
                  kstatus_empty             = 01
                  tkstatus_empty            = 02
                  t130m_error               = 03
                  internal_error            = 04
                  update_error              = 05
                  too_many_errors           = 06.
    Regards,
    Rich Heilman

  • Inbound side status updating,purchase order view

    hi abapers,
    in inbound side when material is received mail triggering should happend and mail should be sent to enduser,for this i used enhancement point in inbound function module 'idoc_input_matmas01'
    in this fm after matrial is created with fm 'material_maintain_dark'.there will be a perform stmt for error handler , in that form i put enhancement point ,every thing is ok ,but problem is when i send material from outbound side ,it going and in bound side it is showing status '64' idoc ready to transfer to application but it should be '53'. transfered to the application.
    one important thing is material is creted in inbound side  with status 64,spokes let me clarify with status 64 also idoc is created in inbound? then why 53 status ..

    you can select the Trigger immidialtly in Partner profileWE20,  after some time the status will be moved to 53 status,   otherwise you run BD87 tcode...
    some times it will happend when system is low memory  the status will chnage after some time...

Maybe you are looking for