Reg: Modification of Master Tables using BDC/BAPI

Dear All,
Thanks for Support shown from all of you.
I want the detailed procedure for Modifying the existing data in the Master Tables using BDC's / BAPI's and Dialog programming.
Please send me one example code.
Please Help me Out.
Thanks In Advance.
Regards,
Adinarayana.B

bapi example
REPORT ZMMR_DELETEPO NO STANDARD PAGE HEADING MESSAGE-ID zisb.
tables : zvtls_sap.
*C-- Types Declarations
TYPES : BEGIN OF tp_flatfile_vtls,
        ebeln(10),
        ebelp type ekpo-ebelp,
        END OF tp_flatfile_vtls.
*=====================================================================
                  INTERNAL TABLES DECLARATION
*=====================================================================
DATA:  t_flatfile_vtls TYPE tp_flatfile_vtls OCCURS 0 WITH HEADER LINE.
data : begin of t_sapdata occurs 0,
       po like zvtls_sap-posap,
       item like zvtls_sap-itemsap,
       end of t_sapdata.
data : begin of t_flatfile_vtls1 occurs 0,
       po(10),
       item like zvtls_sap-itemsap,
       end of t_flatfile_vtls1.
data : begin of t_update occurs 0,
       mandt like zvtls_sap-mandt,
       povtls like zvtls_sap-povtls,
       itemvtls like zvtls_sap-itemvtls,
       posap like zvtls_sap-posap,
       itemsap like zvtls_sap-itemsap,
       aedat like zvtls_sap-aedat,
       paedt like zvtls_sap-paedt,
       loekz like zvtls_sap-loekz,
       end of t_update.
data : begin of t_poheader occurs 0,
       po like zvtls_sap-posap,
       end of t_poheader.
data : begin of t_poitem occurs 0,
       po like zvtls_sap-posap,
       item like zvtls_sap-itemsap,
       end of t_poitem.
DATA : BEGIN OF T_MESSAGE OCCURS 0,
       MSGTY,
       MSGID(2),
       MSGNO(3),
       MSGTX(100),
       PO like zvtls_sap-povtls,
       item like zvtls_sap-itemvtls,
       END OF T_MESSAGE.
DATA : BEGIN OF t_bapi_poheader OCCURS 0.
        INCLUDE STRUCTURE bapimepoheader.
DATA : END OF t_bapi_poheader.
DATA : BEGIN OF t_bapi_poheaderx OCCURS 0.
        INCLUDE STRUCTURE bapimepoheaderx.
DATA : END OF t_bapi_poheaderx.
DATA : BEGIN OF t_bapi_poitem OCCURS 0.
        INCLUDE STRUCTURE bapimepoitem.
DATA : END OF t_bapi_poitem.
DATA : BEGIN OF t_bapi_poitemx OCCURS 0.
        INCLUDE STRUCTURE bapimepoitemx.
DATA : END OF t_bapi_poitemx.
DATA : BEGIN OF t_bapireturn OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA : END OF t_bapireturn.
*=====================================================================
                  V A R I A B L E S
*=====================================================================
DATA: w_success(6)  TYPE n,
      w_bklas like t023-bklas,
      w_curryear(4),
      w_begda like sy-datum,
      w_endda like sy-datum,
      w_begyr(4),
      w_endyr(4),
      w_currmon(2),
      w_assetclass like ankt-anlkl,
      w_price type p,
      w_recordsap type i,
      w_povtls(10),
      w_count type i.
DATA:  w_filepath TYPE rlgrap-filename,
       w_rc TYPE sy-subrc,
       w_sscrfields_ucomm1   TYPE sscrfields-ucomm,
       w_file1 TYPE string,
       w_file2 TYPE FILENAME-FILEINTERN.
*=====================================================================
                  C O N S T A N T S
*=====================================================================
CONSTANTS: c_x              TYPE  c         VALUE 'X',
           c_hyp            TYPE  c         VALUE '-',
           c_err            TYPE  bdc_mart  VALUE 'E'.
CONSTANTS:  c_slash(1)            TYPE c VALUE '/',
            c_hash(1)             TYPE c VALUE '#',
            c_pipe                TYPE c VALUE '|',
            c_1                   TYPE i VALUE 1,
            c_zero                TYPE n VALUE '0',
            c_rg1(3)              TYPE c VALUE 'rg1',
            c_gr3(3)              TYPE c VALUE 'GR3',
            c_gr2(3)              TYPE c VALUE 'GR2',
            c_e(1)                TYPE c VALUE 'E',
            c_filepath(8)         TYPE c VALUE '/interf/',
            c_filetype(10)        TYPE c VALUE 'ASC'.
CONSTANTS : c_bapimepoheaderx   TYPE x030l-tabname
                               VALUE 'bapimepoheaderx',
           c_bapimepoitem      TYPE  x030l-tabname
                               VALUE 'bapimepoitem',
           c_bapimepoaccount   TYPE  x030l-tabname
                               VALUE 'bapimepoaccount',
           c_t_bapi_poheader(15)        TYPE c
                                        VALUE 't_bapi_poheader',
           c_t_bapi_poitem(13)          TYPE c
                                        VALUE 't_bapi_poitem',
           c_t_bapi_poitemx(14)         TYPE c
                                        VALUE 't_bapi_poitemx',
           c_t_bapi_poheaderx(16)       TYPE c
                                        VALUE 't_bapi_poheaderx'.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
*======================================================================
                       SELECTION SCREEN
*======================================================================
SELECTION-SCREEN BEGIN OF BLOCK inputpath WITH FRAME TITLE text-001.
SELECTION-SCREEN : BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
PARAMETERS : p_fore RADIOBUTTON GROUP rg1
                    USER-COMMAND pc,
             p_back RADIOBUTTON GROUP rg1 DEFAULT 'X'.
SELECTION-SCREEN : END OF BLOCK blk2.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-003.
PARAMETERS :  p_file1 LIKE rlgrap-filename OBLIGATORY MODIF ID gr2.
PARAMETERS :  p_afile1 LIKE rlgrap-filename OBLIGATORY MODIF ID gr3.
SELECTION-SCREEN : END OF BLOCK blk1.
SELECTION-SCREEN END OF BLOCK inputpath.
*C-- Initialization Event
INITIALIZATION.
  CLEAR w_filepath.
  CONCATENATE c_filepath sy-sysid c_slash sy-mandt c_slash INTO
  w_filepath.
  CONDENSE w_filepath NO-GAPS.
  p_file1 = text-008.
  p_afile1 = text-009.
*======================================================================
                       SELECTION SCREEN EVENTS
*======================================================================
*C-- Selection Screen Output
AT SELECTION-SCREEN OUTPUT.
  IF p_fore = c_x.
    w_sscrfields_ucomm1 = space.
  ELSE.
    w_sscrfields_ucomm1 = c_rg1.
  ENDIF.
  LOOP AT SCREEN.
*C--Modify selection screen if presentation
*C--or application server radio button is chosen
    IF w_sscrfields_ucomm1 = space.
      IF screen-group1 = c_gr3.
        screen-active = c_zero.
      ENDIF.
    ELSE.
      IF screen-group1 = c_gr2.
        screen-active = c_zero.
      ENDIF.
    ENDIF.
    if screen-name = 'P_AFILE1'.
      screen-input = 0.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
*C-- Selection Screen VALUE-REQUEST FOR File path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
  IF p_fore EQ c_x.
    CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        program_name  = syst-cprog
        dynpro_number = syst-dynnr
      IMPORTING
        file_name     = p_file1.
  ENDIF.
*C-- At Start of the Selection Process
START-OF-SELECTION.
  IF p_fore EQ c_x.
    w_file1 = p_file1.
  ELSE.
    w_file2 = p_afile1.
  ENDIF.
  IF p_fore EQ c_x. " Presentaion Server
*C--Validations for the input files
    PERFORM validate_pre_file USING p_file1.
