Bdc programing

Hi,
i am new to bdc.in my req.. they asked me to change bapi function module and i want replace with bdc. i want to do recording for ME21n or ME21 Tcode and bdc Session method.plz let me know the process by step by step.if any one have code for this send me.for every 1000 line items i want to crate session.
my input file type:
rectyp      type  char1,            " Type of Record indicator - H /T / D
         ebeln       type  ebeln,            " Purchasing Document Number
         bukrs       type zlegacy_company,   " Company Code
         ekgrp       type  bkgrp,            " Purchasing Group
         bsart(6),                           " Purchasing Document Type
         ekorg       type  ekorg,            " Purchasing Organization
         lifnr       type  elifn,            " Vendor Account Number
         bedat       type  ebdat,            " Purchasing Document Date
         ebelp       type  ebelp,            " Item Number of Purchasing Documen
         knttp       type  knttp,            " Account Assignment Category
         matkl       type  matkl,            " Material Group
         werks       type  werks,            " Plant
         txz01       type  txz01,            " Short Text
         menge(13)   type  c,                " Purchase Order Quantity
         meins       type  bstme,            " Purchase Order Unit of Measure
         netpr(16)   type   c,               " Net Price in Purchasing Document
         peinh(5)    type    c,              " Price Unit
         bprme       type  bbprm,            " Order Price Unit (Purchasing)
         eeind       type  datum,            " Delivery Date
         mwskz       type  mwskz,            " Sales Tax Code
         saknr       type  saknr,            " Cost Element
         prctr(15),                          " Profit Center
         po_number   type ebeln,             " PO Number
         bwart       type bwart,             " Movement type
         po_item     type ebelp,             " PO Line Item
         bldat       type bldat,             " Document Date
         lfsnr       type lfsnr,             " Delivery Note
         frbnr       type frbnr,             " Bill of Laden
         bktxt       type bktxt,             " Header Text
         erfmg(13)   type c,
thanks,
ankitha

