Problem in BDC for Transaction F-02

Hi Friends,
I am struck up in BDC for TransactionF-02.i am unable to load the data of my test data.when i am loading its loading the second record not the first record.
Below is the test data
H,RAWATEB,1
M,11072006,ZE,1000,11072006,20,SAR,,,,,RAWATIB,,SALARIES,1000
D,50,482000,3648.61,Z1,,,1000,1111,,,,,,
D,40,113001,3648.61,Z1,,,1000,,,,,,,
D,17,001011,3000000.00,Z1,,,1000,,,,,,,
D,40,113001,3000000.00,Z1,,,1000,,,,,,,
M,17082004,ZE,1000,11072006,20,SAR,,,,,RAWATIB,,SALARIES,1000
D,50,482000,3202.82,Z1,,,1000,1112,,,,,,
D,40,113001,3202.82,Z1,,,1000,,,,,,,
D,50,482000,2600000.00,Z1,,,1000,1111,,,,,,
D,40,001011,2600000.00,Z1,,,1000,,,,,,,
T,0000000002
<b></b>
the report is below
REPORT ZFGLDR0030 line-count 60
                  line-size 160
                  message-id 00.
====================================================================
****************************TABLES**********************************
====================================================================
tables: bkpf.
====================================================================
**************************RECORD LAYOUTS****************************
====================================================================
Data: begin of bdc_tab occurs 200.
        include structure bdcdata.
data: end   of bdc_tab.
Data: Begin of tmp_tab occurs 200,
       fld1(255)   type   c,
      end of tmp_tab.
DATA: BEGIN OF upload_tab OCCURS 200,
        fld1(1)    type   c,
        fld2(10)   type   c,
        fld3(10)   type   c,
        fld4(16)   type   c,
        fld5(10)   type   c,
        fld6(2)    type   c,
        fld7(4)    type   c,
        fld8(10)   type   c,
        fld9(10)   type   c,
        fld10(10)  type   c,
        fld11(10)  type   c,
        fld12(12)  type   c,
        fld13(25)  type   c,
        fld14(50)  type   c,
        fld15(4)   type   c,
        fld16(1)   type   c,
      END OF upload_tab.
data : tmp_rec like upload_tab.
DATA: BEGIN OF upload1_tab OCCURS 200,
        fld1(1)    type   c,
        fld2(10)   type   c,
        fld3(10)   type   c,
        fld4(16)   type   c,
        fld5(10)   type   c,
        fld6(2)    type   c,
        fld7(4)    type   c,
        fld8(10)   type   c,
        fld9(10)   type   c,
        fld10(10)  type   c,
        fld11(10)  type   c,
        fld12(12)  type   c,
        fld13(25)  type   c,
        fld14(50)  type   c,
        fld15(4)   type   c,
        fld16(1)   type   c,
      END OF upload1_tab.
Data: upload2_tab like tmp_rec occurs 200 with header line.
Data: Del_tab like tmp_rec occurs 200 with header line.
DATA: V_SYTABIX TYPE I,
      v_kunnr     like knb1-kunnr,
      v_brsch     like kna1-brsch,
      v_datum     like sy-datum,
      v_tmp(1)    type c,
      v_flag      type i,
      v_ccode(10) type c,
      v_glcd(10)  type c,
      v_len       type n,
      v_rem(50)   type c,
      v_docno(12) type c,
      v_dtype(3)  type c,
      v_sno(8)    type n,
      v_upd_flag  type i,
      v_idx       like sy-tabix,
      v_budat     like bkpf-budat,
      v_fld5(10)  type c,
      v_date(10)  type c.
====================================================================
*********************SELECTION-SCREEN******************************
====================================================================
selection-screen: begin of block b1 with frame .
parameters:p_fl_mct  like  rlgrap-filename
                     default 'C:\test' obligatory,
           p_sesid   like apqi-groupid default 'RAWATIB',
           p_user    like apqi-userid default sy-uname.
selection-screen: end of block b1.
selection-screen: begin of block b2 with frame .
parameters:p_opt1    radiobutton group grp1 default 'X',
           p_opt2    radiobutton group grp1,
           p_budat   like bkpf-budat.
selection-screen: end of block b2.
====================================================================
Validate SELECTION-SCREEN **************************
====================================================================
At Selection-screen.
  translate p_fl_mct to upper  case.
  if p_opt2 = 'X' and p_budat = '00000000'.
    message e398(00) with 'Please enter date to use as Posting date'.
  endif.
