Multiple line items in BDC

Hi Friends
I'm doing a BDC .... in the recording I have found that I've to change different line items.. the part of recording in which I'm facing problem is as below:
BDC_CURSOR     VBAP-ABGRU(06)
VBAP-ABGRU(01)     10
VBAP-ABGRU(02)     10
VBAP-ABGRU(03)     10
VBAP-ABGRU(04)     10
VBAP-ABGRU(05)     10
VBAP-ABGRU(06)     10
now I have counted the item nos in a variable v_count. While filling the internal table of BDCdata how will i approach to fill different line items here as shown above.. for 1 item I have no prob....but for n no of items what will be the code of filling bdctab... please let me know....
Thanks
Moumita

Hi moumita ....
Plz have a look......
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, 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
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.
Sample code
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.
Regards Kaushik Datta

Similar Messages

  • ME21n Multiple line items

    Hi all,
    I wana pass multiple line items thru bdc me21n....can any1 please help me .if u guys have some code can mail me at [email protected] will be rewarded.
    my code below is not working for passing multiple items.
    report y1_po_test
           no standard page heading line-size 255.
    tables: mara,
            lfa1,
            eina,
            eine,
            eban,
            zdrgsah, zdrgsap,
            zdrgsup,
            t100,
            ekko,
            a004, zprice_grpsal, mvke.
    *Internal Table to get the input Data
    data: begin of i_input occurs 0,
            matnr like ekpo-matnr,
            asqty like ekpo-menge,
            ebeln like ekpo-ebeln,
            posnr(5),
           posnr like zdrgsap-posnr,
            invno like zdrgsap-invno,
            invdt like zdrgsah-invdt,
            netpr like zdrgsap-netpr,
            cntno like zdrgsap-cntno,
            shcnm like zdrgsah-shcnm,
            apcno like zdrgsap-apcno,
            spcno like zdrgsap-spcno,
            werks like ekpo-werks,
            lgort like ekpo-lgort,
            matkl like ekpo-matkl,
            pack(10),
            mvgr2 like mvke-mvgr2,
           dpric type p decimals 6 ,
           gpric type p decimals 6,
            end of i_input.
    data: begin of i_inputxt occurs 0,
            matnr(18) ,
            asqty(13) ,
            ebeln(10) ,
            posnr(6)  ,
            invno(10) ,
            invdt(8)  ,
            netpr(11) ,
            cntno(11) ,
            shcnm(10) ,
            werks(4) ,
            lgort(4) ,
            matkl(9) ,
            pack(10),
            end of i_inputxt.
    data: begin of i_error occurs 0,
            prnum like eban-banfn,
            pritm like eban-bnfpo,
            inmat like mara-matnr,
            prmat like mara-matnr,
            asqty like zdrgsap-asqty,
            prqty like eban-menge,
            remak(100),
           remark(255) type c,
          end of i_error.
    data : begin of i_error1 occurs 0,
            prnum like eban-banfn,
            pritm like eban-bnfpo,
            asqty like zdrgsap-asqty,
            prqty like eban-menge,
            remak(100),
            end of i_error1.
    data : begin of i_zsap occurs 0,
           ebeln like zdrgsap-ebeln,
           posnr(5),
           menge like zdrgsap-menge,
           asqty like zdrgsap-asqty,
           end of i_zsap.
    data : v_ebeln like eket-ebeln.
    data : begin of i_a004 occurs 0,
           matnr like a004-matnr,
           knumh like a004-knumh,
           kbetr like konp-kbetr,
           end of i_a004,
           i_a0041 like i_a004 occurs 0 with header line.
    data : begin of i_konp occurs 0,
           knumh like konp-knumh,
           kbetr like konp-kbetr,
          konwa like konp-konwa,
           end of i_konp.
    data : begin of i_konp1 occurs 0,
           knumh like konp-knumh,
           kbetr like konp-kbetr,
           konwa like konp-konwa,
           end of i_konp1.
    data : begin of i_netpr occurs 0,
           ebeln like eket-ebeln,
           ebelp like eket-ebelp,
           matnr like ekpo-matnr,
           menge like ekpo-menge,
           netpr like ekpo-netpr,
          kbetr like konp-kbetr,
           end of i_netpr.
    data : begin of i_grpsal occurs 0,
           pcode like zprice_grpsal-pcode,
           fact like zprice_grpsal-fact,
           wfact like zprice_grpsal-wfact,
           end of i_grpsal.
    data : begin of i_domsal occurs 0,
           pcode like zprice_grpsal-pcode,
           fact like zprice_grpsal-fact,
           wfact like zprice_grpsal-wfact,
           end of i_domsal.
    data : begin of i_zsap1 occurs 0,
           ebeln like zdrgsap-ebeln,
           posnr(5),
           asqty like zdrgsap-asqty,
           end of i_zsap1.
    data: begin of bdcdata occurs 0.
            include structure bdcdata.       " Batch input: New table field
    data: end of bdcdata.
          messages of call transaction
    data:   messtab like bdcmsgcoll occurs 0 with header line.
    data: i_mara type mara occurs 0 with header line,
          i_eina like eina occurs 0 with header line,
          i_eine like eine occurs 0 with header line.
    data : begin of i_inferr occurs 0,
           matnr like eina-matnr,
           infnr like eina-infnr,
           werks like eine-werks,
           end of i_inferr.
    data : begin of i_inferrc occurs 0,
           matnr like eina-matnr,
           end of i_inferrc.
    *Data declaration.
    data: v_file     type string,           " Variable for uploading file
          v_item(5)  type c,             " Line item number
          v_itno(2)  type n,
          p_wkurs like zdrgkurs-wkurs,
          v_matnr(20)    type c,
          v_menge(20)    type c,
          v_banfn(20)    type c,
          v_bnfpo(20)    type c,
          v_bednr(20)    type c,
          v_werks(20),
          p_lifnr(10) ,
          v_flag,
          p_lifnrtxt(10),
          p_wkurstxt(9),
          p_bsartxt(4),
          v_posnr(5), n type i,
          v_quant(13),
          v_asqty(13),
          v_prqty(13),
          v_apcno(6),
          v_spcno(4),
          v_itm(11),
          v_cnt type i,
          v_cntno(4),
          v_pack(10),
          v_order(15),
          v_lifnr(10),
          v_invdt like sy-datum,
          v_waers like ekko-waers,
          v_podat like ekko-bedat,
          v_docdt1 like sy-datum,
          v_docdt(10),
          v_fnam(132).
    data : begin of i_test occurs 0,
           bnfpo like eban-bnfpo,
           matnr like eban-matnr,
           menge like eban-menge,
           bsmng like eban-bsmng,
           end of i_test.
    data : begin of i_mvke occurs 0,
           matnr like mvke-matnr,
           mvgr2 like mvke-mvgr2,
           end of i_mvke.
    data : begin of i_invno,
           ebeln like ekko-ebeln,
           angnr like ekko-angnr,
           end of i_invno.
    data : i_final like zinvdiff occurs 0 with header line.
    Constants
    constants : c_pd01 like eine-werks value 'PD01'.
    *Selection Screen Declarations
    selection-screen begin of block b1 with frame title text-010.
    parameters: p_invno like zdrgsah-invno obligatory,
                p_bsart like ekko-bsart obligatory.
    selection-screen end of block b1.
    start-of-selection.
    To Upload the data into Internal table.
      perform f_upload_data.
    To Validate the input data.
      perform f_check_data.
    if i_error[] is not initial or i_error1[] is not initial.
    To display the error message
       perform f_display_errors.
    else.
    To create PO
      perform f_process_session.
    endif.
      perform f_check_calc_price.
      perform f_display_data.
    perform f_update_zinvdiff.
    *&      Form  f_get_filename
          text
    form f_get_filename.
    endform.                                 " F_get_filename
    *&      Form  f_upload_data
    form f_upload_data .
      select matwa as matnr asqty ebeln posnr b~invno invdt netpr cntno
        shcnm apcno spcno into table i_input
             from zdrgsah as a join zdrgsap as b on
             a~invno = b~invno
             where b~invno eq p_invno.
      select ebeln
             posnr
             menge
             asqty
             from zdrgsap into table i_zsap
             where invno = p_invno.
      loop at i_zsap.
        concatenate i_zsap-posnr(4) '0' into v_posnr.
        i_zsap1-ebeln = i_zsap-ebeln.
        i_zsap1-posnr = v_posnr.
        i_zsap1-asqty = i_zsap-asqty.
        collect i_zsap1.
        clear i_zsap1.
      endloop.
      delete adjacent duplicates  from i_zsap comparing posnr menge .
    delete adjacent duplicates  from i_input comparing ebeln  posnr.
      loop at i_input.
       p_werks = i_input-werks.
        v_invdt = i_input-invdt.
        call function 'CONVERT_DATE_FORMAT'
          exporting
            i_date      = v_invdt
          importing
            e_calc_date = v_invdt.
        if i_input-apcno is initial.
          v_apcno = '0000'.
        else.
          v_apcno = i_input-apcno.
        endif.
        if i_input-spcno is initial.
          v_spcno = '0000'.
        else.
          v_spcno = i_input-spcno.
        endif.
        if i_input-cntno is initial.
          i_input-cntno = '0000'.
        endif.
        concatenate v_apcno v_spcno into i_input-pack.
       concatenate v_pack v_cntno into v_order separated by '-'.
       i_input-order = v_order.
        clear : v_itm, v_cnt, v_cntno, v_pack, v_apcno, v_spcno, v_order.
        concatenate i_input-posnr(4) '0' into v_posnr.
        select single lifnr into p_lifnr from zdrgsup
       where shcnm = i_input-shcnm.
        v_lifnr = p_lifnr.
        if sy-subrc <> 0.
          message e000(zcnc) with text-002.
        endif.
        select single * from eban
           where banfn eq i_input-ebeln
           and   bnfpo eq v_posnr.
        if sy-subrc eq 0.
          move eban-werks to i_input-werks.
          move eban-lgort to i_input-lgort.
          move eban-matkl to i_input-matkl.
          move eban-bnfpo to i_test-bnfpo.
          move eban-matnr to i_test-matnr.
          move eban-menge to i_test-menge.
          move eban-bsmng to i_test-bsmng.
          modify i_input.
          if not i_input-matnr eq i_test-matnr.
            move i_input-ebeln to i_error-prnum.
            move v_posnr to i_error-pritm.
            move i_input-matnr to i_error-inmat.
            move eban-matnr to i_error-prmat.
            i_error-remak = 'Material does not match'.
            append i_error.
            clear i_error.
          endif.
          v_quant = i_test-menge - i_test-bsmng.
          read table i_zsap1 with key ebeln = i_input-ebeln posnr = v_posnr.
          if not i_zsap1-asqty <= v_quant.
            move i_input-ebeln to i_error1-prnum.
            move i_zsap1-posnr to i_error1-pritm.
            move i_zsap1-asqty to i_error1-asqty.
           move eban-menge to i_error1-prqty.
            move v_quant to i_error1-prqty.
            i_error1-remak = 'Material Quantity does not match'.
            append i_error1.
            clear i_error1.
          endif.
          select single matnr infnr from eina
               into corresponding fields of i_eina
               where matnr eq i_input-matnr
               and lifnr eq p_lifnr.
          if sy-subrc = 0.
            append i_eina.
            check not i_eina[] is initial.
            select single * from eine
                   into  i_eine
                   where infnr eq i_eina-infnr
                   and werks eq eban-werks.
            if sy-subrc <> 0.
              move i_input-matnr to i_inferr-matnr.
              move i_eina-infnr to i_inferr-infnr.
              move eban-werks to i_inferr-werks.
              append i_inferr.
              clear i_inferr.
            endif.
          else.
            move i_input-matnr to i_inferrc-matnr.
            append i_inferrc.
            clear i_inferrc.
          endif.
          clear : i_eina, i_eine.
          clear :  i_zsap, i_zsap1,  i_input,  v_posnr,
                  v_quant, i_test.
        endif.
      endloop.
      delete adjacent duplicates from i_error1 comparing prnum pritm.
      perform chk_info_rec.
    endform.                    " f_upload_data
    *&      Form  f_check_data
    form f_check_data .
      if not i_input[] is initial.
        select * from mara
        into table i_mara
        for all entries in i_input
        where matnr eq i_input-matnr.
      endif.
      loop at i_mara.
        read table i_input with key matnr = i_mara-matnr.
        if sy-subrc <> 0.
          write : 'Following Part Numbers are not found in MARA'.
          write : / i_input-matnr.
        endif.
      endloop.
      if i_mara[] is initial.
        loop at i_input.
          format color col_heading intensified off.
          write : 'Following Part Numbers are not found in MARA'.
          format color col_normal intensified off.
          write : / i_input-matnr.
        endloop.
      endif.
      select single wkurs into p_wkurs from zdrgkurs
        where invno = p_invno.
      if sy-subrc ne 0.
        message e000(zcnc) with text-s11.
      endif.
      call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
        exporting
          input  = p_lifnr
        importing
          output = p_lifnr.
      p_lifnrtxt = p_lifnr.
      p_wkurstxt = p_wkurs.
      p_bsartxt = p_bsart.
      loop at i_input.
        move-corresponding i_input to i_inputxt.
        append i_inputxt.
      endloop.
      select single ebeln
                    angnr from ekko
                    into i_invno
                    where angnr = p_invno.
      if sy-subrc = 0.
        perform display_err.
      endif.
    endform.                    " f_check_data
    *&      Form  f_process_session
          text
    form f_process_session.
      v_docdt1 = sy-datum.
      write v_docdt1 to v_docdt using edit mask '__.__.____'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=MEDOCTYPE'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MEPO_TOPLINE-BSART'.
      perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                     p_bsartxt.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'MEPO_TOPLINE-SUPERFIELD'
                                     p_lifnrtxt.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MEPO1222-BUKRS'.
      perform bdc_field       using 'MEPO1222-EKORG'
                                    'SBAP'.
      perform bdc_field       using 'MEPO1222-EKGRP'
                                    'PG1'.
      perform bdc_field       using 'MEPO1222-BUKRS'
                                    'SBA'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=TABHDT2'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                     p_bsartxt.
      perform bdc_field       using 'MEPO_TOPLINE-SUPERFIELD'
                                     p_lifnrtxt.
    ********************conditions***************************************
      perform bdc_field       using 'BDC_CURSOR'
                                    'KOMV-KSCHL(08)'.
      perform bdc_field       using 'KOMV-KSCHL(07)'
                                     'zot1'.
      perform bdc_field       using 'KOMV-KSCHL(08)'
                                    'zinc'.
      perform bdc_field       using 'KOMV-KSCHL(09)'
                                    'ziv1'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=V69A_KOAN'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'KOMV-KSCHL(01)'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'KOMV-KSCHL(02)'
                                    'zca1'.
      perform bdc_field       using 'KOMV-KSCHL(03)'
                                    'zfa1'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=TABHDT7'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'KOMV-KSCHL(09)'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MEPO1229-IHRAN'.
      perform bdc_field       using 'MEPO1229-ANGNR'
                                     p_invno.
      perform bdc_field       using 'MEPO1229-IHRAN'
                                     v_invdt.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=MEV4001BUTTON'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MEPO1229-IHRAN'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=MEV4000BUTTON'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MEPO1229-IHRAN'.
      perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
    loop at i_inputxt.
       concatenate i_inputxt-posnr(4) '0' into v_posnr.
       concatenate 'MEPO1211-EMATN(' v_itno ')' into v_matnr.
       concatenate 'MEPO1211-MENGE(' v_itno ')' into v_menge.
       concatenate 'MEPO1211-BANFN(' v_itno ')' into v_banfn.
       concatenate 'MEPO1211-BNFPO(' v_itno ')' into v_bnfpo.
       concatenate 'MEPO1211-BEDNR(' v_itno ')' into v_bednr.
       concatenate 'MEPO1211-WERKS(' v_itno ')' into v_werks.
       v_item = v_item + 10.
       endif.
       v_itno = v_itno + 1.
       perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
       perform bdc_field       using 'BDC_OKCODE'
                                     '/00'.
       perform bdc_field       using 'BDC_CURSOR'
                                      v_matnr.
       perform bdc_field       using  v_matnr "'MEPO1211-EMATN(01)'
                                      i_inputxt-matnr.
       perform bdc_field       using  v_menge "'MEPO1211-MENGE(01)'
                                      i_inputxt-asqty.
       perform bdc_field       using  v_banfn "'MEPO1211-BANFN(01)'
                                      i_inputxt-ebeln.
       perform bdc_field       using  v_bnfpo "'MEPO1211-BNFPO(01)'
                                      i_inputxt-posnr.
       perform bdc_field       using 'DYN_6000-LIST'
                                      v_itno.
      loop at i_inputxt .
        v_itno = sy-tabix.
        clear v_fnam.
        concatenate 'MEPO1211-EMATN('  v_itno ')' into v_fnam.
        perform bdc_field       using v_fnam
                                      i_inputxt-matnr.
        clear v_fnam.
        concatenate 'MEPO1211-MENGE('  v_itno ')' into v_fnam.
        perform bdc_field       using v_fnam
                                           i_inputxt-asqty.
        clear v_fnam.
        concatenate 'MEPO1211-BANFN('  v_itno ')' into v_fnam.
        perform bdc_field       using v_fnam
                                           i_inputxt-ebeln.
        clear v_fnam.
        concatenate 'MEPO1211-BNFPO('  v_itno ')' into v_fnam.
        perform bdc_field       using v_fnam
                                           i_inputxt-posnr.
        perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
        perform bdc_field       using 'BDC_OKCODE'
                                          '/00'.
      endloop.
    loop at i_inputxt from 6.
       v_itno = sy-tabix.
       clear v_fnam.
       concatenate 'MEPO1211-EMATN('  v_itno ')' into v_fnam.
       perform bdc_field       using v_fnam
                                     i_inputxt-matnr.
       clear v_fnam.
       concatenate 'MEPO1211-MENGE('  v_itno ')' into v_fnam.
       perform bdc_field       using v_fnam
                                          i_inputxt-asqty.
       clear v_fnam.
       concatenate 'MEPO1211-BANFN('  v_itno ')' into v_fnam.
       perform bdc_field       using v_fnam
                                          i_inputxt-ebeln.
       clear v_fnam.
       concatenate 'MEPO1211-BNFPO('  v_itno ')' into v_fnam.
       perform bdc_field       using v_fnam
                                          i_inputxt-posnr.
       perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
       perform bdc_field       using 'BDC_OKCODE'
                                         '/00'.
    endloop.
    perform bdc_field       using 'BDC_CURSOR'
                                   'MEPO1320-SLFDT(01)'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=TABHDT2'.
    perform bdc_field       using 'DYN_6000-LIST'
                               '                                      2'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=V69A_KOAK'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'KOMV-KBETR(05)'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=MECHECKDOC'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'KOMV-KSCHL(01)'.
    perform bdc_dynpro      using 'SAPMSSY0' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                   '04/03'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=&ONT'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=MEV4000BUTTON'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'MEPO_TOPLINE-BSART'.
    perform bdc_field       using 'DYN_6000-LIST'
                               '                                      2'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'KOMV-KBETR(08)'.
    perform bdc_field       using 'KOMV-KBETR(03)'
                                   '             .54'.
    perform bdc_field       using 'KOMV-KBETR(08)'
                                   '             .54'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=MESAVE'.
    perform bdc_field       using 'BDC_CURSOR'
                                   'MEPO1211-NETPR(01)'.
      perform bdc_transaction using 'ME21N'.
    endform.                    "f_process_session
    *&      Form  bdc_transaction
          text
         -->P_0464   text
    form bdc_transaction  using    tcode.
      data: l_mstring(480).
      data: l_subrc like sy-subrc.
      data: v_mode type c.
      v_mode = 'A'.
      refresh messtab.
      call transaction tcode using bdcdata
                       mode  v_mode
                       update 'S'
                       messages into messtab.
      l_subrc = sy-subrc.
         WRITE: / 'CALL_TRANSACTION',
                  TCODE,
                  'returncode:'(I05),
                  L_SUBRC,
                  'RECORD:',
                  SY-INDEX.
      loop at messtab.
        select single * from t100 where sprsl = messtab-msgspra
                                  and   arbgb = messtab-msgid
                                  and   msgnr = messtab-msgnr.
        if sy-subrc = 0.
          l_mstring = t100-text.
          if l_mstring cs '&1'.
            replace '&1' with messtab-msgv1 into l_mstring.
            replace '&2' with messtab-msgv2 into l_mstring.
            replace '&3' with messtab-msgv3 into l_mstring.
            replace '&4' with messtab-msgv4 into l_mstring.
          else.
            replace '&' with messtab-msgv1 into l_mstring.
            replace '&' with messtab-msgv2 into l_mstring.
            replace '&' with messtab-msgv3 into l_mstring.
            replace '&' with messtab-msgv4 into l_mstring.
          endif.
          condense l_mstring.
          if messtab-msgtyp eq 'E' or messtab-msgtyp eq 'W'.
            write: / messtab-msgtyp, l_mstring(250).
          endif.
          search  l_mstring for 'SEA'.
          if sy-subrc = 0.
            write: / messtab-msgtyp, l_mstring(250).
          endif.
        else.
          write: / messtab.
        endif.
      endloop.
    endform.                    " bdc_transaction
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.                    "BDC_DYNPRO
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> space.
        clear bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        append bdcdata.
      endif.
    endform.                    "BDC_FIELD
    *&      Form  f_display_errors
    form f_display_errors .
      if i_error[] is not initial.
        format color col_heading intensified off.
        uline .
        write :/ 'PR No     ',
                (10) 'Item No',
                (20) 'PR Part No',
                (30) 'Invoiced Part No',
                (60) 'Remark'.
        uline .
        loop at i_error.
          perform f_display_color.
          write :/ i_error-prnum,
                  (10) i_error-pritm ,
                  (20) i_error-prmat,
                  (30) i_error-inmat,
                  (60) i_error-remak.
          clear i_error.
        endloop.
      endif.
      if i_error1[] is not initial.
        format color col_heading intensified off.
        uline .
        write :/ 'PR No     ',
                (10) 'Item No',
                (20) 'PR Quantity',
                (30) 'Invoiced Quantity',
                (60) 'Remark'.
        uline .
        loop at i_error1.
          perform f_display_color.
          if not i_error1-asqty is initial.
            v_asqty = i_error1-asqty .
            v_prqty = i_error1-prqty.
            write :/ i_error1-prnum,
                (10) i_error1-pritm ,
                (20) v_prqty,
                (30) v_asqty,
                (60) i_error1-remak.
            clear : v_asqty, v_prqty.
          endif.
          clear i_error1.
        endloop.
      endif.
    endform.                    " f_display_errors
    *&      Form  f_display_color
    form f_display_color .
      if v_flag = 0.
        format color col_normal intensified on.
        v_flag = 1.
      elseif v_flag = 1.
        format color col_normal intensified off.
        v_flag = 0.
      endif.
    endform.                    " f_display_color
    *&      Form  display_err
          text
    -->  p1        text
    <--  p2        text
    form display_err .
      format color col_heading intensified off.
    write (120) text-006.
      uline .
      write : 'PR No     ',
              (15) 'Invoice No',
              (30) 'Remark'.
      uline.
      format color col_negative intensified off.
      write :/ i_invno-ebeln,
          (15) p_invno ,
          (30) 'Invoice Already Exists'.
    endform.                    " display_err
    *&      Form  f_check_calc_price
          text
    -->  p1        text
    <--  p2        text
    form f_check_calc_price .
      data : d_pric type p decimals 6 ,
             g_pric type p decimals 6,
             v_exch type p decimals 4 value '0.1049'.
      select single ebeln
                    waers
                    bedat
                    from ekko into  (v_ebeln , v_waers , v_podat)
                    where angnr eq p_invno.
      loop at i_input.
        concatenate i_input-posnr(4) '0' into v_posnr.
        select single p~ebeln
               p~ebelp
               matnr
               p~menge
               netpr
               into  i_netpr
               from eket as t inner join ekpo as p
               on t~ebeln eq p~ebeln
               and t~ebelp eq p~ebelp
               where t~ebeln eq v_ebeln
               and   t~banfn eq i_input-ebeln
               and   t~bnfpo eq v_posnr.
        if v_waers eq 'JPY'.
          i_netpr-netpr = i_netpr-netpr * 100.
        endif.
        if not i_input-netpr eq i_netpr-netpr.
          append i_netpr.
          clear : i_input, i_netpr, v_posnr.
        else.
          clear : i_input, i_netpr, v_posnr.
        endif.
      endloop.
      delete adjacent duplicates from i_netpr comparing ebeln ebelp matnr.
       modify zinvdiff from table i_final.
      if i_netpr[] is not initial.
        select matnr
               knumh
               from a004
               into table i_a004
               for all entries in i_netpr
               where matnr = i_netpr-matnr
               and kschl = 'ZPR0'
               and vkorg = 'SBAP'
               and vtweg = 'DD'
               and ( datab <= sy-datum and  datbi => sy-datum ).
        select  matnr
                knumh
                from a004
                into table i_a0041
                for all entries in i_netpr
                where matnr = i_netpr-matnr
                and kschl = 'ZPR0'
                and vkorg = 'EXPT'
                and vtweg = 'BR'
                and ( datab <= sy-datum and  datbi => sy-datum ).
        select matnr mvgr2 from mvke
               into  corresponding fields of table i_mvke
               for all entries in i_netpr
               where matnr = i_netpr-matnr
               and vkorg = 'SBAP'
               and vtweg = 'DD'.
        if i_a004[] is not initial.
          select  knumh
                  kbetr
                  from konp
                  into table i_konp
                  for all entries in i_a004
                  where knumh =  i_a004-knumh.
          loop at i_a004.
            read table i_konp with key knumh = i_a004-knumh.
            i_konp-kbetr =  i_konp-kbetr / 10.
            move i_konp-kbetr to i_a004-kbetr.
            modify i_a004.
            clear : i_konp, i_a004.
          endloop.
        endif.
        if i_a0041[] is not initial.
          select  knumh
                  kbetr
                  from  konp
                  into table i_konp1
                  for all entries in i_a0041
                  where knumh = i_a0041-knumh.
          loop at i_a0041.
            read table i_konp1 with key knumh = i_a0041-knumh.
            move i_konp1-kbetr to i_a0041-kbetr.
            modify i_a0041.
            clear : i_konp1, i_a0041.
          endloop.
        endif.
        if i_mvke[] is not initial.
          select pcode
                 fact
                 wfact
                 into table i_domsal
                 from zprice_grpsal
                 for all entries in i_mvke
                 where pcode = i_mvke-mvgr2
                 and vkorg = 'SBAP'
                 and vtweg = 'DD'
                 and lifnr = v_lifnr.
          select pcode
                 fact
                 wfact
                 into table i_grpsal
                 from zprice_grpsal
                 for all entries in i_mvke
                 where pcode = i_mvke-mvgr2
                 and vkorg = 'EXPT'
                 and vtweg = 'BR'
                 and lifnr = v_lifnr.
        endif.
        loop at i_input .
          read table i_mvke with key matnr = i_input-matnr.
          if sy-subrc = 0.
            move i_mvke-mvgr2 to i_input-mvgr2.
          endif.
          read table i_domsal with key pcode = i_input-mvgr2.
          if sy-subrc = 0.
            d_pric =  i_domsal-fact / i_domsal-wfact.
            i_input-dpric = i_input-netpr * d_pric * ( 112 / 100 ).
          endif.
          read table i_grpsal with key pcode = i_input-mvgr2.
          if sy-subrc = 0.
            g_pric =  i_grpsal-fact * i_grpsal-wfact.
            i_input-gpric = ( i_input-netpr * ( 112 / 100 ) ) / g_pric .
          endif.
          modify i_input.
          clear i_input.
          clear d_pric.
          clear g_pric.
        endloop.
      endif.
    endform.                    " f_check_price
    *&      Form  f_display_data
          text
    -->  p1        text
    <--  p2        text
    form f_display_data .
      loop at i_netpr.
        move i_netpr-ebeln to i_final-ebeln.
        move i_netpr-ebelp to i_final-ebelp.
        move i_netpr-matnr to i_final-matnr.
        move i_netpr-netpr to i_final-poprc.
        move i_netpr-menge to i_final-asqty.
        move p_invno to i_final-invoice.
        append i_final.
        clear i_final.
      endloop.
      loop at i_final.
        move v_podat to i_final-podat.
        read table i_input with key matnr = i_final-matnr.
        move i_input-netpr to i_final-invpr.
        move i_input-dpric to i_final-dcalclp.

    Dear Santosh,
    I haven't gone through your piece of code.
    But I can suggest a way out, while handling multiple line-items.
    The following code sample elucidate the use of multiple line-items. This is just an example for your understanding.
    FORM BDC_OPERATION .
      DATA:  LV_ARBPL(15)    TYPE  C,
                 LV_ROWNO(2)     TYPE  N.
      LOOP  AT  IT_TABDATA  INTO  WA_TABDATA.
        CLEAR:  LV_ARBPL
        LV_ROWNO  =  SY-TABIX.  
        CONCATENATE  'PLPOD-ARBPL'    '('  LV_ROWNO  ')'  INTO  LV_ARBPL.
        PERFORM  BDC_DYNPRO  USING  'SAPLCPDI'          '1400'.
        PERFORM  BDC_FIELD       USING  'BDC_CURSOR'   LV_ARBPL.
        PERFORM  BDC_FIELD       USING  'BDC_OKCODE'   '=PICK'.
        PERFORM  BDC_FIELD       USING  LV_ARBPL          WA_TABDATA-ARBPL.
      ENDLOOP.
    ENDFORM.                    " BDC_OPERATION
    Regards,
    Abir
    Please don't forget to award points  *

  • BDC to create SO(VA01) for multiple line items

    Hi all,
    My requirement is to create SO for multiple line items in ECC6.0
    My recording for VA01 is like this.
    start-of-selection.
    perform open_group.
    perform bdc_dynpro      using 'SAPMV45A' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAK-AUART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBAK-AUART'
                                  'ZOR'.
    perform bdc_field       using 'VBAK-VKORG'
                                  '2000'.
    perform bdc_field       using 'VBAK-VTWEG'
                                  '10'.
    perform bdc_field       using 'VBAK-SPART'
                                  '05'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-WERKS(01)'.
    perform bdc_field       using 'RV45A-MABNR(01)'
                                  'hrpocf'.
    perform bdc_field       using 'VBAP-POSNR(01)'
                                  '    10'.
    perform bdc_field       using 'RV45A-KWMENG(01)'
                                  '                 55'.
    perform bdc_field       using 'VBAP-WERKS(01)'
                                  '2010'.
    perform bdc_dynpro      using 'SAPLCEI0' '0109'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RCTMS-MWERT(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RCTMS-MNAME(01)'
                                  'A_THICK_MM'.
    perform bdc_field       using 'RCTMS-MNAME(02)'
                                  'A_WIDTH_MM'.
    perform bdc_field       using 'RCTMS-MNAME(03)'
                                  'A_EQUIVALENT_SPEC'.
    perform bdc_field       using 'RCTMS-MNAME(04)'
                                  'A_BATCH_WEIGHT_MAX_SI'.
    perform bdc_field       using 'RCTMS-MNAME(05)'
                                  'A_BATCH_WEIGHT_MIN_SI'.
    perform bdc_field       using 'RCTMS-MNAME(06)'
                                  'A_COIL_INNER_DIA_MM'.
    perform bdc_field       using 'RCTMS-MWERT(01)'
                                  '3.2'.
    perform bdc_field       using 'RCTMS-MWERT(02)'
                                  '1200'.
    perform bdc_field       using 'RCTMS-MWERT(03)'
                                  'IS_11513_GR_D_1985'.
    perform bdc_field       using 'RCTMS-MWERT(04)'
                                  '26.4'.
    perform bdc_field       using 'RCTMS-MWERT(05)'
                                  '26.4'.
    perform bdc_field       using 'RCTMS-MWERT(06)'
                                  '610'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-WERKS(02)'.
    perform bdc_field       using 'RV45A-MABNR(02)'
                                  'hrpocf'.
    perform bdc_field       using 'VBAP-POSNR(02)'
                                  '    11'.
    perform bdc_field       using 'RV45A-KWMENG(02)'
                                  '                 66'.
    perform bdc_field       using 'VBAP-WERKS(02)'
                                  '2010'.
    perform bdc_dynpro      using 'SAPLCEI0' '0109'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RCTMS-MWERT(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RCTMS-MNAME(01)'
                                  'A_THICK_MM'.
    perform bdc_field       using 'RCTMS-MNAME(02)'
                                  'A_WIDTH_MM'.
    perform bdc_field       using 'RCTMS-MNAME(03)'
                                  'A_EQUIVALENT_SPEC'.
    perform bdc_field       using 'RCTMS-MNAME(04)'
                                  'A_BATCH_WEIGHT_MAX_SI'.
    perform bdc_field       using 'RCTMS-MNAME(05)'
                                  'A_BATCH_WEIGHT_MIN_SI'.
    perform bdc_field       using 'RCTMS-MNAME(06)'
                                  'A_COIL_INNER_DIA_MM'.
    perform bdc_field       using 'RCTMS-MWERT(01)'
                                  '3.1'.
    perform bdc_field       using 'RCTMS-MWERT(02)'
                                  '1250'.
    perform bdc_field       using 'RCTMS-MWERT(03)'
                                  'IS_11513_GR_D_1985'.
    perform bdc_field       using 'RCTMS-MWERT(04)'
                                  '20.084'.
    perform bdc_field       using 'RCTMS-MWERT(05)'
                                  '20.084'.
    perform bdc_field       using 'RCTMS-MWERT(06)'
                                  '610'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PDE3'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(01)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(01)'
                                  'X'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-TAXM1'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM2'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM3'
                                  '0'.
    perform bdc_field       using 'VBAP-TAXM4'
                                  '0'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'FDGFDG'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\10'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-POSEX_E'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '000005'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PDE3'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(02)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(02)'
                                  'X'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-TAXM1'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM2'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM3'
                                  '0'.
    perform bdc_field       using 'VBAP-TAXM4'
                                  '0'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'GFGFDG'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\10'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-POSEX_E'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '000005'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSEX'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '5'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=KKAU'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\02'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-KONDA'.
    perform bdc_field       using 'VBAK-AUDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAK-VKBUR'
                                  'IN15'.
    perform bdc_field       using 'VBAK-WAERK'
                                  'INR'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-KDGRP'
                                  'CF'.
    perform bdc_field       using 'VBKD-PLTYP'
                                  '01'.
    perform bdc_field       using 'VBKD-KONDA'
                                  '01'.
    perform bdc_field       using 'VBKD-BZIRK'
                                  'NORTH'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\03'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-VSART'.
    perform bdc_field       using 'VBAK-VSBED'
                                  '01'.
    perform bdc_field       using 'VBKD-KZAZU'
                                  'X'.
    perform bdc_field       using 'VBKD-VSART'
                                  'ER'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\05'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAK-TAXK1'
                                  '1'.
    perform bdc_field       using 'VBAK-TAXK3'
                                  'l'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-ZLSCH'.
    perform bdc_field       using 'VBKD-KTGRD'
                                  '01'.
    perform bdc_field       using 'VBKD-ZLSCH'
                                  'c'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'BDFBFDB'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\11'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=KSTC'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(02)'.
    perform bdc_field       using 'J_STMAINT-ANWS(01)'
    perform bdc_field       using 'J_STMAINT-ANWS(02)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(03)'.
    perform bdc_field       using 'J_STMAINT-ANWS(02)'
    perform bdc_field       using 'J_STMAINT-ANWS(03)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(04)'.
    perform bdc_field       using 'J_STMAINT-ANWS(03)'
    perform bdc_field       using 'J_STMAINT-ANWS(04)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'JOSTD-OBJNR'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-TXT_VBELN'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    perform bdc_transaction using 'VA01'.
    perform close_group.
    if in excel file one row of records means i am succesfully creating SO.
    But for multiple i am not getting idea to create SO.
    My excel file details like this.In this excel file based on VBKD-BSTKD_E value i have to keep the records in line items.
    VBAK-AUART    :Order Type
    VBAK-VKORG    : Sales Org
    VBAK-VTWEG    : Distri Channel
    VBAK-SPART    : Division
    VBAK-KUNNR    : Sold-to-Party
    VBPA-KUNNAR   : Ship-to-Party
    VBAK-BSTNK    : PO No
    VBAK-BSTDK    : PO Date
    VBAP-MATNR    : Material No
    A_THICK_MM
    A_WIDTH_MM
    A_EQUIVALENT_SPEC
    A_COIL_INNER_DIA_MM
    A_BATCH_WEIGHT_MIN_SI
    A_BATCH_WEIGHT_MAX_SI
    VBAP-KWMENG    : Qty
    VBAP-WERKS     : Delivery Plant
    VBKD-INCO2     : Incoterm2
    VBKD-KONDA     : Price Group
    VBKD-VSART     : Shipping Type
    VBAK-TAXK1     : Cust Tax-1
    VBAK-TAXK2     : Cust Tax-2
    VBAK-TAXK3     : Cust Tax-3
    VBAK-TAXK4     : Cust Tax-4
    VBKD-ZLSCH     : Payment Method
    VBAP-TAXM1     : Mat tax clss-1
    VBAP-TAXM2     : Mat tax clss-2
    VBAP-TAXM3     : Mat tax clss-3
    VBAP-TAXM4     : Mat tax clss-4
    VBAP-POSEX     : IMPS Order No
    VBKD-BSTKD_E   : old SO in 4.6c
    VBKD-POSEX_E   : old SO Item  in 4.6c
    Text Id        : TDC No
    Text Id-ES10   : Special Inst(Unld const & Veh)
    ZOR,2000,10,5,100000,100000,PO NO 125,19.01.2008,HRPOCF,3.1,1200,IS_11513_GR_D_1985,610,20.084,20.084
    51,2010,Mumbai,01Freight-pre paid,ER,2,0,L,0,c,1,1,0,0,108128,3011192,     1,PO 444 AMD 1,Spl Inst
    based on VBKD-BSTKD_E line items has to create.
    if VBKD-BSTKD_E = 3011192 is like 4 records in excel means for these 4 should be one SO
    if it is changed to 3011193 then only different SO.
    PLs If any one knows solution pls write some sample code for me.
    If u send that code to my mail id also  very thankful.
    [email protected]
    Pls help me this is urgent requirement.
    Thanks & Regards,
    J.Lokesh

    HI,
    Instead of using BDC , why dont you make use of BAPI.
    As you are on ECC, you can make use of BAPI BAPI_SALESORDER_CREATEFROMDAT2
    Collect all your records based on PO # and pass them into line item table structure ORDER_ITEMS_IN.
    *--Logic something like this.
      loop at it_exceldata into l_line.
      loop at it_exceldata into l_so where bstkd_e eq l_line-bstkd.
      *This will loop at all the same  PO#
      *collect the data related into corr tables. and append
      endloop.
      *Now you are outside the loop.
      *Call the BAPI to update this SO
      delete it_exceldata where bstkd_e eq l_line-bstkd_e.
      endloop.
    Also pass all the necessary data to header structure ORDER_HEADER_IN
    Do not check for Sy-subrc at the end of execution.
    Instead read the Return table with message type 'A' or 'E whichi means there is an error/abort in BAPI execution.
    Remember to expicitly COMMIT_WORK after succesfull execution of BAPI using BAPI_TRANSACTION_COMMIT
    Please let me know , if you need more help in this
    Gary.

  • To Record  J1IS BDC  For Multiple Line Items

    Hi,
      Iam trying to record BDC for J1IS transaction.
    while  recording  material document which contains more than  8 line items , Only 8 line items get saved and the rest of the items doesn't get saved ,
        But when I  do this manually then  all the line items get saved,
        Can anyone give the remedy for this Problem (to record J1IS for multiple line items).
      Thanks in Advance.
    Regards,
    S.Janani.

    Hi Janani / Leo
    The problem might be that the scroll down functionality after 8 line items is not recorded in your recording.
    In order to overcome the issue, you need to check OK__CODE whicle page down and add it in recording after Number of line items are greater than 8.
    Please check below link for details:
    http://scn.sap.com/thread/1106677
    http://scn.sap.com/thread/797827
    http://scn.sap.com/thread/2037271
    Best Regards,
    Sachin

  • BDC for multiple line items (VA01)

    Hi Experts,
      I create a BDC for VA01 transaction for single line item in that now i want to upload multiple line items also with  o/p of total no. of records uploaded, no. of records posted and the no. of error records...
    Can any body explain with sample code...

    Hi,
    if the flat file is containing header and item records...
    first split those records tooo two internal tables header and item..
    Loop at header ...
      process of recording steps for header....
    Loop at item...
    here create a varialbe with char 2 .. for index value....
      process of item recording steps..
      increment the index value by 1....
      here u have to pass  'p+'  OK_CODE..
    Endloop ..(item)
    Endloop...(header)
    for more info goo through this link...
    http://www.sap-img.com/bdc.htm
    hope helpful
    Raghunath.S

  • Bdc for multiple line items

    hi all,
    i am developing bdc program to upload multiple line items for ml10.
    i am uploading folling fields
    spec_no
    astyp
    txz01,
    sort1,
    waers,
    matkl,
    ekorg,
    srvpos ' service number
    menge. 'quantity
    service number and quantity are multiple line items.
    i have developed a code which is taking single record only, it is not working for multiple service no and quantity.
    include bdcrecx1.
    parameters: filename like rlgrap-filename.
    data: begin of record,
    SPEC_NO(10),
    ASTYP(4),
    TXZ01(40),
    SORT1(20),
    WAERS(5),
    MATKL(9),
    EKORG(4),
    NEW_ROW(10),
    SRVPOS(18),
    MENGE(13),
    end of record.
    data: itab_program like record occurs 0 with header line.
    At Selection Screen
    at selection-screen on value-request for filename.
    perform query_filename changing filename.
    *START-OF-SELECTION
    start-of-selection.
    *-- Upload flat data to ITAB.
    perform upload_to_itab.
    *{ chg001 -- modified as per requirement
    perform open_group.
    loop at itab_program.
    perform upload_programs.
    endloop.
    perform close_group.
    FORM UPLOAD_TO_ITAB *
    form upload_to_itab.
    call function 'WS_UPLOAD'
    exporting
    CODEPAGE = ' '
    filename = filename
    filetype = 'DAT'
    HEADLEN = ' '
    LINE_EXIT = ' '
    TRUNCLEN = ' '
    USER_FORM = ' '
    USER_PROG = ' '
    DAT_D_FORMAT = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = itab_program
    EXCEPTIONS
    CONVERSION_ERROR = 1
    FILE_OPEN_ERROR = 2
    FILE_READ_ERROR = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    write : 'File opening error.'.
    endif.
    endform.
    FORM QUERY_FILENAME *
    --> P_FILENAME *
    form query_filename changing p_filename.
    data : tmp_filename like filename.
    call function 'WS_FILENAME_GET'
    exporting
    def_filename = filename
    mask = ',.txt,.txt.'
    mode = 'O'
    title = 'Select the file to Upload'
    importing
    filename = tmp_filename
    exceptions
    inv_winsys = 01
    no_batch = 02
    selection_cancel = 03
    selection_error = 04.
    if sy-subrc = 0.
    filename = tmp_filename.
    endif.
    endform.
    *perform open_group.
    *& Form UPLOAD_programs
    text
    --> p1 text
    <-- p2 text
    form upload_programs.
    perform bdc_dynpro using 'SAPLMLSM' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'TEMP_SPEC-ASTYP'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'TMP_SPEC-SPEC_NO'
    ITAB_PROGRAM-SPEC_NO.
    perform bdc_field using 'TMP_SPEC-ASTYP'
    ITAB_PROGRAM-ASTYP.
    *****************************************************************SCREEN1
    perform bdc_dynpro using 'SAPLMLSM' '0200'.
    perform bdc_field using 'BDC_CURSOR'
    'TMP_SPEC-EKORG'.
    perform bdc_field using 'BDC_OKCODE'
    '=SRV'.
    perform bdc_field using 'TMP_SPEC-TXZ01'
    ITAB_PROGRAM-TXZ01.
    perform bdc_field using 'TMP_SPEC-SORT1'
    ITAB_PROGRAM-SORT1.
    perform bdc_field using 'TMP_SPEC-WAERS'
    ITAB_PROGRAM-WAERS.
    perform bdc_field using 'TMP_SPEC-MATKL'
    ITAB_PROGRAM-MATKL.
    perform bdc_field using 'TMP_SPEC-EKORG'
    ITAB_PROGRAM-EKORG.
    *****************************************************************END OF SCREEN2
    perform bdc_dynpro using 'SAPLMLSP' '0201'.
    perform bdc_field using 'BDC_OKCODE'
    '=BZE'.
    *perform bdc_field using 'RM11P-HEADTEXT'
    ITAB_PROGRAM-TXZ01.
    perform bdc_field using 'BDC_SUBSCR'
    'SAPLMLSP'.
    perform bdc_dynpro using 'SAPLMLSP' '0201'.
    perform bdc_field using 'BDC_OKCODE'
    '=BZE'.
    perform bdc_field using 'BDC_CURSOR'
    'ESLL-MENGE(01)'.
    perform bdc_field using 'ESLL-SRVPOS(01)'
    ITAB_PROGRAM-SRVPOS.
    perform bdc_field using 'ESLL-MENGE(01)'
    ITAB_PROGRAM-MENGE.
    perform bdc_dynpro using 'SAPLMLSP' '0201'.
    perform bdc_field using 'BDC_OKCODE'
    '=SAV'.
    perform bdc_field using 'BDC_SUBSCR'
    'SAPLMLSP'.
    perform bdc_transaction using 'ML10'.
    endform. " UPLOAD_programs
    can any body help me in this regard.
    thanks in advance
    siva

    Loop at itab_program.
    < Here will be your BDC Program>
    call transaction..... .
    endloop.
    and all the records in you internal table itab_program will get updated...
    Regards.
    Jayant
    <b>Please award if helpful</b>

  • "BDC for multiple line items of PO"

    I am using this code to move data for multiple line items of a PO. But only one is getting transferred. I am using BDC for this.
    FORM transaction_bdc .
      DATA :
      v_cnt(2) TYPE n,
      v_bst(2) TYPE n,
      v_bn TYPE i,
      v_bstpo(25),
      v_ebtyp(25),
      v_menge(25),
      v_eeind(25),
      v_xblnr(25),
      v_xblnr1(25),
      v_ebelp(2) TYPE n,
      v_ebelpt(2),
      v_menge1(11),
      v_ebt TYPE i,
      v_vebtyp LIKE ekes-ebtyp,
      v_eb(2) TYPE n,
      v_tcselflag(40),
      v_tem(2) TYPE n,
      v_correct TYPE i,
      v_file TYPE string.
      DATA: ls_outtab TYPE tb_struc.
      DATA: l_valid TYPE c,
            l_locked TYPE c.
      CALL METHOD g_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid EQ 'X'.
        LOOP AT tb_output WHERE check EQ 'X' .
          MOVE-CORRESPONDING tb_output TO itab_output.
          APPEND itab_output.
          CLEAR itab_output.
        ENDLOOP.
        IF tb_output-check <> 'X'.
          MESSAGE e003 WITH text-004.
        ENDIF.
      ENDIF.
      IF itab_output[] IS NOT INITIAL.
        PERFORM open_group.
    ***looping at purchase order level.
        LOOP AT itab_output where ebelp is not initial .
          CLEAR v_bn.
          CLEAR v_ebt.
          PERFORM bdc_dynpro USING 'SAPMM06E' '0105'.
          PERFORM bdc_field USING 'BDC_CURSOR'
          'RM06E-BSTNR'.
          PERFORM bdc_field USING 'BDC_OKCODE'
          '/00'.
          PERFORM bdc_field USING 'RM06E-BSTNR'
          itab_output-ebeln.
    ***Changing alphanumeric fields and quantity fields to character type**
    *v_ebelp = tB_OUTPUT-ebelp.
    *clear v_ebelpt.
    *v_menge1 = tB_OUTPUT-menge.
    *v_ebelpt = v_ebelp.
    ***End Of Changing**
    *Checking for the exact number of the item**
          LOOP AT tb_output where ebeln = itab_output-ebeln.
            READ TABLE itab_output INDEX 1.
            IF tb_output-ebelp = itab_output-ebelp.
              exit.
            ELSE.
              v_bn = v_bn + 1.
            ENDIF.
          ENDLOOP.
    v_bst = v_bn + 1.
    *End Of Checking**
    **Mapping items**
            v_tem = 1.
            CONCATENATE 'RM06E-BSTPO(' v_bst ')' INTO v_bstpo.
            CONCATENATE 'RM06E-TCSELFLAG(' v_tem ')' INTO v_tcselflag.
            PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            v_bstpo.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '=DETA'.
            PERFORM bdc_field USING 'RM06E-EBELP'
            v_ebelpt.
            PERFORM bdc_dynpro USING 'SAPMM06E' '0111'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            'EKPO-BSTAE'.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '/00'.
            PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            v_bstpo.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '=BSTA'.
            PERFORM bdc_field USING 'RM06E-EBELP'
            v_ebelpt.
            PERFORM bdc_field USING v_tcselflag
            'X'.
    **Checking weather Confirmation category already exists**
            SELECT ebtyp FROM ekes INTO v_vebtyp WHERE ebelp =
            itab_output-ebelp AND ebeln = itab_output-ebeln.
            ENDSELECT.
            IF sy-dbcnt > 0.
              v_ebt = sy-dbcnt.
            ENDIF.
            v_eb = v_ebt + 1.
    **End Of Checking**
    **For Line items**
            CONCATENATE 'EKES-EBTYP(' v_eb ')' INTO v_ebtyp.
            CONCATENATE 'EKES-MENGE(' v_eb ')' INTO v_menge.
            CONCATENATE 'RM06E-EEIND(' v_eb ')' INTO v_eeind.
            CONCATENATE 'EKES-XBLNR(' v_eb ')' INTO v_xblnr.
    **End**
            PERFORM bdc_dynpro USING 'SAPLEINB' '0200'.
            PERFORM bdc_field USING 'BDC_CURSOR'
            v_xblnr.
            PERFORM bdc_field USING 'BDC_OKCODE'
            '=BU'.
            PERFORM bdc_field USING v_ebtyp
            itab_output-ebtyp.
            PERFORM bdc_field USING v_eeind
            itab_output-eindt.
            PERFORM bdc_field USING v_menge
            v_menge1.
            PERFORM bdc_field USING v_xblnr
            itab_output-xblnr.
    **End Of Mappings**
    *loop at itab_output.
            MOVE-CORRESPONDING itab_output TO ekes.
            modify ekes.
           MOVE-CORRESPONDING itab_output TO eket.
           MODIFY eket.
           MOVE-CORRESPONDING tb_output TO ekpo.
           MODIFY ekpo.
         ENDLOOP.
          CALL TRANSACTION 'ME22N'
          USING itbdc
          MODE   'E'.
          commit work.
    perform bdc_transaction using 'ME22N'.
    **End Of Purchase Order Loop**
        PERFORM close_group.
        endloop.
         endif.

    Hi Asha,
    check the below code once...
    LOOP AT tb_output where ebeln = itab_output-ebeln.
    READ TABLE itab_output INDEX 1.
    IF tb_output-ebelp = itab_output-ebelp.
    exit.
    ELSE.
    v_bn = v_bn + 1.
    ENDIF.
    ENDLOOP.
    Here you are reading the table itab_output with index 1, it means you alway reading the first record of that internal table.
    Regards,
    Satya.

  • BDC of multiple line item

    Dear All,
    I am writing BDC for F-28
    Where  wanted to add multiple line items in screen 0731 for the field rfo5a-sel01
    It's urgent
    Regards
    Shashikant

    Hi,
    You can use the program RFBIBL00 to upload the FI documents.
    Sample BDC
    File Format : Below listed fields must be filled when you wnat to post new document. Program will recognize new document by itab-newdoc = 'X'.
    NEWDOC , "New Doc
    BLDAT(10) , "Doc Date
    BUDAT(10) , "Posting Date
    BLART(2) , "Document Type
    XBLNR LIKE BKPF-XBLNR , "Refrence
    BKTXT LIKE BKPF-BKTXT , "Doc Header Text
    You need one serverfile. After sucessfully run of program you have to run the progrma RFBIBL00. Pass data transfer type = 'B'.
    Regards,
    Naimesh.
    PS: Reward points, if it is useful..!
    REPORT ZTEST_NP .
    Tables
    TABLES: BSEG ,
    BGR00,
    BBKPF,
    BBSEG,
    t001.
    Internal Tables
    DATA: BEGIN OF ITAB OCCURS 0 ,
    NEWDOC , "New Doc
    BLDAT(10) , "Doc Date
    BUDAT(10) , "Posting Date
    BLART(2) , "Document Type
    XBLNR LIKE BKPF-XBLNR , "Refrence
    BKTXT LIKE BKPF-BKTXT , "Doc Header Text
    BSCHL(2) , "Posting Key
    HKONT(10) , "Account
    UMSKZ(1), "Sp GL ind
    ZLSCH(1) , "Payment Method
    ZLSPR(1) , "Payment Block
    WRBTR(16), "Amount without sign
    KOSTL(10), "Cost center
    GSBER(4) , "Business Area
    ZUONR LIKE BSEG-ZUONR , "Assignment
    AUFNR LIKE BSEG-AUFNR , "Order
    PERNR(8) , "Personal Number
    SGTXT LIKE BSEG-SGTXT, "Line Item Text
    END OF ITAB .
    DATA: ITAB1 LIKE ITAB OCCURS 0 WITH HEADER LINE.
    DATA: I_BBKPF LIKE BBKPF OCCURS 0 WITH HEADER LINE.
    DATA: I_BBSEG LIKE BBSEG OCCURS 0 WITH HEADER LINE.
    DATA: I_BWITH LIKE BWITH OCCURS 0 WITH HEADER LINE.
    Data Declaration
    DATA: C_NODATA(1) TYPE C VALUE '/',
    W_CNT TYPE I.
    FIELD-SYMBOLS <F>.
    SELECTION-SCREEN: BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-T01.
    PARAMETER: P_BUKRS LIKE BKPF-BUKRS OBLIGATORY,
    PSESSION(12) OBLIGATORY DEFAULT 'Auto_FI',
    P_SFILE LIKE RLGRAP-FILENAME OBLIGATORY ,
    P_LFILE LIKE RLGRAP-FILENAME OBLIGATORY .
    SELECTION-SCREEN: END OF BLOCK BLK1.
    At Selection Screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_LFILE.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    FILE_NAME = P_LFILE.
    Start Of Selection
    START-OF-SELECTION .
    OPEN DATASET P_SFILE FOR OUTPUT IN TEXT MODE .
    PERFORM INIT_BGR00 USING C_NODATA.
    PERFORM INIT_IBKPF USING C_NODATA.
    PERFORM INIT_IBSEG USING C_NODATA.
    PERFORM UPLOAD .
    PERFORM SET_DATA.
    *& Form INIT_BGR00
    FORM INIT_BGR00 USING NODATA .
    CLEAR BGR00.
    BGR00-STYPE = '0'.
    BGR00-GROUP = PSESSION.
    BGR00-MANDT = SY-MANDT .
    BGR00-USNAM = SY-UNAME .
    bgr00-start = datum .
    BGR00-XKEEP = 'X'.
    BGR00-NODATA = NODATA.
    TRANSFER BGR00 TO P_SFILE.
    ENDFORM. " INIT_BGR00
    *& Form INIT_IBKPF
    FORM INIT_IBKPF USING NODATA .
    Initialize data fields with NODATA:
    W_CNT = 0.
    DO.
    ADD 1 TO W_CNT.
    ASSIGN COMPONENT W_CNT OF STRUCTURE I_BBKPF TO <F>.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF.
    MOVE NODATA TO <F>.
    ENDDO.
    ENDFORM.
    *& Form INIT_IBSEG
    FORM INIT_IBSEG USING NODATA.
    Initialize data fields with NODATA:
    W_CNT = 0.
    DO.
    ADD 1 TO W_CNT.
    ASSIGN COMPONENT W_CNT OF STRUCTURE I_BBSEG TO <F>.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF.
    MOVE NODATA TO <F>.
    ENDDO.
    ENDFORM.
    *& Form INIT_BBKPF
    FORM INIT_BBKPF.
    MOVE I_BBKPF TO BBKPF.
    BBKPF-STYPE = '1'.
    ENDFORM. " INIT_BBKPF
    *& Form INIT_BBSEG
    FORM INIT_BBSEG.
    MOVE I_BBSEG TO BBSEG.
    BBSEG-STYPE = '2'.
    BBSEG-TBNAM = 'BBSEG'.
    ENDFORM. " INIT_BBSEG
    *& Form UPLOAD
    FORM UPLOAD.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = P_LFILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = ITAB
    EXCEPTIONS
    CONVERSION_ERROR = 1
    FILE_OPEN_ERROR = 2
    FILE_READ_ERROR = 3
    INVALID_TABLE_WIDTH = 4
    INVALID_TYPE = 5
    NO_BATCH = 6
    UNKNOWN_ERROR = 7
    OTHERS = 8.
    IF SY-SUBRC NE 0 .
    MESSAGE S001(01) WITH 'The File Could not be Uploaded..!' .
    LEAVE LIST-PROCESSING .
    ELSE.
    DELETE ITAB INDEX 1 .
    ENDIF .
    LOOP AT ITAB .
    DO .
    REPLACE '.' WITH '' INTO ITAB-BLDAT .
    IF SY-SUBRC NE 0 .
    CONDENSE ITAB-BLDAT NO-GAPS .
    EXIT .
    ENDIF .
    ENDDO .
    DO .
    REPLACE '.' WITH '' INTO ITAB-BUDAT .
    IF SY-SUBRC NE 0 .
    CONDENSE ITAB-BUDAT NO-GAPS .
    EXIT .
    ENDIF .
    ENDDO .
    MODIFY ITAB .
    ENDLOOP .
    ENDFORM. " UPLOAD
    *& Form SET_DATA
    FORM SET_DATA.
    DATA: L_DOCCNT TYPE I,
    L_LNCNT TYPE I .
    SELECT SINGLE * FROM T001
    WHERE BUKRS = P_BUKRS.
    LOOP AT ITAB .
    IF ITAB-NEWDOC = 'X' OR ITAB-NEWDOC = 'x' .
    CLEAR : L_LNCNT .
    L_DOCCNT = L_DOCCNT + 1.
    PERFORM INIT_BBKPF .
    BBKPF-TCODE = 'FB01'.
    BBKPF-BUKRS = P_BUKRS.
    WRITE : ITAB-BLDAT DD/MM/YY TO BBKPF-BLDAT.
    WRITE : ITAB-BUDAT DD/MM/YY TO BBKPF-BUDAT.
    BBKPF-BLART = ITAB-BLART .
    BBKPF-WAERS = T001-WAERS.
    BBKPF-BKTXT = ITAB-BKTXT .
    BBKPF-XBLNR = ITAB-XBLNR .
    TRANSFER BBKPF TO P_SFILE.
    ENDIF .
    L_LNCNT = L_LNCNT + 1 .
    IF L_LNCNT GT 990 .
    MESSAGE S001(01) WITH 'Number of Records Exceed 990 Line Items'
    'Program cannot be executed' .
    LEAVE LIST-PROCESSING .
    ENDIF .
    PERFORM INIT_BBSEG .
    BBSEG-NEWKO = ITAB-HKONT .
    BBSEG-NEWBS = ITAB-BSCHL .
    BBSEG-WRBTR = ITAB-WRBTR .
    IF NOT ITAB-KOSTL IS INITIAL .
    BBSEG-KOSTL = ITAB-KOSTL .
    ELSE .
    IF NOT ITAB-GSBER IS INITIAL .
    BBSEG-GSBER = ITAB-GSBER .
    ENDIF .
    ENDIF .
    BBSEG-ZUONR = ITAB-ZUONR.
    BBSEG-SGTXT = ITAB-SGTXT .
    IF NOT ITAB-AUFNR IS INITIAL .
    BBSEG-AUFNR = ITAB-AUFNR .
    ENDIF .
    IF NOT ITAB-UMSKZ IS INITIAL .
    BBSEG-NEWUM = ITAB-UMSKZ .
    ENDIF .
    IF ITAB-BSCHL = '29' OR ITAB-BSCHL = '39' OR ITAB-BSCHL = '09' .
    BBSEG-ZFBDT = BBKPF-BLDAT .
    ENDIF .
    IF NOT ITAB-ZLSCH IS INITIAL .
    BBSEG-ZLSCH = ITAB-ZLSCH .
    ENDIF .
    IF NOT ITAB-PERNR IS INITIAL .
    BBSEG-PERNR = ITAB-PERNR .
    ENDIF .
    IF NOT ITAB-ZLSPR IS INITIAL .
    BBSEG-ZLSPR = ITAB-ZLSPR .
    ENDIF .
    TRANSFER BBSEG TO P_SFILE.
    ENDLOOP .
    IF L_DOCCNT NE 0 .
    WRITE :/ P_SFILE , 'has been created' .
    WRITE :/ L_DOCCNT , 'DOCUMENTS UPLOADED' .
    ELSE .
    WRITE :/'INPUT FILE CONTAINS NO DATA' .
    ENDIF .
    CLOSE DATASET P_SFILE .
    ENDFORM. " SET_DATA
    Reward points if Useful
    Regards
    Gokul

  • BDC for F - 43, Multiple posting keys,multiple line items

    Dear gurus,
                     I need to develop a bdc for  F-43, it it working for multiple posting keys with two line items, but not working for multiple line items, can you tell me where to loop the line items.
    regards,
    vidyasagar yadav.

    F-43 is actually FB01 (with two parameters, check it with SE93).
    So you could use the following FMs in sequence to build the BDC :
    POSTING_INTERFACE_START
    POSTING_INTERFACE_DOCUMENT
    POSTING_INTERFACE_END
    Else
    Re-execute transaction SHDB for a document with 2 items and for a document with a dozen items and analyze the result.
    Use a BAPI like BAPI_ACC_INVOICE_RECEIPT_POST or BAPI_ACC_DOCUMENT_POST
    Regards,
    Raymond

  • BDC for VA01 with multiple line items

    Hi,
    My client is 4.6c version, I have created a BDC program for transaction VA01 which will have multiple line items. I'm able to enter 12 items in the first instance, then 12 items next time. But I'm not doing any P+..System is automatically taking me to first item after reaching item 12 every time.
    But I have a doubt in production system also I will have only 12 items every time to enter..If not my program may not work..
    I'm calling BDC using following statment..
      CALL TRANSACTION 'VA01' USING BDCDATA
                        MODE 'N'
                        UPDATE 'S'
                        MESSAGES INTO lt_message.
    Please suggest me the solution.
    Regards
    Jaker.

    I had a similar problem with goods movements in a CO11N BDC I wrote.  Here's how it was fixed:
    DATA: lcl_opt     TYPE ctu_params.
    lcl_opt-defsize  = 'X'.
    CALL TRANSACTION 'CO11N' USING i_bdctbl OPTIONS FROM lcl_opt
                                 MESSAGES INTO messco11n.
    The option "defsize" makes sure that the screen always contains the same number of lines as it goes through the BDC.  That way, you can write in the paging logic without having to worry about the number of lines that appear on a user's screen as it may vary depending on how their screen resolution is set up.

  • BDC code for MB01 Application(Multiple Line Items)

    Hi,
    Can anybody please send me the BDC CODE for MB01 Application(for Multiple Line items).
    Very urgent.
    Thanks And Regards,
    Ajay

    Instead of BDC you can use following BAPI.
    see the following ex:
    BAPI TO Upload Inventory Data
    GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
                         02 - MB31 - Goods Receipts for Prod Order
                         03 - MB1A - Goods Issue
                         04 - MB1B - Transfer Posting
                         05 - MB1C - Enter Other Goods Receipt
                         06 - MB11
    Domain: KZBEW - Movement Indicator
         Goods movement w/o reference
    B - Goods movement for purchase order
    F - Goods movement for production order
    L - Goods movement for delivery note
    K - Goods movement for kanban requirement (WM - internal only)
    O - Subsequent adjustment of "material-provided" consumption
    W - Subsequent adjustment of proportion/product unit material
    LOOP AT I_TAB.
          count = sy-tabix.
          SELECT SINGLE * FROM ZMM_GI_WIP
                                    WHERE GI_NO = I_TAB-DOCNO AND
                                    GI_DATE = I_TAB-DOCDT.
          IF SY-SUBRC = 0.
            I_TAB-FLAG = 'C'.
            modify i_tab index count.
            CONCATENATE 'ERROR  GI : ' I_TAB-DOCNO
            '  WAS ALREADY UPLOADED' INTO I_MSG1.
            APPEND I_MSG1.
            CLEAR I_TAB-FLAG.
            CONTINUE.
          ELSE.
            CONCATENATE I_TAB-DOCDT+4(2)
                        I_TAB-DOCDT+6(2)
                        I_TAB-DOCDT+2(2)
                        I_TAB-DOCDT+0(2)
                        INTO G_DATE.
            gmhead-pstng_date = G_DATE.
            gmhead-doc_date = sy-datum.
            gmhead-pr_uname = sy-uname.
    "01 - MB01 - Goods Receipts for Purchase Order
            gmcode-gm_code = '03'.
            refresh itab.
            clear itab.
            SORT I_MAIN BY SOL_DOCNO.
            LOOP AT I_MAIN WHERE DOCNO = I_TAB-DOCNO.
              IF I_MAIN-GI_TXN_TYPE = 'MGI'.
                itab-move_type  = '291'.
              ENDIF.
              itab-mvt_ind    = ' '.
              itab-plant      = I_MAIN-WERKS.
              itab-material   = I_MAIN-MATNR.
              itab-entry_qnt  = I_MAIN-ERFMG.
              itab-stge_loc   = I_MAIN-LGOBE.
              itab-ENTRY_UOM = I_MAIN-ERFME.
              IF I_MAIN-WERKS = 'MR'.
                itab-TR_PART_BA = '11'.
              ELSEIF I_MAIN-WERKS = 'MR'.
                itab-TR_PART_BA = '12'.
              ENDIF.
              append itab.
            ENDLOOP.
            if not itab[] is initial.
              call function 'BAPI_GOODSMVT_CREATE'
               exporting
                   goodsmvt_header             = gmhead
                   goodsmvt_code               = gmcode
                 *   TESTRUN                     = ' '
              IMPORTING
                  goodsmvt_headret            = mthead
             *   MATERIALDOCUMENT            =
      MATDOCUMENTYEAR             =
               tables
                 goodsmvt_item               = itab
      GOODSMVT_SERIALNUMBER       =
                return                      = errmsg.
              clear errflag.
              loop at errmsg.
                if errmsg-type eq 'E'.
                  write:/'Error in function', errmsg-message.
                  errflag = 'X'.
                else.
                  write:/ errmsg-message.
                endif.
                move errmsg-message to i_msg1.
                append i_msg1.
              endloop.
              if errflag is initial.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT          =
              IMPORTING
                RETURN        =
               commit work and wait.
                if sy-subrc ne 0.
                  write:/ 'Error in updating'.
                  exit.
                 endif.
            endif.
          ENDIF.
           wait up to 20 seconds.
        ENDLOOP.

  • Bdc sales order multiple line items

    hi friends,
    i prepare multiple sales orders multiple line items through  single flat file
    in bdc program.
    i know information about ...
    H
    I
    I
    I
    BUT my problem is
    H
    I
    I
    H1
    I
    I
    H2
    I
    I
    how will develop this code?

    George Bush,
    Answer fir this question is, you need to do basic ABAP Training.
    Search for SAP ABAP Training Courses.
    You need to build logic in you program by defining appropriate internal table and use loop events to build BDC.   BDC is old style of programming. I would advice you to use BAPI with immediate order processing.
    If you want BDC, you can also try to use LSMW by defining appropriate inbound data structures.
    If you need help let me know.
    Thanks & Regards,
    Mahesh Apte

  • Pls help me to create SO using BDC for multiple line items (VA01)

    Hi all,
    My requirement is to create SO for multiple line items in ECC6.0
    My recording for VA01 is like this.
    start-of-selection.
    perform open_group.
    perform bdc_dynpro      using 'SAPMV45A' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAK-AUART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBAK-AUART'
                                  'ZOR'.
    perform bdc_field       using 'VBAK-VKORG'
                                  '2000'.
    perform bdc_field       using 'VBAK-VTWEG'
                                  '10'.
    perform bdc_field       using 'VBAK-SPART'
                                  '05'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-WERKS(01)'.
    perform bdc_field       using 'RV45A-MABNR(01)'
                                  'hrpocf'.
    perform bdc_field       using 'VBAP-POSNR(01)'
                                  '    10'.
    perform bdc_field       using 'RV45A-KWMENG(01)'
                                  '                 55'.
    perform bdc_field       using 'VBAP-WERKS(01)'
                                  '2010'.
    perform bdc_dynpro      using 'SAPLCEI0' '0109'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RCTMS-MWERT(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RCTMS-MNAME(01)'
                                  'A_THICK_MM'.
    perform bdc_field       using 'RCTMS-MNAME(02)'
                                  'A_WIDTH_MM'.
    perform bdc_field       using 'RCTMS-MNAME(03)'
                                  'A_EQUIVALENT_SPEC'.
    perform bdc_field       using 'RCTMS-MNAME(04)'
                                  'A_BATCH_WEIGHT_MAX_SI'.
    perform bdc_field       using 'RCTMS-MNAME(05)'
                                  'A_BATCH_WEIGHT_MIN_SI'.
    perform bdc_field       using 'RCTMS-MNAME(06)'
                                  'A_COIL_INNER_DIA_MM'.
    perform bdc_field       using 'RCTMS-MWERT(01)'
                                  '3.2'.
    perform bdc_field       using 'RCTMS-MWERT(02)'
                                  '1200'.
    perform bdc_field       using 'RCTMS-MWERT(03)'
                                  'IS_11513_GR_D_1985'.
    perform bdc_field       using 'RCTMS-MWERT(04)'
                                  '26.4'.
    perform bdc_field       using 'RCTMS-MWERT(05)'
                                  '26.4'.
    perform bdc_field       using 'RCTMS-MWERT(06)'
                                  '610'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-WERKS(02)'.
    perform bdc_field       using 'RV45A-MABNR(02)'
                                  'hrpocf'.
    perform bdc_field       using 'VBAP-POSNR(02)'
                                  '    11'.
    perform bdc_field       using 'RV45A-KWMENG(02)'
                                  '                 66'.
    perform bdc_field       using 'VBAP-WERKS(02)'
                                  '2010'.
    perform bdc_dynpro      using 'SAPLCEI0' '0109'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RCTMS-MWERT(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RCTMS-MNAME(01)'
                                  'A_THICK_MM'.
    perform bdc_field       using 'RCTMS-MNAME(02)'
                                  'A_WIDTH_MM'.
    perform bdc_field       using 'RCTMS-MNAME(03)'
                                  'A_EQUIVALENT_SPEC'.
    perform bdc_field       using 'RCTMS-MNAME(04)'
                                  'A_BATCH_WEIGHT_MAX_SI'.
    perform bdc_field       using 'RCTMS-MNAME(05)'
                                  'A_BATCH_WEIGHT_MIN_SI'.
    perform bdc_field       using 'RCTMS-MNAME(06)'
                                  'A_COIL_INNER_DIA_MM'.
    perform bdc_field       using 'RCTMS-MWERT(01)'
                                  '3.1'.
    perform bdc_field       using 'RCTMS-MWERT(02)'
                                  '1250'.
    perform bdc_field       using 'RCTMS-MWERT(03)'
                                  'IS_11513_GR_D_1985'.
    perform bdc_field       using 'RCTMS-MWERT(04)'
                                  '20.084'.
    perform bdc_field       using 'RCTMS-MWERT(05)'
                                  '20.084'.
    perform bdc_field       using 'RCTMS-MWERT(06)'
                                  '610'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PDE3'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(01)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(01)'
                                  'X'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-TAXM1'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM2'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM3'
                                  '0'.
    perform bdc_field       using 'VBAP-TAXM4'
                                  '0'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'FDGFDG'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\10'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-POSEX_E'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '000005'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PDE3'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(02)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(02)'
                                  'X'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-TAXM1'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM2'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM3'
                                  '0'.
    perform bdc_field       using 'VBAP-TAXM4'
                                  '0'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'GFGFDG'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\10'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-POSEX_E'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '000005'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSEX'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '5'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=KKAU'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\02'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-KONDA'.
    perform bdc_field       using 'VBAK-AUDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAK-VKBUR'
                                  'IN15'.
    perform bdc_field       using 'VBAK-WAERK'
                                  'INR'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-KDGRP'
                                  'CF'.
    perform bdc_field       using 'VBKD-PLTYP'
                                  '01'.
    perform bdc_field       using 'VBKD-KONDA'
                                  '01'.
    perform bdc_field       using 'VBKD-BZIRK'
                                  'NORTH'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\03'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-VSART'.
    perform bdc_field       using 'VBAK-VSBED'
                                  '01'.
    perform bdc_field       using 'VBKD-KZAZU'
                                  'X'.
    perform bdc_field       using 'VBKD-VSART'
                                  'ER'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\05'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAK-TAXK1'
                                  '1'.
    perform bdc_field       using 'VBAK-TAXK3'
                                  'l'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-ZLSCH'.
    perform bdc_field       using 'VBKD-KTGRD'
                                  '01'.
    perform bdc_field       using 'VBKD-ZLSCH'
                                  'c'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'BDFBFDB'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\11'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=KSTC'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(02)'.
    perform bdc_field       using 'J_STMAINT-ANWS(01)'
    perform bdc_field       using 'J_STMAINT-ANWS(02)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(03)'.
    perform bdc_field       using 'J_STMAINT-ANWS(02)'
    perform bdc_field       using 'J_STMAINT-ANWS(03)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(04)'.
    perform bdc_field       using 'J_STMAINT-ANWS(03)'
    perform bdc_field       using 'J_STMAINT-ANWS(04)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'JOSTD-OBJNR'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-TXT_VBELN'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    perform bdc_transaction using 'VA01'.
    perform close_group.
    if in excel file one row of records means i am succesfully creating SO.
    But for multiple i am not getting idea to create SO.
    My excel file details like this.In this excel file based on VBKD-BSTKD_E value i have to keep the records in line items.
    VBAK-AUART    :Order Type
    VBAK-VKORG    : Sales Org
    VBAK-VTWEG    : Distri Channel
    VBAK-SPART    : Division
    VBAK-KUNNR    : Sold-to-Party
    VBPA-KUNNAR   : Ship-to-Party
    VBAK-BSTNK    : PO No
    VBAK-BSTDK    : PO Date
    VBAP-MATNR    : Material No
    A_THICK_MM
    A_WIDTH_MM
    A_EQUIVALENT_SPEC
    A_COIL_INNER_DIA_MM
    A_BATCH_WEIGHT_MIN_SI
    A_BATCH_WEIGHT_MAX_SI
    VBAP-KWMENG    : Qty
    VBAP-WERKS     : Delivery Plant
    VBKD-INCO2     : Incoterm2
    VBKD-KONDA     : Price Group
    VBKD-VSART     : Shipping Type
    VBAK-TAXK1     : Cust Tax-1
    VBAK-TAXK2     : Cust Tax-2
    VBAK-TAXK3     : Cust Tax-3
    VBAK-TAXK4     : Cust Tax-4
    VBKD-ZLSCH     : Payment Method
    VBAP-TAXM1     : Mat tax clss-1
    VBAP-TAXM2     : Mat tax clss-2
    VBAP-TAXM3     : Mat tax clss-3
    VBAP-TAXM4     : Mat tax clss-4
    VBAP-POSEX     : IMPS Order No
    VBKD-BSTKD_E   : old SO in 4.6c
    VBKD-POSEX_E   : old SO Item  in 4.6c
    Text Id        : TDC No
    Text Id-ES10   : Special Inst(Unld const & Veh)
    ZOR,2000,10,5,100000,100000,PO NO 125,19.01.2008,HRPOCF,3.1,1200,IS_11513_GR_D_1985,610,20.084,20.084
    51,2010,Mumbai,01Freight-pre paid,ER,2,0,L,0,c,1,1,0,0,108128,3011192,     1,PO 444 AMD 1,Spl Inst
    based on VBKD-BSTKD_E line items has to create.
    if VBKD-BSTKD_E = 3011192 is like 4 records in excel means for these 4 should be one SO
    if it is changed to 3011193 then only different SO.
    PLs If any one knows solution pls write some sample code for me.
    If u send that code to my mail id also  very thankful.
    Pls help me this is urgent requirement.
    [email protected]
    Thanks & Regards,
    J.Lokesh

    If u want to add Items data, u have to handle the Table control by writing the complete code.
    U have to write code for 2 items, when u press enter u will get new row to enter new record one by one.
    Narendra

  • How to insert multiple line items in fv60 using bdc.

    Hi all,
          How to insert multiple line items in fv60 using bdcs

    hi
    chk this
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : V_EBELP(30) , V_MENGE(30) , V_WERKS(30), V_EMATN(30) ,
    V_PEINH(30).
    DATA : FILE TYPE STRING, V_MSG(100) , V_IND(2) TYPE N , FLAG VALUE 'X'.
    PARAMETERS: P_FILE(50) TYPE C DEFAULT 'C:\ME21_TEST'.
    DATA : BEGIN OF ITAB OCCURS 0,
            IND(02),
            LIFNR_001(010),
    data element: BSART
            BSART_002(004),
    data element: BEDAT
    data element: EKORG
            EKORG_004(004),
            EKGRP_006(003),
    data element: LPEIN
            LPEIN_005(001),
    data element: EMATNR
            EMATN_01_007(018),
    data element: EWERK
            WERKS_01_008(004),
    data element: EPEIN
            PEINH_01_009(006),
    data element: EWERK
           MENGE_01_013(017),
    data element: AUFEP
            EBELP_014(005),
    data element: AUFEP
         END OF ITAB.
    START-OF-SELECTION.
    FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FILE
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = ITAB
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    SORT ITAB BY IND.
    START-OF-SELECTION.
    LOOP AT ITAB.
    REFRESH IT_MESSAGES.
    <b>V_IND = V_IND + 1.</b>
    <b>AT NEW IND.</b>
    <b>READ TABLE ITAB INDEX SY-TABIX.</b>
    PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0100'.
    PERFORM BDC_FIELD       USING 'EKKO-LIFNR'
                                  ITAB-LIFNR_001.
    PERFORM BDC_FIELD       USING 'RM06E-BSART'
                                  ITAB-BSART_002.
    *perform bdc_field       using 'RM06E-BEDAT'
                                 ITAB-BEDAT_003.
    PERFORM BDC_FIELD       USING 'EKKO-EKORG'
                                  ITAB-EKORG_004.
    PERFORM BDC_FIELD       USING 'RM06E-LPEIN'
                                  ITAB-LPEIN_005.
    PERFORM BDC_FIELD       USING 'EKKO-EKGRP'
                                  ITAB-EKGRP_006.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    ENDAT.
    <b>PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
    CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN.
    PERFORM BDC_FIELD       USING  V_EMATN
                                   ITAB-EMATN_01_007.
    CONCATENATE 'EKPO-WERKS(' V_IND ')' INTO V_WERKS.
    PERFORM BDC_FIELD       USING  V_WERKS
                                   ITAB-WERKS_01_008.
    CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH.
    PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
    PERFORM BDC_FIELD       USING  V_PEINH
                                   ITAB-PEINH_01_009.
    *CONCATENATE 'EKPO-MENGE(' V_IND ')' INTO V_MENGE.
    *perform bdc_dynpro      using 'SAPMM06E' '0120'.
    *perform bdc_field       using  V_MENGE
                                  ITAB-MENGE_01_013.
    *CONCATENATE 'EKPO-EBELP(' V_IND ')' INTO V_EBELP.
    PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
    PERFORM BDC_FIELD       USING  'RM06E-EBELP'
                                   ITAB-EBELP_014.</b>PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    AT END OF IND.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=BU'.
    ENDAT.
    CALL TRANSACTION 'ME21' USING IT_BDCDATA MODE 'A'
                                             UPDATE 'S'
                                        MESSAGES INTO IT_MESSAGES.
       LOOP AT IT_MESSAGES WHERE MSGTYP = 'E' OR MSGTYP = 'A'.
         IF FLAG = 'X'.
         CALL FUNCTION 'BDC_OPEN_GROUP'
         EXPORTING
            CLIENT                    = SY-MANDT
           DEST                      = FILLER8
            GROUP                     = 'GAMY_FAILURE'
           HOLDDATE                  = FILLER8
            KEEP                      = 'X'
            USER                      = SY-UNAME
           RECORD                    = FILLER1
           PROG                      = SY-CPROG
         IMPORTING
           QID                       =
          EXCEPTIONS
            CLIENT_INVALID            = 1
            DESTINATION_INVALID       = 2
            GROUP_INVALID             = 3
            GROUP_IS_LOCKED           = 4
            HOLDDATE_INVALID          = 5
            INTERNAL_ERROR            = 6
            QUEUE_ERROR               = 7
            RUNNING                   = 8
            SYSTEM_LOCK_ERROR         = 9
            USER_INVALID              = 10
            OTHERS                    = 11
         IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         CLEAR FLAG.
         ENDIF.
         CALL FUNCTION 'BDC_INSERT'
          EXPORTING
            TCODE                  = 'ME21'
           POST_LOCAL             = NOVBLOCAL
           PRINTING               = NOPRINT
           SIMUBATCH              = ' '
           CTUPARAMS              = ' '
           TABLES
             DYNPROTAB              = IT_BDCDATA
          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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
        ENDIF.
    CALL FUNCTION 'FORMAT_MESSAGE'
      EXPORTING
        ID              = IT_MESSAGES-MSGID
        LANG            = 'EN'
        NO              = IT_MESSAGES-MSGNR
        V1              = IT_MESSAGES-MSGV1
        V2              = IT_MESSAGES-MSGV2
        V3              = IT_MESSAGES-MSGV3
        V4              = IT_MESSAGES-MSGV4
      IMPORTING
        MSG             = V_MSG
      EXCEPTIONS
        NOT_FOUND       = 1
        OTHERS          = 2
       WRITE : / V_MSG.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
       ENDLOOP.
    IF FLAG NE 'X'.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
       EXCEPTIONS
         NOT_OPEN          = 1
         QUEUE_ERROR       = 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.
      ENDIF.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-PROGRAM  = PROGRAM.
      IT_BDCDATA-DYNPRO   = DYNPRO.
      IT_BDCDATA-DYNBEGIN = 'X'.
      APPEND IT_BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
        CLEAR IT_BDCDATA.
        IT_BDCDATA-FNAM = FNAM.
        IT_BDCDATA-FVAL = FVAL.
        APPEND IT_BDCDATA.

  • Creation of po with mutiple line items using BDC

    Hi Gurus,
          Can any body hav notes for creating po's using BDC with multiple line items in transaction ME21. I hav created po for single line item but if i tried to create multiple line items, it ll create multiple po's...
    thanks in advance
    arun

    See the Below Logic for me22 and it is also same for me21
    report zpochange.
    data : i_error like bdcmsgcoll occurs 0 with header line.
    data : i_bdcdata like bdcdata occurs 0 with header line.
    tables : ekko, ekpo.
    data :c1(10) value 'ME22',
          c2(1) value ',',c3(10).
    data : var1(20). " LIKE EKKO-EBELN.
    data : var2 like ekko-ebeln.
    data : begin of i_ekko occurs 0,
              header(2),
              ebeln like ekko-ebeln,
              end of i_ekko.
    data : begin of i_ekpo occurs 0,
    item(2),
            ebeln like ekpo-ebeln,
            ebelp like ekpo-ebelp,
            menge(10), " LIKE EKPO-MENGE,
           end of i_ekpo.
    data : v like ekpo-ebelp.
    data: begin of itab occurs 0,
             text(300),
            end of itab.
    parameters: p_file like ibipparms-path.
    *PARAMETERS: PONUMBER LIKE EKPO-EBELN.
    at selection-screen on value-request for p_file.
    call function 'F4_FILENAME'
      exporting
        program_name        = syst-cprog
        dynpro_number       = syst-dynnr
       FIELD_NAME          = ' '
      importing
        file_name           = p_file
    start-of-selection.
    *SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE EBELN = PONUMBER.
          SELECT EBELN EBELP MENGE FROM EKPO INTO TABLE I_EKPO WHERE EBELN
    *= PONUMBER.
    perform get_data.
    *LOOP AT ITAB.
    WRITE :/ ITAB.
    ENDLOOP.
    loop at itab.
    var1 = itab-text+0(1).
    if var1 = 'H'.
    *I_EKKO-EBELN = ITAB-TEXT.
    split itab at c2 into i_ekko-header
                           i_ekko-ebeln.
    SPLIT  ITAB AT ',' INTO I_EKKO-EBELN.
                        " I_EKPO-EBELP
                        " I_EKPO-MENGE
                        " var1.
    append i_ekko.
    else.
    split itab at c2 into i_ekpo-item
                            i_ekpo-ebeln
                            i_ekpo-ebelp
                            i_ekpo-menge.
    append i_ekpo.
    endif.
    *var2 = i_ekpo-ebeln.
      MOVE VAR1 TO I_EKPO-EBELN.
      MOVE VAR1 TO I_EKKO-EBELN.
    APPEND: I_EKPO.
    *if not var1 is initial.
        split var1 at ',' into i_ekpo-ebelp
                               i_ekpo-menge.
      i_ekpo-ebeln = var2.
    append i_ekpo.
    *endif.
    endloop.
    loop at i_ekpo.
    write :/ i_ekpo.
    endloop.
    loop at i_ekko.
    perform fill_data. " TABLES I_EKPO.
    endloop.
    LOOP AT I_EKPO.
    WRITE :/ I_EKPO.
    ENDLOOP.
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    *LOOP AT I_ERROR.
    WRITE :/ I_ERROR.
    ENDLOOP.
    form get_data.
    call function 'WS_UPLOAD'
    exporting
       codepage                      = ' '
       filename                      = p_file
       filetype                      = 'ASC'
       headlen                       = ' '
       line_exit                     = ' '
       trunclen                      = ' '
       user_form                     = ' '
       user_prog                     = ' '
       dat_d_format                  = ' '
    IMPORTING
      FILELENGTH                    =
      tables
        data_tab                      = itab
    exceptions
       conversion_error              = 1
       file_open_error               = 2
       file_read_error               = 3
       invalid_type                  = 4
       no_batch                      = 5
       unknown_error                 = 6
       invalid_table_width           = 7
       gui_refuse_filetransfer       = 8
       customer_error                = 9
       others                        = 10
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    endform.                    " GET_DATA
    *&      Form  FILL_DATA
          text
         -->P_I_EKPO  text
    form fill_data. " tables   i_ekpo .
    perform bdcscreen using 'SAPMM06E' '0105'.
    perform bdcfield using 'RM06E-BSTNR' i_ekko-ebeln.
    perform bdcfield using 'BDC_OKCODE' '/00'.
    loop at i_ekpo where ebeln = i_ekko-ebeln.
      V = I_EKPO-EBELP.
    perform bdcscreen using 'SAPMM06E' 0120.
    perform bdcfield using 'BDC_CURSOR' 'RM06E-EBELP'.
    perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.
    perform bdcfield using 'BDC_OKCODE' '/00'.
    perform bdcscreen using 'SAPMM06E' 0120.
    perform bdcfield using 'BDC_CURSOR' 'EKPO-MENGE(01)'.
    perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.
    perform bdcfield using 'EKPO-MENGE(01)' i_ekpo-menge.
    perform bdcfield using 'BDC_OKCODE' '/00'.
    *PERFORM BDCSCREEN USING 'SAPMM06E' 0120.
    *PERFORM BDCFIELD USING 'BDC_CURSOR'  'RMO6E-EBELP'.
    *CLEAR V.
    endloop.
    perform bdcfield using 'BDC_OKCODE' '=BU'.
    call transaction  c1 using i_bdcdata mode 'A'
                                       messages into i_error.
    refresh i_bdcdata.
    endform.                    " FILL_DATA
    *&      Form  BDCSCREEN
          text
         -->P_0140   text
         -->P_0120   text
    form bdcscreen using    p_program p_screen.
    i_bdcdata-program = p_program.
    i_bdcdata-dynpro = p_screen.
    i_bdcdata-dynbegin = 'X'.
    append i_bdcdata.
    clear i_bdcdata.
    endform.                    " BDCSCREEN
    *&      Form  BDCFIELD
          text
         -->P_0145   text
         -->P_I_EKPO_EBELN  text
    form bdcfield using    fnam fval.
    i_bdcdata-fnam = fnam.
    i_bdcdata-fval = fval.
    append i_bdcdata.
    clear i_bdcdata.
    endform.                    " BDCFIELD
    Reward Points if it is helpful
    Thanks
    Seshu

Maybe you are looking for