Hi Ankitha,
Its not possible to use BDC for ME21N, becos this is Enjoy Tcode. Better create program using BAPI_PO_CREATE1 Bapi.
if u want here is the code with bapi.....
FORM create_sto .
REFRESH: i_errpo, i_error.
CLEAR: w_header, i_errpo, i_error, v_success, v_error.
LOOP AT i_header_sa INTO w_header.
CLEAR: w_errpo, w_poheaderx, w_exppurchaseorder, w_expheader,
w_return, w_poitem, w_poitemx, w_poschedule, w_poschedulex,
i_return, w_poitem, w_poitemx, i_poschedule, i_poschedulex.
REFRESH: i_return, i_poitem, i_poitemx, i_poschedule, i_poschedulex.
*--Fill Header
w_poheader-po_number = w_header-ebeln.
w_poheader-doc_type = 'ZU'.
*--The supplying plant is mapped based on the recieving plant in from the ZCA_CONV_UTILITY.
The conversion is based on the new values of the recieving plant and storage location
v_value_old = w_header-bukrs.
PERFORM convert TABLES i_values
USING 'BUKRS'
v_value_old
CHANGING v_value_new.
w_poheader-comp_code = v_value_new(4).
w_poheader-pur_group = w_header-ekgrp.
CLEAR: v_value_old, v_value_new.
v_value_old = w_header-ekorg.
PERFORM convert TABLES i_values
USING 'EKORG'
v_value_old
CHANGING v_value_new.
WRITE w_header-aedat+4(2) TO v_po_date(2).
WRITE w_header-aedat6(2) TO v_po_date2(2).
WRITE w_header-aedat(4) TO v_po_date+4(4).
w_poheader-purch_org = v_value_new(4).
w_poheader-vendor = w_header-lifnr.
w_poheader-creat_date = v_po_date.
w_poheader-item_intvl = w_header-pincr.
w_poheader-langu = w_header-spras.
w_poheader-subitemint = w_header-upinc.
w_poheader-vper_start = w_header-kdatb.
w_poheader-vper_end = w_header-kdate.
w_poheader-warranty = w_header-gwldt.
w_poheader-ref_1 = w_header-ihrez.
w_poheader-sales_pers = w_header-verkf.
w_poheader-our_ref = w_header-unsez.
w_poheader-telephone = w_header-telf1.
w_poheaderx-po_number = 'X'.
w_poheaderx-doc_type = 'X'.
w_poheaderx-suppl_plnt = 'X'.
w_poheaderx-comp_code = 'X'.
w_poheaderx-pur_group = 'X'.
w_poheaderx-purch_org = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-creat_date = 'X'.
w_poheaderx-item_intvl = 'X'.
w_poheaderx-langu = 'X'.
w_poheaderx-subitemint = 'X'.
w_poheaderx-vper_start = 'X'.
w_poheaderx-vper_end = 'X'.
w_poheaderx-warranty = 'X'.
w_poheaderx-ref_1 = 'X'.
w_poheaderx-sales_pers = 'X'.
w_poheaderx-our_ref = 'X'.
w_poheaderx-telephone = 'X'.
CLEAR: w_item, v_poitem.
LOOP AT i_item INTO w_item WHERE ebeln EQ w_header-ebeln.
CLEAR: w_zmm_cordlog,
v_split,
w_matnr.
READ TABLE i_zmm_cordlog INTO w_zmm_cordlog WITH KEY ponumber = w_item-ebeln
poitem = w_item-ebelp.
IF sy-subrc EQ 0.
*--If file is processed earlier, rollback work.
IF NOT w_zmm_cordlog-mdoc561 IS INITIAL. "STO has to be processed for 561 Goods Mvmt
w_errortab-ponumber = w_item-ebeln.
w_errortab-poitem = w_item-ebelp.
w_errortab-message = text-051. "Process STO for 561 Goods Mvmt.
APPEND w_errortab TO i_errortab.
ADD 1 TO v_error.
CLEAR w_errortab.
PERFORM error_pos.
CONTINUE.
ELSE.
IF NOT w_zmm_cordlog-eccpo IS INITIAL. "STO already exists
w_errortab-ponumber = w_item-ebeln.
w_errortab-poitem = w_item-ebelp.
w_errortab-eccpo = w_zmm_cordlog-eccpo.
w_errortab-eccpoitem = w_zmm_cordlog-eccpoitem.
w_errortab-message = text-052. "STO already created, record skipped
APPEND w_errortab TO i_errortab.
ADD 1 TO v_error.
CLEAR w_errortab.
PERFORM error_pos.
CONTINUE.
ENDIF.
ENDIF.
ENDIF.
CLEAR w_mard.
SELECT SINGLE * FROM mard INTO w_mard
WHERE matnr EQ w_item-matnr
AND werks EQ w_item-werks
AND lgort EQ w_item-lgort.
IF sy-subrc <> 0.
w_itmerror-ponumber = w_item-ebeln.
w_itmerror-poitem = w_item-ebelp.
CONCATENATE w_item-matnr w_item-werks w_item-lgort text-044
INTO w_itmerror-message SEPARATED BY space.
APPEND w_itmerror TO i_itmerror.
ADD 1 TO v_error.
CONTINUE.
ENDIF.
*--Plant and Storage location conversion
CLEAR: v_value_old, i_values[], v_value_new.
CONCATENATE w_item-werks w_item-lgort INTO v_value_old.
PERFORM convert TABLES i_values
USING 'WERKSLGORT'
v_value_old
CHANGING v_value_new.
w_item-werks = v_value_new+0(4).
w_item-lgort = v_value_new+4(4).
*--The converted recieving plant will be the same as the supplying plant in the new system
and the supplying storage location would be OW01.
w_poheader-suppl_plnt = w_item-werks.
*--Fill item
w_poitem-po_item = w_item-ebelp.
w_poitem-material = w_item-matnr.
w_poitem-plant = w_item-werks.
w_poitem-stge_loc = w_item-lgort.
w_poitem-po_unit = w_item-meins.
PERFORM get_valuation_type USING w_item-matnr
w_item-werks
w_item-lgort
CHANGING w_poitem-val_type.
IF w_item-matnr CP '*-R'.
SPLIT w_item-matnr AT '-R' INTO w_item-matnr v_split.
ELSEIF w_item-matnr CP '*-D'.
SPLIT w_item-matnr AT '-D' INTO w_item-matnr v_split.
ENDIF.
SELECT SINGLE matnr INTO w_matnr
FROM mara
WHERE matnr = w_item-matnr.
IF sy-subrc NE 0.
w_errortab-ponumber = w_item-ebeln.
w_errortab-poitem = w_item-ebelp.
CONCATENATE w_item-matnr 'Does not exist in the MARC table'
INTO w_errortab-message.
ADD 1 TO v_error.
CONTINUE.
ENDIF.
w_poitem-matl_group = w_item-matkl.
w_poitem-item_cat = w_item-pstyp.
w_poitem-acctasscat = w_item-knttp.
w_poitem-reminder1 = w_item-mahn1.
w_poitem-conf_ctrl = w_item-bstae.
w_poitem-ackn_reqd = w_item-kzabs.
w_poitem-quantity = w_item-menge.
w_poitem-reminder2 = w_item-mahn2.
w_poitem-acknowl_no = w_item-labnr.
w_poitem-reminder3 = w_item-mahn3.
w_poitem-trackingno = w_item-bednr.
w_poitem-gr_pr_time = w_item-webaz.
w_poitem-under_dlv_tol = w_item-untto.
w_poitem-qual_insp = w_item-insmk.
w_poitem-over_dlv_tol = w_item-uebto.
w_poitem-unlimited_dlv = w_item-uebtk.
w_poitem-no_more_gr = w_item-elikz.
w_poitem-shipping = w_item-evers.
w_poitem-period_ind_expiration_date = ' '.
APPEND w_poitem TO i_poitem.
w_poitemx-po_item = w_poitem-po_item.
w_poitemx-po_itemx = 'X'.
w_poitemx-material = 'X'.
w_poitemx-plant = 'X'.
w_poitemx-stge_loc = 'X'.
w_poitemx-po_unit = 'X'.
w_poitemx-val_type = 'X'.
w_poitemx-matl_group = 'X'.
w_poitemx-item_cat = 'X'.
w_poitemx-acctasscat = 'X'.
w_poitemx-reminder1 = 'X'.
w_poitemx-conf_ctrl = 'X'.
w_poitemx-ackn_reqd = 'X'.
w_poitemx-quantity = 'X'.
w_poitemx-reminder2 = 'X'.
w_poitemx-acknowl_no = 'X'.
w_poitemx-reminder3 = 'X'.
w_poitemx-trackingno = 'X'.
w_poitemx-gr_pr_time = 'X'.
w_poitemx-under_dlv_tol = 'X'.
w_poitemx-qual_insp = 'X'.
w_poitemx-over_dlv_tol = 'X'.
w_poitemx-unlimited_dlv = 'X'.
w_poitemx-no_more_gr = 'X'.
w_poitemx-shipping = 'X'.
w_poitemx-period_ind_expiration_date = 'X'.
APPEND w_poitemx TO i_poitemx.
CLEAR w_poitemx.
CLEAR: w_slines, v_scheditem.
LOOP AT i_slines INTO w_slines WHERE ebeln EQ w_item-ebeln
AND ebelp EQ w_item-ebelp.
*--Fill Schedule lines for PO
w_poschedule-po_item = w_item-ebelp.
w_poschedule-sched_line = w_slines-etenr.
w_poschedule-del_datcat_ext = ' '.
w_poschedule-delivery_date = w_slines-eindt.
w_poschedule-quantity = w_slines-menge.
APPEND w_poschedule TO i_poschedule.
CLEAR w_poschedule.
w_poschedulex-po_item = w_item-ebelp.
w_poschedulex-sched_line = w_slines-etenr.
w_poschedulex-po_itemx = 'X'.
w_poschedulex-sched_linex = 'X'.
w_poschedulex-del_datcat_ext = 'X'.
w_poschedulex-delivery_date = 'X'.
w_poschedulex-quantity = 'X'.
APPEND w_poschedulex TO i_poschedulex.
CLEAR w_poschedulex.
CLEAR w_slines.
ENDLOOP.
CLEAR: w_poitem,
w_item.
ENDLOOP.
SORT: i_poitem, i_poitemx, i_poschedule, i_poschedulex.
*--If the import data to BAPI is empty, then raise a message to check the Material Error file for
any PO items which are skipped.
The PO in error is also moved to the error file for reprocessing.
IF w_poheader IS INITIAL OR
i_poitem[] IS INITIAL.
CLEAR: w_poheader, w_poheaderx, i_return[], i_poitem, i_poitem[].
CONTINUE.
ENDIF.
*--BAPI call for PO creation
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = w_poheader
poheaderx = w_poheaderx
testrun = p_test
IMPORTING
exppurchaseorder = w_exppurchaseorder
expheader = w_expheader
TABLES
return = i_return
poitem = i_poitem
poitemx = i_poitemx
poschedule = i_poschedule
poschedulex = i_poschedulex.
*--Commit the transaction if a success message is returned, else rollback work.
Update the legacy PO and items in the ZMM_CORDLOG table
start of modification
WAIT UP TO time SECONDS.
end of modification
IF NOT i_return[] IS INITIAL.
LOOP AT i_return INTO w_return.
*--Read the error messages
IF w_return-type = 'E'.
w_errortab-ponumber = w_header-ebeln.
w_errortab-doctype = w_poheader-doc_type.
w_errortab-supplplnt = w_poheader-suppl_plnt.
w_errortab-vendor = w_poheader-vendor.
w_errortab-eccpo = w_expheader-po_number.
w_errortab-message = w_return-message(73).
APPEND w_errortab TO i_errortab.
ADD 1 TO v_error.
ROLLBACK WORK.
ELSEIF w_return-type = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
v_success = v_success + 1.
CLEAR w_poitem.
LOOP AT i_poitem INTO w_poitem.
w_zmm_cordlog-ponumber = w_poheader-po_number.
w_zmm_cordlog-poitem = w_poitem-po_item.
w_zmm_cordlog-doctype = w_poheader-doc_type.
w_zmm_cordlog-supplplnt = w_poheader-suppl_plnt.
w_zmm_cordlog-vendor = w_poheader-vendor.
w_zmm_cordlog-eccpo = w_poheader-po_number.
w_zmm_cordlog-eccpoitem = w_poitem-po_item.
w_zmm_cordlog-message = w_return-message(73).
MODIFY zmm_cordlog FROM w_zmm_cordlog. "Modify DB table
CLEAR w_zmm_cordlog.
w_errpo-ebeln = w_poheader-po_number.
w_errpo-ebelp = w_poitem-po_item.
APPEND w_errpo TO i_errpo.
CLEAR w_errpo.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.
CLEAR: w_header,
w_poheader,
w_poheaderx.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDLOOP.
IF NOT i_errpo[] IS INITIAL.
*--Separate error records (all records for any PO in error).
PERFORM create_error_file TABLES i_header_sa.
*--Write data to Application Server
IF NOT i_error[] IS INITIAL.
OPEN DATASET p_error FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE e398 WITH text-023 space space space.
ENDIF.
LOOP AT i_error INTO w_error.
TRANSFER w_error TO p_error.
ENDLOOP.
ENDIF.
ENDIF.
COMMIT WORK.
ENDFORM. " create_sto
some other example code with bapi.. for ME21N
use BAPI_PO_CREATE1.
check this Sample code,
REPORT  zpo_create                              .
PARAMETERS: p-file LIKE rlgrap-filename DEFAULT
                          'c:\demo3.txt'.
DATA: BEGIN OF itab OCCURS 0,
  line(1000),
  END OF itab.
DATA l_item(5) TYPE n.
TABLES : zerror.
DATA lcounter(3) TYPE n.
DATA : l_errflag.
DATA : l_po_header LIKE bapimepoheader.
DATA : l_po_headerx LIKE bapimepoheaderx.
DATA : t_po_account LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE.
DATA : t_po_accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE.
DATA : l_new_po(10), l_last_po(10).
DATA : l_purchaseorder LIKE bapimepoheader-po_number.
*DATA : L_HEADER LIKE BAPIMEPOHEADER STRUCTURE BAPIMEPOHEADER.
DATA : BEGIN OF t_po_items OCCURS 0.
        INCLUDE STRUCTURE bapimepoitem.
DATA : END OF t_po_items.
DATA : BEGIN OF t_po_itemsx OCCURS 0.
        INCLUDE STRUCTURE bapimepoitemx.
DATA : END OF t_po_itemsx.
DATA : BEGIN OF t_return OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA : END OF t_return.
CLEAR : l_po_header.
CALL FUNCTION 'WS_UPLOAD'
  EXPORTING
    filename                = p-file
    filetype                = 'DAT'
  TABLES
    data_tab                = itab
  EXCEPTIONS
    file_open_error         = 1
    file_read_error         = 2
    no_batch                = 3
    gui_refuse_filetransfer = 4
    invalid_type            = 5
    OTHERS                  = 6.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  EXIT.
