Regarding BDC coding

hi friends ,
i m facing problem while uploading data from excel sheet to sap system,the fields are postking key,cmpycode,gl a/c,vendor code,vendor name,business area n amount...here below i m giving my cmplete coding part for ur help......
looking forward to an early reply...PLZ HELP ME
tables:rf02k,addr1_data,bseg,bkpf,cobl,rf05a.
data:begin of itab occurs 0,
     lifnr like rf02k-lifnr,
     name1 like addr1_data,
     hkont like bseg-hkont,
     bukrs like bkpf-bukrs,
     wrbtr like bseg-wrbtr,
     gsber like cobl-gsber,
     newbs like rf05a-newbs,
     bschl like kmzei-bschl,
     bukrs like kmzei-bukrs,
     hkont like kmzei-hkont,
     gsber like kmzei-gsber,
     wrbtr like kmzei-wrbtr,
     end of itab.
data:begin of jtab occurs 0.
     include structure bdcdata.
data:end of jtab.
data:begin of i_excel occurs 0.
     include structure alsmex_tabline.
data:end of i_excel.
parameters:fname like rlgrap-filename,
           ftype like rlgrap-filetype,
           start type i, end type i.
at selection-screen on value-request for fname.
call function 'F4_FILENAME'
EXPORTING
  PROGRAM_NAME        = SYST-CPROG
  DYNPRO_NUMBER       = SYST-DYNNR
  FIELD_NAME          = ' '
IMPORTING
   FILE_NAME           =  fname.
start-of-selection.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  exporting
    FILENAME                      = fname
    I_BEGIN_COL                   = 2
    I_BEGIN_ROW                   = start
    I_END_COL                     = 8
    I_END_ROW                     = end
  TABLES
    INTERN                        = i_excel
EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
end-of-selection.
loop at i_excel.
  case i_excel-col.
  when '0002'.
  itab-NEWBS = i_excel-value.
  when '0003'.
  itab-bukrs = i_excel-value.
  when '0004'.
  itab-hkont = i_excel-value.
  when '0005'.
  itab-lifnr = i_excel-value.
  when '0006'.
  itab-name1 = i_excel-value.
  when '0007'.
  itab-gsber = i_excel-value.
  when '0008'.
  itab-wrbtr = i_excel-value.
  endcase.
  at end of row.
  append itab.
  clear itab.
  endat.
  endloop.
loop at Itab.
refresh jtab.
perform sub using 'SAPMF05A' '300'.
PERFORM sub1 using 'BDC_CURSOR' 'RF05A-NEWBS'.
PERFORM sub1 using 'BDC_OKCODE' '/00'.
PERFORM sub1 using 'RF05A-NEWBS' ITAB-NEWBS.
PERFORM sub1 using 'BKPF-BUKRS' ITAB-BUKRS.
PERFORM sub1 using 'BSEG-HKONT' ITAB-HKONT.
call transaction 'F-02' using jtab.
perform sub using 'SAPMF02K' '100'.
PERFORM sub1 using 'BDC_CURSOR' 'RF02K-LIFNR'.
PERFORM sub1 using 'BDC_OKCODE' '/00'.
PERFORM sub1 using 'RF02K-LIFNR' ITAB-LIFNR.
PERFORM sub1 using 'ADDR1_DATA-NAME1' ITAB-NAME1.
call transaction 'XK01' using jtab.
PERFORM sub using 'SAPMF05A' '300'.
PERFORM sub1 using 'BDC_CURSOR' 'COBL-GSBER'.
PERFORM sub1 using 'BDC_OKCODE' '/00'.
PERFORM sub1 using 'COBL-GSBER' ITAB-GSBER.
PERFORM sub1 using 'BSEG-WRBTR' ITAB-WRBTR.
call transaction 'FKMT'  using jtab .
endloop.
form sub using A B.
clear jtab.
jtab-program = A.
jtab-dynpro = B.
jtab-dynbegin = 'X'.
append jtab.
endform.
form sub1 using C D.
clear jtab.
jtab-fnam = C.
jtab-fval = D.
append jtab.
endform.