*C-- Load the contents of the input file into the internal table
    PERFORM upload_file TABLES t_flatfile_vtls
                        USING w_file1
                        CHANGING w_rc.
    IF w_rc <> 0.
      MESSAGE s006 DISPLAY LIKE c_e.
    ENDIF.
  ELSE. " Application Server
*C--Validations for the input files
    PERFORM validate_app_file USING  w_file2.
*C-- Load the contents of the input file into the internal table
    PERFORM upload_file_app TABLES t_flatfile_vtls
                            USING w_file2
                            CHANGING w_rc.
  ENDIF.
  loop at t_flatfile_vtls.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = t_flatfile_vtls-ebeln
      IMPORTING
        output = t_flatfile_vtls1-po.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = t_flatfile_vtls-ebelp
      IMPORTING
        output = t_flatfile_vtls1-item.
    append t_flatfile_vtls1.
    clear t_flatfile_vtls1.
  endloop.
  perform get_podata.
  loop at t_poheader.
    perform move_to_bapi.
    perform call_bapi.
  endloop.
  PERFORM STORE_MESSAGES TABLES T_MESSAGE.
*&      Form  validate_pre_file
    Routine to validate presentation server file path.
     -->fp_name  text
FORM validate_pre_file USING fp_name TYPE rlgrap-filename.
  DATA : l_result,
         l_filename TYPE string.
  l_filename = fp_name.
  CLEAR l_result.
  CALL METHOD cl_gui_frontend_services=>file_exist
    EXPORTING
      file                 = l_filename
    RECEIVING
      result               = l_result
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      wrong_parameter      = 3
      not_supported_by_gui = 4
      OTHERS               = 5.
  IF sy-subrc <> 0.
    MESSAGE s007 DISPLAY LIKE c_e.
    LEAVE LIST-PROCESSING.
  ELSEIF l_result IS INITIAL.
    MESSAGE s008 DISPLAY LIKE c_e.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.                    " validate_pre_file_hdr
*&      Form  validate_app_file
      text - Checks if the path entered and filename is correct
FORM validate_app_file USING  fp_file  TYPE FILENAME-FILEINTERN.
  data : l_fname(60).
  CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
      LOGICAL_FILENAME = FP_FILE
      OPERATING_SYSTEM = SY-OPSYS
    IMPORTING
      FILE_NAME        = L_FNAME
    EXCEPTIONS
      FILE_NOT_FOUND   = 1
      OTHERS           = 2.
  IF SY-SUBRC = '0'.
    OPEN DATASET  L_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
      MESSAGE s007 DISPLAY LIKE c_e.
    ELSE.
      CLOSE DATASET l_fname.
    ENDIF.
  ENDIF.
ENDFORM.                    " validate_app_file
*&      Form  upload_file
      Routine to upload data from file to tables.
     -->P_fp_flatfile
     -->P_fp_file
     <--P_fp_rc
FORM  upload_file TABLES   fp_flatfile
                  USING    fp_file TYPE string
                  CHANGING fp_rc TYPE sy-subrc.
  IF fp_flatfile[] IS INITIAL.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                = fp_file
        filetype                = c_filetype
        has_field_separator     = c_x
      TABLES
        data_tab                = fp_flatfile
      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.
    MOVE sy-subrc TO fp_rc.
  ENDIF.
ENDFORM.  " upload_file
*&      Form  upload_file_app
      text
     -->FP_FLATFILEtext
     -->FP_FILE    text
     -->FP_RC      text
FORM  upload_file_app TABLES   fp_flatfile
                      USING    fp_file TYPE FILENAME-FILEINTERN
CHANGING fp_rc TYPE sy-subrc.
  DATA: l_string TYPE tedata-data.
  DATA: wa_data_file TYPE tp_flatfile_vtls,
        l_wllength TYPE i,
        FNAME(60).
  CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
      LOGICAL_FILENAME = FP_FILE
      OPERATING_SYSTEM = SY-OPSYS
    IMPORTING
      FILE_NAME        = FNAME
    EXCEPTIONS
      FILE_NOT_FOUND   = 1
      OTHERS           = 2.
  IF SY-SUBRC = 0.
    OPEN DATASET  FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
*C-- commented by Bikash
     MESSAGE s107(yaero_ps) DISPLAY LIKE c_e.
      message e008.
    ELSE.
      DO.
        CLEAR: l_string.
        READ DATASET  FNAME INTO l_string LENGTH l_wllength.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT l_string AT con_tab INTO   wa_data_file-ebeln
                                           wa_data_file-ebelp.
          APPEND wa_data_file TO fp_flatfile.
        ENDIF.
      ENDDO.
      CLOSE DATASET  FNAME.
    ENDIF.
  ENDIF.
ENDFORM.  " upload_file_app
*&      Form  get_podata
      text
form get_podata.
  select *
  into table t_update
  from zvtls_sap
  for all entries in t_flatfile_vtls1
   where itemvtls = t_flatfile_vtls1-item
  and povtls = t_flatfile_vtls1-po.
  sort t_update by posap itemsap.
  loop at t_update.
    at new posap.
      t_poheader-po = t_update-posap.
      append t_poheader.
      clear t_poheader.
    endat.
    t_poitem-po = t_update-posap.
    t_poitem-item = t_update-itemsap.
    append t_poitem.
    clear t_poitem.
    t_update-paedt = sy-datum.
    t_update-loekz = 'X'.
    modify t_update.
  endloop.
  modify zvtls_sap from table t_update.
endform.                    "get_podata
*&      Form  move_to_bapi
      text
form move_to_bapi.
  t_bapi_poheader-po_number = t_poheader-po.
  CLEAR t_bapi_poheaderx.
  PERFORM fill_check_structure USING c_bapimepoheaderx
                                     c_t_bapi_poheader
                                     c_t_bapi_poheaderx
                                     c_x.
  refresh : t_bapi_poitem,t_bapi_poitemx.
  loop at t_poitem where po = t_poheader-po.
    clear t_bapi_poitem.
    t_bapi_poitem-po_item = t_poitem-item.
    t_bapi_poitem-delete_ind = 'X'.
    CLEAR t_bapi_poitemx.
    PERFORM fill_check_structure USING c_bapimepoitem
                                       c_t_bapi_poitem
                                       c_t_bapi_poitemx
                                       c_x.
    t_bapi_poitemx-po_item = t_poitem-item.
    t_bapi_poitemx-po_itemx = c_x.
    APPEND t_bapi_poitem.
    APPEND t_bapi_poitemx.
    clear t_bapi_poitem.
    clear t_bapi_poitemx.
  endloop.
endform.                    "move_to_bapi
*&      Form  call_bapi
      This form Routine is used to commit the data records
FORM call_bapi .
  DATA : l_msgty      TYPE c,
         l_msgid(2)   TYPE c,
         l_msgno(3)   TYPE c,
         l_msgtx(100) TYPE c,
         l_errflag    TYPE c.
  CLEAR: t_bapireturn.
  REFRESH: t_bapireturn.
  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      PURCHASEORDER = T_POHEADER-PO
      POHEADER      = T_BAPI_POHEADER
      POHEADERX     = T_BAPI_POHEADERX
    TABLES
      RETURN        = T_BAPIRETURN
      POITEM        = T_BAPI_POITEM
      POITEMX       = T_BAPI_POITEMX.
  READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.
  IF sy-subrc NE 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = c_x.
  ENDIF.