ENDIF.
LOOP  AT itab.
  IF itab-line(1) EQ 'K'.
    l_new_po = itab-line(10).
    IF l_last_po NE  l_new_po AND l_last_po NE space.
      PERFORM create_po.
      PERFORM refresh_table.
    ENDIF.
    IF itab-line+13(2) EQ '40'.
      PERFORM append_header.
    ENDIF.
    IF itab-line+13(2) EQ '81'.
      PERFORM append_item.
    ENDIF.
    l_last_po = l_new_po.
  ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
  PERFORM create_po.
  PERFORM refresh_table.
ENDIF.
*&      Form  CREATE_PO
PO Create
-->  p1        text
<--  p2        text
FORM create_po .
  CLEAR : l_purchaseorder.
  CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
      poheader                     = l_po_header
     poheaderx                    = l_po_headerx
    POADDRVENDOR                 =
    TESTRUN                      =
    MEMORY_UNCOMPLETE            =
    MEMORY_COMPLETE              =
    POEXPIMPHEADER               =
    POEXPIMPHEADERX              =
    VERSIONS                     =
    NO_MESSAGING                 =
    NO_MESSAGE_REQ               =
    NO_AUTHORITY                 =
    NO_PRICE_FROM_PO             =
   IMPORTING
     exppurchaseorder             = l_purchaseorder
    EXPHEADER                    =
    EXPPOEXPIMPHEADER            =
   TABLES
     return                       = t_return
     poitem                       = t_po_items
     poitemx                      = t_po_itemsx
    POADDRDELIVERY               =
    POSCHEDULE                   =
    POSCHEDULEX                  =
     poaccount                    = t_po_account
    POACCOUNTPROFITSEGMENT       =
     poaccountx                   = t_po_accountx
    POCONDHEADER                 =
    POCONDHEADERX                =
    POCOND                       =
    POCONDX                      =
    POLIMITS                     =
    POCONTRACTLIMITS             =
    POSERVICES                   =
    POSRVACCESSVALUES            =
    POSERVICESTEXT               =
    EXTENSIONIN                  =
    EXTENSIONOUT                 =
    POEXPIMPITEM                 =
    POEXPIMPITEMX                =
    POTEXTHEADER                 =
    POTEXTITEM                   =
    ALLVERSIONS                  =
    POPARTNER                    =
  l_errflag = space.
  lcounter  = 1.
  LOOP AT t_return .
    IF t_return-type = 'E'.
      l_errflag = 'X'.
      GET TIME.
      PERFORM append_error.
    ENDIF.
    WRITE : /1 t_return-message.
  ENDLOOP.
  IF l_errflag EQ space.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
  ENDIF.
ENDFORM.                    " CREATE_PO
*&      Form  APPEND_HEADER
PO Header print
-->  p1        text
<--  p2        text
FORM append_header .
  l_po_header-comp_code = '1000'." Company Code
  l_po_header-doc_type = 'NB'. " Order Typr BSART
  l_po_header-creat_date = sy-datum. " P.O Dt - BEDAT
*CONCATENATE '0000' ITAB+72(6) INTO L_PO_HEADER-VENDOR .
  l_po_header-vendor = itab-line+71(6).
*L_PO_HEADER-VENDOR = ITAB+72(6)    " 'ABC'. "Vendor - EKKO-LIFNR
  IF itab-line(4) NE 'K034'.
    l_po_header-purch_org = '2000'. " Purch. Org - EKKO-EKORG
    l_po_header-pur_group = 'F01'. " Purch Group - EKKO-EKGRP
  ELSE.
    l_po_header-purch_org = '1000'. " Purch. Org - EKKO-EKORG
    l_po_header-pur_group = '001'. " Purch Group - EKKO-EKGRP
  ENDIF.
  l_po_header-currency_iso = 'USD'. " Currency Default field for Enjoy
  l_po_header-ref_1       = itab-line+1(9).
*L_PO_HEADER-DOC_CAT = 'F'. " Account Assign Cat EKPO-KNTTP
*_PO_HEADER-CREATED_BY = SY-UNAME.
  CLEAR : l_po_headerx.
  l_po_headerx-po_number = 'X'.
  l_po_headerx-comp_code = 'X'." Company Code
  l_po_headerx-doc_type = 'X'. " Order Typr BSART
  l_po_headerx-vendor = 'X'. "Vendor - EKKO-LIFNR
  l_po_headerx-purch_org = 'X'. " Purch. Org - EKKO-EKORG
  l_po_headerx-pur_group = 'X'. " Purch Group - EKKO-EKGRP
  l_po_headerx-currency_iso = 'X'. " Currency Default field for Enjoy
  l_po_headerx-ref_1       = 'X'.
ENDFORM.                    " APPEND_HEADER
*&      Form  APPEND_ITEM
Material Number and Item print
-->  p1        text
<--  p2        text
FORM append_item .
PO Line Items
  l_item = l_item + 10.
  t_po_items-po_item = l_item.
*T_PO_ITEMS-PO_ITEM = '00010'." Line Item No - EKPO-EBELP
*T_PO_ITEMS-SHORT_TEXT = 'KSR TEXT'." Line Item TEXT
  CONCATENATE  '00000000' itab-line+32(10) INTO t_po_items-material.
*T_PO_ITEMS-MATERIAL = '000000000000000043'. " Material No - EKPO-EMATN
  CONCATENATE  '00000000' itab-line+32(10) INTO t_po_items-ematerial.
  t_po_items-plant = '2001'. " Plant - EKPO-WERKS
  t_po_items-quantity = '1.000'.
  t_po_items-net_price = '10.00'. " EKPO-NETPR
  t_po_items-price_unit = '10 '.
*T_PO_ITEMS-TAX_CODE = 'A2'.
  IF  itab-line+0(4) EQ 'K034'.
    t_po_items-acctasscat = 'R'.
    t_po_items-plant = '1001'.
    t_po_account-po_item = l_item.
    t_po_account-profit_ctr = 'BR034'.
    t_po_account-gl_account = '0000135075'.
T_PO_ACCOUNT-CO_AREA  = '1000'.
    APPEND t_po_account.
    CLEAR t_po_account.
    t_po_accountx-po_item = l_item.
    t_po_accountx-profit_ctr = 'X'.
    t_po_accountx-gl_account = 'X'.
T_PO_ACCOUNTX-CO_AREA  = 'X'.
    APPEND t_po_accountx.
    CLEAR t_po_accountx.
  ENDIF.
  APPEND t_po_items.
  CLEAR t_po_items.
  t_po_itemsx-po_item = l_item.
  t_po_itemsx-po_itemx = 'X'.
  t_po_itemsx-acctasscat = 'X'.
  t_po_itemsx-material = 'X'.
  t_po_itemsx-ematerial = 'X'.
  t_po_itemsx-plant = 'X'.
  t_po_itemsx-quantity = 'X'.
  t_po_itemsx-net_price = 'X'.
  t_po_itemsx-price_unit = 'X'.
*T_PO_ITEMSX-TAX_CODE = 'X'.
  APPEND t_po_itemsx.
  CLEAR t_po_itemsx.
Second Line Item
ENDFORM.                    " APPEND_ITEM
*&      Form  REFRESH_TABLE
      text
-->  p1        text
<--  p2        text
FORM refresh_table .
  REFRESH : t_po_items, t_po_itemsx.
  CLEAR l_item.
ENDFORM.                    " REFRESH_TABLE
*&      Form  append_error
      text
-->  p1        text
<--  p2        text
FORM append_error .
  MOVE : sy-datum TO zerror-zdate,
          sy-uzeit TO zerror-ztime,
          itab+3(5) TO zerror-document_no,
          t_return-message    TO zerror-message.
  lcounter =  lcounter + 1.
  zerror-counter = lcounter .
  zerror-rec_type = itab-line(1).
  MODIFY zerror. CLEAR zerror.
  COMMIT WORK.
ENDFORM.                    " append_error
~~Guduri
Mark the helpful answers
        NAVEEN KUMAR GUDURI