at selection-screen on value-request for p_fl_mct.
  data : v_mask(120)          type c.
  v_mask = ',IT2 files (.),.'.
  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            DEF_FILENAME     = ' '
            DEF_PATH         = ' '
            MASK             = v_mask
            TITLE            = 'File Selection for Upload'
       IMPORTING
            FILENAME         = p_fl_mct
           RC               =
       EXCEPTIONS
            INV_WINSYS       = 1
            NO_BATCH         = 2
            SELECTION_CANCEL = 3
            SELECTION_ERROR  = 4
            OTHERS           = 5.
end-of-selection.
====================================================================
*****************************CONSTANTS******************************
====================================================================
====================================================================
*****************************VARIABLES******************************
====================================================================
====================================================================
TOP OF PAGE*******************************
====================================================================
top-of-page.
start-of-selection.
  v_upd_flag = 0.
  perform initialise_process.
  perform bdc_open.
  perform process_upload_tab.
  perform terminate_process.
end-of-selection.
====================================================================
Form : Initialise_Process                                          *
====================================================================
FORM initialise_process.
   Initialises variables                                           *
  move : sy-repid to sy-tvar0,
         sy-uname to sy-tvar1,
         p_sesid  to sy-tvar2,
         sy-pagno to sy-tvar3.
  write: sy-datum to sy-tvar4,
         sy-uzeit to sy-tvar5.
Selecting the GL codes to be updated**********************
  call function 'WS_UPLOAD'
    EXPORTING
      FILENAME         = p_fl_mct
      FILETYPE         = 'ASC'
    TABLES
      data_tab         = Tmp_tab
    EXCEPTIONS
      CONVERSION_ERROR = 1
      FILE_OPEN_ERROR  = 2
      OTHERS           = 10.
  if sy-subrc <> 0.
    message e398(00) with 'Unable to upload data'.
  endif.
Validation for Upload file **********************
  read table tmp_tab index 1.
  split tmp_tab-fld1 at ',' into tmp_rec-fld1
                                 tmp_rec-fld2
                                 tmp_rec-fld3
                                 tmp_rec-fld4
                                 tmp_rec-fld5
                                 tmp_rec-fld6
                                 tmp_rec-fld7
                                 tmp_rec-fld8
                                 tmp_rec-fld9
                                 tmp_rec-fld10
                                 tmp_rec-fld11
                                 tmp_rec-fld12
                                 tmp_rec-fld13
                                 tmp_rec-fld14
                                 tmp_rec-fld15
                                 v_tmp.
  if tmp_rec-fld2 <> 'RAWATEB'.
    message e398(00) with 'Invliad file format, cannot upload'.
  endif.
  loop at tmp_tab.
    clear upload_tab.
    v_tmp = tmp_tab-fld1+0(1).
    if v_tmp = 'M' or v_tmp = 'D'.
      split tmp_tab-fld1 at ',' into upload_tab-fld1
                                     upload_tab-fld2
                                     upload_tab-fld3
                                     upload_tab-fld4
                                     upload_tab-fld5
                                     upload_tab-fld6
                                     upload_tab-fld7
                                     upload_tab-fld8
                                     upload_tab-fld9
                                     upload_tab-fld10
                                     upload_tab-fld11
                                     upload_tab-fld12
                                     upload_tab-fld13
                                     upload_tab-fld14
                                     upload_tab-fld15
                                     v_tmp.
      if upload_tab-fld1 = 'M'.
        clear tmp_rec.
        move upload_tab to tmp_rec.
      else.
        clear upload1_tab.
        move upload_tab to upload1_tab.
        upload1_tab-fld10  = tmp_rec-fld2.
        upload1_tab-fld12 = tmp_rec-fld12.
        upload1_tab-fld15 = tmp_rec-fld15.
        append upload1_tab.
      endif.
      append upload_tab.
    endif.
  endloop.
Mark the already uploaded Transaction to skip ***********
  Loop at upload_tab.
    if upload_tab-fld1 = 'M'.
      v_idx = sy-tabix.
      move upload_tab-fld24(4) to v_budat0(4).
      move upload_tab-fld22(2) to v_budat4(2).
      move upload_tab-fld20(2) to v_budat6(2).
      Select single * from bkpf where BLART = upload_tab-fld3 and
                                      BUKRS = upload_tab-fld4 and
                                      XBLNR = upload_tab-fld12 and
                                      budat = v_budat.
      if sy-subrc = 0.
        do 1000 times.
          clear del_tab.
          move upload_tab to del_tab.
          append del_tab.
          upload_tab-fld16 = '*'.
          modify upload_tab index v_idx.
          v_idx = v_idx + 1.
          Read table upload_tab index v_idx.
          if upload_tab-fld1 = 'M' or sy-subrc <> 0.
            exit.
          endif.
        enddo.
      endif.
    endif.
  endloop.