*C-- Write messages
  WRITE: / 'PO Number', t_poheader-po.
  clear : t_update,w_povtls.
  read table t_update with key posap = t_poheader-po.
  w_povtls = t_update-povtls.
  CLEAR l_errflag.
  LOOP AT t_bapireturn.
    CLEAR: l_msgty, l_msgid, l_msgno, l_msgtx.
    l_msgty = t_bapireturn-type.
    l_msgid = t_bapireturn-id.
    l_msgno = t_bapireturn-number.
    l_msgtx = t_bapireturn-message.
    WRITE: / l_msgty, l_msgid, l_msgno, l_msgtx.
    if l_msgtx cs t_poheader-po.
      w_count = w_count + 1.
      loop at t_update.
        if sy-tabix = w_count.
          t_message-item = t_update-itemvtls.
        endif.
      endloop.
    endif.
    t_message-msgty = l_msgty.
    t_message-msgid = l_msgid.
    t_message-msgno = l_msgno.
    t_message-msgtx = l_msgtx.
    t_message-po = w_povtls.
    append t_message.
    clear t_message.
    IF l_msgty EQ c_err.
      l_errflag = c_x.
    ENDIF.    " l_msgty EQ 'E'
  ENDLOOP.
  ULINE.
  IF l_errflag NE c_x.
    w_success = w_success + 1.
  ENDIF.    " l_errflag NE C_X
endform.                    "call_bapi
*&      Form  fill_check_structure
      This form Routine will check whether the specified structure
      exist/active
FORM fill_check_structure  USING    fp_tabname TYPE any
                                    fp_orgtabname TYPE any
                                    fp_chktabname TYPE any
                                    fp_check TYPE c.
  FIELD-SYMBOLS : <fs_chk>, <fs_org>.
  DATA:    l_char1(61)  TYPE c,
           l_char2(61)  TYPE c.
  DATA:    BEGIN OF tl_nametab OCCURS 60.
          INCLUDE STRUCTURE x031l.
  DATA:    END OF tl_nametab.
  REFRESH tl_nametab.
  CALL FUNCTION 'RFC_GET_NAMETAB'
    EXPORTING
      tabname          = fp_tabname
    TABLES
      nametab          = tl_nametab
    EXCEPTIONS
      table_not_active = 1
      OTHERS           = 2.
  IF sy-subrc <> 0.
    CLEAR tl_nametab.
  ENDIF.
  LOOP AT tl_nametab.
    CLEAR: l_char1, l_char2.
    CONCATENATE fp_chktabname c_hyp tl_nametab-fieldname INTO l_char1.
    ASSIGN (l_char1) TO <fs_chk>.
    CONCATENATE fp_orgtabname c_hyp tl_nametab-fieldname INTO l_char2.
    ASSIGN (l_char2) TO <fs_org>.
    IF <fs_org> IS NOT INITIAL.
      <fs_chk> = fp_check.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " fill_check_structure
*&      Form  STORE_MESSAGES
      text
     -->FP_MESSAGEStext
FORM STORE_MESSAGES TABLES FP_MESSAGES STRUCTURE T_MESSAGE.
  DATA: wl_output_data LIKE t_MESSAGE.
  DATA: l_catstr TYPE string.
  DATA: l_fieldvalue TYPE string.
  DATA: l_index TYPE i VALUE 1.
  DATA: L_FNAME(60).
  FIELD-SYMBOLS <fs>.
  CLEAR l_catstr.
  CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
      LOGICAL_FILENAME = '/USR/SAP/VTLS/POCHANGE/LOG'
      OPERATING_SYSTEM = SY-OPSYS
    IMPORTING
      FILE_NAME        = L_FNAME
    EXCEPTIONS
      FILE_NOT_FOUND   = 1
      OTHERS           = 2.
  IF SY-SUBRC = '0'.
    IF fp_messages[] IS NOT INITIAL.
      OPEN DATASET L_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        LEAVE LIST-PROCESSING.
      ELSE.
        LOOP AT fp_messages INTO wl_output_data.
          DO.
           ASSIGN COMPONENT l_index OF STRUCTURE wl_output_data TO <fs>.
            IF sy-subrc <> 0.
              EXIT.
            ENDIF.
            MOVE <fs> TO l_fieldvalue.
            IF l_catstr IS NOT INITIAL.
              CONCATENATE l_catstr l_fieldvalue INTO l_catstr SEPARATED
              BY con_tab.
            ELSE.
              MOVE l_fieldvalue TO l_catstr.
            ENDIF.
            l_index = l_index + c_1.
            CLEAR l_fieldvalue.
            CLEAR <fs>.
          ENDDO.
          l_index = c_1.
          TRANSFER l_catstr TO L_FNAME .
          CLEAR wl_output_data.
          CLEAR l_catstr.
        ENDLOOP.
        CLOSE  DATASET L_FNAME.
      ENDIF.
    ENDIF.
  ENDIF.
ENDFORM.                    "STORE_MESSAGES