Similar Messages

  • Standard BDC program used for FI

    hi all ,
    i would like to know the standard BDC program used in FI , like for tcode fb01 or somethings else.
    Appreciate for any segguestion.
    thanks and regards.

    hi siddu m 
    thanks for replay ,
    i have anohter question
    provided the transaction A was contianed in the first batch file,
    and also  contained in the second batch file , how the tcode treated as the duplicate posting ?
    many thanks

  • Changes in BDC program to upload data from text/excel file

    Hi friends i have obtained the BDc program after recording :
    start-of-selection.
    perform open_group.
    perform bdc_dynpro      using 'SAPLCOIH' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'AUFPAR-PM_AUFART'
                                  'PM01'.
    perform bdc_field       using 'CAUFVD-IWERK'
                                  '460a'.
    perform bdc_field       using 'CAUFVD-GSBER'
                                  '2460'.
    perform bdc_field       using 'CAUFVD-EQUNR'
                                  '10000009'.
    perform bdc_dynpro      using 'SAPLCOIH' '3000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'CAUFVD-KTEXT'
                                  'abc'.
    perform bdc_field       using 'CAUFVD-INGPR'
                                  'GM'.
    perform bdc_field       using 'CAUFVD-VAPLZ'
                                  'RTN_VELR'.
    perform bdc_field       using 'CAUFVD-VAWRK'
                                  '460A'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-GLTRP'.
    perform bdc_field       using 'CAUFVD-GSTRP'
                                  '1.8.2010'.
    perform bdc_field       using 'CAUFVD-GLTRP'
                                  '1.8.2010'.
    perform bdc_field       using 'CAUFVD-TPLNR'
                                  'RTNP-HIG'.
    perform bdc_field       using 'CAUFVD-EQUNR'
                                  '10000009'.
    perform bdc_field       using 'AFVGD-INDET'
                                  '1'.
    perform bdc_field       using 'AFVGD-WERKS'
                                  '460A'.
    perform bdc_field       using 'AFVGD-STEUS'
                                  'PMIN'.
    perform bdc_field       using 'AFVGD-ARBEH'
                                  'H'.
    perform bdc_field       using 'AFVGD-DAUNE'
                                  'H'.
    perform bdc_dynpro      using 'SAPLCOIH' '3000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-KTEXT'.
    perform bdc_field       using 'CAUFVD-KTEXT'
                                  'abc'.
    perform bdc_field       using 'CAUFVD-INGPR'
                                  'GM'.
    perform bdc_field       using 'CAUFVD-VAPLZ'
                                  'RTN_VELR'.
    perform bdc_field       using 'CAUFVD-VAWRK'
                                  '460A'.
    perform bdc_field       using 'CAUFVD-GSTRP'
                                  '01.08.2010'.
    perform bdc_field       using 'CAUFVD-GLTRP'
                                  '01.08.2010'.
    perform bdc_field       using 'CAUFVD-TPLNR'
                                  'RTNP-HIG'.
    perform bdc_field       using 'CAUFVD-EQUNR'
                                  '10000009'.
    perform bdc_field       using 'AFVGD-LTXA1'
                                  'abc'.
    perform bdc_field       using 'AFVGD-INDET'
                                  '1'.
    perform bdc_field       using 'AFVGD-ARBPL'
                                  'RTN_VELR'.
    perform bdc_field       using 'AFVGD-WERKS'
                                  '460A'.
    perform bdc_field       using 'AFVGD-STEUS'
                                  'PMIN'.
    perform bdc_field       using 'AFVGD-ARBEH'
                                  'H'.
    perform bdc_field       using 'AFVGD-DAUNE'
                                  'H'.
    perform bdc_transaction using 'IW31'.
    perform close_group.
    after executing it has two options.one is for call transactioin and other is for with session.Now i want to do the uploading from text file.Please guide me how to achieve that and what should be the order of fields in the text file.I am just a beginner.I know how to do that with LSMW bt trying BDc first time for creating PM orders

    You can use class "cl_gui_frontend_services". First you must select file with "file_open_dialog" method and the you can upload file with "gui_upload" method into internal table. Here is a sample: (I didn't try the code but I'm sure you can get it working, there are lots of sample codes about that. You can also search FM "GUI_UPLOAD").
    REPORT  zreport.
    DATA:
    gv_subrc TYPE sysubrc,
    gv_result TYPE abap_bool,
    gt_data_tab type table of zstruc.
    PARAMETERS: p_fname LIKE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
        PERFORM file_open_dialog USING space space space space
                            CHANGING p_fname gv_action gv_subrc.
    START-OF-SELECTION.
    PERFORM gui_upload TABLES gt_data_tab
                     USING p_fname  CHANGING gv_subrc.
    *** FORMS ***
    FORM file_open_dialog USING pv_window_title
                                pv_default_extension
                                pv_default_filename
                                pv_initial_directory
                       CHANGING pv_filename
                                pv_user_action
                                pv_subrc.
      DATA:
      lt_file_table TYPE filetable,
      lv_rc         TYPE i,
      lv_initial_directory TYPE string.
      IF pv_initial_directory IS INITIAL.
        PERFORM get_desktop_directory CHANGING lv_initial_directory.
      ELSE.
        lv_initial_directory = pv_initial_directory.
      ENDIF.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = pv_window_title
          default_extension       = pv_default_extension
          default_filename        = pv_default_filename
    *     file_filter             =
    *     with_encoding           =
          initial_directory       = lv_initial_directory
    *     multiselection          =
        CHANGING
          file_table              = lt_file_table
          rc                      = lv_rc
          user_action             = pv_user_action
    *     file_encoding           =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5
      pv_subrc = sy-subrc.
      IF pv_subrc EQ 0.
        READ TABLE lt_file_table INTO pv_filename INDEX 1.
      ENDIF.
    ENDFORM.
    FORM gui_upload TABLES pt_data_tab
                     USING pv_filename
                  CHANGING pv_subrc    TYPE sysubrc.
      DATA:
      lt_data_tab TYPE TABLE OF string,
      lv_filename TYPE string.
      lv_filename = pv_filename.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename                = lv_filename
          filetype                = 'ASC'
         has_field_separator     = 'X'
    *     header_length           = 0
    *     read_by_line            = 'X'
    *     dat_mode                = SPACE
    *     codepage                = SPACE
    *     ignore_cerr             = ABAP_TRUE
    *     replacement             = '#'
    *     virus_scan_profile      =
    *     show_transfer_status    = 'X'
    *   IMPORTING
    *     filelength              =
    *     header                  =
        CHANGING
          data_tab                = lt_data_tab
        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
          not_supported_by_gui    = 17
          error_no_gui            = 18
          OTHERS                  = 19
      pv_subrc = sy-subrc.
      IF pv_subrc EQ 0.
        pt_data_tab[] = lt_data_tab[].
      ENDIF.
    ENDFORM.

  • BDC Program is not working in background mode

    Hi All,
             I hv one bdc program for tcode fb02 which is working fine in foreground mode and data is updated to each screen properly. While running the same program in Background mode data is not updated. Can u seggust the solution.
    Regards,
    Rahul S

    Hi ,
    Remove the break point in the BDC performs.
    put the break point once u complete the BDC.... otherwise execute the BDC in MODE 'E'.. error mode.
    regards,
    Rama Reddy
    Edited by: ram reddy on Nov 16, 2009 5:37 AM

  • BDC program is not working in BI Production.

    Dear All,
    My BDC program for RSA1 is working fine in BI Development, but it is not working in BI Production. I have debug the BDC program and found that data is coming from the excel file. Then why it is not working. Please help me.
    Thanks,
    With regards,
    Rosaline.

    Hi all, the problem is now solved.
    With regards,
    Rosaline.

  • Questions on BDC program statements.....

    Hi,
    Currently i am checking below BDC program for packing material use.
    But there is a statement that i am not very clear what it is for...
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'V51VE-EXIDV(01)'.
    For the  'V51VE-EXIDV(01)', here why need to add an (01) at the end.  What does the (01) means??
    Thanks!!!!
      LOOP AT i_lips.
        CLEAR: i_bdc_tab,i_msg_tab.
        REFRESH: i_bdc_tab,i_msg_tab.
        PERFORM bdc_dynpro      USING 'SAPMV50A' '4004'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LIKP-VBELN'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'LIKP-VBELN'
                                      i_lips-vbeln.
        PERFORM bdc_dynpro      USING 'SAPMV50A' '1000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=VERP_T'.
    *perform bdc_field       using 'LIKP-BLDAT'
    *                              record-BLDAT_002.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'LIPS-POSNR(01)'.
    *perform bdc_field       using 'LIKP-WADAT'
    *                              record-WADAT_003.
    *perform bdc_field       using 'LIKP-WAUHR'
    *                              record-WAUHR_004.
    *perform bdc_field       using 'LIKP-BTGEW'
    *                              record-BTGEW_005.
    *perform bdc_field       using 'LIKP-GEWEI'
    *                              record-GEWEI_006.
        PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ENTR'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'V51VE-VHILM(01)'.
        PERFORM bdc_field       USING 'V51VE-VHILM(01)'
                                      'BOX'.
    *Select all materails
        PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=HU_MARKA'.
    *Select all Boxes
        PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=HUMARKHU'.
    *perform bdc_field       using 'V51VE-SELKZ(01)'
    *                              record-SELKZ_01_008.
        PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=HU_VERP'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'V51VE-EXIDV(01)'.
        PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SICH'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'V51VE-EXIDV(01)'.
        CALL TRANSACTION 'VL02N' USING i_bdc_tab
                          MODE p_mode
                          MESSAGES INTO i_msg_tab.
    Message was edited by:
            Hoo Laa

    And if this is a BDC running in background, or a call transaction, then placing the cursor on a given field has no effect unless it is needed for navigation to the next screen. 
    When you record a BDC using SHDB there are a lot of statements like this that are added in but are not needed for the BDC to work. 
    Another example is the "BDC_SUBSCR" field name - this does not in most cases appear to have any effect on how the BDC is processed.
    Also, the recording will include fields which have default values on the screen that you do not need to overwrite with the same value from the BDC.
    I often delete these statements from the recording, taking care that I understand what the impact is.  You can try commenting out the line and see what difference it makes to processing. 
    When using a BDC for updating a lot of records, having less of these types of lines in the BDCDATA table will speed performance a bit.
    Andrew

  • Running BDC program in background for the transaction VL02N

    Hi All,
    I have coded a BDC program (call transaction method) for the transaction code VL02N. I can able to run the program manually & successfully. But if I execute the program in background(SM36), it is going to dump giving CNTL_ERROR.
    Note: I am not using any of the GUI_UPLOAD, GUI_DOWNLOAD funciton modules in the program. But I am using the FTP command funtion modules like( FTP_COMMAND, FTP_CONNECT, FTP_DISCONNECT and FTP_SERVER_TO_R/3).
    <removed_by_moderator>
    Thanks in advance.
    Ramesh.
    Edited by: Julius Bussche on Jul 8, 2008 5:55 PM

    VL02N is an enjoy transaction. You cant run it in background. Please try VL02.
    Thanks
    Romit

  • How can we know the return code of BDC Program ?

    Hi All,
    Please tell me : How can we know the return code of BDC Program when being exceuted in Session or in Transaction mode.
    In my program, we are uploading data from Excel sheet to SAP via BDC
    The records that are not updated we want to create a log file.
    Now to know whether a record is updated ot not, wat syst field shloud be used?
    Its urgent....
    <b>Reward Point will be there ....</b>
    Thanks,
    Harish

    Hi harish,
    try the logic in this code ...
    i had attached input file in the end.
    TYPES: begin of errmess,
            msgnr type t100-msgnr,
            text type t100-text,
           end of errmess.
    TABLES : t100.
    DATA: BEGIN OF DD_VA01,
           AUART TYPE VBAK-AUART,
           KUNNR TYPE RV45A-KUNNR,
           BSTKD TYPE VBKD-BSTKD,
           MABNR TYPE RV45A-MABNR,
           KWMENG(2) type C,
           KBETR(2) type C,
          END OF DD_VA01.
    DATA:IT_VA01     Like TABLE OF DD_VA01,
         WA_VA01     Like LINE  OF IT_VA01,
         WA_VA01_F   Like LINE  OF IT_VA01,
         IT_BDCDATA  TYPE TABLE OF BDCDATA,
         WA_BDCDATA  Like Line  OF IT_BDCDATA,
         W_FNAME     TYPE STRING,
         messtab like bdcmsgcoll occurs 0 with header line,
         it_errmess type table of errmess,
         wa_errmess like line of it_errmess,
         err_message type string.
    data: zf1 type i,
          zc1 type c value '2',
          fn(20) type c.
    Main Code ************************************************************
    PERFORM get_input using 'C:\Documents and Settings\ic881592\Desktop\Daran_bdc_VA01-e.txt'.
    SORT IT_VA01 BY AUART KUNNR BSTKD.
    LOOP AT IT_VA01 INTO WA_VA01.
      if WA_VA01_F-AUART <> WA_VA01-AUART OR
         WA_VA01_F-KUNNR <> WA_VA01-KUNNR OR
         WA_VA01_F-BSTKD <> WA_VA01-BSTKD.
           PERFORM set_header_flag.
           PERFORM create_bdc_header_data.
      endif.
      PERFORM create_bdc_item_data.
    ENDLOOP.
    PERFORM call_transaction.
    PERFORM errorlog.
    Procedures ***********************************************************
    form get_input using w_fname.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME            = W_FNAME
          HAS_FIELD_SEPARATOR = '#'
        TABLES
          DATA_TAB            = IT_VA01.
    endform.
    form call_transaction.
        PERFORM bdc_field       using 'BDC_OKCODE' '/11'.
        CALL TRANSACTION 'VA01' USING IT_BDCDATA MODE 'A' messages into messtab.
        refresh it_bdcdata.
    endform.
    FORM set_header_flag.
           WA_VA01_F-AUART = WA_VA01-AUART.
           WA_VA01_F-KUNNR = WA_VA01-KUNNR.
           WA_VA01_F-BSTKD = WA_VA01-BSTKD.
           if zf1 = 1.
               PERFORM call_transaction.
           endif.
           zf1 = 1.
    endform.   "set_header_flag.
    form create_bdc_header_data.
         perform bdc_dynpro      using 'SAPMV45A' '0101'.
         perform bdc_field       using 'VBAK-AUART' WA_VA01-AUART.
         perform bdc_field       using 'BDC_OKCODE' '/00'.
         perform bdc_dynpro      using 'SAPMV45A' '4001'.
         perform bdc_field       using 'KUAGV-KUNNR' WA_VA01-KUNNR.
         perform bdc_field       using 'VBKD-BSTKD' WA_VA01-BSTKD.
         perform bdc_field       using 'BDC_OKCODE' '/00'.
         perform bdc_dynpro      using 'SAPMSSY0' '0120'.
         perform bdc_field       using 'BDC_CURSOR' '04/06'.
         perform bdc_field       using 'BDC_OKCODE' '=CHOO'.
         perform bdc_dynpro      using 'SAPMV45A' '4001'.
         PERFORM bdc_field       USING 'BDC_OKCODE' '=POAN'.
    endform. "create_bdcdata
    FORM create_bdc_item_data.
         CONCATENATE 'RV45A-KWMENG(' zc1 ')' INTO FN.
         perform bdc_field       using 'BDC_CURSOR' FN.
         perform bdc_field       using FN WA_VA01-KWMENG.
         CONCATENATE 'KOMV-KBETR(' zc1 ')' INTO FN.
         perform bdc_field       using FN WA_VA01-KBETR.
         CONCATENATE 'RV45A-MABNR(' zc1 ')' INTO FN.
         perform bdc_field       using FN WA_VA01-MABNR.
         perform bdc_dynpro      using 'SAPMV45A' '4001'.
         PERFORM bdc_field       USING 'BDC_OKCODE' '=POAN'.
    ENDFORM.
    form errorlog.
      LOOP AT MESSTAB .
        if MESSTAB-MSGNR = '311' or MESSTAB-MSGTYP = 'E'.
            SELECT SINGLE msgnr text FROM T100
                            into wa_errmess
                            WHERE SPRSL = MESSTAB-MSGSPRA
                              AND ARBGB = MESSTAB-MSGID
                              AND MSGNR = MESSTAB-MSGNR.
            IF SY-SUBRC = 0.
              err_message = wa_errmess-TEXT.
              IF err_message CS '&1'.
                REPLACE '&1' WITH MESSTAB-MSGV1 INTO err_message.
                REPLACE '&2' WITH MESSTAB-MSGV2 INTO err_message.
                REPLACE '&3' WITH MESSTAB-MSGV3 INTO err_message.
                REPLACE '&4' WITH MESSTAB-MSGV4 INTO err_message.
              ELSE.
                REPLACE '&' WITH MESSTAB-MSGV1 INTO err_message.
                REPLACE '&' WITH MESSTAB-MSGV2 INTO err_message.
                REPLACE '&' WITH MESSTAB-MSGV3 INTO err_message.
                REPLACE '&' WITH MESSTAB-MSGV4 INTO err_message.
              ENDIF.
              CONDENSE err_message.
              WRITE: / MESSTAB-MSGTYP, err_message .
            ELSE.
              WRITE: / MESSTAB.
            ENDIF.
        endif.
      ENDLOOP.
    endform. "errorlog
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      WA_BDCDATA-PROGRAM  = PROGRAM.
      WA_BDCDATA-DYNPRO   = DYNPRO.
      WA_BDCDATA-DYNBEGIN = 'X'.
      APPEND WA_BDCDATA TO IT_BDCDATA.
      CLEAR  WA_BDCDATA.
    ENDFORM.
    FORM BDC_FIELD USING FNAM FVAL.
      WA_BDCDATA-FNAM = FNAM.
      WA_BDCDATA-FVAL = FVAL.
      APPEND WA_BDCDATA TO IT_BDCDATA.
      CLEAR  WA_BDCDATA.
    ENDFORM.
    input file :
    OR     2148     0001235     R-1162     8     17
    OR     2148     0001235     R-1161     2     30
    OR     2148     0001235     100-400     6     25
    OR     2148     0001235     R-1162     4     12
    OR     2148     0001236     R-1162     3     12
    OR     2148     0001236     R-1161     2     30
    OR     2148     0001236     100-400     1     25
    OR     2148     0001236     R-1162     7     12
    OR     2148     0001236     R-1161     8     30
    OR     2148     0001236     100-400     10     25
    OR     2148     0001235     R-1161     5     30
    OR     2148     0001235     100-400     2     25
    OR     2148     0001235     R-11621     3     12
    OR     2148     0001235     R-1161     2     30
    OR     2148     0001235     100-400     1     25
    OR     2148     0001235     R-1162     7     12
    OR     2148     0001235     R-1161     8     30
    OR     2148     0001235     100-400     10     25
    OR     2148     0001236     R-1162     8     17
    OR     2148     0001236     R-1161     2     30
    OR     2148     0001236     100-400     6     25
    OR     2148     0001236     R-1162     4     12
    OR     2148     0001236     R-1161     5     30
    OR     2148     0001236     100-400     2     25

  • Problem in creating a BDC program for transaction cj20n(project sytem)

    Hi all,
    I am trying to create project,WBS element ,network and activity using a BDC program,
      I am able to create to a recording for the transaction cj20n using tcode shdb but when i run the recording it doesnt run properly i am not able to create any thing.
    I get error saying that a particular field doesnt exist on the screen.
    Is possible to create a BDC program for transaction CJ20N ?
    Also is there any other alternative  apart from using a BAPI or a function module.
    Thanks,
    Nishant

    Hi,
        Check below link for BAPIs of transaction cj20n.
    [BAPI for cj20n|BAPI for CJ20N transaction]
    Thanks,
    Asit Purbey.

  • How to upload a multistructured file in BDC program using gui_upload?

    I want to upload a multistructured file in BDC program...in which some structures are repeating for multiple records..how to do this..
    BP_GEN_DATA     FR0100270154                         FR12345678902
    BP_PAYMENT     FR     0123456789     01234567890          
    BP_UNLOAD     MARSEILLE     X     FR                    
    BP_UNLOAD     PARIS          FR                         
    Here BP_GEN_DATA is root structure and BP_UNLOAD is lower level structure which is repeating

    Resolved

  • Problem in the BDC program to upload the data from a flat file.

    Hi,
    I am required to write a BDC program to upload the data from a flat file. The conditions are as mentioned below:-
    1) Selection Screen will be prompted to user and user needs to provide:- File Path on presentation server (with F4 help for this obligatory parameter) and File Separator e.g. @,#,$,%,... etc(fields in the file will be separated by using this special character) or fields may be separated by tab(tab delimited).
    2) Finally after the data is uploaded, following messages need to be displayed:-
    a) Total Number of records successfully uploaded.
    b) Session Name
    c) Number of Sessions created.
    Problem is when each record is fetched from flat file, the record needs to be split into individual fields separated by delimiter or in case tab separated, then proceeding in usual manner.
    It would be great if you provide me either the logic, pseudocode, or sample code for this BDC program.
    Thanks,

    Here is an example program,  if you require the delimitor to be a TAB, then enter TAB on the selection screen, if you require the delimitor to be a comma, slash, pipe, whatever, then simply enter that value.  This example is simply the uploading of the file, not the BDC, I assume that you know what to do once you have the data into the internal table.
    REPORT zrich_0001.
    TYPES: BEGIN OF ttab,
            rec TYPE string,
           END OF ttab.
    TYPES: BEGIN OF tdat,
           fld1(10) TYPE c,
           fld2(10) TYPE c,
           fld3(10) TYPE c,
           fld4(10) TYPE c,
           END OF tdat.
    DATA: itab TYPE TABLE OF ttab.
    data: xtab like line of itab.
    DATA: idat TYPE TABLE OF tdat.
    data: xdat like line of idat.
    DATA: file_str TYPE string.
    DATA: delimitor TYPE string.
    PARAMETERS: p_file TYPE localfile.
    PARAMETERS: p_del(5) TYPE c.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      DATA: ifiletab TYPE filetable.
      DATA: xfiletab LIKE LINE OF ifiletab.
      DATA: rc TYPE i.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        CHANGING
          file_table = ifiletab
          rc         = rc.
      READ TABLE ifiletab INTO xfiletab INDEX 1.
      IF sy-subrc = 0.
        p_file = xfiletab-filename.
      ENDIF.
    START-OF-SELECTION.
      TRANSLATE p_del TO UPPER CASE.
      CASE p_del.
        WHEN 'TAB'.
          delimitor = cl_abap_char_utilities=>horizontal_tab.
        WHEN others.
          delimitor = p_del.
      ENDCASE.
      file_str = p_file.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename = file_str
        CHANGING
          data_tab = itab.
      LOOP AT itab into xtab.
        CLEAR xdat.
        SPLIT xtab-rec AT delimitor INTO xdat-fld1
                                         xdat-fld2
                                         xdat-fld3
                                         xdat-fld4.
        APPEND xdat to idat.
      ENDLOOP.
      LOOP AT idat into xdat.
        WRITE:/ xdat-fld1, xdat-fld2, xdat-fld3, xdat-fld4.
      ENDLOOP.
    Regards,
    Rich Heilman

  • BDC programming using Batch input Session.

    Hello Experts.
    I'm an ABAP beginner. I've benn practicing BDC programming using Batch input Session
    at the moment.
    This is the program that upload Local file which has plural records, and put the records into a Session.
    These are the records.
    413459,KIM EI HWAN121                ,19810607,MIADONG1234
    423459,KIM EI HWAN122                ,19810607,MIADONG1235
    433459,KIM EI HWAN123                ,19810607,MIADONG1236
    443459,KIM EI HWAN124                ,19810607,MIADONG1237
    453459,KIM EI HWAN125                ,19810607,MIADONG1238
    463459,KIM EI HWAN126                ,19810607,MIADONG1239
    I succeeded making Session.
    However, for some reaseon, every record in the Session has got the same, value which is the first record.
    Why is this happening? And How can I correct the code below?
    REPORT ZBCUSER002_BATCH NO STANDARD PAGE HEADING
                            LINE-SIZE 255
                            MESSAGE-ID ZBATCH.
    = Types definition ===================================================
    TYPES: BEGIN OF TYP_LOCAL,               "For Local file upload
             RECORD(200) TYPE C,
           END   OF TYP_LOCAL.
    = Internal table definition ==============================================
    DATA: BEGIN OF BDC_TAB OCCURS 0.        "BDCDATA itab
            INCLUDE STRUCTURE BDCDATA.
    DATA: END   OF BDC_TAB.
    DATA: BEGIN OF MESSAGE_BDC OCCURS 0.    "Message itab
            INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END   OF MESSAGE_BDC.
    DATA: TBL_LOCAL TYPE STANDARD TABLE OF TYP_LOCAL,  "Local file itab
          F_TBL     TYPE FILETABLE.                    "FILETABLE fot local
    = Structure table definition =========================================
    DATA: STR_F_TBL LIKE LINE OF F_TBL,                "FILETABLE structure
          STR_LOCAL TYPE TYP_LOCAL.                    "Local file structure
    = Variable definition ================================================
    DATA: LV_RC     TYPE I,                            "Method parameter
          ENUMBER   TYPE ZT601-ENUMBER,                "Employee number
          NAME      TYPE ZT601-NAME,                   "Employee name
          BIRTH     TYPE ZT601-BIRTH,                           "Birthday
          HOMETOWN  TYPE ZT601-HOMETOWN,                        "Hometown
          SYSVAL    TYPE SY-SUBRC.                     "System valuible
    = Constants definition ===============================================
    CONSTANTS: TBL_NAME(10) TYPE C VALUE 'ZT601'.      "Table name ZT601
    = Parameters definition ==============================================
    PARAMETERS: F_NAME      TYPE RLGRAP-FILENAME OBLIGATORY,    "File path
                EXECMODE(1) TYPE C.                    "Execute mode
    INITIALIZATION
    *----- Initialize all valuables, structures and internal tables
    CLEAR: LV_RC,
           STR_F_TBL,
           STR_LOCAL,
           ENUMBER,
           NAME,
           BIRTH,
           HOMETOWN.
    REFRESH: F_TBL,
             TBL_LOCAL.
    AT SELECTION-SCREEN
    *----- When the button next to Parameter 'F_NAME',
    *----- File dialog open.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_NAME.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        EXPORTING
          WINDOW_TITLE            = 'SELECT FILE'
          DEFAULT_FILENAME        = '*.TXT'
       CHANGING
         FILE_TABLE               = F_TBL
         RC                       = LV_RC
        EXCEPTIONS
          FILE_OPEN_DIALOG_FAILED = 1
          CNTL_ERROR              = 2
          OTHERS                  = 3
    *----- system valiable check.
    *----- If done properly,
    *----- Put the path into the File path parameter
      IF SY-SUBRC = 0.
        READ TABLE F_TBL INTO STR_F_TBL INDEX 1.
        F_NAME = STR_F_TBL.
    *----- If not done properly, show message
    *----- An error occured while getting file path then end program
      ELSE.
        MESSAGE E000.
      ENDIF.
    *----- Execute code can only be A or N.
    AT SELECTION-SCREEN ON EXECMODE.
      IF EXECMODE <> 'A' AND EXECMODE <> 'N'.
        MESSAGE E001.
      ENDIF.
    START-OF-SELECTION
    START-OF-SELECTION.
    *----- Upload Local file of file path parameter.
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                FILENAME                = F_NAME
                FILETYPE                = 'ASC'
           TABLES
                DATA_TAB                = TBL_LOCAL
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_READ_ERROR         = 2
                NO_BATCH                = 3
                GUI_REFUSE_FILETRANSFER = 4
                INVALID_TYPE            = 5
                OTHERS                  = 6.
    *----- System valiable check.
    *----- If not done properly, show an error message
    *----- An error occured while uploading local file then end program
      IF SY-SUBRC <> 0.
        MESSAGE E002.
      ENDIF.
      PERFORM BDC_OPEN.
    *----- Loop Internal table
      LOOP AT TBL_LOCAL INTO STR_LOCAL.
    *----- Spilt the file record and put them into each valiable.
        SPLIT STR_LOCAL AT ',' INTO  ENUMBER
                                     NAME
                                     BIRTH
                                     HOMETOWN.
    *----- Data check Function module
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
             EXPORTING
                  DATE                      = BIRTH
             EXCEPTIONS
                  PLAUSIBILITY_CHECK_FAILED = 1
                  OTHERS                    = 2.
    *----- When error occurs while checking date, show an error message.
    *----- (&1) is not date
        IF SY-SUBRC <> 0.
          MESSAGE E003 WITH BIRTH.
        ENDIF.
    *-- The first screen of SE11
    *----- Screen number 0102 of program id SAPMSRD0
        PERFORM BDC_DYNPRO      USING 'SAPMSRD0' '0102'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RSRD1-TBMA_VAL'. "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=SHOW'.          "Display button
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA'
                                      'X'.
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA_VAL'
                                       TBL_NAME.                "ZT601
    *-- Table definition screen
    *----- Screen number 2000 of program id SAPLSD02
        PERFORM BDC_DYNPRO      USING 'SAPLSD02' '2000'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'DD02D-TABCLTEXT'.  "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=TDED'.            "Create entry
        PERFORM BDC_FIELD       USING 'BDC_SUBSCR'
                                      'SAPLSD02'.
        PERFORM BDC_FIELD       USING 'BDC_SUBSCR'
                                      'SAPLSED5'.
    *-- Data input screen
    *----- Screen number 0101 of program /1BCDWB/DBZT601
        PERFORM BDC_DYNPRO      USING '/1BCDWB/DBZT601' '0101'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'ZT601-CRUSER'.    "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=SAVE'.                  "Save
        PERFORM BDC_FIELD       USING 'ZT601-MANDT'
                                      SY-MANDT.                 "Client
        PERFORM BDC_FIELD       USING 'ZT601-ENUMBER'
                                      ENUMBER.           "Employee number
        PERFORM BDC_FIELD       USING 'ZT601-NAME'
                                      NAME.              "Employee name
        PERFORM BDC_FIELD       USING 'ZT601-BIRTH'
                                      BIRTH.                    "Birthday
        PERFORM BDC_FIELD       USING 'ZT601-HOMETOWN'
                                      HOMETOWN.                 "Hometown
        PERFORM BDC_FIELD       USING 'ZT601-CRDATE'
                                      SY-DATUM.          "System date
        PERFORM BDC_FIELD       USING 'ZT601-CRTIME'
                                      SY-UZEIT.          "System time
        PERFORM BDC_FIELD       USING 'ZT601-CRUSER'
                                      SY-UNAME.          "System user
    *-- Data input screen (After input)
    *----- Screen number 0101 of program /1BCDWB/DBZT601
        PERFORM BDC_DYNPRO      USING '/1BCDWB/DBZT601' '0101'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/EBACK'.                 "Back
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'ZT601-CRUSER'.    "Field on Cursor
    *-- Table definition screen]
    *----- Screen number 2000 of program SAPLSD02
        PERFORM BDC_DYNPRO      USING 'SAPLSD02' '2000'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'DD02D-TABCLTEXT'.  "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=WB_BACK'.               "Back
    *-- The first screen of SE11
    *----- Screen number 0102 of program SAPMSRD0
        PERFORM BDC_DYNPRO      USING 'SAPMSRD0' '0102'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RSRD1-TBMA_VAL'.   "Field on Cursor
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=BACK'.
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA'
                                      'X'.
        PERFORM BDC_FIELD       USING 'RSRD1-TBMA_VAL'
                                      TBL_NAME.
        PERFORM BDC_INSERT.
      ENDLOOP.
      PERFORM BDC_CLOSE.
          FORM BDC_DYNPRO                                               *
          Put Program-Id, Dynpro screen number, Start point
          into DBCDATA
    -->  PROGRAM                                                       *
    -->  DYNPRO                                                        *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDC_TAB.
      BDC_TAB-PROGRAM  = PROGRAM.
      BDC_TAB-DYNPRO   = DYNPRO.
      BDC_TAB-DYNBEGIN = 'X'.
      APPEND BDC_TAB.
    ENDFORM.
          FORM BDC_FIELD                                                *
          Put Field Name and Value into BDCDATA
    -->  FNAM                                                          *
    -->  FVAL                                                          *
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR BDC_TAB.
      BDC_TAB-FNAM = FNAM.
      BDC_TAB-FVAL = FVAL.
      APPEND BDC_TAB.
    ENDFORM.
          FORM bdc_process                                              *
    FORM BDC_OPEN.
      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                CLIENT = SY-MANDT
                GROUP  = 'Testsession'
                KEEP   = 'X'
                USER   = SY-UNAME.
      IF SY-SUBRC <> 0.
        MESSAGE E006 WITH SY-SUBRC.
      ENDIF.
    ENDFORM.
          FORM bdc_insert                                               *
    FORM BDC_INSERT.
      CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                TCODE            = 'SE11'
           TABLES
                DYNPROTAB        = BDC_TAB
           EXCEPTIONS
                INTERNAL_ERROR   = 1
                NOT_OPEN         = 2
                QUEUE_ERROR      = 3
                TCODE_INVALID    = 4
                PRINTING_INVALID = 5
                POSTING_INVALID  = 6
                OTHERS           = 7.
      IF SY-SUBRC <> 0.
        MESSAGE E007 WITH SY-SUBRC.
      ENDIF.
      CLEAR: BDC_TAB.
    ENDFORM.
          FORM bdc_close                                                *
    FORM BDC_CLOSE.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                NOT_OPEN    = 1
                QUEUE_ERROR = 2
                OTHERS      = 3.
      IF SY-SUBRC <> 0.
        MESSAGE E008 WITH SY-SUBRC.
      ENDIF.
    ENDFORM.

    God I forgot to refresh Internal table after putting record into Session.
    Now I'm done.
    You guys be careful too.

  • Issue while inserting a BDC program in Inbound Proxy.JDBC-- PI-- SAP.

    The scenerio is jdbcsender-sappi-inboundproxy(ECC6.0).
    The issue is related to SAP Plant Maintenance Module where  We have a requirement for creating Maintenance item
    programmatically from (SQLDatabase)Legacy Data for one of the interface.
    since there are no standard BAPIS/Idocs or function modules available from SAP side for creating the maintenance item. So I
    have written BDC program and with the help of submit statement in inbound proxy program, I am calling BDC program for
    creation of the maintenance item.
    When I tested the program independently on proxy side  the Maintenance Item is getting created successfully but when I
    executed from end-to-end ie.  SQLDATABASE->SAP PI-->SAP. The message is getting strucked into the queue and queue  got stopped on SAP.
    ECC side and the status of the message is scheduled state  on SXMB_MONI  transaction of SAP ECC.
    As the message  is in scheduled state multiple number of Maintenance Items are getting created with the same values.
    Has any one of our SAP friends, encountered this type of issue while inserting a BDC program in inbound proxy, please help 
    in fixing this issue. FYI... I am using sap pi7.0 with service pack 24 and ecc6.0
    Waiting for your kind expert guidance...
    cheers,
    Ram

    Raj,
    Thanks for the reply. I have tried registering the queues but still the same problem. the message got stuck in the queue of ECC and showing below message in queue.
    function module                                    StatusText
    SXMS_ASYNC_EXEC                  connection closed (no data)
    I have checked in the forums especially  for this issue but no one has provided the answer for this.
    Thanks and Regards
    Ram

  • Error while runing bdc program

    hi,
           i written one bdc program there are no syntax errors and in flat file also no error records but when uploading data it showing pop up that do you want to save data with 2 push buttons yes or no. i suppose to be it is front end problem how to avoid that.
                                                                                  p.surendar reddy

    Hi,
    You have miss a step while recording.. What i mean is you have created
    bdc for changing some document. you recorded the fields to be changed
    but didn't save before terminating recording.
    re-create your recording... and before and click save icon as the last step#
    in your recording..
    Hope this solves your problem..
    Enjoy SAP,
    Pankaj Singh.

  • Problem in BDC Program

    I have a problem while I am doing BDC program for Maintaining Quotation.i.e,I have Header data and Item Data.In Item data it has multiple items.For each item I have to give condition type in the table control(which has already pre-existed condition types),but I have to place new Condition type at the last line of the table control.

    Hi,
    In pricing element Table Control we have to pass condition type. For each material a set of condition types pre-exists, for us to pass condition types we have to capture index number which changes dynamically.
    We have to pass the index number to T_BDCDATA prior calling the transaction ME47 to append the condition type to the last line of the Pricing element table control which changes dynamically.

  • Can we make a BDC program as a webservice

    Hi All,
    Can we write a BDC program in RFC Function Module and access it through web service.
    We have a requirement to create a Return Order, for that we have recorded the Va01 transaction for return order and included the same recorded code in RFC Function module and also created web service for it. But when we tried to access through webservice, it is showing the following error
    "Call to returned http code 500 (Internal Server Error) with unacceptable content type (text/html; charset=utf-8).
    ><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode> soap:Server </faultcode><faultstring xml:lang="en"> RABAX occurred on server side </faultstring><detail><sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic"><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><SYMSGID>VX</SYMSGID><SYMSGTY>S</SYMSGTY><SYMSGNO>206</SYMSGNO><SYMSGV1>TextEditControl</SYMSGV1><SYMSGV2></SYMSGV2><SYMSGV3></SYMSGV3><SYMSGV4></SYMSGV4><SYREPID>SAPLV70T</SYREPID><SYTCODE>VA01</SYTCODE><SYDYNNR>2000</SYDYNNR><SYUNAME>DIK</SYUNAME><SYMANDT>100</SYMANDT><SYLANGU>E</SYLANGU><SYECODE>558</SYECODE><SYHOST>sapdvp</SYHOST><SYSYSID>SD1</SYSYSID><SYOPSYS>Windows NT</SYOPSYS><SYDBSYS>MSSQL</SYDBSYS><SYSAPRL>700</SYSAPRL><SYXPROG>SAPCNVE</SYXPROG><SYXFORM>CONVERSION_EXIT</SYXFORM><SYDATUM>20111104</SYDATUM><SYUZEIT>153001</SYUZEIT><SYETEXT>RABAX_STATE</SYETEXT><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE><PATHTRANS>/sap/bc/srt/rfc/sap/zcom_create_return_bdc/100/zcom_create_return_bdc/zcom_create_return_bdc</PATHTRANS><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE></sap:Rabax></detail></soap:Fault></soap:Body></soap:Envelope>"
    When we execute the same RFC from SAP SE37 T-Code , it is working fine but same not working from web service .
    One more thing If anybody knows the standard BAPI or Function Module to create the Sales Return Order please do post .
    Thanks in advance ,
    Chaitanya

    Hi Pranav,
    Okay. Kindly let me know how to run rfc function module in background  because we have call transaction perform in RFC function module and I am posting BDC code that is using inside RFC function module.
    TYPES:BEGIN OF t_bdcdata,
            program TYPE bdc_prog,
            dynpro  TYPE bdc_dynr,
            dynbegin TYPE bdc_start,
            fnam TYPE fnam_____4,
            fval  TYPE bdc_fval,
        END OF t_bdcdata.
      DATA:wa_bdcdata TYPE t_bdcdata,
           it_bdcdata TYPE TABLE OF t_bdcdata.
      DATA:auart_001 TYPE bdc_fval,
         vkorg_002 TYPE bdc_fval,
         vtweg_003 TYPE bdc_fval,
         spart_004 TYPE bdc_fval,
         vbeln_005 TYPE bdc_fval,
         kunwe_006 TYPE bdc_fval,
         bstkd_007 TYPE bdc_fval,
         augru_010 TYPE bdc_fval,
         bsark_011 TYPE bdc_fval,
         augru_019 TYPE bdc_fval,
         bsark_020 TYPE bdc_fval.
      DATA:v_subrc TYPE sy-subrc.
      MOVE auart TO auart_001.
      MOVE vkorg TO vkorg_002.
      MOVE vtweg TO vtweg_003.
      MOVE spart TO spart_004.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = vbeln
        IMPORTING
          output = vbeln.
      MOVE vbeln TO vbeln_005.
      MOVE kunwe TO kunwe_006.
      MOVE bstkd TO bstkd_007.
      MOVE augru TO augru_010.
      MOVE bsark TO bsark_011.
      MOVE augru TO augru_019.
      MOVE bsark TO bsark_020.
      wa_bdcdata-program  = 'SAPMV45A'.
      wa_bdcdata-dynpro   = '0101'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'VBAK-AUART'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=COPY'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-AUART'.
      wa_bdcdata-fval = auart_001.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-VKORG'.
      wa_bdcdata-fval = vkorg_002.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-VTWEG'.
      wa_bdcdata-fval = vtweg_003.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'VBAK-SPART'.
      wa_bdcdata-fval = spart_004.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = 'SAPLV45C'.
      wa_bdcdata-dynpro   = '0100'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=UEBR'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'LV45C-VBELN'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'LV45C-VBELN'.
      wa_bdcdata-fval = vbeln_005.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = 'SAPLJ3AD'.
      wa_bdcdata-dynpro   = '2010'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=ENT1'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-KUNWE'.
      wa_bdcdata-fval = kunwe_006.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-BSTKD'.
      wa_bdcdata-fval = bstkd_007.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.
      wa_bdcdata-fval = augru_010.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.
      wa_bdcdata-fval = bsark_011.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = 'SAPLJ3AD'.
      wa_bdcdata-dynpro   = '2010'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_OKCODE'.
      wa_bdcdata-fval = '=SICH'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'BDC_CURSOR'.
      wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.
      wa_bdcdata-fval = augru_019.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.
      wa_bdcdata-fval =  bsark_020.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
      CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
        EXPORTING
          tcode                         = 'VA01'
         skip_screen                   = ''
         mode_val                      = 'N'
         update_val                    = 'A'
       IMPORTING
         subrc                         = subrc
       TABLES
         using_tab                     = it_bdcdata
        SPAGPA_TAB                    =
         mess_tab                      = messtab
       EXCEPTIONS
         call_transaction_denied       = 1
         tcode_invalid                 = 2
         OTHERS                        = 3
      IF sy-subrc <> 0.
        subrc = sy-subrc.
        EXIT.
      ENDIF.
    so i am using BDC code to create order instead of function module and converted bdccode into rfc function module,
    just help how to do with above code.
    With Regards,
    Krishna Chaitanya

Maybe you are looking for

  • Photoshop CC or Photoshop CC 2014: which should I be using?

    This may be a dumb question, but I'll ask it anyway: I have both versions of Photoshop installed on my Windows PC: CC and CC (2014)  I only want one version because two versions is confusing (see below).  Which one should I be using? Here's why two v

  • Can't download updates using software update or from apple's site

    I just got my mac about a week ago. i am trying to download the updates using software update, but they only partially download. After awhile, I get an error message (-1001) that says to check the network connection and try again later. I have tried

  • Rearrange array elements

    HI I want to rearrange the elements of an array in a certain order,based on their index. For example: Input array A = [1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2] Output array B should look like this: B = [1111111122222222] The values in the array are random, s

  • Resizing Image

    Hi, I have added the image to metafile which is defined in image. then resize the image display depends on the screen resolution. I have problem in resolution. My system configuration is, windows 8.1 screen resolution 1920x1080 and screen set in larg

  • SAVING PICTURES FROM WEBCAM

    Hi, there!! I need to save frames from a Web Cam... How could I do that??? Thank You very much!!