ENDFORM.                    "initialise_process
====================================================================
Form : Process_Ord_itab                                            *
====================================================================
FORM process_upload_tab .
  v_flag = 0.
  loop at upload_tab where fld16 <> '*' .
Performing the Save at the end of Transaction *************
    if upload_tab-fld1 = 'M' and v_flag = 1.
      perform load_save.
      perform bdc_insert.
    endif.
Putting the Header information of the document ************
    if upload_tab-fld1 = 'M'.
      perform load_header.
      v_date = v_fld5.
      v_rem  = upload_tab-fld14.
      v_flag = 0.
    endif.
Putting the Detail information of the document ************
    if upload_tab-fld1 = 'D'.
      if upload_tab-fld2 = '40' or upload_tab-fld2 = '50'  .
        perform Load_next.
        v_tmp = v_glcd.
        v_len = strlen( upload_tab-fld3 ).
        If ( v_tmp = '2' or v_tmp = '4' or v_tmp = '0' )  .
          Perform load_ccenter.
        elseif v_flag = 1.
          perform upload_blank.
        endif.
        perform load_Detail.
        v_flag = 1.
        v_glcd = upload_tab-fld3.
        v_ccode = upload_tab-fld9.
      else.
        perform Load_next.
        v_tmp = v_glcd.
        v_len = strlen( upload_tab-fld3 ).
        perform upload_blank.
        perform load_Detail_301.
        v_flag = 0.
        v_glcd = '1'.
      endif.
    endif.
  endloop.
  if v_flag = 1.
    perform load_save.
  endif.
  perform bdc_insert.
  v_upd_flag = 1.
ENDFORM.                    "process_upload_tab
====================================================================
Form : BDC_OPEN                                                   *
====================================================================
FORM bdc_open.
  call function 'BDC_OPEN_GROUP'
    EXPORTING
      client = sy-mandt
      group  = p_sesid
      user   = p_user
      keep   = 'X'.
ENDFORM.                    "bdc_open
====================================================================
Form : Fill_BDC_Tab                                                *
====================================================================
FORM fill_bdc_tab using dynbegin
                        name
                        value.
  if dynbegin = 'X'.
    clear bdc_tab.
    move:  name  to bdc_tab-program,
           value to bdc_tab-dynpro,
           'X'   to bdc_tab-dynbegin.
    append bdc_tab.
  else.
    clear bdc_tab.
    move:  name  to bdc_tab-fnam,
           value to bdc_tab-fval.
    append bdc_tab.
  endif.
ENDFORM.                    "fill_bdc_tab
====================================================================
Form : BDC_INSERT                                                 *
====================================================================
FORM bdc_insert .
  call function 'BDC_INSERT'
    EXPORTING
      tcode     = 'F-02'
    TABLES
      dynprotab = bdc_tab.
  refresh bdc_tab.
  clear bdc_tab.
ENDFORM.                    "bdc_insert
====================================================================
Form : BDC_CLOSE                                                  *
====================================================================
FORM bdc_close.
  call function 'BDC_CLOSE_GROUP'.
ENDFORM.                    "bdc_close
====================================================================
Form : Terminate_Process                                          *
====================================================================
FORM terminate_process.
  perform bdc_close.
ENDFORM.                    "terminate_process
*&      Form  load_Header
FORM load_Header.
  If upload_tab-fld1 = 'M'.
    v_fld5 = upload_tab-fld5.
    if p_opt2 = 'X'.
      move p_budat6(2) to v_fld50(2).
      move p_budat4(2) to v_fld52(2).
      move p_budat0(4) to v_fld54(4).
    endif.
    perform fill_bdc_tab using:
     'X' 'SAPMF05A'     '0100',
     ' ' 'BDC_CURSOR'   'RF05A-NEWKO',
     ' ' 'BKPF-BLDAT'    upload_tab-fld2,
     ' ' 'BKPF-BLART'    upload_tab-fld3,
     ' ' 'BKPF-BUKRS'    upload_tab-fld4,
     ' ' 'BKPF-BUDAT'    v_fld5,
     ' ' 'BKPF-WAERS'    upload_tab-fld7,
     ' ' 'BKPF-XBLNR'    upload_tab-fld12,
     ' ' 'BKPF-BKTXT'    upload_tab-fld13.
  Endif.