Similar Messages

  • Reg Vendor master upload using BDC Call Transaction Method

    Hi All,
    Thanks in advance.
    I am uploading vendor master data using bdc call transaction method for XK01. In that  i am getting an error message that the fields " smtp_addr" ( for email) and "time_zone" (for time zone) doesnot exist on the screen '0110' ( this is the second screen) . the field timezone will be displayed on the screen only when we go for communications button and select the URL field .
    Do anybody have the solution for this problem. if possible can you give me the code for that screen.

    Create a recording via SM35 (menu go to=>recording), this will generate automatically the code for filling your bdcdata-table...

  • Help on Updating master table using SAP NetWeaver 2004s

    Dear BSP ians,
    I need to edit,modify multiple records and has to be updated in the master table using MVC. We are using SAP NetWeaver 2004s.
    We have gone through the sample codings which is present in the forum already, and we have worked out using Pages with Flow Logic on ECC 6.0 and those are not getting exexcuted for "SAP NetWeaver 2004s".
    Help me in this issue.
    Points will be rewarded for helpful infos.
    Gokul.N

    My issue is, the sample codes present alreaady in the forums works in ECC 6.0
    But we are using  "SAP Netweaver 2004s"

  • How to get custom field value in vbkd table using "SD_SALESDOCUMENT_CREATE" bapi

    Hi Experts,
    Need your help . In one program Iam using SD_SALESDOCUMENT_CREATE bapi .
    i/p for my report is am excel.
    excel is having  below formatt.
    To create salesdoc we are using SD_SALESDOC_CREATE bapi.
    but After execution of the program we are unable to find the ZZFV_SBCNT (which is custom  field) in VBKD w.r.t salesdocument.
    Need your help what we need to do to reflect the value in vbkd table.
    Here temp will contains the data from excel
    1)
    FORM f_move_header_data .
       wg_header-doc_type            = wg_temp-auart .                   "Order type
       wg_header-sales_org           = wg_temp-vkorg .                   "Sales Organization
       wg_header-distr_chan          = wg_temp-vtweg .                   "Distribution Channel
       wg_header-division            = wg_temp-spart.                    "Division
       wg_header-sales_off           = wg_temp-vkbur .                   "Sales Office
       wg_header-sales_grp           = wg_temp-vkgrp .                   "Sales Group
       wg_header-purch_no_c          = wg_temp-bstnk .                   "Customer purchase order number
       wg_header-pymt_meth           = wg_temp-zlsch  .                  "Payment Method
       wg_header-zzychan_role        = wg_temp-zzychan_role_i.           "Channel Role
       wg_header-zzysub_role         = wg_temp-zzysub_role  .            "Submitter Role
       wg_header-zzy_inv_for_opt     = wg_temp-zzinv_format  .           "Invoice Format Optio
       wg_header-ord_reason          = wg_temp-augru  .                  "Order Reason Code
       wg_header-bill_block          = wg_temp-faksp.                    "Billing Block
       wg_headerx-doc_type            = c_set .                   "Order type
       wg_headerx-sales_org           = c_set .                   "Sales Organization
       wg_headerx-distr_chan          = c_set .                   "Distribution Channel
       wg_headerx-division            = c_set.                    "Division
       wg_headerx-sales_off           = c_set .                   "Sales Office
       wg_headerx-sales_grp           = c_set .                   "Sales Group
       wg_headerx-purch_no_c          = c_set .                   "Customer purchase order number
       wg_headerx-pymt_meth           = c_set  .                  "Payment Method
       wg_headerx-zzychan_role        = c_set.                    "Channel Role
       wg_headerx-zzysub_role         = c_set .                   "Submitter Role
       wg_headerx-zzy_inv_for_opt     = c_set .                   "Invoice Format Option
       wg_headerx-ord_reason          = c_set .                   "Order Reason Code
       wg_headerx-bill_block           = c_set.                    "Billing Block
    ENDFORM.                    " F_MOVE_HEADER_DATA
    2)
    FORM f_move_item_data .
       wg_item-itm_number          =   g_itmnumber.                              "Item number
       wg_item-material            =   wg_process-matnr .                        "Material
       wg_item-target_qty          =   wg_process-target_qty.                    "Targeted Qty
       wg_item-item_categ          =   wg_process-pstyv.                         "Sales document item category
       wg_item-zzylegal_i          =   wg_process-zzlegal.                       "Legal Contract
    **********Added this line for vbkd-ZZFV_SBCNT****************************
       wg_item-zzfv_sbcnt          = wg_process-zzfv_sbcnt.      
    APPEND wg_item TO i_item.
    wg_itemx-material            =   c_set .                        "Material
       wg_itemx-target_qty          =   c_set.                         "Targeted Qty
       wg_itemx-item_categ          =   c_set.                         "Sales document item category
       wg_itemx-zzylegal_i          =   c_set.                         "Legal Contract
       wg_itemx-zzsteady_date       =   c_set .                        "Amortization Start Date
       wg_itemx-zzsteady_end_dat    =   c_set.                         "Amortization Stop Date
    **********Added this line for vbkd-ZZFV_SBCNT****************************
       wg_itemx-ZZFV_SBCNt     =   c_set.   "
       APPEND wg_itemx TO i_itemx.
       CLEAR : wg_itemx. 
    endform. 
    3)           
    FORM f_move_head_ext
    wg_extension-structure   = c_ext_vbak.
       wg_ext_vbak-zzinv_format = wg_temp-zzinv_format.
    wg_ext_vbak-zzychan_role = wg_temp-zzychan_role_i.
       wg_ext_vbak-zzysub_role  = wg_temp-zzysub_role.
       wg_extension+30 = wg_ext_vbak.
    APPEND wg_extension to i_extension.
    CLEAR wg_extension.
       wg_extensionx-structure =  c_ext_vbakx.
       wg_ext_vbakx-zzinv_format = c_set.
      wg_ext_vbakx-zzlegal      = c_set.
       wg_ext_vbakx-zzychan_role = c_set.
       wg_ext_vbakx-zzysub_role  = c_set.
       wg_extensionx+30 = wg_ext_vbakx.
       APPEND wg_extensionx TO i_extensionx.
       CLEAR wg_extensionx.
    ENDFORM.                    " F_MOVE_HEAD_EXT
    *&      Form  F_MOVE_ITEM_EXT
    *       Item Extension
    4)
    FORM f_move_item_ext .
    * Structure for BAPI parameter Extension
       wg_extension-structure = c_ext_vbap.
       wg_ext_vbap-posnr      = g_itmnumber.
       wg_ext_vbap-zzsteady_date       =   wg_process-zzsteady_date .                 "Amortization Start Date
       wg_ext_vbap-zzsteady_end_dat    =   wg_process-zzsteady_end_dat.               "Amortization Stop Date
       wg_ext_vbap-zzlegal             =   wg_process-zzlegal.                        "Legal Contract
       wg_extension+30 = wg_ext_vbap.
    APPEND wg_extension to i_extension.
    * Structure for BAPI parameter Extension - Update Indicator Fields
       wg_extensionx-structure =  c_ext_vbapx.
       wg_ext_vbapx-posnr = g_itmnumber.
       wg_ext_vbapx-zzsteady_date       =   c_set .
       wg_ext_vbapx-zzsteady_end_dat    =   c_set.
    *  wg_ext_vbapx-zzlegal             =   c_set.
    *wg_process-zzfv_sbcnt = c_set.
       wg_extensionx+30 = wg_ext_vbapx.
       APPEND wg_extensionx TO i_extensionx.
       CLEAR wg_extensionx.
    and bapi calling is like below.
    CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
         EXPORTING
           sales_header_in       = wg_header
           sales_header_inx      = wg_headerx
           logic_switch          = wg_logic_switch
           business_object       = fp_bus_obj
           status_buffer_refresh = 'X'
         IMPORTING
           salesdocument_ex      = g_sorder
         TABLES
          return                = i_return
           sales_items_in        = i_item
           sales_items_inx       = i_itemx
           sales_partners        = i_partner
           sales_conditions_in   = i_cond
           sales_conditions_inx  = i_condx
           sales_text            = i_text
           extensionin           = i_extension
         extensionex           = i_extensionx.
    still we are not getting ZZFV_SBCNT value in VBKD table w.r.t created salesdoc(g_sorder)
    Please help me from this issue.
    Thank You..

    Hi,
    Please let me know how to add custom fields in the characteristic list, My clients wants department and profit center grouping.
    Please tell me how to solve it..
    Thanks & Regards,
    Reena..

  • Problem in uploading material master data using BDC?

    Hi all,
    I am using  BDC call transaction method to upload material data. Here i am facing a problem that a value in the flat file is going to the wrong screen field . But my recording done properly.
    In recording, after entering the data in the view BASIC DATA1 and trying to enter the text . For this i need to scroll down the scroll bar and after that i am clicking on basic data text and entering the text. Here i am not touching the languge field.
    But the problem is the text to be entered into the basic data text is storing in language and giving error.
    Please help me by specifying the reason and solution for this problem? Whether i did any mistake in recording in scrolling?
    Thanks,
    Vamshi.

    Hi
    Go with BAPI for such huge transactions and screens. Use BAPI: BAPI_MATERIAL_SAVEDATA.
    Regards,
    Vishwa.

  • How to use loop in VBAK table using BDC RFC connection through excel vba ?

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

  • Uploading entries into table using bdc

    hi,
    I have save the recording first in the bdc and i got the source code in program. i want to add more entries multiple into the same tabel "zmat". with different zmatcode & zmat-zdesp.
    please help me how to write the code. or what changes i have to do.
    report ZRAJESH_BDC_01
           no standard page heading line-size 255.
    include bdcrecx1.
    start-of-selection.
    perform open_group.
    perform bdc_dynpro      using 'SAPLZMAT' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZMATCODE(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=NEWL'.
    perform bdc_dynpro      using 'SAPLZMAT' '0003'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZDESP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SAVE'.
    perform bdc_field       using 'ZMAT-ZMATCODE'
                                  'rajeshswami'.
    perform bdc_field       using 'ZMAT-ZDESP'
                                  'test 1001'.
    perform bdc_dynpro      using 'SAPLZMAT' '0003'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZDESP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=NEXT'.
    perform bdc_field       using 'ZMAT-ZDESP'
                                  'TEST 1001'.
    perform bdc_dynpro      using 'SAPLZMAT' '0003'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZDESP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SAVE'.
    perform bdc_field       using 'ZMAT-ZMATCODE'
                                  'ram 0001'.
    perform bdc_field       using 'ZMAT-ZDESP'
                                  'test 0001'.
    perform bdc_dynpro      using 'SAPLZMAT' '0003'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZDESP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UEBE'.
    perform bdc_field       using 'ZMAT-ZDESP'
                                  'TEST 0001'.
    perform bdc_dynpro      using 'SAPLZMAT' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZMATCODE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_dynpro      using 'SAPLZMAT' '0002'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ZMAT-ZMATCODE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_transaction using 'ZMAT'.
    perform close_group.

    hi archana , first thanks for helping me.
    well this the code which i wrote.
    report ZRAJESH_07 &
           no standard page heading line-size 255. &
    PARAMETERS: zcode type ZMAT-ZMATCODE, &
                zdesp type ZMAT-ZDESP. &
    data: itab type table of zmat, &
          wa_itab like line of itab. &
    include bdcrecx1. &
    start-of-selection. &
    perform open_group. &
    perform bdc_dynpro      using 'SAPLZMAT' '0002'. &
    perform bdc_field       using 'BDC_CURSOR' &
                                  'VIM_POSITION_INFO'. &
    perform bdc_field       using 'BDC_OKCODE' &
                                  '=NEWL'. &
    perform bdc_dynpro      using 'SAPLZMAT' '0003'. &
    perform bdc_field       using 'BDC_CURSOR' &
                                  'ZMAT-ZDESP'. &
    perform bdc_field       using 'BDC_OKCODE' &
                                  '=SAVE'. &
    perform bdc_field       using 'ZMAT-ZMATCODE' &
                                  'raj1'. &
    perform bdc_field       using 'ZMAT-ZDESP' &
                                  'test raj'. &
    perform bdc_dynpro      using 'SAPLZMAT' '0003'. &
    perform bdc_field       using 'BDC_CURSOR' &
                                  'ZMAT-ZDESP'. &
    perform update_nextdata using 'zcode' 'zdesp'. &
    perform bdc_transaction using 'ZMAT1'. &
    perform close_group. &
    form update_nextdata using wa_itab-ZMATCODE wa_itab-ZMAT-ZDESP. &
      loop at itab into wa_itab. &
    perform bdc_field       using 'BDC_OKCODE' &
                                  '=NEXT'.
    *perform bdc_field       using 'ZMAT-ZDESP' &
                                 'TEST RAJ'.
    perform bdc_dynpro      using 'SAPLZMAT' '0003'. &
    perform bdc_field       using 'BDC_CURSOR' &
                                  'ZMAT-ZDESP'. &
    perform bdc_field       using 'BDC_OKCODE' &
                                  '=SAVE'. &
    perform bdc_field       using 'ZMAT-ZMATCODE' &
                                  wa_itab-ZMATCODE. &
    perform bdc_field       using 'ZMAT-ZDESP' &
                                  wa_itab-ZDESP. &
    perform bdc_dynpro      using 'SAPLZMAT' '0003'. &
    perform bdc_field       using 'BDC_CURSOR' &
                                  'ZMAT-ZDESP'. &
    perform bdc_field       using 'BDC_OKCODE' &
                                  '=ENDE'. &
    perform bdc_field       using 'ZMAT-ZDESP' &
                                  'RAJ2 TEST'. &
    endloop. &
    endform. &
    regards,
    <<Email address removed>>
    Edited by: Matt on Mar 4, 2010 3:41 PM

  • Search Help Creation Using HR Master Table

    Hi,
    I have got one functional spec for elementary search help creation in SAP HR,
    that elementary search help contain a view. In that view i want TWO fields with
    two different selection condition say,
    Field Name is <b>USERID from the table PA0105 with Sub type 01  as Core id and Sub Type 10 as Location</b>, I want these two fields to be there in my View but the field name are same.
    There is any option for this in the VIEW creation.
    Reg,
    Hariharan

    Hi Kiran,
      Master table is PA0003, where all pernrs will be  
      stored here.But to get employee name you can use
      PA0001-ENAME (Formatted name of employee)
      PA0001-SNAME (Employee's name)
      For last name and first name you can check
      PA0002-VORNA and PA0002-NACHN.
      Hope this will you.
    Thanks & Regards,
    Srilatha.

  • Upload Material Master using LSMW BAPI BUS1001006-SaveData

    Hi Gurus,
    I'm working with material master upload using the BAPI BUS1001006-SaveData.
    I'm wondering on how can I know what structure should I populate on step 4 of LSMW "Maintain Field Mapping and Conversion Rules".
    Seen some tutorials on material master upload but it wasn't explained there why or what structure should be populated..
    Thanks and Regards.

    I just check each structure one by one to which the field is appropriate depending on its description....

  • How to upload chunks of Jpeg pictures in smartform using BDC.

    helo expert,
    Could you please tell me how can  i upload pictures in sap tables using bdc or something else.
    actually i would like to display pics as a field value dynamically in samrtforms while printing an invoice.
    IS there any facility to upload JPEG type pics because i need clarity in pics while printing ?
    Thanks........
    Santosh.............

    Use the standard process and BMP's uploaded into the graphics manager.  BMP's work fine for photos and you can mass upload them directly using the code from SE78 via LSMW or a program (no BDC required) and then call them dynamically in  your smartforms.

  • Uses of BAPI

    Hi,
    Can anyone explain about BAPI transaction? Whats the uses of BAPI?
    Regards
    R.Sasikumar

    Hi,
    BAPI it's SAP function module which is responsible for execution of major processes for data entry/maintenance. For example, creation of FI document, Purchase orders, etc. Additionally, one can fetch data from the tables using certain BAPIs. BAPIs could be used(called) in an ABAP program, manually (via SE37) or via LSMW process.
    BAPI transaction gives summary for all active SAP BAPIs + documentation for their usage.
    Regards,
    Eli

  • How do u save datas more than one table using net beans ide using JSF

    Hi,
    I am new to JSF.
    I save / delete / update / New master table using POJO (Plain Old Java Objects), database - oracle and Toplink Persistence Unit.
    How do u save data more than one table using net beans ide using JSF (I am using POJO) ?
    and also Tell me the reference book for JSF.
    Thanks in advance.
    regards,
    N.P.Siva

    SivaNellai wrote:
    I am new to JSF.
    So, I am using net beans IDE 6.1 from sun microsystem. It is a free software.No, you don't drag'n'drop if you're new to JSF. Switch to source code mode. Write code manually, with the help of IDE for the speed up.
    So, please guide me the reference books, articles. I need the basic understanding of JSF, net beans IDE.[JSF: The Complete Reference|http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400] is a good book. The [JSF specification document|http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] is also a good reading to understand what JSF is and how it works. There are also javadocs and tlddocs of Sun JSF Mojarra.

  • Tables used in MM Master Data Upload using LSMW or BDC?

    Hi,
    Can anyone provide me with the following information about uploading MM Master Data using LSMW or BDC :-
    1. What and all tables are used for uploading Material Master, Vendor Master, Info Record, Open PO, Open PR, RFQ, Open Contracts/Agreements ?
    2. What problems are faced during Data Upload ?
    3. What error appears/encouontered during upload ?
    4. What is the diffrence b/w LSMW and BDC ? Both can be used for Data upload so, what differences are b/w them ?
    5. Any other thing to remember/know during Data Upload ?
    Thanks,
    Lucky

    Hi Lucky,
    Dont get angry by seeing my response.
    See each and every question posted by u is available , in this forum,
    u need to do just a search on individual post.
    see what ever ur posted, u r definetly got the solutions through others,
    remember most of these answers are fetching by this threads itself (60-70%)
    a few solutions are there that are given by own,
    so better to search first, in the forum , if not satisfied with the solutions then .........
    Just its an friendly talk
    and Reward points for helpful answers
    Thanks
    Naveen khan

  • How to Use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA

    Hi ,
      How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
      May i know what are the input parameters & fields mandatory
      for each Table structures ct_data , ct_datax , it_descript , it_longtext.
      Can any one explain me Step by Step Process.
      B'cos i tried with below code. Equipment is not getting created.
      wa_itab-equipment_ext = '000000000100000001'.
      wa_itab-descript      = 'Test 2 -> Lube Oil Pump'.
      wa_itab-text_language = 'EN'.
      wa_itab-sdescript     = 'Short Description'.
      APPEND wa_itab TO it_itab.
      CLEAR  wa_itab.
      LOOP AT it_itab INTO wa_itab.
        ct_data-ta_guid       = '000000000000000001'.
        ct_data-equipment_ext = wa_itab-equipment_ext.
        ct_data-descript      = wa_itab-descript     .
        ct_data-valid_date    = sy-datum.
        ct_data-equicatgry    = 'M'.
        APPEND ct_data.
        CLEAR  ct_data.
        ct_datax-ta_guid       = '000000000000000001'.
        ct_datax-equipment_ext = 'X'.
        ct_datax-equipment     = 'X'.
        APPEND ct_datax.
        CLEAR  ct_datax.
        it_descript-ta_guid       = '000000000000000001'.
        it_descript-text_language = wa_itab-text_language.
        it_descript-descript      = wa_itab-sdescript    .
        APPEND it_descript.
        CLEAR  it_descript.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'LTXT'.
        it_longtext-text_line      = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'aaaaaaaaaaaaaaa'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'bbbbbbbbbbbb'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'cccccccccccccccc'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      call BAPI-function in this system
        CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
          TABLES
            ct_data     = ct_data
            ct_datax    = ct_datax
            it_descript = it_descript
            it_longtext = it_longtext
            return      = return
          EXCEPTIONS
            OTHERS      = 1.
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          WRITE : 'Successful'.
        ENDIF.
        IF NOT return IS INITIAL.
          LOOP AT return.
            IF return-type = 'A' OR return-type = 'E'.
              WRITE : 'Error'.
            ENDIF.
          ENDLOOP.
        ENDIF.
        REFRESH  return.
      ENDLOOP.
    Regards
    SUrendar

    Hi ,
      How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
      May i know what are the input parameters & fields mandatory
      for each Table structures ct_data , ct_datax , it_descript , it_longtext.
      Can any one explain me Step by Step Process.
      B'cos i tried with below code. Equipment is not getting created.
      wa_itab-equipment_ext = '000000000100000001'.
      wa_itab-descript      = 'Test 2 -> Lube Oil Pump'.
      wa_itab-text_language = 'EN'.
      wa_itab-sdescript     = 'Short Description'.
      APPEND wa_itab TO it_itab.
      CLEAR  wa_itab.
      LOOP AT it_itab INTO wa_itab.
        ct_data-ta_guid       = '000000000000000001'.
        ct_data-equipment_ext = wa_itab-equipment_ext.
        ct_data-descript      = wa_itab-descript     .
        ct_data-valid_date    = sy-datum.
        ct_data-equicatgry    = 'M'.
        APPEND ct_data.
        CLEAR  ct_data.
        ct_datax-ta_guid       = '000000000000000001'.
        ct_datax-equipment_ext = 'X'.
        ct_datax-equipment     = 'X'.
        APPEND ct_datax.
        CLEAR  ct_datax.
        it_descript-ta_guid       = '000000000000000001'.
        it_descript-text_language = wa_itab-text_language.
        it_descript-descript      = wa_itab-sdescript    .
        APPEND it_descript.
        CLEAR  it_descript.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'LTXT'.
        it_longtext-text_line      = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'aaaaaaaaaaaaaaa'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'bbbbbbbbbbbb'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'cccccccccccccccc'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      call BAPI-function in this system
        CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
          TABLES
            ct_data     = ct_data
            ct_datax    = ct_datax
            it_descript = it_descript
            it_longtext = it_longtext
            return      = return
          EXCEPTIONS
            OTHERS      = 1.
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          WRITE : 'Successful'.
        ENDIF.
        IF NOT return IS INITIAL.
          LOOP AT return.
            IF return-type = 'A' OR return-type = 'E'.
              WRITE : 'Error'.
            ENDIF.
          ENDLOOP.
        ENDIF.
        REFRESH  return.
      ENDLOOP.
    Regards
    SUrendar

  • Material master upload using BAPI...

    Helo SDNers,
    I am trying to upload material master using BAPI.
    data :  begin of t_mat occurs 0,
            material type matnr,             " Material - MATNR
            ind_sec type mbrsh,              " Industry sector  - MBRSH
            mat_typ type mtart,              " Material type - MTART
            plant type werks_d,              " plant - WERKS_D
            stge_loc type lgort_d,           " Storage location - LGORT_D
            sales_org type vkorg,            " Sales org - VKORG
            distr_chan type vtweg,           " Distribution channel - VTWEG
            mat_desc type maktx,             " Material description - MAKTX
            base_uom type meins,             " Base unit of measurement- MEINS
            mat_grp type matkl,              " material group - MATKL
            division type spart,             " Division - SPART
            gen_itmcatmgrp type MTPOS,       " General item category group -MTPOS_MARA
            gros_weight type BRGEW,          " Gross weight - BRGEW
            net_weight type NTGEW,          " Net weight - NTGEW
            mat_grppack type MAGRV,          " Material group pack - MAGRV
            delv_plant type DWERK_EXT,       " Delivery plant
            tax_clasif type TAXKM,           " Tax classification
            item_catgrp type MTPOS,          " Item category group
            aval_check type MTVFP,           " Availability check
            trans_grp type TRAGR,            " Transportation group
            load_grp type LADGR,             " Loading group
            pur_grp type EKGRP,              " Purchasing grp,
            mrp_type type DISMM,             " MRP type
            mrp_contr type DISPO,            " MRP Controller
            lot_size type DISLS,             " Lot size,
            gr_processing type WEBAZ,        " GR Processing time
            schdmargin_key type FHORI,       " Schedule margin key
            batch_mangment type XCHPF,       " Batch management
            strog_cond type RAUBE,           " Storage condition
            source_list type KORDB,          " Source list
            mrp_grp type DISGR,              " MRP group
            reorder_point type MINBE,        " Reorder point
            procurement_type type BESKZ,     " Procurement type
            sp_procurement_type type SOBSL,  " Special  Procurement type
            inhouse_prod type DZEIT,                    " Inhouse production
            safety_stock type EISBE,         " Safety stock
            strategy_group type STRGR,       " Strategy group
            availabilty_grp type MTVFP,      " Availability group
            batch_entry type KZECH ,         " Batch entry
            valuation_class type BKLAS,      " Valuation class
            price_control type VPRSV,        " Price control
            moving_price type VERPR,         " Moving price
            standard_price type STPRS,       " Standard price - STPRS
            langu(2),                        " Language
    end of t_mat.
    this is my internal table i have these many content in my excel file
    please explain me what the following code does .....
    move-corresponding wa to bapi_head.
    bapi_head-basic_view = 'X'.
    bapi_head-sales_view = 'X'.
    bapi_head-purchase_view = 'X'.
    bapi_head-mrp_view = 'X'.
    bapi_head-forecast_view = 'X'.
    bapi_head-work_sched_view = 'X'.
    bapi_head-prt_view = 'X'.
    bapi_head-storage_view = 'X'.
    bapi_head-warehouse_view = 'X'.
    bapi_head-quality_view = 'X'.
    bapi_head-account_view = 'X'.
    bapi_head-cost_view = 'X'.
    and also please help with an example how do i upload data from IT (my internal table) using BAPI.
    Regards,
    Ranjith N

    Hi ,
    First you upload your Excel data into Internal Table.
    Move all data to Respected BAPI Structures.
    and then call 'BAPI_MATERIAL_SAVEDATA' and pass all structures.
    Sample Code:
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_fname
          i_begin_col             = v_c1
          i_begin_row             = l_v_r
          i_end_col               = v_cl
          i_end_row               = v_rl
        TABLES
          intern                  = i_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc eq 0.
        LOOP AT i_excel.
          CASE i_excel-col.
            WHEN 0001.
              wa_final-field1 = i_excel-value.
            WHEN 0002.
              wa_final-field2 = i_excel-value.
            WHEN 0003.
              wa_final-field3 = i_excel-value.
            WHEN 0004.
              wa_final-field4 = i_excel-value.
            WHEN 0005.
              wa_final-field5 = i_excel-value.
            WHEN 0006.
              wa_final-field6 = i_excel-value.
            WHEN 0007.
              wa_final-field7 = i_excel-value.
            WHEN 0008.
              wa_final-field8 = i_excel-value.
            WHEN 0009.
              wa_final-field9 = i_excel-value.
            WHEN 0010.
              wa_final-field10 = i_excel-value.
            WHEN 0011.
              wa_final-field11 = i_excel-value.
            WHEN 0012.
              wa_final-field12 = i_excel-value.
            WHEN 0013.
              wa_final-field13 = i_excel-value.
            WHEN 0014.
              wa_final-field14 = i_excel-value.
            WHEN 0015.
              wa_final-field15 = i_excel-value.
            WHEN 0016.
              wa_final-field16 = i_excel-value.
          ENDCASE.
    *-at end of each row, a record needs to append the internal table
          AT END OF row.
            APPEND wa_final TO i_final.
            CLEAR: wa_final.
          ENDAT.
        ENDLOOP.
      ENDIF.
    Move all your Inatrnal tbale data to respected BAPI structures
    *&      Form  MOVE_HEADDATA
       * Move Header data to BAPI Header.
    FORM move_headdata .
    Move Header Data to BAPI Fields
      MOVE : wa_final-matnr      TO wa_mathead-material,
             wa_final-mbrsh      TO wa_mathead-ind_sector,
             wa_final-mtart      TO wa_mathead-matl_type.
    To get UOM
      SELECT SINGLE * FROM t006 INTO t006 WHERE msehi = wa_final-meins.
      MOVE: t006-isocode TO wa_mara-base_uom_iso,
            c_x          TO wa_marax-base_uom_iso.
    **-- Move Material Descriptions
      PERFORM move_materialdescription .
    ENDFORM.                    " MOVE_HEADDATA
    *&      Form  MOVE_CLIENTDATA
          * Move Basic data to Clientdata
    FORM   move_clientdata .
      MOVE : wa_final-spart      TO wa_mara-division,
             wa_final-bismt      TO wa_mara-old_mat_no,
             wa_final-extwg      TO wa_mara-extmatlgrp,
             wa_final-mtpos_mara TO wa_mara-item_cat,
             wa_final-groes      TO wa_mara-size_dim,
             wa_final-zeivr      TO wa_mara-doc_vers,
             wa_final-ekwsl      TO wa_mara-pur_valkey.
      MOVE : c_x      TO wa_marax-division,
             c_x      TO wa_marax-old_mat_no,
             c_x      TO wa_marax-extmatlgrp,
             c_x      TO wa_marax-item_cat,
             c_x      TO wa_marax-size_dim,
             c_x      TO wa_marax-doc_vers,
             c_x      TO wa_marax-pur_valkey.
    ENDFORM.                    " MOVE_CLIENTDATA
    *&      Form  MOVE_STORAGELOCATIONDATA
          * Move storage location data to STORAGELOCATIONDATA
    FORM move_storagelocationdata .
      CLEAR: wa_mard,wa_mardx.
      MOVE : wa_final-werks      TO wa_mard-plant,
             wa_final-lgort      TO wa_mard-stge_loc.
      MOVE : wa_final-werks      TO wa_mardx-plant,
             wa_final-lgort      TO wa_mardx-stge_loc.
    ENDFORM.                    " MOVE_STORAGELOCATIONDATA
    *&      Form  MOVE_SALESDATA
         * Move Salesdate to SALESDATA
    FORM move_salesdata .
      MOVE : wa_final-vkorg      TO wa_mvke-sales_org,
             wa_final-vtweg      TO wa_mvke-distr_chan,
             wa_final-dwerk      TO wa_mvke-delyg_plnt,
             wa_final-versg      TO wa_mvke-matl_stats,
             wa_final-ktgrm      TO wa_mvke-acct_assgt,
             wa_final-mtpos      TO wa_mvke-item_cat,
             wa_final-mvgr1      TO wa_mvke-matl_grp_1,
             wa_final-mvgr2      TO wa_mvke-matl_grp_2,
             wa_final-mvgr3      TO wa_mvke-matl_grp_3,
             wa_final-mvgr4      TO wa_mvke-matl_grp_4,
             wa_final-mvgr5      TO wa_mvke-matl_grp_5,
             wa_final-vrkme      TO wa_mvke-sales_unit.
      MOVE : wa_final-vkorg      TO wa_mvkex-sales_org,
             wa_final-vtweg      TO wa_mvkex-distr_chan,
             c_x                 TO wa_mvkex-delyg_plnt,
             c_x                 TO wa_mvkex-matl_stats,
             c_x                 TO wa_mvkex-acct_assgt,
             c_x                 TO wa_mvkex-item_cat,
             c_x                 TO wa_mvkex-matl_grp_1,
             c_x                 TO wa_mvkex-matl_grp_2,
             c_x                 TO wa_mvkex-matl_grp_3,
             c_x                 TO wa_mvkex-matl_grp_4,
             c_x                 TO wa_mvkex-matl_grp_5,
             c_x                 TO wa_mvkex-sales_unit.
    ENDFORM.                    " MOVE_SALESDATA
    *&      Form  MOVE_MATERIALDESCRIPTION
          * Move MATERIALDESCRIPTION to Material Description
    FORM move_materialdescription .
      CLEAR: wa_makt,i_makt.
      MOVE : wa_final-maktx TO wa_makt-matl_desc,
             sy-langu       TO wa_makt-langu.
      APPEND wa_makt TO i_makt.
      CLEAR wa_makt.
    ENDFORM.                    " MOVE_MATERIALDESCRIPTION
    *&      Form  basic_data
    FORM basic_data .
    **-- Move Material Data at Storage Location Level
      PERFORM move_storagelocationdata .
      MOVE : wa_final-vkorg      TO wa_mvke-sales_org,
             wa_final-vtweg      TO wa_mvke-distr_chan.
      MOVE : wa_final-vkorg      TO wa_mvkex-sales_org,
             wa_final-vtweg      TO wa_mvkex-distr_chan.
    **-- Move Material Data at Client Level
      PERFORM move_clientdata .
    IF ALT_UOM is not Given in flat file Move BASEUOM as ALT_UOM
      IF wa_final-meinh EQ c_space.
        MOVE : wa_final-meins     TO wa_marm-alt_unit,
               wa_final-meins     TO wa_marmx-alt_unit.
      ELSE.
        MOVE : wa_final-meinh      TO wa_marm-alt_unit,
                wa_final-umren      TO wa_marm-numerator.
        MOVE : wa_final-meinh     TO wa_marmx-alt_unit,
               c_x                TO wa_marmx-numerator.
      ENDIF.
      MOVE : wa_final-numtp      TO wa_marm-ean_cat,
             wa_final-brgew      TO wa_marm-gross_wt,
             wa_final-volum      TO wa_marm-volume,
             wa_final-voleh      TO wa_marm-volumeunit,
             wa_final-gewei      TO wa_marm-unit_of_wt.
      APPEND wa_marm TO i_marm.
      CLEAR wa_marm.
      MOVE : c_x                TO wa_marmx-ean_cat,
             c_x                TO wa_marmx-gross_wt,
             c_x                TO wa_marmx-volume,
             c_x                TO wa_marmx-volumeunit,
             c_x                TO wa_marmx-unit_of_wt.
      APPEND wa_marmx TO i_marmx.
      CLEAR wa_marmx.
    ENDFORM.                    " basic_data
    *&      Form  sales_data1
    FORM sales_data1 .
    Move Sales & Plant Data
      MOVE : wa_final-werks      TO wa_marc-plant,
             wa_final-mtvfp      TO wa_marc-availcheck,
             wa_final-ladgr      TO wa_marc-loadinggrp,
             wa_final-prctr      TO wa_marc-profit_ctr.
      MOVE : wa_final-werks      TO wa_marcx-plant,
             c_x                 TO wa_marcx-availcheck,
             c_x                 TO wa_marcx-loadinggrp,
             c_x                 TO wa_marcx-profit_ctr.
      MOVE: wa_final-tragr      TO wa_mara-trans_grp,
            c_x                 TO wa_marax-trans_grp.
    **-- Move Sales Data
      PERFORM move_salesdata .
    Move Tax Data
      MOVE : 'JP'              TO wa_mlan-depcountry_iso,
            'MWAR'             TO wa_mlan-tax_type_1,
             wa_final-taklv    TO wa_mlan-taxclass_1.
      APPEND wa_mlan TO i_mlan.
      CLEAR wa_mlan.
    ENDFORM.                    " sales_data1
    *&      Form  purchase_data
    FORM purchase_data .
    Move Plant Data
      MOVE : wa_final-werks      TO wa_marc-plant,
             wa_final-werks      TO wa_marcx-plant.
    Move PO data
      MOVE : wa_final-ekgrp  TO wa_marc-pur_group,
             wa_final-kautb  TO wa_marc-auto_p_ord,
             wa_final-usequ  TO wa_marc-quotausage,
             wa_final-kordb  TO wa_marc-sourcelist,
             c_x             TO wa_marcx-pur_group,
             c_x             TO wa_marcx-auto_p_ord,
             c_x             TO wa_marcx-quotausage,
             c_x             TO wa_marcx-sourcelist.
      MOVE: wa_final-matkl  TO wa_mara-matl_group,
            wa_final-bstme  TO wa_mara-po_unit,
             c_x            TO wa_marax-matl_group,
             c_x            TO wa_marax-po_unit.
    ENDFORM.                    " purchase_data
    *&      Form  mrp_data
    FORM mrp_data .
    **-- Move Material Data at Storage Location Level
      PERFORM move_storagelocationdata .
    Move All MRP data
      MOVE: wa_final-diskz TO wa_mard-mrp_ind,
            c_x            TO wa_mardx-mrp_ind.
      MOVE : wa_final-werks TO wa_marc-plant,
             wa_final-dismm TO wa_marc-mrp_type,
             wa_final-dispo TO wa_marc-mrp_ctrler,
             wa_final-beskz TO wa_marc-proc_type,
             wa_final-sobsl TO wa_marc-spproctype,
             wa_final-mtvfp TO wa_marc-availcheck,
             wa_final-minbe  TO wa_marc-reorder_pt,
             wa_final-fxhor  TO wa_marc-pl_ti_fnce,
             wa_final-disls  TO wa_marc-lotsizekey,
             wa_final-bstmi  TO wa_marc-minlotsize,
             wa_final-bstma  TO wa_marc-maxlotsize,
             wa_final-bstfe  TO wa_marc-fixed_lot,
             wa_final-mabst  TO wa_marc-max_stock,
             wa_final-ausss  TO wa_marc-assy_scrap,
             wa_final-dzeit  TO wa_marc-inhseprodt,
             wa_final-plifz  TO wa_marc-plnd_delry,
             wa_final-webaz  TO wa_marc-gr_pr_time,
             wa_final-fhori  TO wa_marc-sm_key,
             wa_final-eisbe  TO wa_marc-safety_stk,
             wa_final-strgr  TO wa_marc-plan_strgp,
             wa_final-wzeit  TO wa_marc-replentime,
             wa_final-lgfsb  TO wa_marc-sloc_exprc,
             wa_final-sbdkz  TO wa_marc-dep_req_id,
             wa_final-kzbed  TO wa_marc-grp_reqmts,
             wa_final-miskz  TO wa_marc-mixed_mrp,
             wa_final-stlal  TO wa_marc-alternative_bom,
             wa_final-stlan  TO wa_marc-bom_usage.
      MOVE : wa_final-werks TO wa_marcx-plant,
             c_x            TO wa_marcx-mrp_type,
             c_x            TO wa_marcx-mrp_ctrler,
             c_x            TO wa_marcx-proc_type,
             c_x            TO wa_marcx-spproctype,
             c_x            TO wa_marcx-availcheck,
             c_x            TO wa_marcx-reorder_pt,
             c_x            TO wa_marcx-pl_ti_fnce,
             c_x            TO wa_marcx-lotsizekey,
             c_x            TO wa_marcx-minlotsize,
             c_x            TO wa_marcx-maxlotsize,
             c_x            TO wa_marcx-fixed_lot,
             c_x            TO wa_marcx-max_stock,
             c_x            TO wa_marcx-assy_scrap,
             c_x            TO wa_marcx-inhseprodt,
             c_x            TO wa_marcx-plnd_delry,
             c_x            TO wa_marcx-gr_pr_time,
             c_x            TO wa_marcx-sm_key,
             c_x            TO wa_marcx-safety_stk,
             c_x            TO wa_marcx-plan_strgp,
             c_x            TO wa_marcx-replentime,
             c_x            TO wa_marcx-sloc_exprc,
             c_x            TO wa_marcx-dep_req_id,
             c_x            TO wa_marcx-grp_reqmts,
             c_x            TO wa_marcx-mixed_mrp,
             c_x            TO wa_marcx-alternative_bom,
             c_x            TO wa_marcx-bom_usage.
    ENDFORM.                    " mrp_data
    *&      Form  accounting_data
    FORM accounting_data .
    Move Plant Data
      MOVE: wa_final-werks TO wa_marc-plant,
            wa_final-werks TO wa_marcx-plant.
    Move Account Data
      MOVE :  wa_final-werks TO wa_mbew-val_area,
              wa_final-bklas TO wa_mbew-val_class,
              wa_final-vprsv TO wa_mbew-price_ctrl,
              wa_final-verpr TO wa_mbew-moving_pr,
              wa_final-peinh TO wa_mbew-price_unit,
              wa_final-stprs TO wa_mbew-std_price.
      MOVE :  wa_final-werks TO wa_mbewx-val_area,
              c_x TO wa_mbewx-val_class,
              c_x TO wa_mbewx-price_ctrl,
              c_x TO wa_mbewx-moving_pr,
              c_x TO wa_mbewx-price_unit,
              c_x TO wa_mbewx-std_price.
    ENDFORM.                    " accounting_data
    *&      Form  cost_data
    FORM cost_data .
    Move Plant Data
      MOVE: wa_final-werks TO wa_marc-plant,
            wa_final-awsls TO wa_marc-variance_key,
            wa_final-verid  TO wa_marc-prodverscs,   " Production Version
            wa_final-werks TO wa_marcx-plant,
            c_x            TO wa_marcx-variance_key,
            c_x            TO wa_marcx-prodverscs.
    Move Cost Data
      MOVE :  wa_final-werks TO wa_mbew-val_area,
              wa_final-bklas TO wa_mbew-val_class,
              wa_final-vprsv TO wa_mbew-price_ctrl,
              wa_final-ekalr TO wa_mbew-qty_struct.
      MOVE :  wa_final-werks TO wa_mbewx-val_area,
              c_x            TO wa_mbewx-val_class,
              c_x            TO wa_mbewx-price_ctrl,
              c_x            TO wa_mbewx-qty_struct.
    ENDFORM.                    " cost_data
    Call All Structures in to BAPI
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          headdata             = wa_mathead
          clientdata           = wa_mara
          clientdatax          = wa_marax
          plantdata            = wa_marc
          plantdatax           = wa_marcx
          storagelocationdata  = wa_mard
          storagelocationdatax = wa_mardx
          valuationdata        = wa_mbew
          valuationdatax       = wa_mbewx
          salesdata            = wa_mvke
          salesdatax           = wa_mvkex
        IMPORTING
          return               = i_return
        TABLES
          materialdescription  = i_makt
          unitsofmeasure       = i_marm
          unitsofmeasurex      = i_marmx
          taxclassifications   = i_mlan.
      IF i_return-type = 'A' OR i_return-type = 'E' .
        DATA : l_v_string TYPE string,
               l_v_msg1   TYPE string,
               l_v_msg2   TYPE string.
        MOVE i_return-message TO l_v_string.
        CONDENSE l_v_string.
        PERFORM fill_error_table USING 'E'
                                       'ZMSG_MM'
                                       '098'
                                       v_reccon
                                       l_v_string
        v_error = v_error + 1.
        CLEAR: l_v_string.
      ELSEIF i_return-type = 'S'.
        PERFORM fill_error_table USING 'S'
                                             i_return-id
                                             i_return-number
                                            i_return-message_v1
                                           i_return-message_v2
                                           i_return-message_v3
                                           i_return-message_v4.
        v_success = v_success + 1.
      ENDIF .
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      IF sy-subrc = 0.
        COMMIT WORK AND WAIT.      "for the update to table Transcation
      ENDIF.
    Regards,
    Siva.

Maybe you are looking for