BDC for Open Po

Dear Gurus,
Any one can send me the BDC code For ME21N.
Kl. Help me... I recorded but not working in multi line items...
Rewards will be sure..
Regards,
Murugesh R

Hi Try this code...
*& Report YBAPI_PO_CREATE1
REPORT YBAPI_PO_CREATE1.
data:
header like BAPIMEPOHEADER,
headerx like BAPIMEPOHEADERX,
it_item like standard table of BAPIMEPOITEM,
it_itemx like standard table of BAPIMEPOITEMX,
return like standard table of BAPIRET2,
wa_item like BAPIMEPOITEM,
wa_itemx like BAPIMEPOITEMX,
p_int type i,
p_matnr like mara-matnr,
p_pono like ekko-ebeln.
constants:
c_x type c value 'X'.
header-comp_code = '3000'.
header-doc_type = 'DP25'.
header-creat_date = sy-datum.
header-item_intvl = '10'.
header-vendor = 'ARAMI-00'.
header-langu = sy-langu.
header-pmnttrms = '0001'.
header-purch_org = '3000'.
header-pur_group = '010'.
header-currency = 'USD'.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-creat_date = c_x.
headerx-item_intvl = c_x .
headerx-vendor = c_x.
headerx-langu = c_x.
headerx-pmnttrms = c_x .
headerx-purch_org = c_x.
headerx-pur_group = c_x.
*LOOP AT it_final2 INTO wa_final2.
p_int = p_int + 10.
wa_item-po_item = p_int.
p_matnr = 'T-SRM01'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = p_matnr
IMPORTING
output = p_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
*IF sy-subrc = 0.
*MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
wa_item-material = p_matnr.
wa_item-plant = '3200'.
wa_item-quantity = 100.
wa_item-conf_ctrl = 'Z01'.
wa_item-ACKN_REQD = 'X'.
WA_ITEM-ERS = ''.
APPEND wa_item TO it_item.
wa_itemx-po_item = p_int.
wa_itemx-material = c_x.
wa_itemx-plant = c_x .
wa_itemx-stge_loc = c_x .
wa_itemx-quantity = c_x .
wa_itemx-item_cat = c_x .
wa_itemx-acctasscat = c_x .
wa_itemx-conf_ctrl = 'X'.
wa_itemx-ACKN_REQD = 'X'.
WA_ITEMX-ERS = 'X'.
APPEND wa_itemx TO it_itemx.
*ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = p_pono
TABLES
return = return
poitem = it_item
poitemx = it_itemx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
write:/ p_pono.