ENDFORM.                    "load_Header
*&      Form  load_Detail
FORM load_Detail.
  perform fill_bdc_tab using:
   'X' 'SAPMF05A'     '0300',
   ' ' 'BDC_CURSOR'   'BSEG-WRBTR',
   ' ' 'BSEG-WRBTR'    upload_tab-fld4,
  ' ' 'BSEG-VALUT'    v_date,
   ' ' 'BSEG-SGTXT'    v_rem.
ENDFORM.                    " LOAD_DATA
*&      Form  load_Detail
FORM load_Detail_301.
  perform fill_bdc_tab using:
   'X' 'SAPMF05A'     '0301',
   ' ' 'BDC_CURSOR'   'RF05A-NEWUM',
   ' ' 'BSEG-WRBTR'    upload_tab-fld4,
  ' ' 'BSEG-VALUT'    v_date,
   ' ' 'BSEG-SGTXT'    v_rem.
ENDFORM.                    " LOAD_DATA
*&      Form  load_Next
FORM Load_next.
  perform fill_bdc_tab using:
   ' ' 'RF05A-NEWBS'    upload_tab-fld2,
   ' ' 'RF05A-NEWKO'    upload_tab-fld3,
   ' ' 'BDC_OKCODE'   '/00'.
ENDFORM.                    "Load_next
*&      Form  load_Save
FORM Load_save.
  perform fill_bdc_tab using:
  'X' 'SAPMF05A'     '0300',
   ' ' 'BDC_OKCODE'   '=BU'.
  v_tmp = v_glcd.
  v_len = strlen( upload_tab-fld3 ).
  If ( v_tmp = '2' or v_tmp = '4' or v_tmp = '0' )  .
    Perform load_ccenter.
  elseif v_flag = 1.
    perform upload_blank.
  endif.
  perform fill_bdc_tab using:
   'X' 'SAPMF05A'     '0700',
   ' ' 'BDC_OKCODE'   '=BU'.
ENDFORM.                    "Load_save
*&      Form  load_CCenter
FORM Load_Ccenter.
  perform fill_bdc_tab using:
   'X' 'SAPLKACB'     '0002',
   ' ' 'BDC_CURSOR'   'COBL-KOSTL',
  ' ' 'COBL-KOSTL'   '4200-0451',
   ' ' 'COBL-KOSTL'    v_ccode,
  ' ' 'COBL-KOSTL'   '4200-0295',
   ' ' 'BDC_OKCODE'   '/EENTE'.
ENDFORM.                    "Load_Ccenter
*&      Form  load_blank
FORM UpLoad_blank.
  perform fill_bdc_tab using:
   'X' 'SAPLKACB'     '0002',
   ' ' 'BDC_OKCODE'   '/EENTE'.
ENDFORM.                    "UpLoad_blank

ur  code  looking  ok..
just change  it..
call function <b>'WS_UPLOAD'</b>--->to  <b>gui_upload</b>
EXPORTING
FILENAME = p_fl_mct
FILETYPE = 'ASC'
TABLES
data_tab = Tmp_tab
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
OTHERS = 10.
if sy-subrc <> 0.
message e398(00) with 'Unable to upload data'.
endif.