Ravi,
No need to write like that way...
follow this way...
in XX = put the value as like length of the fild..
example: rf02k-lifnr is of length  10
so i declaed lifnr(10) type cahr.
then declare..
data:begin of itab occurs 0,
lifnr(10) type cahr," like rf02k-lifnr,
name1(XX) type cahr," like addr1_data,
hkont(XX) type cahr," like bseg-hkont,
bukrs(XX) type cahr," like bkpf-bukrs,
wrbtr(XX) type cahr," like bseg-wrbtr,
gsber(XX) type cahr," like cobl-gsber,
newbs(XX) type cahr," like rf05a-newbs,
end of itab.
maintain the flat file in excel/text format
use to upload
        CALL FUNCTION 'UPLOAD'
             EXPORTING
                  filename = 'c:\windows\desktop\'
                  filetype = 'DAT'
             TABLES
                  data_tab = itab.
loop  itab.
pass records to BDC...ok
endloop.
Regards,
Ramesh.

Similar Messages

  • BDC coding for TABLE controls

    how to write BDC coding based on Table Controls...

    http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
    How to deal with table control / step loop in BDC
    Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
    Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
    Demo ABAP code has two purposes:
    1. how to determine number of visible lines and how to calculte page number;
    (the 'calpage' routine has been modify to meet general purpose usage)
    2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.
    Now I begin to describe the step to implement my method:
    (I use transaction 'ME21', screen 121 for sample,
    the method using is Call Transation Using..)
    Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.
    (Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
    Now we have : FixedLine = 9
                  LoopLine  = 2(for table control, LoopLine is always equal to 1)
    Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
    Now we have: FirstLine = 0
              or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
    Step3: write a subroutine calcalculating number of pages
    (here, the name of actual parameter is the same as formal parameter)
    global data:    FixedLine type i, " number of fixed line on a certain screen
                    LoopLine  type i, " the number of lines occupied by one steploop item
                    FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new                                                               " scrolling screen is empty, otherwise is 1
                    Dataline  type i, " number of items you will use in BDC, using DESCRIBE to get
                    pageno    type i, " you need to scroll screen how many times.
                    line      type i, " number of lines appears on the screen.
                    index(2)  type N, " the screen index for certain item
                    begin     type i, " from parameter of loop
                    end       type i. " to parameter of loop
    *in code sample, the DataTable-linindex stands for the table index number of this line
    form calpage using FixedLine type i (see step 1)
                       LoopLine  type i (see step 1)
                       FirstLine type i (see step 2)
                       DataLine  type i ( this is the item number you will enter in transaction)
              changing pageno    type i (return the number of page, depends on run-time visible                                                                             line in table control/ Step Loop)
              changing line      type i.(visible lines one the screen)
    data: midd type i,
          vline type i, "visible lines
    if DataLine eq 0.
       Message eXXX.
    endif.
    vline = ( sy-srows - FixedLine ) div LoopLine.
    *for table control, you should compare vline with maximum line of
    *table control, then take the small one that is min(vline, maximum)
    *here only illustrate step loop
    if FirstLine eq 0.
            pageno = DataLine div vline.
            if pageno eq 0.
               pageno = pageno + 1.
            endif.
    elseif FirstLine eq 1.
            pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
            midd = ( DataLine - 1 ) mod ( vline - 1).
            if midd = 0 and DataLine gt 1.
                    pageno = pageno - 1.
            endif.
    endif.
    line = vline.
    endform.
    Step4 write a subroutine to calculate the line index for each item.
    form calindex using Line type i (visible lines on the screen)
                        FirstLine type i(see step 2)
                        LineIndex type i(item index)
              changing  Index type n.    (index on the screen)
      if  FirstLine = 0.
            index = LineIndex mod Line.
            if index = '00'.
                    index = Line.
            endif.
      elseif FirstLine = 1.
            index = LineIndex mod ( Line - 1 ).
            if ( index between 1 and 0 ) and LineIndex gt 1.
                    index = index + Line - 1.
            endif.
            if Line = 2.
                    index = index + Line - 1.
            endif.
    endif.
    endform.
    Step5 write a subroutine to calculate the loop range.
    form calrange using Line type i ( visible lines on the screen)
                        DataLine type i
                        FirstLine type i
                        loopindex like sy-index
            changing    begin type i
                        end type i.
    If FirstLine = 0.
       if loopindex = 1.
            begin = 1.
            if DataLine <= Line.
                    end = DataLine.
            else.
                    end = Line.
            endif.
       elseif loopindex gt 1.
            begin = Line * ( loopindex - 1 ) + 1.
            end   = Line * loopindex.
            if end gt DataLine.
               end = DataLine.
            endif.
       endif.
    elseif FirstLine = 1.
      if loopindex = 1.
            begin = 1.
            if DataLine <= Line.
                    end = DataLine.
            else.
                    end = Line.
            endif.
      elseif loop index gt 1.
            begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
            end =   ( Line - 1 ) * ( loopindex - 1 ) + Line.
            if end gt DataLine.
                    end = DataLine.
            endif.
      endif.
    endif.
    endform.
    Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
    form creat_bdc.
    field-symbols: <material>, <quan>, <indicator>.
    data: name1(14) value 'EKPO-EMATN(XX)',
          name2(14) value 'EKPO-MENGE(XX)',
          name3(15) value 'RM06E-SELKZ(XX)'.
    assign:         name1 to <material>,
                    name2 to <quan>,
                    name3 to <indicator>.
    do pageno times.
    if sy-index gt 1
    *insert scroll page ok_code"
    endif.
            perform calrange using Line DataLine FirstLine sy-index
                             changing begin end.
    loop at DataTable from begin to end.
            perform calindex using Line FirstLine DataTable-LineIndex changing Index.
            name1+11(2) = Index.
            name2+11(2) = Index.
            name3+12(2) = Index.
            perform bdcfield using <material> DataTable-matnr.
            perform bdcfield using <quan>     DataTable-menge.
            perform bdcfield using <indicator> DataTable-indicator.
    endloop.
    enddo.
    Cheers
    VJ

  • BDC Coding & Short Dump

    HI Experts,
    I need to change the Document by using the FB02 Transaction. For this I am using BDC Call transaction. I did this by Recording. While Executing I am getting short dump. Can any one help me ASAP.
    BDC Code….
      DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
      DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
      CONSTANTS:  lv_tcode LIKE tstc-tcode VALUE 'FB02'.
      DATA: it_bseg LIKE bseg OCCURS 0 WITH HEADER LINE.
      DATA: w_chect LIKE regud-chect,    "CHECK NO.
            w_bukrs LIKE bseg-bukrs,    "COMPANY CODE
            w_belnr LIKE bseg-belnr,     "Accounting Doc. No.
            w_augbl LIKE bseg-augbl,    "Doc No. Of Clearing Doc.
            w_blart LIKE bkpf-blart,    "Document type.
            w_zlsch LIKE bseg-zlsch,    "Payment methods.
            w_assig LIKE bseg-zuonr,    "Assignment
            w_count(2) TYPE n,
            w_rep(2)   TYPE n.
    *First find out the Posting Document No.
      SELECT SINGLE augbl FROM bseg INTO w_augbl
             WHERE bukrs = regup-bukrs
             AND   belnr = regup-belnr.
      SELECT * FROM bseg INTO TABLE it_bseg
               WHERE bukrs = regup-bukrs
               AND   belnr = w_augbl.
    *Findint the Cheque No. from PAYR
      SELECT SINGLE chect FROM payr INTO w_chect
             WHERE vblnr = w_augbl
             AND   rzawe IN ('C','S').
    *Finding the Posting Document Type
      SELECT SINGLE blart FROM bkpf INTO w_blart
             WHERE belnr = w_augbl.
      SELECT COUNT( * ) FROM bseg INTO w_count
             WHERE belnr = w_augbl
             AND   zlsch IN ('C','S').
      IF w_blart EQ 'ZP' AND w_count GT 0.
        MOVE 01 TO w_rep.
        PERFORM bdc_dynpro      USING 'SAPMF05L' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RF05L-BELNR'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RF05L-BELNR'
                                      w_augbl.
        PERFORM bdc_field       USING 'RF05L-BUKRS'
                                      regup-bukrs.
        PERFORM bdc_field       USING 'RF05L-GJAHR'
                                      regup-gjahr.
        w_count = w_count + 1.
        DO w_count TIMES.
          PERFORM bdc_dynpro      USING 'SAPMF05L' '0700'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RF05L-ANZDT(w_rep)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=PK'.
          IF w_rep EQ 01.
            PERFORM bdc_dynpro      USING 'SAPMF05L' '0302'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'BSEG-ZUONR'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=AB'.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          w_chect+7(6).
           PERFORM bdc_field       USING 'BDC_OKCODE'
                                               '=ENTE'.
            w_rep = w_rep + 1.
          ELSE.
            PERFORM bdc_dynpro      USING 'SAPMF05L' '0300'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'BSEG-ZUONR'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=AB'.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          w_chect+7(6).
            PERFORM bdc_field       USING 'DKACB-FMORE'
                                    'X'.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'COBL-PRCTR'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=ENTE'.
            w_rep = w_rep + 1.
          ENDIF.
        ENDDO.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                       '=AE'.
        PERFORM call_transaction.
      ENDIF.
    FORM call_transaction .
      CALL TRANSACTION lv_tcode USING bdcdata
                         MODE   'N'
                         UPDATE 'S'
                         MESSAGES INTO messtab.
      REFRESH bdcdata.
    ENDFORM.                    " call_transaction
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.
    And I am getting Short Dump …..
    Runtime Error          DBIF_RSQL_INVALID_CURSOR
    Exception              CX_SY_OPEN_SQL_DB      
    Can any one help me ASAP.
    Thanks & Regards
    Rajendra

    HI,
    Actually I including this code in the RFFOUS_C Program, this pgm for Cheque printing Printing. After generate Cheques, in the Transaction FBO2 if we see the related Document. The Assignment field of all the line items must be filled with Cheque no. For this I included the above BDC code in the ZRFFOUS_C pgm. For this I am getting that short dump in the standard program coding selection statement.
    Thanks & Regards
    Rajendra

  • BDC Coding in a program

    Hi,
    I have done BDC recording and saved into a program. now i want to insert this coding in other program. what to do? what extra coding should i write there? i am also getting some parameter on the screen to run in which mode. i want that also to be disabled.  i searched forum but i was unable to get my requirement.

    HI,
    You are doing session method or call trans. method? if session methods means, first u need to run the program then go to session tcode and run from there , while running the session , u wil get the pop up with all information like background or foreground and with all screens or no screen all these information u wil get.
    In the call trans method, do the normal debugging....
    Reagrds,
    Bharani

  • Regarding bdc line items

    hi everybody,
                        how r u all.  i have a prob with bdc line items. all the fields r getting displayed in only one field.  tell me clearly how to handle bdc line items.
    Regards,
    sindhu.

    Hi,
    check this code for line items
    FORM POPULATE_BDC.
    DATA:L_COUNTER TYPE N,
             L_STRING TYPE STRING.
    LOOP AT IT_CUSTOMER.
    AT NEW KUNNR.
    CLEAR L_COUNTER.
          L_INDEX = SY-TABIX.
          READ TABLE IT_CUSTOMER INDEX L_INDEX.
    perform bdc_dynpro      using 'SAPMV10A' '0100'.
    perform bdc_field       using 'MV10A-KUNNR'
                                  IT_CUSTOMER-KUNNR.
    perform bdc_field       using 'MV10A-VKORG'
                                  IT_CUSTOMER-VKORG.
    perform bdc_field       using 'MV10A-VTWEG'
                                  IT_CUSTOMER-VTWEG.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    ENDAT.
    L_COUNTER = L_COUNTER + 1.
        CLEAR L_STRING.
    perform bdc_dynpro      using 'SAPMV10A' '0200'.
    CONCATENATE 'MV10A-MATNR(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using L_STRING
                            IT_CUSTOMER-MATNR.
    CONCATENATE 'MV10A-KDMAT(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using     L_STRING
                                     IT_CUSTOMER-KDMAT.
    CONCATENATE 'MV10A-MEGRU(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using   L_STRING
                                    IT_CUSTOMER-MEGRU.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *-- For Page down in Call Transaction Mode
        IF L_COUNTER = 14.
          CLEAR L_COUNTER.
          PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                                '=P+'.
        ENDIF.
    perform bdc_dynpro      using 'SAPMV10A' '0200'.
    CONCATENATE 'MV10A-SELKZ(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using L_STRING
                              IT_CUSTOMER-SELKZ.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SELE'.
    perform bdc_dynpro      using 'SAPMV10A' '0300'.
    perform bdc_field       using 'MV10A-KDMAT'
                                  IT_CUSTOMER-KDMAT.
    perform bdc_field       using 'MV10A-LPRIO'
                                  IT_CUSTOMER-LPRIO.
    perform bdc_field       using 'MV10A-ANTLF'
                                  IT_CUSTOMER-ANTLF.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/EBACK'.
    at end of kunnr.
    READ TABLE IT_CUSTOMER INDEX L_INDEX.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    CALL TRANSACTION 'VD51' USING IT_BDC MODE 'A' UPDATE 'S'
          MESSAGES INTO IT_MESSAGES.
          CLEAR IT_BDC.
          REFRESH IT_BDC.
    ENDAT.
      IF NOT IT_MESSAGES[] IS INITIAL.
        PERFORM FORMAT_MESSAGE.
      ENDIF.
    ENDLOOP.
    ENDFORM.                    " POPULATE_BDC
    regards,
    keerthi

  • Hi friends any one can reply this regarding Bdc

    HI friends,
    in bdc irrepsctive of screen resolution we use one structure is used .for table controls...
    can u kindly tell me what is that...i just forgotten...and if code avialable regarding that it much more useful.

    hi there..
    Following is a sample code of handling table control in BDC.
    REPORT Y730_BDC5 .
    *HANDLING TABLE CONTROL IN BDC
    DATA : BEGIN OF IT_DUMMY OCCURS 0,
           DUMMY(100) TYPE C,
           END OF IT_DUMMY.
    DATA : BEGIN OF IT_XK01 OCCURS 0,
           LIFNR(10) TYPE C,
           BUKRS(4)  TYPE C,
           EKORG(4)  TYPE C,
           KTOKK(4)  TYPE C,
           NAME1(30) TYPE C,
           SORTL(10) TYPE C,
           LAND1(3)  TYPE C,
           SPRAS(2)  TYPE C,
           AKONT(6)  TYPE C,
           FDGRV(2)  TYPE C,
           WAERS(3)  TYPE C,
           END OF IT_XK01,
           BEGIN OF IT_BANK OCCURS 0,
           BANKS(3)  TYPE C,
           BANKL(10) TYPE C,
           BANKN(10) TYPE C,
           KOINH(30) TYPE C,
           LIFNR(10) TYPE C,
           END OF IT_BANK.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
           IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = 'C:\VENDOR.TXT'
       FILETYPE                      = 'ASC'
    TABLES
       DATA_TAB                      = IT_DUMMY.
    LOOP AT IT_DUMMY.
      IF IT_DUMMY-DUMMY+0(2) = '11'.
        IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
        IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
        IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
        IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
        IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
        IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
        IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
        IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
        IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
        IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
        IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
        APPEND IT_XK01.
      ELSE.
        IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
        IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
        IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
        IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
        IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
        APPEND IT_BANK.
      ENDIF.
    ENDLOOP.
    LOOP AT IT_XK01.
    REFRESH IT_BDCDATA.
    perform bdc_dynpro      using 'SAPMF02K' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-REF_LIFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  IT_XK01-LIFNR.
    perform bdc_field       using 'RF02K-BUKRS'
                                  IT_XK01-BUKRS.
    perform bdc_field       using 'RF02K-EKORG'
                                  IT_XK01-EKORG.
    perform bdc_field       using 'RF02K-KTOKK'
                                  IT_XK01-KTOKK.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-TELX1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-NAME1'
                                  IT_XK01-NAME1.
    perform bdc_field       using 'LFA1-SORTL'
                                  IT_XK01-SORTL.
    perform bdc_field       using 'LFA1-LAND1'
                                  IT_XK01-LAND1.
    perform bdc_field       using 'LFA1-SPRAS'
                                  IT_XK01-SPRAS.
    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-KOINH(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    DATA : FNAM(20) TYPE C,
           IDX      TYPE C.
      MOVE 1 TO IDX.
    LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
      CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
      perform bdc_field       using FNAM
                                    IT_BANK-BANKS.
      CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
      perform bdc_field       using FNAM
                                    IT_BANK-BANKL.
      CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
      perform bdc_field       using FNAM
                                    IT_BANK-BANKN.
      CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
      perform bdc_field       using FNAM
                                    IT_BANK-KOINH.
      IDX = IDX + 1.
    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'
                                  IT_XK01-AKONT.
    perform bdc_field       using 'LFB1-FDGRV'
                                  IT_XK01-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'
                                  IT_XK01-WAERS.
    perform bdc_dynpro      using 'SAPMF02K' '0320'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'WYT3-PARVW(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    CALL TRANSACTION 'XK01' USING IT_BDCDATA
                            MODE  'A'
                           UPDATE 'S'
                         MESSAGES INTO IT_BDCMSGCOLL.
    ENDLOOP.
    FORM BDC_DYNPRO USING PROG SCR.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-PROGRAM = PROG.
      IT_BDCDATA-DYNPRO  = SCR.
      IT_BDCDATA-DYNBEGIN = 'X'.
      APPEND IT_BDCDATA.
    ENDFORM.
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-FNAM = FNAM.
      IT_BDCDATA-FVAL  = FVAL.
      APPEND IT_BDCDATA.
    ENDFORM.
    do reward if helpful

  • Regarding BDC for MB31

    Hi,
    Can anybody help me for  BDC CODE for MB31(Goods Receipt for Production Order).
    This is 1st time i am using BDC for MB31. I don't know how to do recording of MB31.
    How many fields are mandatory? Or Anyother way to create Good Receipt.(Like FM or BAPI)
    Thanks And Regards,
    Amit

    Hi Amit,
    Use following function module to create Goods receipt:
    MB_CREATE_GOODS_MOVEMENT
    The function module provides a general interface for posting goods movements.
    Hope this helps.
    Regards,
    Abhijeet

  • Regarding BDC for CO01

    Hi Friends,
    Can anybody help me for BDC CODE for CO01(Create production order).
    This is 1st time i am using BDC for CO01. I don't know how to do recording of CO01.
    How many fields are mandatory? Or Anyother way to Create production orde.(Like FM or BAPI)
    Thanks And Regards,
    Amit

    Amit,
    Here is a trick (you can treat it as method) to know mandatory fields for BDC method.
    1. Go to your transaction code, I guess you are working 'co01'.
    2. Press 'Enter' on the screen, you would be asked to enter value for a field-enter correct value and then press enter, next you may be asked to enter value for another field....continue until you don't get any error/warning.
    3. You will be taken to next/second screen if you were successful entering correct values in the first screen.
    4. Mean while, note down those fields that you have filled.
    5. Follow above steps until you are done with all screens.
    6. Next you can start recording from T.Code 'SHDB'.
    Reply to the post if you have any question in the explanation.

  • Doubt regarding BDC

    Hi all,
    I developed a BDC.
    Client had asked for a requirement  tat while uploading an excel for eg of 1000 records, and if ter is an error in the 600th record ,as of now it will throw error,but tey were telling BDC shud not stop ter,else it shud discard that particular record and shud continue processing. and at the end it shud display in the output which all wer the recored with error.
    Is this possible n if so how..?
    Please reply..
    Thanks in Advance
    Nitin

    Hi,
    I consider u hv collected all the 1000 records in the excel file into an internal table called it_upload.
    Loop at it_upload into wa_upload.
    *write the BDC code for e.g.,
    PERFORM bdc_dynpro      USING 'SAPMV86E' '0601'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SICH'.
          PERFORM bdc_field       USING 'BDC_SUBSCR'
                                        'SAPMV86E'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RV86E-KOMMA'.
          PERFORM bdc_field       USING 'RV86E-DAT_STATA'
                                        sy-datum.
          PERFORM bdc_field       USING 'RV86E-ZET_STATA'
                                        '00:00:00'.
          PERFORM bdc_field       USING 'RV86E-KOMMA'
                                        wa_upload-vbeln.
    CALL TRANSACTION <tcode> USING it_bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsg.
    COMMIT WORK.
    LOOP AT it_bdcmsg INTO wa_bdcmsg.
            IF wa_bdcmsg-msgtyp = 'S'.
              MOVE wa_bdcmsg-msgv1 TO wa_error.
            ENDIF.
            APPEND  wa_error TO it_error.
    ENDLOOP.
    ENDLOOP.
    Hope this helps.
    Regards,
    Arnab.

  • Regarding BDC's, BAPI's, ALE ,IDOCs, BADI's

    Hi all,
    can any one send materials with screen shots having example programs
    for BDC's, BAPI's, ALE ,IDOCs, BADI's
    to my mail id
    <b><REMOVED BY MODERATOR></b>
    regards and thanks
    venu
    Message was edited by:
            Alvaro Tejada Galindo

    hi
    For BDC:
    http://myweb.dal.ca/hchinni/sap/bdc_home.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    Check these link:
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    http://www.planetsap.com/bdc_main_page.htm
    call Transaction or session method ?
    http://www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_DATADICTIONARY_FAQ.html
    http://www.****************/InterviewQ/interviewQ.htm
    http://help.sap.com/saphelp_46c/helpdata/en/35/2cd77bd7705394e10000009b387c12/frameset.htm
    ALE/ IDOC
    http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/sapedi/idoc_abap.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap.html
    http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.allsaplinks.com/idoc_sample.html
    Check these step-by-step links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    BAPI
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    List of all BAPIs
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    <b><REMOVED BY MODERATOR></b>
    regards
    Nagesh.Paruchuri
    Message was edited by:
            Alvaro Tejada Galindo

  • Please help regarding PLSQL coding standards

    Hi,
    Can you please send any document for PL/SQL coding standards,
    Please help.. I did nt find any good resources on net regarding..
    Pleease help me if any pdf regarding are exitst to my mail id
    [email protected]
    Thanks and Regards
    asp

    I did nt find any good resources on net regarding..Here is a list from the net for you to start with (courtesy of many of the fellow posters here in these forums), and there will be plenty more. Just need to search correctly.
    http://www.redhat.com/docs/manuals/waf/rhea-dg-waf-en-6.0/ap-sql-standards.html
    http://www.orafaq.com/faqplsql.htm
    http://www.williamrobertson.pwp.blueyonder.co.uk/documents/plsqlcodingstandards.html
    http://www.orafaq.com/node/48
    http://apex.oracle.com/pls/otn/f?p=2853:4:11598658413321972351::NO::P4_QA_ID:3262
    http://www.bbc.co.uk/guidelines/newmedia/technical/databases.shtml
    Message was edited by:
    Kamal Kishore
    Message was edited by:
    Kamal Kishore

  • Regarding BDC session

    Hi
    i am processing my BDC pro. in Session method.
    my requirement is i have to capture the error records into a file
    and i have to write that file on appl. server.
    how to capture the error records from error log?
    please reply

    Hai  Saritha,
    Usually if there are any errors in CALL TRANSACTION we send those records to SESSION METHOD by using below logic.
    eg:
    CALL TRANSACTION 'XK01' USING
    t_bdcdata MODE 'N' .
    IF sy-subrc 0.
    PERFORM session_bdc.
    ENDIF.
    ENDLOOP.
    IF s_flag = 'X'.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    ENDIF.
    This is subroutine .
    FORM session_bdc .
    IF s_flag = ' '.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    client = sy-mandt
    group = 'vcentric'
    holddate = filler8
    keep = 'X'
    user = sy-uname
    prog = sy-cprog.
    s_flag = 'X'.
    ENDIF.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    tcode = 'XK01'
    TABLES
    dynprotab = t_bdcdata.
    ENDFORM. " SESSION_BDC
    or we can send the error records on into an flat file by using the below logic.
    CALL TRANSACTION 'XK01' USING
    T_BDCDATA MODE 'N' MESSAGES INTO T_BDCMSG.
    IF SY-SUBRC 0.
    APPEND W_UPLOAD TO T_ERROR.
    ENDIF.
    CLEAR W_BDCMSG.
    READ TABLE T_BDCMSG INTO W_BDCMSG INDEX 1.
    CLEAR L_MSG.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = W_BDCMSG-MSGID
    LANG = SY-LANGU
    NO = W_BDCMSG-MSGNR
    V1 = W_BDCMSG-MSGV1
    V2 = W_BDCMSG-MSGV2
    V3 = W_BDCMSG-MSGV3
    V4 = W_BDCMSG-MSGV4
    IMPORTING
    MSG = L_MSG
    EXCEPTIONS
    NOT_FOUND = 1
    OTHERS = 2.
    IF SY-SUBRC = 0.
    WRITE:/ W_UPLOAD-NAME1, '----', L_MSG.
    ENDIF.
    ENDLOOP.
    this is subroutine.
    FORM ERROR_RECORDS .
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = 'C:/ERROR.TXT'
    FILETYPE = 'ASC'
    WRITE_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = T_ERROR.
    ENDFORM. " ERROR_RECORDS
    Reward is useful.
    Regards.
    Eshwar.

  • Plz help with BDC coding

    Hi,
    In the QM view of mm02 I have 5 rows containing inspection types 1,2,5,7,15. When I do the BDC recording to delete insp type 5, the BDC cursor is on position (03) RMQAM-SELEKT(03). How do I write the BDC code to select the row based on inspection type. RMQAM-ART(05) where ART is the insp type field selects row 5 which has insp type 15.
    Regards,
    bindazme

    Hi,
    What I understand from the your question is that you want to make changes on a particular row but in recording that row is shown as (03) or (05) and likewise.
    What I can suggest is that there must be a line number for the row which you want to change.Also line number field must also have an entry in the respective field.If you observe closely the recordings have a pattern of 03 for line 30 05 for line item 50 and so on.You can read that line item field from the table itself and then divide it by 10 to get the correct number.Store it in  a variable.Make sure that the variable type is such so that ypu get 03 and not just 3(use type i).Then concatenate the entire text for the bdc cursor using the variable and then use it in you program.
    Hope it works,
    Thanks,
    Sandeep.

  • Regarding BDC with RFC Enabled FM

    Hi,
    When we run BDC with function module, I believe its the session method, but after the program is run I do not see any session in SM35, even if I KEEP THE SESSION ('X'). I am using the following function mod. however the data is being updated.
    CALL FUNCTION 'Z_FM_Z1_REC'
       EXPORTING
         mode                 = 'N'
       UPDATE               = 'A'
         group                = s_name
       USER                 = sy-uname
       KEEP                 = 'X'
       HOLDDATE             = h_date
      NODATA               = '/'
       MATNR_001            = i_tab-matnr
       MBRSH_002            = i_tab-mbrsh
       MTART_003            = i_tab-mtart
       KZSEL_01_004         = 'X'
       MAKTX_005            = i_tab-maktx
       MEINS_006            = i_tab-meins
       MTPOS_MARA_007       = 'NORM'
    IMPORTING
       SUBRC                = subrc
    TABLES
       MESSTAB              = messtab  .
    Also, this FM is RFC enabled but does not work, any idea why ?
    Thirdly, where is this session data stored (database table).
    Thanks!
    "Max Points Are Assured for Most Appropriate Answers"

    Hi,
    Answer to Q1) You need to check the content of your custom FM... Check if you have used BDC_OPEN_GROUP, BDC_INSERT and BDC_CLOSE_GROUP to generate the session... it is NOT the question with the FM that you are using...
    First, try using the above mentioned FMs to generate session... if it works (and it should), then put them into your custom FM.
    Answer to Q2) The table for storing all the BDC sessions is APQI.
    Regards, Tapas
    <Allot points pls if it solves your problem>

  • Regarding bdc for automatic run

    hi experts,
                    i have developed a bdc for hr in which the data is uploading from the excel sheet,what my user wants that this report will run automatically at 11 pm every day so for this send me the steps for this i know i have to exceute it in the background but how plz help me ...
    ***plz dnt send me the url come up with your own answer....
    thnx in advance.....

    Hi RAVI,
    if u've created the BDC in call transaction method, then create a variant for the selection screen with the relevant data. and create a scheduled job from SM36.
    in case of session: u need to schedule the two programs in SM36.
    1st the bdc program to create the session and next the program RSBDCSUB with variants. in case of scheduling RSBDCSUB session name & other details should be saved in the variants.
    Reward if useful
    Regards
    ANUPAM

Maybe you are looking for

  • Can I install an OS to a serial drive

    Hi a friend of mine is building a system almosty identical to mine except he only has an s-ata drive. The problem arises with the fact that windows install (2K and XP) procedure won't recognise his drive despite loading the driver from the floppy. I

  • I am using Leopard but need  Mountain Lion for the Mac App Store.  How do I get Snow Leopard to be able to upgrade to Mountain Lion?

    I am currently using Leopard but need Snow Leopard to be able to get Mountain Lion. I can see this is no longer available from Apple.  How would I get it so I could then get Mountain Lion. I want the Logic 9 Mac App Store App as I don't want to have

  • Player Exception quick Help

    Hi i have a code to see through the webcam import javax.media.Manager; import javax.media.MediaLocator; import javax.media.Player; import javax.swing.*; import java.awt.Component; public class SwingCapture {      public static void main(String[] args

  • Exporting as html

    Forgive me for being new and inexperienced with both Fireworks and this forum, but I am having trouble exporting a fireworks png file to dreamweaver. Tghe file is showing up in DW but we are having trouble manipulating it. sssThe FW file itself is ki

  • HT1311 i can't change apple id in app store

    I can' change apple id in app store