Similar Messages

  • BDC or LSMW for open PO

    Dear Friends,
    We are suppose to go likve soon, but we have @ 500 open Purchase orders and we would like to ipload same in sap as retail can any 1 guide me how to do it?
    Regrads,
    Vishal
    [email protected]

    Hi Vishal,
    Please make a note that,
    LSMW is used to transfer Master Data.
    BDC is used for transactional Data.
    LSMW can import data from legacy systems (e.g. in the form of Excel sheets or CSV files). For this, I guess, LSMW converts your data into batch input files automatically. If you use BDC, on the other hand, you have to write your batch input file yourself, line per line.
    So, Open Purchase Order are the Transactional Data for you can use BDC for this Purpose
    Please take your ABAPER's help to will write a Code to Migrate the Data.
    Hope this Solve your Purpose and Please Reward If Really Helpful,
    Thanks and Regards,
    Sateesh.Kandula

  • FM or BAPI or BDC for clearing open items...

    Hello Gurus,
    I have to write a code to clear/ close 12 million open G/L items in SAP. Is there a standard SAP FM or BAPI to do this ? Or do I have to write a BDC for this. If I have to write BDC, do I write BDC on T-Code F.13, FB05 or other T-Code.
    Regards,
    Jainam.
    Edited by: Jainam Shah on Sep 23, 2010 5:13 PM

    If you have configured the correct clearing criteria in the IMG, then you can just run program SAPF124.  Why did you need a shell program with a BDC - are you trying to clear by document within your clearing criteria?

  • Issue with MB25 BDC for Dynamic Selection Screen

    Hi Experts,
    I recorded one BDC for MB25 Tcode regarding to determine Open Reservation(s) in E Mode (Display Mode). I am passing 3 parameters.
    1. Plant,
    2. Requirement Date
    3. Multiple Reservation Numbers i.e. RSNUM from Dynamic Selection i.e. 2nd Button -> Header Data for Reservation -> Reservation -> Multiple Selection Icon.
    But while executing that BDC, I need to manually click every time on 'Header Data for Reservation' Tree and then Multiple Selection for Reservation Icon.
    I want below steps automatically while executing:
    - Open 'Header Data for Reservation' Tree
    - Click Reservation
    - Open Popup for 'Multiple Selection'.
    So no need to click every time on Dynamic Selection Screen i.e. Header Data for Reservation -> Reservation -> Multiple Selection Icon.
    Please find attached screen shot for your reference.
    Please guide.
    Thanks and Regards,
    Emon Master

    Hello Jainam,
    submit (sy-repid) with selection-table v_sp
                             with free selections EXPRESSIONS
                             via selection-screen.
    Without going through the details, dont you think this will cause an inifinite loop as the calling & the called programs are the same.
    Please enlighten me !!
    BR,
    Suhas

  • Problem in BDC for F-02 -- Currency Problem

    Dear Experts,
    I have written a BDC for F-02 to upload the opening balances of vendors.
    Problem is , this BDC is for Libya country,  where decimal places is 3.
    Now when i run my BDC, if the amount is  22.54, it will upload it as 22.540, which is ok, but if the amount is 22.543, it upload it as 22.540 instead of 22.543.
    can one provide some guidance in this....
    Regards,
    Maverick

    Hi
    The output format of an amonut is managed by the currency, you shouldn't have any particular problem,
    In BDC program the field to be used to transfer the amount has to be char, so probably the easier solution is to write it into the bdc field in according to the currency:
    WRITE <AMOUNT> CURRENCY <CUURENCY> TO <BDC FIELD>.
    Max

  • BDC for every 80 records

    Dear All,
    I have one typical BDC problem.
    If the number of records in file are crossing 80,my bdc is giving problem. So I need to split total records into sets of 80 and submit them.
    So I need to create the session name dynamically, pass the data dynamically.
    IF you can send some example code for the above it will be great help for me.
    Many Thanks,
    Ranjan

    Please find my code..
    This info may be useful..
    I'm doing BDC for KB31N tcode,where i have two items in header(doc date, posting date).Multiple line items(each line item should consists of 4 fields namely cost center,statistical key figure,total qty,text).
    When i'm sending more than 80 rec records i'm being populated an error message "BDC_Close_group, session not opened"
    Kindly advice me how to handle this
    *& Report  ZCO_I025_WSKAZNIKI_STAT_DEV                                 *
    *& Interfejs wczytywania wskaŸników statystycznych                     *
    REPORT  zco_i025_wskazniki_stat_dev                                 .
    TYPES: BEGIN OF l_tab_dane,
        indic LIKE rk23f-stagr,
        quant LIKE rk23f-mbgbtr,
        mpk LIKE rk23f-ekostl,
        order LIKE rk23f-eaufnr,
        text LIKE rk23f-sgtxt,
      END OF l_tab_dane.
    DATA: it_excel TYPE TABLE OF alsmex_tabline,
      wa_excel TYPE alsmex_tabline,
      it_data TYPE TABLE OF l_tab_dane,
      wa_data TYPE l_tab_dane,
      error  TYPE C,
      msg TYPE string.
    DATA:iv_pole TYPE string,
      ddatum(10),
      kdatum(10),
    *Inserted By  Developer
       filelist    TYPE filetable,
            rc          TYPE i.
    DATA: BEGIN OF bdctab OCCURS 5.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdctab.
    SELECTION-SCREEN BEGIN OF BLOCK p1 WITH FRAME TITLE text-001.
    PARAMETERS:
      p_zakla LIKE tka01-kokrs DEFAULT '1000',
      p_ddate LIKE sy-datum DEFAULT sy-datum,
      p_kdate LIKE sy-datum DEFAULT sy-datum.
    SELECTION-SCREEN ULINE.
    PARAMETERS:
      p_fname LIKE rlgrap-filename.  " DEFAULT 'd:dane.xls'.
    SELECTION-SCREEN END OF BLOCK p1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          file_filter       = cl_gui_frontend_services=>filetype_excel
         multiselection    = 'X'
        CHANGING
          file_table        = filelist
          rc                = rc.
      IF LINES( filelist ) IS INITIAL.
        EXIT.
      ENDIF.
      READ TABLE filelist INDEX 1 INTO p_fname.
    START-OF-SELECTION.
    AUTHORITY-CHECK OBJECT 'TKA01'
      ID 'KOKRS' FIELD p_zakla.
    CONCATENATE p_ddate6(2) '.' p_ddate4(2) '.' p_ddate(4) INTO ddatum.
    CONCATENATE p_kdate6(2) '.' p_kdate4(2) '.' p_kdate(4) INTO kdatum.
    error = '0'.
    PERFORM wczytaj_dane.
    IF error = '0'.
      PERFORM utworz_sesje.
      PERFORM wprowadz_dane.
        PERFORM zamknij_sesje.   "comment by prav
    ENDIF.
    PERFORM zamknij_sesje.        "add by prav
    IF error = '1'.
      WRITE: msg, /.
    ENDIF.
    WRITE: 'Wykonano', /.
    *&      Form  wczytaj_dane
          text
    FORM wczytaj_dane.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_fname
          i_begin_col             = 1
          i_begin_row             = 1
          i_end_col               = 8
          i_end_row               = 65000
        TABLES
          intern                  = it_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE: / 'B³ad importu pliku wejsciowego: ', p_fname, ' - ',
        sy-subrc.
      ELSE.
        SORT it_excel BY row col.
        LOOP AT it_excel INTO wa_excel.
          IF wa_excel-row = 1.
            CONTINUE.
          ENDIF.
          iv_pole = wa_excel-value.
          CASE wa_excel-col.
            WHEN 1. wa_data-indic = iv_pole.
            WHEN 2.
              REPLACE ',' WITH '.' INTO iv_pole.
              wa_data-quant = iv_pole.
            WHEN 3. wa_data-mpk = iv_pole.
            WHEN 4. wa_data-order = iv_pole.
            WHEN 5. wa_data-text = iv_pole.
          ENDCASE.
          AT END OF row.
            IF wa_data-mpk IS INITIAL AND wa_data-order IS INITIAL.
              error = '1'.
              WRITE:
    'Musi byæ podane Stanowisko kosztów lub Zlecenie wewnêtrzne. Rekord: ',
              wa_excel-row, /.
              EXIT.
            ENDIF.
            IF wa_data-mpk IS NOT INITIAL AND wa_data-order IS NOT INITIAL.
              error = '1'.
              WRITE:
    'Musi byæ podane Stanowisko kosztów lub Zlecenie wewnêtrzne. Rekord: ',
              wa_excel-row, /.
              EXIT.
            ENDIF.
            IF wa_data-indic IS INITIAL.
              error = '1'.
              WRITE: 'Brak identyfikatora wskaŸnika. Rekord: ', wa_excel-row
              EXIT.
            ENDIF.
            IF wa_data-quant IS INITIAL.
              error = '1'.
              WRITE: 'Brak informacji o iloœci. Rekord: ', wa_excel-row, /.
              EXIT.
            ENDIF.
            APPEND wa_data TO it_data.
            CLEAR wa_data.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "wczytaj_dane
    *&      Form  wprowadz_dane
          text
    FORM wprowadz_dane.
      DATA:licznik TYPE i,
        l_txt TYPE string,
        pole(30) TYPE c,
        liczba(15) TYPE c.
      PERFORM bdc_dynpro      USING 'SAPLSPO4' '0300'.
      PERFORM bdc_field       USING 'BDC_CURSOR' 'SVALD-VALUE(01)'.
      PERFORM bdc_field       USING 'BDC_OKCODE' '=FURT'.
      PERFORM bdc_field       USING 'SVALD-VALUE(01)' p_zakla.
      PERFORM bdc_dynpro      USING 'SAPLK23F1' '1200'.
      PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
      PERFORM bdc_field       USING 'COHEADER-SEND_REC_REL' '03SAP'.
      PERFORM bdc_field       USING 'RK23F-STATUS' 'L'.
      PERFORM bdc_field       USING 'COHEADER-BLDAT' ddatum.
      PERFORM bdc_field       USING 'COHEADER-BUDAT' kdatum.
      PERFORM bdc_field       USING 'BDC_CURSOR' 'EKOSTL(1)'.
      licznik = 0.
      LOOP AT it_data into wa_data.
        ADD 1 TO licznik.
        l_txt = licznik.
        CONCATENATE 'EL4(' l_txt ')' INTO pole.
        condense pole no-gaps.
        PERFORM bdc_field USING pole wa_data-indic.
        CONCATENATE 'ELR1(' l_txt ')' INTO pole.
           condense pole no-gaps.
          liczba = wa_data-quant.
          if liczba <  0.
              shift liczba circular  left up to '-'.
          endif.
            condense liczba no-gaps.
        PERFORM bdc_field USING pole liczba.
        IF NOT wa_data-mpk IS INITIAL.
          CONCATENATE 'EL2(' l_txt ')' INTO pole.
             condense pole no-gaps.
          PERFORM bdc_field USING pole wa_data-mpk.
        ENDIF.
        IF NOT wa_data-order IS INITIAL.
          CONCATENATE 'EL3(' l_txt ')' INTO pole.
             condense pole no-gaps.
          PERFORM bdc_field USING pole wa_data-order.
        ENDIF.
        CONCATENATE 'EL8(' l_txt ')' INTO pole.
           condense pole no-gaps.
        PERFORM bdc_field USING pole wa_data-text.
      ENDLOOP.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode            = 'KB31N'
        TABLES
          dynprotab        = bdctab
        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.
        WRITE: / text-010 .
      ENDIF.
      REFRESH bdctab.
    clear:bdctab.        "by praveen
    ENDFORM.                    "wprowadz_dane
    *&      Form  bdc_dynpro
          text
         -->PROGRAM    text
         -->DYNPRO     text
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdctab.
      MOVE:
        program   TO bdctab-program,
        dynpro    TO bdctab-dynpro,
        'X'       TO bdctab-dynbegin.
      APPEND bdctab.
    ENDFORM.                    "bdc_dynpro
    *&      Form  bdc_field
          text
         -->POLE       text
         -->WARTOSC    text
    FORM bdc_field USING pole wartosc.
      CLEAR bdctab.
      MOVE:
        pole     TO bdctab-fnam,
        wartosc  TO bdctab-fval.
      APPEND bdctab.
    ENDFORM.                    "bdc_field
    *&      Form  utworz_sesje
          text
    FORM utworz_sesje.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = 'WSKASTAT'
          user   = sy-uname
          keep   = 'X'.
    ENDFORM.                    "utworz_sesje
    *&      Form  zamknij_sesje
          text
    FORM zamknij_sesje.
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
      IF sy-subrc NE 0.
        WRITE: /, 'B³ad podczas zamykania sesji'.
        EXIT.
      ENDIF.
    ENDFORM.                    "zamknij_sesje

  • BDC for Tax code updation

    Hi all,
    Iam trying to update tax code for open POs using T.Code ME22. For this iam writing BDC using call transaction.
    I have PO, POitem,INTROW,EXTROW,Required Tax code in input file.
    Pls guide me how to handle the updation of tax code with the available information.
    Note: All the POs are last fiscal yrs open POs.

    Record the BDC using SHDB with one of the records given in your file.
    Check the code and use it in your BDC program.

  • BDC for ME01.

    Hi All,
         I need to write a BDC for Source list(ME01). Could anzbody suggest me how to do this.
    It should be definetely contain the field AUTET.
    Thanks.
    Pls explain more elaborately.

    Hi Shekar,
    Hi,
    See the sample attached code for ME51 using table control.
    similarly record the same for ME01 and copy the TC logic from this.
    REPORT zmm_pr_upload_mat
    NO STANDARD PAGE HEADING
    LINE-SIZE 255.
    Standard Include for Selection Screen
    INCLUDE bdcrecx1.
    Internal Table for Upload Data
    DATA: BEGIN OF i_pr OCCURS 0,
    Header Screen
    sno(3), " SNo
    bsart(004), " PR Type
    epstp(001), " Item Category
    knttp(001), " Account Assignment
    eeind(010), " Delivery Date
    lpein(001), " Category of Del Date
    werks(004), " Plant
    lgort(004), " Storage Location
    ekgrp(003), " Purchasing Group
    matkl(009), " Material Group
    bednr(010), " Tracking No
    afnam(012), " Requisitioner
    Item Details
    matnr(018), " Material No
    menge(017), " Quantity
    badat(010),
    frgdt(010),
    preis(014), " Valuation Price
    waers(005), " Currency
    peinh(005),
    wepos(001),
    repos(001),
    sakto(010), " GL Account
    kostl(010), " Cost Center
    bnfpo(005),
    END OF i_pr.
    Internal Table for header Data
    DATA: BEGIN OF it_header OCCURS 0,
    sno(3), " SNo
    bsart(004), " PR Type
    epstp(001), " Item Category
    knttp(001), " Account Assignment
    eeind(010), " Delivery Date
    werks(004), " Plant
    lgort(004), " Storage Location
    ekgrp(003), " Purchasing Group
    matkl(009), " Material Group
    bednr(010), " Tracking No
    afnam(012), " Requisitioner
    END OF it_header.
    Internal Table for Item Data
    DATA: BEGIN OF it_item OCCURS 0,
    sno(3), " SNo
    matnr(018), " Material No
    menge(017), " Quantity
    preis(014), " Valuation Price
    sakto(010), " GL Account
    kostl(010), " Cost Center
    END OF it_item.
    Data Variables & Constants
    CONSTANTS : c_x VALUE 'X'. " Flag
    DATA : v_l(2), " Counter
    v_rowno(5), " Row No
    v_2(2), " Counter
    v_rows LIKE sy-srows, " Rows in TC
    v_field(45). " String
    Parameters
    PARAMETERS: p_file LIKE ibipparms-path. " Filename
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_file.
    Start of Selection
    START-OF-SELECTION.
    Open the BDC Session
    PERFORM open_group.
    Upload the File into internal Table
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    filename = p_file
    filetype = 'DAT'
    TABLES
    data_tab = i_pr
    EXCEPTIONS
    conversion_error = 1
    invalid_table_width = 2
    invalid_type = 3
    no_batch = 4
    unknown_error = 5
    gui_refuse_filetransfer = 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.
    SORT i_pr BY sno.
    LOOP AT i_pr.
    MOVE-CORRESPONDING i_pr TO it_item.
    APPEND it_item.
    CLEAR it_item.
    AT END OF sno.
    READ TABLE i_pr INDEX sy-tabix.
    MOVE-CORRESPONDING i_pr TO it_header.
    APPEND it_header.
    CLEAR it_header.
    ENDAT.
    ENDLOOP.
    SORT it_header BY sno.
    SORT it_item BY sno.
    v_rows = sy-srows - 6.
    Upload the Data from Internal Table
    LOOP AT it_header.
    Header Data
    PERFORM bdc_dynpro USING 'SAPMM06B' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EBAN-BEDNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'EBAN-BSART'
    it_header-bsart.
    PERFORM bdc_field USING 'RM06B-EPSTP'
    it_header-epstp.
    PERFORM bdc_field USING 'EBAN-KNTTP'
    it_header-knttp.
    PERFORM bdc_field USING 'RM06B-EEIND'
    it_header-eeind.
    PERFORM bdc_field USING 'RM06B-LPEIN'
    it_header-lpein.
    PERFORM bdc_field USING 'EBAN-WERKS'
    it_header-werks.
    PERFORM bdc_field USING 'EBAN-LGORT'
    it_header-lgort.
    PERFORM bdc_field USING 'EBAN-EKGRP'
    it_header-ekgrp.
    PERFORM bdc_field USING 'EBAN-MATKL'
    it_header-matkl.
    PERFORM bdc_field USING 'EBAN-BEDNR'
    it_header-bednr.
    PERFORM bdc_field USING 'EBAN-AFNAM'
    it_header-afnam.
    Item Details
    v_l = 0.
    To add no. of rows
    v_2 = 0 .
    As the screen is showing 13 rows defaulted to 130
    v_rowno = 130 .
    LOOP AT it_item WHERE sno = it_header-sno.
    v_l = v_l + 1.
    IF v_l = 14 .
    IF v_2 = 12 .
    v_2 = 12 .
    v_l = 2 .
    From second time onwards it is displaying 12 rows only
    v_rowno = v_rowno + 120 .
    PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RM06B-BNFPO'.
    PERFORM bdc_field USING 'RM06B-BNFPO'
    v_rowno.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    ELSE.
    V_2 initialized to 12 for second screen purpose
    v_2 = 12 .
    v_l = 2 .
    PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RM06B-BNFPO'.
    PERFORM bdc_field USING 'RM06B-BNFPO'
    v_rowno .
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    ENDIF.
    ENDIF.
    PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    CLEAR v_field.
    CONCATENATE 'EBAN-MATNR(' v_l ')' INTO v_field.
    PERFORM bdc_field USING v_field it_item-matnr.
    CLEAR v_field.
    CONCATENATE 'EBAN-MENGE(' v_l ')' INTO v_field.
    PERFORM bdc_field USING v_field it_item-menge.
    PERFORM bdc_dynpro USING 'SAPMM06B' '0102'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EBAN-PREIS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'EBAN-PREIS'
    it_item-preis.
    PERFORM bdc_dynpro USING 'SAPMM06B' '0505'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EBKN-SAKTO'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTE'.
    PERFORM bdc_field USING 'EBKN-SAKTO'
    it_item-sakto.
    Cost Center
    PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'COBL-KOSTL'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTE'.
    PERFORM bdc_field USING 'COBL-KOSTL'
    it_item-kostl.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTE'.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RM06B-BNFPO'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BU'.
    Call The Transaction
    PERFORM bdc_transaction USING 'ME51'.
    ENDLOOP.
    Close the BDC Session
    PERFORM close_group.
    <b>reward if useful</b>
    <b>Regards,
    Jackie..</b>

  • BDC for MIGO issue

    Hi All,
    I am trying to create BDC for MIGO T-code.But in recording part i am facing some problem
    recording steps : 1 .I am putting putting Purchasing Document Number.
                             2. Press enter.
                             3  Delivery Note
                             4. Bill of lading
                             5. GR/GI Slip No
                            6.  then in second part of screen i select batch tab and click on classification here i am
                                 geeting problem in normal way when we click this classification button new screen open in which we put values and then new batch is create but in recording after click on classification
    that screen is not coming so please can any body tell  how can i populate this classification screen.
    and put my values so migo process end.
    Regards
    Ankit

    Use this code
        l_meins = 'EA'.
      l_wa_goodsmvt_header-pstng_date = sy-datum.
      l_wa_goodsmvt_header-doc_date   = sy-datum.
      l_wa_goodsmvt_item-move_type      = '555'.
      l_wa_goodsmvt_item-move_plant     = '2000'   " Receiving plant
      l_wa_goodsmvt_item-move_stloc     = '0700'.  " Receiving SLoc
      l_wa_goodsmvt_item-material       = wa_ret_order-zzmat_no.
      l_wa_goodsmvt_item-entry_qnt      = wa_ret_order-zzqty_entered.
      l_wa_goodsmvt_item-plant          = wa_ret_order-zzissu_plant. " Plant
      l_wa_goodsmvt_item-stge_loc       = wa_ret_order-zzissu_strg_loc.
      l_wa_goodsmvt_item-entry_uom      = l_meins.
      l_wa_goodsmvt_item-entry_uom_iso  = l_meins.
      l_wa_goodsmvt_item-costcenter     = wa_ret_order-kostl.
      APPEND  l_wa_goodsmvt_item TO l_i_goodsmvt_item.
      l_goodsmvt_code-gm_code      = '03'.
    * Migo posting
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          goodsmvt_header  = l_wa_goodsmvt_header
          goodsmvt_code    = l_goodsmvt_code
        IMPORTING
          goodsmvt_headret = l_wa_goodsmvt_headret
          materialdocument = l_materialdocument
        TABLES
          goodsmvt_item    = l_i_goodsmvt_item
          return           = l_i_return.
    * Commit the changes
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = c_check.
    This code is mainly for creating STO
    Thanks
    Amitava

  • BDC for F-03

    Hi all,
    does anybody worked on BDC for F-03 ti upload open and post G/L accounts.
    send me that code.
    thanks
    Sachin

    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    Rob
    Edited by: Rob Burbank on Jun 29, 2010 10:02 AM

  • Bdc for transaction va01

    hi friends.
            how to create a bdc for va01... i need step by step procedure. please help me...

    Hi
    BDC (Batch Data Communication) works based on the data in the Internal table of structure "BDCDATA", and some of the very important lines with information (in sequence) Dynpro, Cursor-field and Data Fields, then call Transaction / Session Creation Logic.
    In Call Transaction method of BDC, the Message is handled manually using the structure "BDCMSGCOLL" and by refering to messages in "T100" Table. [Refer the standard Include BECRECX1 for more information.
    BDC can be created by Recording tool or my scracth creating a new program. Use transaction code 'SHDB'.
    A sample code by using the Recording method (Here both Call transaction and Session Method of BDC will be created by standard Recording tool [this you can find in include BDCRECX1])
    Code Only the Program, withoug Include BDCRECX1 (This std, inclu you can find)
    ***INCLUDE BDCRECX1.
    * for programs doing a data transfer by creating a batch-input session
    * and
    * for programs doing a data transfer by CALL TRANSACTION USING
    selection-screen begin of line.
    parameters session radiobutton group ctu. "create session
    selection-screen comment 3(20) text-s07 for field session.
    selection-screen position 45.
    parameters ctu radiobutton group ctu. "call transaction
    selection-screen comment 48(20) text-s08 for field ctu.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 3(20) text-s01 for field group.
    selection-screen position 25.
    parameters group(12). "group name of session
    selection-screen comment 48(20) text-s05 for field ctumode.
    selection-screen position 70.
    parameters ctumode like ctu_params-dismode default 'N'.
    "A: show all dynpros
    "E: show dynpro on error only
    "N: do not display dynpro
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 3(20) text-s02 for field user.
    selection-screen position 25.
    parameters: user(12) default sy-uname. "user for session in batch
    selection-screen comment 48(20) text-s06 for field cupdate.
    selection-screen position 70.
    parameters cupdate like ctu_params-updmode default 'L'.
    "S: synchronously
    "A: asynchronously
    "L: local
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 3(20) text-s03 for field keep.
    selection-screen position 25.
    parameters: keep as checkbox. "' ' = delete session if finished
    "'X' = keep session if finished
    selection-screen comment 48(20) text-s09 for field e_group.
    selection-screen position 70.
    parameters e_group(12). "group name of error-session
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 3(20) text-s04 for field holddate.
    selection-screen position 25.
    parameters: holddate like sy-datum.
    selection-screen comment 51(17) text-s02 for field e_user.
    selection-screen position 70.
    parameters: e_user(12) default sy-uname. "user for error-session
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 51(17) text-s03 for field e_keep.
    selection-screen position 70.
    parameters: e_keep as checkbox. "' ' = delete session if finished
    "'X' = keep session if finished
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 51(17) text-s04 for field e_hdate.
    selection-screen position 70.
    parameters: e_hdate like sy-datum.
    selection-screen end of line.
    selection-screen skip.
    selection-screen begin of line.
    selection-screen comment 1(33) text-s10 for field nodata.
    parameters: nodata default '/' lower case. "nodata
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33) text-s11 for field smalllog.
    parameters: smalllog as checkbox. "' ' = log all transactions
    "'X' = no transaction logging
    selection-screen end of line.
    * data definition
    * Batchinputdata of single transaction
    data: bdcdata like bdcdata occurs 0 with header line.
    * messages of call transaction
    data: messtab like bdcmsgcoll occurs 0 with header line.
    * error session opened (' ' or 'X')
    data: e_group_opened.
    * message texts
    tables: t100.
    * at selection screen *
    at selection-screen.
    * group and user must be filled for create session
    if session = 'X' and
    group = space or user = space.
    message e613(ms).
    endif.
    * open dataset *
    form open_dataset using p_dataset.
    open dataset p_dataset
    for input in text mode
    encoding default.
    if sy-subrc <> 0.
    write: / text-e00, sy-subrc.
    stop.
    endif.
    endform.
    * close dataset *
    form close_dataset using p_dataset.
    close dataset p_dataset.
    endform.
    * create batchinput session *
    * (not for call transaction using...) *
    form open_group.
    if session = 'X'.
    skip.
    write: /(20) 'Create group'(i01), group.
    skip.
    * open batchinput group
    call function 'BDC_OPEN_GROUP'
    exporting client = sy-mandt
    group = group
    user = user
    keep = keep
    holddate = holddate.
    write: /(30) 'BDC_OPEN_GROUP'(i02),
    (12) 'returncode:'(i05),
    sy-subrc.
    endif.
    endform.
    * end batchinput session *
    * (call transaction using...: error session) *
    form close_group.
    if session = 'X'.
    * close batchinput group
    call function 'BDC_CLOSE_GROUP'.
    write: /(30) 'BDC_CLOSE_GROUP'(i04),
    (12) 'returncode:'(i05),
    sy-subrc.
    else.
    if e_group_opened = 'X'.
    call function 'BDC_CLOSE_GROUP'.
    write: /.
    write: /(30) 'Fehlermappe wurde erzeugt'(i06).
    e_group_opened = ' '.
    endif.
    endif.
    endform.
    * Start new transaction according to parameters *
    form bdc_transaction using tcode.
    data: l_mstring(480).
    data: l_subrc like sy-subrc.
    * batch input session
    if session = 'X'.
    call function 'BDC_INSERT'
    exporting tcode = tcode
    tables dynprotab = bdcdata.
    if smalllog <> 'X'.
    write: / 'BDC_INSERT'(i03),
    tcode,
    'returncode:'(i05),
    sy-subrc,
    'RECORD:',
    sy-index.
    endif.
    * call transaction using
    else.
    refresh messtab.
    call transaction tcode using bdcdata
    mode ctumode
    update cupdate
    messages into messtab.
    l_subrc = sy-subrc.
    if smalllog <> 'X'.
    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.
    write: / messtab-msgtyp, l_mstring(250).
    else.
    write: / messtab.
    endif.
    endloop.
    skip.
    endif.
    ** Erzeugen fehlermappe ************************************************
    if l_subrc <> 0 and e_group <> space.
    if e_group_opened = ' '.
    call function 'BDC_OPEN_GROUP'
    exporting client = sy-mandt
    group = e_group
    user = e_user
    keep = e_keep
    holddate = e_hdate.
    e_group_opened = 'X'.
    endif.
    call function 'BDC_INSERT'
    exporting tcode = tcode
    tables dynprotab = bdcdata.
    endif.
    endif.
    refresh bdcdata.
    endform.
    * Start new screen *
    form bdc_dynpro using program dynpro.
    clear bdcdata.
    bdcdata-program = program.
    bdcdata-dynpro = dynpro.
    bdcdata-dynbegin = 'X'.
    append bdcdata.
    endform.
    * Insert field *
    form bdc_field using fnam fval.
    if fval <> nodata.
    clear bdcdata.
    bdcdata-fnam = fnam.
    bdcdata-fval = fval.
    append bdcdata.
    endif.
    endform.
    Refer this link as an example:
    <b>http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm</b>
    Alternatively, Press the Item To Top Button(The 4th from left)Under the Item Table control, every time you want to enter item details,
    This would bring the item to the top of the table control every time.
    Record the transaction this way, and code for your BDC.
    Another alternative is to use a bapi:
    <b>BAPI_SALESORDER_CREATEFROMDAT2</b>
    Regards,
    Rk
    Message was edited by:
            Rk Pasupuleti

  • BDC for ME21N (Flat file format)

    Hello,
         I have to write a BDC for ME21N(stock transfer).... Someone pls give me the format of flat file... we need separate files for header and items or only one file is enough??? pls someone send me the format and code......
    my email id is [email protected]
    Thanks in advance...
    Regards,
    Maya.

    Hi
    see this and do accordingly
    REPORT zmm_bdcp_purchaseorderkb02
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    Declaring internal tables *
    *-----Declaring line structure
    DATA : BEGIN OF it_dummy OCCURS 0,
    dummy(255) TYPE c,
    END OF it_dummy.
    *-----Internal table for line items
    DATA : BEGIN OF it_idata OCCURS 0,
    ematn(18), "Material Number.
    menge(13), "Qyantity.
    netpr(11), "Net Price.
    werks(4), "Plant.
    ebelp(5), "Item Number.
    END OF it_idata.
    *-----Deep structure for header data and line items
    DATA : BEGIN OF it_me21 OCCURS 0,
    lifnr(10), "Vendor A/c No.
    bsart(4), "A/c Type.
    bedat(8), "Date of creation of PO.
    ekorg(4), "Purchasing Organisation.
    ekgrp(3), "Purchasing Group.
    x_data LIKE TABLE OF it_idata,
    END OF it_me21.
    DATA : x_idata LIKE LINE OF it_idata.
    DATA : v_delimit VALUE ','.
    DATA : v_indx(3) TYPE n.
    DATA : v_fnam(30) TYPE c.
    DATA : v_count TYPE n.
    DATA : v_ne TYPE i.
    DATA : v_ns TYPE i.
    *include bdcrecx1.
    INCLUDE zmm_incl_purchaseorderkb01.
    Search help for file *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION.
    To upload the data into line structure *
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = p_file
    filetype = 'DAT'
    TABLES
    data_tab = it_dummy.
    Processing the data from line structure to internal tables *
    REFRESH:it_me21.
    CLEAR :it_me21.
    LOOP AT it_dummy.
    IF it_dummy-dummy+0(01) = 'H'.
    v_indx = v_indx + 1.
    CLEAR it_idata.
    REFRESH it_idata.
    CLEAR it_me21-x_data.
    REFRESH it_me21-x_data.
    SHIFT it_dummy.
    SPLIT it_dummy AT v_delimit INTO it_me21-lifnr
    it_me21-bsart
    it_me21-bedat
    it_me21-ekorg
    it_me21-ekgrp.
    APPEND it_me21.
    ELSEIF it_dummy-dummy+0(01) = 'L'.
    SHIFT it_dummy.
    SPLIT it_dummy AT v_delimit INTO it_idata-ematn
    it_idata-menge
    it_idata-netpr
    it_idata-werks
    it_idata-ebelp.
    APPEND it_idata TO it_me21-x_data.
    MODIFY it_me21 INDEX v_indx.
    ENDIF.
    ENDLOOP.
    To open the group *
    PERFORM open_group.
    To populate the bdcdata table for header data *
    LOOP AT it_me21.
    v_count = v_count + 1.
    REFRESH it_bdcdata.
    PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0100',
    ' ' 'BDC_CURSOR' 'EKKO-LIFNR',
    ' ' 'BDC_OKCODE' '/00',
    ' ' 'EKKO-LIFNR' it_me21-lifnr,
    ' ' 'RM06E-BSART' it_me21-bsart,
    ' ' 'RM06E-BEDAT' it_me21-bedat,
    ' ' 'EKKO-EKORG' it_me21-ekorg,
    ' ' 'EKKO-EKGRP' it_me21-ekgrp,
    ' ' 'RM06E-LPEIN' 'T'.
    PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
    ' ' 'BDC_CURSOR' 'RM06E-EBELP',
    ' ' 'BDC_OKCODE' '/00'.
    MOVE 1 TO v_indx.
    *-----To populate the bdcdata table for line item data
    LOOP AT it_me21-x_data INTO x_idata.
    CONCATENATE 'EKPO-EMATN(' v_indx ')' INTO v_fnam.
    PERFORM subr_bdc_table USING ' ' v_fnam x_idata-ematn.
    CONCATENATE 'EKPO-MENGE(' v_indx ')' INTO v_fnam.
    PERFORM subr_bdc_table USING ' ' v_fnam x_idata-menge.
    CONCATENATE 'EKPO-NETPR(' v_indx ')' INTO v_fnam.
    PERFORM subr_bdc_table USING ' ' v_fnam x_idata-netpr.
    CONCATENATE 'EKPO-WERKS(' v_indx ')' INTO v_fnam.
    PERFORM subr_bdc_table USING ' ' v_fnam x_idata-werks.
    v_indx = v_indx + 1.
    PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
    ' ' 'BDC_CURSOR' 'RM06E-EBELP',
    ' ' 'BDC_OKCODE' '/00'.
    ENDLOOP.
    PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
    ' ' 'BDC_CURSOR' 'RM06E-EBELP',
    ' ' 'BDC_OKCODE' '=BU'.
    PERFORM bdc_transaction USING 'ME21'.
    ENDLOOP.
    PERFORM close_group.
    End of selection event *
    END-OF-SELECTION.
    IF session NE 'X'.
    *-----To display the successful records
    WRITE :/10 text-001. "Sucess records
    WRITE :/10 SY-ULINE(20).
    SKIP.
    IF it_sucess IS INITIAL.
    WRITE :/ text-002.
    ELSE.
    WRITE :/ text-008, "Total number of Succesful records
    35 v_ns.
    SKIP.
    WRITE:/ text-003, "Vendor Number
    17 text-004, "Record number
    30 text-005. "Message
    ENDIF.
    LOOP AT it_sucess.
    WRITE:/4 it_sucess-lifnr,
    17 it_sucess-tabix CENTERED,
    30 it_sucess-sucess_rec.
    ENDLOOP.
    SKIP.
    *-----To display the erroneous records
    WRITE:/10 text-006. "Error Records
    WRITE:/10 SY-ULINE(17).
    SKIP.
    IF it_error IS INITIAL.
    WRITE:/ text-007. "No error records
    ELSE.
    WRITE:/ text-009, "Total number of erroneous records
    35 v_ne.
    SKIP.
    WRITE:/ text-003, "Vendor Number
    17 text-004, "Record number
    30 text-005. "Message
    ENDIF.
    LOOP AT it_error.
    WRITE:/4 it_error-lifnr,
    17 it_error-tabix CENTERED,
    30 it_error-error_rec.
    ENDLOOP.
    REFRESH it_sucess.
    REFRESH it_error.
    ENDIF.
    CODE IN INCLUDE.
    Include ZMM_INCL_PURCHASEORDERKB01
    DATA: it_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA: it_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA: E_GROUP_OPENED.
    *-----Internal table to store sucess records
    DATA:BEGIN OF it_sucess OCCURS 0,
    msgtyp(1) TYPE c,
    lifnr LIKE ekko-lifnr,
    tabix LIKE sy-tabix,
    sucess_rec(125),
    END OF it_sucess.
    DATA: g_mess(125) type c.
    *-----Internal table to store error records
    DATA:BEGIN OF it_error OCCURS 0,
    msgtyp(1) TYPE c,
    lifnr LIKE ekko-lifnr,
    tabix LIKE sy-tabix,
    error_rec(125),
    END OF it_error.
    Selection screen
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS session RADIOBUTTON GROUP ctu. "create session
    SELECTION-SCREEN COMMENT 3(20) text-s07 FOR FIELD session.
    SELECTION-SCREEN POSITION 45.
    PARAMETERS ctu RADIOBUTTON GROUP ctu. "call transaction
    SELECTION-SCREEN COMMENT 48(20) text-s08 FOR FIELD ctu.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-s01 FOR FIELD group.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS group(12). "group name of session
    SELECTION-SCREEN COMMENT 48(20) text-s05 FOR FIELD ctumode.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
    "A: show all dynpros
    "E: show dynpro on error only
    "N: do not display dynpro
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 48(20) text-s06 FOR FIELD cupdate.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'L'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-s03 FOR FIELD keep.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS: keep AS CHECKBOX. "' ' = delete session if finished
    "'X' = keep session if finished
    SELECTION-SCREEN COMMENT 48(20) text-s09 FOR FIELD e_group.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS e_group(12). "group name of error-session
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 51(17) text-s03 FOR FIELD e_keep.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS: e_keep AS CHECKBOX. "' ' = delete session if finished
    "'X' = keep session if finished
    SELECTION-SCREEN END OF LINE.
    PARAMETERS:p_file LIKE rlgrap-filename.
    at selection screen *
    AT SELECTION-SCREEN.
    group and user must be filled for create session
    IF SESSION = 'X' AND
    GROUP = SPACE. "OR USER = SPACE.
    MESSAGE E613(MS).
    ENDIF.
    create batchinput session *
    FORM OPEN_GROUP.
    IF SESSION = 'X'.
    SKIP.
    WRITE: /(20) 'Create group'(I01), GROUP.
    SKIP.
    *----open batchinput group
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = GROUP
    USER = sy-uname.
    WRITE:/(30) 'BDC_OPEN_GROUP'(I02),
    (12) 'returncode:'(I05),
    SY-SUBRC.
    ENDIF.
    ENDFORM. "OPEN_GROUP
    end batchinput session *
    FORM CLOSE_GROUP.
    IF SESSION = 'X'.
    *------close batchinput group
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
    (12) 'returncode:'(I05),
    SY-SUBRC.
    ELSE.
    IF E_GROUP_OPENED = 'X'.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    WRITE: /.
    WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
    ENDIF.
    ENDIF.
    ENDFORM. "CLOSE_GROUP
    Start new transaction according to parameters *
    FORM BDC_TRANSACTION USING TCODE TYPE ANY.
    DATA: L_SUBRC LIKE SY-SUBRC.
    *------batch input session
    IF SESSION = 'X'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = TCODE
    TABLES
    DYNPROTAB = it_BDCDATA.
    WRITE: / 'BDC_INSERT'(I03),
    TCODE,
    'returncode:'(I05),
    SY-SUBRC,
    'RECORD:',
    SY-INDEX.
    ELSE.
    REFRESH it_MESSTAB.
    CALL TRANSACTION TCODE USING it_BDCDATA
    MODE CTUMODE
    UPDATE CUPDATE
    MESSAGES INTO it_MESSTAB.
    L_SUBRC = SY-SUBRC.
    WRITE: / 'CALL_TRANSACTION',
    TCODE,
    'returncode:'(I05),
    L_SUBRC,
    'RECORD:',
    SY-INDEX.
    ENDIF.
    Message handling for Call Transaction *
    perform subr_mess_hand using g_mess.
    *-----Erzeugen fehlermappe
    IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
    IF E_GROUP_OPENED = ' '.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = E_GROUP
    USER = sy-uname
    KEEP = E_KEEP.
    E_GROUP_OPENED = 'X'.
    ENDIF.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = TCODE
    TABLES
    DYNPROTAB = it_BDCDATA.
    ENDIF.
    REFRESH it_BDCDATA.
    ENDFORM. "BDC_TRANSACTION
    Form subr_bdc_table *
    text
    -->P_0220 text *
    -->P_0221 text *
    -->P_0222 text *
    FORM subr_bdc_table USING VALUE(P_0220) TYPE ANY
    VALUE(P_0221) TYPE ANY
    VALUE(P_0222) TYPE ANY.
    CLEAR it_bdcdata.
    IF P_0220 = ' '.
    CLEAR it_bdcdata.
    it_bdcdata-fnam = P_0221.
    it_bdcdata-fval = P_0222.
    APPEND it_bdcdata.
    ELSE.
    it_bdcdata-dynbegin = P_0220.
    it_bdcdata-program = P_0221.
    it_bdcdata-dynpro = P_0222.
    APPEND it_bdcdata.
    ENDIF.
    ENDFORM. " subr_bdc_table
    Form subr_mess_hand *
    text *
    -->P_G_MESS text *
    FORM subr_mess_hand USING P_G_MESS TYPE ANY.
    LOOP AT IT_MESSTAB.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = it_messtab-msgid
    LANG = it_messtab-msgspra
    NO = it_messtab-msgnr
    v1 = it_messtab-msgv1
    v2 = it_messtab-msgv2
    IMPORTING
    MSG = P_G_MESS
    EXCEPTIONS
    OTHERS = 0.
    CASE it_messtab-msgtyp.
    when 'E'.
    it_error-error_rec = P_G_MESS.
    it_error-lifnr = it_me21-lifnr.
    it_error-tabix = v_count.
    APPEND IT_ERROR.
    when 'S'.
    it_sucess-sucess_rec = P_G_MESS.
    it_sucess-lifnr = it_me21-lifnr.
    it_sucess-tabix = v_count.
    APPEND IT_SUCESS.
    endcase.
    ENDLOOP.
    Describe table it_sucess lines v_ns.
    Describe table it_error lines v_ne.
    ENDFORM. " subr_mess_hand
    Regards
    Anji

  • How to Make BDC for transcation KKS1

    Hi dear,
    can any one tell me that how to make BDC for KKS1.
    because i have recorded the BDC and converted into the program logic than it is showing the first window but not showing the window with ALV and futher more. So what coding i have to apply.
    Please help.
    Siddarth Jain

    Hi,
    U can record the flow in using SHDB transaction recorder.
    U can record and it will generate the program, u can copy and paste the part of the code that is generated, in ur ALV report. this will call the transaction.
    Do as follows:
    <b>SHDB > New Recording > Specify Recording Name YTEST > Transaction code KKS1 > STRAT RECORDING BUTTON></b>
    then speciy the vales u want to give to run the transaction. U can save and come back as soon as u reach the screen when u want to stop it.
    EG:
    Declare a messtab
    DATA: i_bdcdata TYPE STANDARD TABLE OF bdcdata,
    * Internal table to hold BDC messages
    i_messtab TYPE STANDARD TABLE OF bdcmsgcoll
    * Work area to hold bdcdata value
    DATA: w_bdcdata TYPE bdcdata,
    * Work area to hold BDC messages
    w_messtab TYPE bdcmsgcoll.
    CONSTANTS : c_e type bdcmsgcoll-msgtyp value 'E', "E
    c_a type bdcmsgcoll-msgtyp value 'A', "A
    nodata type c value '/'. "/
    perform f1000_bdc_mm03 using lv_matnr lv_werks.
    FORM f1000_bdc_mm03 USING P_LV_MATNR
    P_LV_WERKS.
    perform bdc_dynpro using 'SAPLMGMM' '0060'.
    perform bdc_field using 'BDC_CURSOR'
    'RMMG1-MATNR'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RMMG1-MATNR'
    p_lv_matnr.
    perform bdc_dynpro using 'SAPLMGMM' '0070'.
    perform bdc_field using 'BDC_CURSOR'
    'MSICHTAUSW-DYTXT(15)'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTR'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(15)'
    'X'.
    perform bdc_dynpro using 'SAPLMGMM' '0080'.
    perform bdc_field using 'BDC_CURSOR'
    'RMMG1-WERKS'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTR'.
    perform bdc_field using 'RMMG1-WERKS'
    p_lv_werks.
    perform bdc_dynpro using 'SAPLMGMM' '4000'.
    perform bdc_field using 'BDC_OKCODE'
    '=ZU01'.
    perform bdc_field using 'BDC_CURSOR'
    'RMMG1-MATNR'.
    perform bdc_dynpro using 'SAPLMGMM' '4300'.
    perform bdc_field using 'BDC_OKCODE'
    '=ZU08'.
    perform bdc_field using 'BDC_CURSOR'
    'RMMG1-MATNR'.
    perform bdc_dynpro using 'SAPLMGMM' '4110'.
    perform bdc_field using 'BDC_OKCODE'
    '=GESV'.
    *perform bdc_field using 'BDC_CURSOR'
    * 'RMMG1-MATNR'.
    call transaction c_transaction_call_MM03 using i_bdcdata MODE 'N'MESSAGES INTO i_messtab.
    <b>Kindly close the previous threads opened by u.</b>
    Message was edited by: Judith Jessie Selvi

  • How to write BDC for tcode F-32

    Hi Experts,
    How to write BDC for tcode F-32 .
    is it possible i recorded in SHDB BUT IF I AM DOING IT'S COMING WRONG .
    plz guide me sir.
    regars,
    Hari
    Edited by: hari311 on Oct 27, 2009 9:22 AM

    There might be that when u provide the data in the selction screen of F-32 and press process open items some custom program might be attached to it and gets executed...
    chek it out..
    if so..
    pass the bdcdata of the second screen into a memory id
    export t_bdcdata into v_memid.
    in that custoom report jus import this..
    then fill the t_bdcdata with the header information and call the transcation f-32..
    Edited by: imran khan on Oct 27, 2009 9:35 AM

  • BDC for CRMD_ORDER

    hi,
    i am trying to write BDC for crmd_order transaction as i have a requirement to create Service contract Quotation automatically in background.
    i am using "CRM_AUC_ORDER_CREATE_MULT" this function module to create Quotation, but this FM has limited input fields through which though i am able to create the quotation i want to insert few extra values for which i am trying to use BDC code to open the created quotation in change mode.
    My problem is... in item level data i have a Tab called Object List where i have to enter multiple Object IDs . But hence this field has no Screen-Field it is not getting recorded.
    Expecting expert suggestions.
    please let me know if there is any function module through which i can enter the Object ID's as well .

    Hi,
    you can never use bdc for crmd_order.
    Pl use the funtion modules: either CRM_ORDER_MAINTAIN .
    first put a break point in the function module. then manually create one order.
    then you came to know how to populate the values into the concerned sturcutes.
    Hope this will help you to get an idea.
    regards,
    Mallik

Maybe you are looking for

  • PO amount should appear Once

    Hi, In my PO wise payment detail under PO amount column amount is displaying multiple times but my requirement is PO amt should display single for one PO number.. Thanx In advance

  • Is it possible to pay in other currency that the AP invoice currency?

    I have ebs 11.5.10, I need to pay an invoice in other currency that the invoice currency. Is it possible? When i migrate to Release 12 i can do the same? thanks a lot Daniel

  • IPhoto isnt reading my photos

    iPhoto is saying that it can't download my pictures because it can't read them but its always been able to do it before and I havent been doing anything different.. any thoughts?

  • DNG Profile Editor vs. Adobe Standard

    I'm working in PS CS3, I shoot in Leaf 11.2 and process my files in Camera Raw 4.6. I've mostly be unhappy with the color differences between PS and Leaf. The adobe standard profile brings me close, but not enough. I've attempted to shoot a color che

  • Same TV Show, Different Section

    Hi, I'm having a bit of a problem with iTunes. I have a few episodes from a tv show that I didn't buy off of itunes and they were all sorted in the tv show section, then I bought a couple more episodes of the same show and season and they are in a to