Similar Messages

  • BDC for transaction J1IFQ

    Hi Experts,
    I am trying to develop BDC for transaction J1IFQ .
    When I do recording at the end I press SAVE it give me message that record is reconcilie and then I press logout.
    But when I use same recording in my program it dosn't save data. I am not able to find out what is the problem, please guide me.
    Thanking you.

    Hi Narayani
    It seems you need to inspect the new flow of the transaction and your BDC program more carefully. You might have skiped somethings to change.
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • BDC for Transaction F-02

    Hi,
    Any idea how to write BDC for transaction F-02?
    The problem is how do we upload one item after another within the same loop?
    Regards,
    Naba

    You may solve easily your problem writing the data in the LOOP like
    LOOP AT IT_BSEG
      " if first line, fill BDCDATA for header and the first line call
      " if not first line, fill BDCDATA for the bottom of the previous line
      " fill ok code for next line
      " fill BDCDATA for the current line
    ENDLOOP.
    " fill ok code for save and call transaction
    But it should be easier to use FM like [POSTING_INTERFACE_START|https://www.sdn.sap.com/irj/scn/advancedsearch?query=posting_interface_start&cat=sdn_all]; [POSTING_INTERFACE_DOCUMENT|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=posting_interface_document&adv=false&sortby=cm_rnd_rankvalue] and [POSTING_INTERFACE_END|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=posting_interface_end&adv=false&sortby=cm_rnd_rankvalue], those function modules will build the BDC flow.
    Another, and better solution is to use [BAPI_ACC_DOCUMENT_POST|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi_acc_document_post&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • BDC for Transaction WB02

    Hi,
       I am trying to write BDC for transaction WB02 , wherein each site(Plant) in our company is to be made a customer of each other, so as to fecilitate inter-site  movement of goods. the transaction works fine normally, but at the time of recording it comes to screen '315' and gets stuck and dont move ahead or either go back, it just gets stuck there, and has to be terminated.. i tried to replicate the transaction thru' BDC but it is getting stuck at the same screen.. can anybody tell me why this is happening and the possible solution for it..
    thanks.
    sharon

    Hi,
    What u can do is Read your Messages table with message types E(Error) and A(Abort). IF NOT sy-subrc IS INITIAlL means your transaction is successfull. So u can give your custom message saying IDOC sent successfully.
    READ TABLE IT_BDCMSGCOLL WITh KEY TYPE = 'E'.
    IF NOT sy-subrc IS INITIAL.
      READ TABLE IT_BDCMSGCOLL WITH KEY TYPE = 'A'
      IF NOT sy-subrc IS INITIAL.
      MESSAGE i000 WITH 'IDOC sent successfully'.
      ELSE.
      MESSAGE i000 WITH 'Problem in sending IDOC'.
      ENDIF.
    ELSE.
      MESSAGE i000 WITH 'Problem in sending IDOC'.
    ENDIF.
    Thanks,
    Vinod.

  • Program does BDC for transaction F-52 or f-53

    Hi GuruI am functional person and working with a developer in a program . The program does BDC for transaction F-52 or f-53 . I am uploading a file ,so that the program picks it and o either F-52 or F-53 based on condition. When i try to upload the program with mulitple record ,i am getting the message difference is too large to clear . If i execute the same program without doing any changes again i can see few more records getting posted . when i do next time remaining records are posted . Insted of getting posted in one ,I have to execute the program more than once .can any one help me out why this is happening

    i think you should ask  your programmer to use transaction SM35 to process the BDC in foreground mode (first changing the mode to A). I would think you will see what's going wrong then. There are a few transactions that look different in foreground mode than in background and you will see where the difference is if you use this method to process

  • Problem in BDC  for se78

    Hi All,
      I am trying to record a BDC for transaction se78. After executing the recording I am getting an error " Field RB_GRAPHIC_BCOl. does not exist in the screen SAPMSSCH 2000".
    Can any one please help me how to get rid of this error.
    Thanks and Regards,
    Nimisha Deshpande.

    ur  code  looking  ok..
    just change  it..
    call function <b>'WS_UPLOAD'</b>--->to  <b>gui_upload</b>
    EXPORTING
    FILENAME = p_fl_mct
    FILETYPE = 'ASC'
    TABLES
    data_tab = Tmp_tab
    EXCEPTIONS
    CONVERSION_ERROR = 1
    FILE_OPEN_ERROR = 2
    OTHERS = 10.
    if sy-subrc <> 0.
    message e398(00) with 'Unable to upload data'.
    endif.

  • Creating bdc for transaction f-02 ?

    Hi People,
    I am going a bdc for transaction f-02 ..... my template involves 7 posting keys ( 40 50 31 01 29 09 70 ) ... depending up
    on the posting key the next screen will change .......... can you people tel me how to do this and what are all the logic
    involved in this program ?
    thanks u all in advance.
    Siva

    Hi,
    Please use the following format for your upload file template
    DocDate1    ComCd1    Currency1    pstky1
    DocDate1    ComCd1    Currency1    pstky2
    DocDate1    ComCd1    Currency1    pstky3
    DocDate2    ComCd2    Currency2    pstky1
    DocDate2    ComCd2    Currency2    pstky2
    Then use the following logic.
    At New Currency1
    add the header data
    DocDate1    ComCd1    Currency1
    Thus this code will run only once for every new Header
    and remain in the screen till posting key are entered.
    Regards,
    Lokesh
    Edited by: Lokesh Tibbani on Sep 5, 2008 12:17 PM

  • BDC for transaction FAGLSKF

    Hi,
    I need to develop BDC for transaction FAGLSKF. I tried recording the transaction and found that the line items are not getting recorded since the transaction uses an editable ALV and not a table control. I have seen some post regarding this but everyone is saying to use some FM's but all these FM's are not yet released by SAP & even if i use it I still have to seperately take care of validations. Please let me know if anyone has faced this issue and found an alternative.
    Thanks,
    Antony

    Hi ,
    Check this BAPI Function module BAPI_ACC_STAT_KEY_FIG_POST.
    Regards,
    Ashok.

  • Hi All, I developed a BDC for transaction IE02

    Hi All, I developed a BDC for transaction IE02, when i am uploading data into this bdc 'validity period' is automatically taking the present system date, as in program i have not given any validations for this validity from Can anyone guide me on this as so why the data in validity from is taking present system date and how do i avoid it.
    Thanks..!!!
    Regards,
    Swarna

    Hi Swarna,
    AS you mention  IE02  Validity From is not editable.
    If you capturing this field in BDC then you can put hard-code date value sy-datum in this field , no need to chnage in excel or manual update every time.
    and If you are not capturing  this field in BDC  then please try to use BAPI for uploading data.
    like.
    BAPI_EQUI_CHANGE or
    BAPI_EQMT_MODIFY.
    Regards,
    Prasenjit

  • Problem in creation of BDC for transaction phap_create

    Hello Friends,
    I am trying to create BDC for PHAP_CREATE.
    When you run a transaction a pop up window appears to select the template id.
    And in BDC it is selected by cursor position. So once selected, the value of template id cannot be changed.
    I want this as a parameter.So that each time I run a BDC I will be able to create different types of Appraisal documents i.e with different template ids.
    How to go about it???
    Regards,
    Bhushan

    Hi,
    For selecting the id, while doing recording,
    record with
    CTRL + F ( Where u can give ur id) and proceed further.

  • Problem in bdc for table control for line items

    Hi experts,
    I am runnig a bdc for ME52.
    i am just entering PR number, in the second screen i have got all the line items. I need to select these line item 10 and double click or hit enter, it takes me to screen 3, there im just checking a checkbox and saving.
    Again i need to select the line item 20 and double click or hit enter. again the same process.
    Again repeat for all the line items.
    But my problem is it is updating everytime for only line item  10. for line item 20 and others it say "no chnge in the data".
    I am pasting my code here. please check and revert me back .plz.
    DATA: w_output LIKE LINE OF i_output.
      REFRESH I_ITAB[].
      SELECT * FROM EBAN
               INTO TABLE i_itab
               WHERE banfn in s_banfn AND
                     bsart in s_bsart AND
                     bstyp in s_bstyp AND
                     matnr in s_matnr AND
                     werks in s_werks AND
                     lfdat in s_lfdat AND
                     pstyp in s_pstyp AND
                     knttp in s_knttp AND
                     estkz in s_estkz AND
                     loekz eq ' '.
      IF sy-subrc = 0.
        CLEAR: w_itab,
                 i_poitab[].
        SORT i_itab by banfn.
        LOOP AT i_itab INTO w_itab where menge GT eban-bsmng.
          IF p_close = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = 'X'.
              w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = ' '.
              w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_close = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
      LOOP AT i_poitab into w_output.
        APPEND w_output to i_output.
       PERFORM CALL_BDC.
      endloop.
    IF p_rep = 'X'.
    PERFORM CALL_BDC.
    ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  CALL_BDC
          text
    -->  p1        text
    <--  p2        text
    FORM CALL_BDC.
    DATA: seltab(5) TYPE N,
          seltab1(2) TYPE N,
          tempvar(30) TYPE N,
          cnt TYPE N.
    LOOP AT i_output.
    clear: seltab,
           seltab1.
    seltab = i_output-bnfpo.
    seltab1 = seltab+2(2).
    perform bdc_dynpro      using 'SAPMM06B' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-BANFN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EBAN-BANFN'
                                  i_output-banfn.
    perform bdc_dynpro      using 'SAPMM06B' '0106'.
    clear tempvar.
    *cnt = 1.
    concatenate 'EBAN-BNFPO(' seltab1 ')' into tempvar.
    perform bdc_field       using 'BDC_CURSOR'
                                 'EBAN-BNFPO(seltab1)'.
                                    tempvar.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DETA'.
    perform bdc_field       using 'RM06B-BNFPO'
                                  i_output-bnfpo.
    perform bdc_field       using 'RM06B-TCSELFLAG(seltab1)'
                                 'X'.
    perform bdc_dynpro      using 'SAPMM06B' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-EBAKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'EBAN-EBAKZ'
                                  i_output-ebakz.
    CALL TRANSACTION 'ME52' USING bdc_data MODE 'A'
                                   MESSAGES INTO i_bdcmsg.
        COMMIT WORK AND WAIT.
    ENDLOOP.
    ENDFORM.                    " CALL_BDC
    *&      Form  bdc_dynpro
          text
         -->P_0686   text
         -->P_0687   text
    FORM bdc_dynpro USING    program dynpro.
    CLEAR bdc_data.
      bdc_data-program  = program.
      bdc_data-dynpro   = dynpro.
      bdc_data-dynbegin = 'X'.
      APPEND bdc_data.
      CLEAR bdc_data.
    ENDFORM.   
    thanks,
    N

    Looks like table control logic is wrong -- do compare with below program...
    only table contril area
    REPORT ZPadmam
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Thanks
    Seshu

  • Problem in BDC for IA05 tcode.

    Hi,
    I am facing a problem while uploading data for IA05 t.code using BDC call transaction method.
    when I an running thru BDC, in the operational overview, when i select an operational line item, and go for inspection characteristics overview and provide inspection characteristics, sampling procedure, version and press enter, an window is popping up which is asking for inspection method, plant for inspection method and inspection method version number.
    but when I am running the tcode normally, this inspection window is not popping up and details are not being asked. these inspection method details are not neccessary for my business logic. how can I by-pass this popup window which  i don't want even when I run thru BDC.
    Thanks and Regards,
    Krishna.

    Hi Krishna
    This is not the right forum to post this question. Post this to proper forum in order to get quick response.
    Regards
    Vaishali

  • Problem in BDC For Actions

    Hi All,
    I am making a BDC for IT0000.
    I have done the recording and developed a program for that.
    IT0105 is also there in info grouping for action.When I am executing the bdc in Foreground Processing the error is coming "No batch input data for screen MP010500 2000" for IT0105.
    When I am processing the program in background error is coming in the screen IT0105.But the screen displayed here for IT0105 shows different fields from what it shows in foreground processing.
    Can anyone help me out in solving the problem?

    Hi Sutapa,
    Try making the call transaction in mode 'E' and it will stop in the screen which is giving you the error. Some screens will come up only during the backend run(mode N). So in that case you need to write the code after seeing it in mode 'E' which all are the screens coming up.
    Cheers
    JK.

  • Problem in BDC For MR21

    hi all,
    I had written the bdc for mr21 using session method. I am not able to change the standard price using BDC. Recording is perfect. Using transaction mr21 I can change the price but using bdc , it's not changing.It is not giving any error. it gives message that no changes in price have been made.
    Thanks in Advance.
    Regards,
    Atul

    Hi,
    In the code check for one thing...
    when you are populating the price value in the table use the following code and then check if it works.
    data lw_string type string.
    write price to lw_string currency currncykey   " here price is the variable which contains the value... and
    "   Currency key is the currency key for the price which you can get from the table where you get the price.
    "then
    bdcdata-fieldval = lw_string.
    append bdcdata.
    Just check if this works, As earlier I faced a similar kind of a problem when I did this it was resolved....
    Regards,
    Siddarth

  • Problem in BDC for MB1B

    Dear Experts ,
    I am doing a BDC for MB1B...
    In my selection screen I am having,
    Plant, Vendor No, text and and options to enter 5 different materials and its corresponding qauntity.
    When the user enter the above details and execute , these details should trigger in MB1B
    ( using BDC background ).
    My problem is i the final stage where the document needs to get saved, as in my case
    its getting saved and also if the user enters only 1 material the loop should happen only once, but here
    its getting looped with balnk values.
    I have pasted my code below, please have look and advice me.
    REFRESH: BDCDATA, MESSTAB.
      PERFORM DYNPRO USING:
      'X' 'SAPMM07M' '0400',
      ' ' 'RM07M-BWARTWA' '941',
      ' ' 'RM07M-WERKS'  itab-WERKS,
      ' ' 'RM07M-LGORT' itab-LGORT,
      ' ' 'MKPF-BKTXT'  itab-BKTXT,
      ' ' 'BDC_OKCODE' '/00',
      'X' 'SAPMM07M' '0421',
      ' ' 'MSEGK-UMWRK' itab-WERKS,
      ' ' 'MSEGK-LIFNR' itab-VEND,
      ' ' 'BDC_OKCODE' 'NLE',
      'X' 'SAPLKACB' '0002',
      ' ' 'BDC_OKCODE' '/00'.
      LOOP AT ITAB1.
      QAN = ITAB1-ERFMG.
      QTY = QAN+6(6).
      CNT = CNT + 1.
      CN = CNT.
      CONCATENATE 'MSEG-MATNR(' CN  ')' INTO FN1.
      CONCATENATE 'MSEG-ERFMG(' CN  ')' INTO FN2.
        PERFORM DYNPRO USING:
        'X' 'SAPMM07M' '0421',
        ' '  FN1 ITAB1-MATNR,
        ' '  FN2 QTY,
        ' ' 'BDC_OKCODE' '/00',
        'X' 'SAPLKACB' '0002',
        ' ' 'BDC_OKCODE' '=ENTE'.
      ENDLOOP.
      CALL TRANSACTION 'MB1B' USING BDCDATA MODE 'A'

    Hi Naga,
    Thanks a lot for ur valuable advice !!
    Now my document is getting posted , while using:
    *CALL TRANSACTION 'MB1B' USING BDCDATA MODE  'A' *
    but when I am using
    *CALL TRANSACTION 'MB1B' USING BDCDATA MODE  'N' *
    I am getting 'S' message  No batch input data for screen SAPLKACB 0002.
    I am pasting my code please have a look and advice me.
    REFRESH: BDCDATA, MESSTAB.
      PERFORM DYNPRO USING:
      'X' 'SAPMM07M' '0400',
      ' ' 'RM07M-BWARTWA' '941',
      ' ' 'RM07M-WERKS' S_WERKS,
      ' ' 'RM07M-LGORT' S_LGORT,
      ' ' 'MKPF-BKTXT'  S_BKTXT,
      ' ' 'BDC_OKCODE' '/00',
      'X' 'SAPMM07M' '0421',
      ' ' 'MSEGK-UMWRK' S_WERKS,
      ' ' 'MSEGK-LIFNR' S_VEND,
      ' ' 'BDC_OKCODE' 'NLE',
      'X' 'SAPLKACB' '0002',
      ' ' 'BDC_OKCODE' '/00'.
      LOOP AT ITAB.
        DELETE ITAB WHERE MATNR IS INITIAL.
        QAN = ITAB-ERFMG.
        QTY = QAN+6(6).
        CNT = CNT + 1.
        CN = CNT.
        CONCATENATE 'MSEG-MATNR(' CN  ')' INTO FN1.
        CONCATENATE 'MSEG-ERFMG(' CN  ')' INTO FN2.
        PERFORM DYNPRO USING:
        'X' 'SAPMM07M' '0421',
        ' '  FN1 ITAB-MATNR,
        ' '  FN2 QTY,
        ' ' 'BDC_OKCODE' '/00'.
      ENDLOOP.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                  '=BU'.
      PERFORM BDC_FIELD       USING 'DKACB-FMORE'
                                    'X'.
      PERFORM DYNPRO          USING 'X' 'SAPLKACB' '0002'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=ENTE'.
      CALL TRANSACTION 'MB1B' USING BDCDATA MODE 'N'
      MESSAGES INTO MESSTAB.
    Rgds
    Karthik

Maybe you are looking for

  • Queue problems!

    MAIN QUESTION IS: WHEN INSERTING AN ITEM INTO A QUEUE IT OVERWRITES THE PREVIOUS ITEMS WITH THE NEW ITEM, PLUS IT ADDS THAT ITEM AS WELL. SO IF THE QUEUE ORIGINALLY HAD 'N' ITEMS, WHEN YOU ADD A NEW ITEM YOU GET N+1 OF THAT NEW ITEM. SEE BELOW FOR MO

  • Blue screen at start up

    I am trying to get my eMac to start and i can't get past the blue screen. It won't start in safe mode either. That goes to the blue screen and freezes too. I have read othe posts that says to use the install disc to boot up, but I can't do that becau

  • BW Business content activation for BPC 7 NW.

    What are the standard business contents needs to be activated for BPC7NW installation in BW? I means any infoobjects, cubes specific to BPC which can be activated in BW/BI server. Please let me know any input or links.

  • Libstdc++.so.5 not found

    Hi there I recently made pacman -Syu and upgraded to gcc 4.1.1 and matching binutils. Now, when i try opening a rar file, all i get is unrar: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or direct

  • Netbeans 6.0 debugger problem

    The debugger passes through the breakpoint as if there wasn't one. It's probably some kind of option because one of my colleagues, who uses the same version, has no problems with the debugger. Any ideas?