Bdc for vk11/vk12

hi!
can anybody plz tell  me how to do bdc for vk11 and vk12.
the scene is that i have zpogram which displays the data and from there i have to add one button and whenever that button is triggred bdc had to be performed for vk11 and vk12 only for those fields which are diaplayed by my z program.
kindly help me out.
regards
anjali

Hi Anjali
It is not advicable to create BDC for transactions like VK11, MEK1 ... which we use to create condition records. The reason is for each condition type, the options we see might vary when ever there is change in access sequences and their precedence. So if we create BDC, our program needs to modified everytime there is change in the access sequences and condition tables.
I would recommed you to either use the program that i have provided or use some BAPI's to upload/change condition records.
As you are saying, you have the data in your internal table. Download the data to a file in the format RV14BTCI needs and SUBMIT the program.
For understanding on the structure for this program, use transaction SXDB.
Kind Regards
Eswar

Similar Messages

  • I hav to upload bdc for vk11 trans and table konv.

    hi experts,
    i m new in BDC... i hav to upload bdc for vk11 trans and table konv.
    frst doubt is
    i hv to run shdb transc?? or just i hv to write program??
    nd cn any1 send me teps as hw to create upload..
    Condition Type Sales Organisation Distribution channel Material Price Unit Valid from Valid to
    KSCHL VKORG VTWEG MATNR_01 KBETR_01 KPEIN_01 DATAB_01 DATBI_01
    now plz tel me hw to do this...whether to run shdb or jus to write program in se38..
    or i hv to do both...bt plz tel me step by step

    Please don't ignore the warnings. Read the rules of engagement.
    Thread locked, again.
    Thomas
    wrking on ABAP OOPS, oput is coming but 1 field name wd customer name is nt

  • Bapi for VK11 & VK12

    i have created a BDC program for uploading data into VK11 & VK12 .what it does that it compares the valid from and valid to dates from the flat files
    and if they already exist then for that condiotn type it goes to vk 12 and changes the prices and scalling quantity according to the falt file
    and if the date range is not present then it oes to VK11 and creates the same from the flat file
    now i want a bapi that works the same manner..
    if any body can hel;p me
    thanks in advance

    I am using the RV_condition_copy function the way it is described in this post, I am able to update the date but not the price in Vk12 / vk13 . I am using option D for maintain_mode (create with reference) - > this is essentially what I want to do, as we already ahve the pricing in vk13, we want to change it for year 2008.
    Please advise what I must be doing wrong. I do not get any errors while running the following code. Also I am doing commit. Thanks.
    Pranav
    Do I have to pass any values to I_komk I_komp, i do not have anything to pass.??!$#?
    ls_komg-kunnr = '0001000008'.  " Cust number
    ls_komg-matnr = 'PP500P3'.      " Mat number
    ls_komg-VKORG = 'PPC1'.
    ls_komg-vtweg = 'BB'.
    clear: Lt_komv,LS_KOMV.
    ls_komv-kappl = 'V '.        " Application V = Sales
    ls_komv-kschl = 'PR00'.    " Condition type
    ls_komv-waers = 'USD'.       " Currency
    ls_komv-kmein = 'EA'.        " Unit of measurement
    ls_komv-kpein = '100'.
    ls_komv-krech = 'C'.         " calculation type;
                                  "M = Quantity - monthy price
    LS_KOMV-KAWRT = '251.00'.
    ls_komv-kbetr = '121.50'.   " new condition value
    *LS_KOMV-KWERT_K = '251.10'.
    *LS_KOMV-KNUMV ='0000008911'
    append ls_komv to lt_komv.
    CLEAR LT_KOMV.
    call function 'RV_CONDITION_COPY'
      exporting
        application              = 'V'
        condition_table          = '005'      " cond. table
        condition_type           = 'PR00'   " cond. type
        date_from                = '20070108' " valid on
        date_to                  = '99991231' " valid to
        enqueue                  = 'X'        " lock entry
       i_komk                   = ls_komk
       i_komp                   = ls_komp
        key_fields               = ls_komg    " key fields
        maintain_mode            = 'D'        " A= create
                                              " B= change,
                                              " C= display
                                              " D= create with reference
    with reference
        no_authority_check       = 'X'
        keep_old_records         = 'X'
        overlap_confirmed        = 'X'
        no_db_update             = space
      importing
       e_komk                   = ls_komk
    e_komp                   = ls_komp
        new_record               = lv_new_record
      tables
        copy_records             = lS_komv
             EXCEPTIONS
                ENQUEUE_ON_RECORD        = 1
                INVALID_APPLICATION      = 2
                INVALID_CONDITION_NUMBER = 3
                INVALID_CONDITION_TYPE   = 4
                NO_SELECTION             = 5
                TABLE_NOT_VALID          = 6
                NO_AUTHORITY_EKORG       = 7
                NO_AUTHORITY_KSCHL       = 8.
    call function 'RV_CONDITION_SAVE'.
    call function 'RV_CONDITION_RESET'.
    necessary to write data
    commit work.
    Message was edited by:
            pranav kulkarni

  • Generic BDC for VK11 - URGENT

    Hi
    Can any one tell me how to create <b>Generic BDC for  transaction VK11 (Creating condition records)</b>
    My actual requirement is like we need to create <b>condition record</b> for every material  with all the condition types exist for that material  for different key combinations . <b>A condition record for every material is to be created for different condition types and  different key combinations where material MATNR is a key field .For example we need to create condition records dynamically for condition types ZPR0, ZCM0 etc.. for different key combinations where matnr is a key field .</b>
    can anyone of you point out a way to me?
    Thanks in advance
    Shivakumar

    please   copy the  program and  use it 
    *  Report to Upload the pricing condtion records for materials.        *
    *  Program  : ZSDR_PRICE_UPLOAD                                        *
    *  Author   : girish.
    *  Description:                                                        *
    *  This report Creat pricing condition records for materials           *
    * Tables Used :                      SELECT UPDATE INSERT DELETE       *
    * MVKE                                                X                *
    * Input/Output Files:                                                  *
    * Transactions called:                                                 *
    * Includes:                                                            *
    * Run Frequency -                                                      *
    * Program History                                                      *
    * Date       Change No            Change Request   SAP Rel    NSC Rel  *
    *            Description                                               *
    *                                                  4.6C                *
    REPORT zsdr_price_upload  MESSAGE-ID zsdr_bdc_vk11  LINE-SIZE 150
    LINE-COUNT 75 .
    ******Internal Table for Header Data.
    TYPES : BEGIN OF type_header,
            kschl LIKE konv-kschl,
            vkorg LIKE vbak-vkorg,
            vtweg LIKE komg-spart,
            matnr LIKE mvke-matnr,
            kbetr(11) TYPE c,
            datab(10) TYPE c,
            datbi(10) TYPE c,
            END OF type_header.
    ****Internal Table for Item Level.
    TYPES : BEGIN OF type_item,
            kschl LIKE konv-kschl,
            vkorg LIKE vbak-vkorg,
            vtweg LIKE komg-spart,
            matnr LIKE mvke-matnr,
            kbetr(11)  TYPE c,
            datab(10) TYPE c,
            datbi(10) TYPE c,
           END OF type_item.
    ******Error Table For not found in MVKE.
    TYPES : BEGIN OF type_error ,
            kschl LIKE konv-kschl,
            vkorg LIKE vbak-vkorg,
            vtweg LIKE komg-spart,
            matnr LIKE mvke-matnr,
            kbetr LIKE konp-kbetr,
            datab(10) TYPE c,
            datbi(10) TYPE c,
            text(100) TYPE c,
            END OF type_error.
    ****For error Messages
    TYPES : BEGIN OF type_mtab,
            matnr   LIKE mara-matnr,
            msgtyp  LIKE bdcmsgcoll-msgtyp,
            msgid   LIKE bdcmsgcoll-msgid,
            msgnr   LIKE bdcmsgcoll-msgnr,
            text(100) TYPE c,
            END OF type_mtab.
    ****Internal Table
    TYPES: BEGIN OF type_mvke,
           matnr LIKE mvke-matnr,
           vkorg LIKE mvke-vkorg,
           vtweg LIKE mvke-vtweg,
           END OF type_mvke.
    ****Internal Table
    TYPES : BEGIN OF type_tvkov,
            vkorg LIKE tvkov-vkorg,
            vtweg LIKE tvkov-vtweg,
            END OF type_tvkov.
    ** Declaring Internal Tables
    DATA : t_header TYPE STANDARD TABLE OF type_header,
           t_item TYPE STANDARD TABLE OF type_item,
           t_mvke TYPE STANDARD TABLE OF type_mvke,
           t_tvkov TYPE STANDARD TABLE OF type_tvkov,
           t_error TYPE STANDARD TABLE OF type_error,
           t_mtab TYPE STANDARD TABLE OF type_mtab.
    ** Work Area Declaration.
    DATA : wa_header LIKE LINE OF t_header,
           wa_item LIKE LINE OF t_item,
           wa_error LIKE LINE OF t_error,
           wa_mtab LIKE LINE OF t_mtab,
           wa_tvkov LIKE LINE OF t_tvkov,
           wa_mvke LIKE LINE OF t_mvke.
    **Rows for Table with Excel Data********
    DATA: t_xls_file LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    ***Constant.
    DATA : c_params LIKE ctu_params.
    DATA : c_ans(1) TYPE c.
    DATA : v_count(4) TYPE c. " To show No.of records
    DATA :  bdctab LIKE bdcdata OCCURS 10 WITH HEADER LINE.      " BDCDATA
    DATA :  tmess_mtab  LIKE  bdcmsgcoll OCCURS 10 WITH HEADER LINE.
    **  SELECTION SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_fname LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    * END OF SELECTION SCREEN.
    DATA : repid LIKE sy-repid.
    DATA : v_matnr(50) TYPE c, "used for line items
           v_kbetr(50) TYPE c, "used for line items
           v_dat1(50) TYPE c,  "used for line items
           v_dat(50) TYPE c.   "used for line items
    DATA : v_lindx(5) TYPE n ,"index counter for first 14 records.
           v_lindx1(5) TYPE n  VALUE '01', "index counter for  13 records.
           v_item(5) TYPE c,  "To increment the line index
           v_pgedwn2  TYPE i . "For Pagedown Counter
    DATA:  v_currentrow TYPE i.  "For Current Row
    DATA  v_bdc(50) TYPE c." Text to apper in Confrim POPUP Window.
    ************AT SELECTION-SCREEN
    AT SELECTION-SCREEN  ON VALUE-REQUEST FOR p_fname.
      PERFORM get_filename USING p_fname.
    *************START-OF-SELECTION
    START-OF-SELECTION.
    ******Values for Ctu_params to Transaction
      c_params-defsize = 'X'.
      c_params-dismode = 'N'.
      c_params-updmode = 'S'.
    ******Refresh
      PERFORM f_refresh.
    *********To upload File.
      PERFORM upload_file.
    ****User Confrimation only BDC will Process
      IF c_ans = '1'.
    ** *** BDC Process.
        PERFORM read_data.
      ELSE.
        FORMAT COLOR 3 INTENSIFIED .
        WRITE:/ 'Selected not to Process the Upload'.
        EXIT.
      ENDIF.
    ******On completion of  Process Refresh the Internal Table
      REFRESH :  t_xls_file,
                   t_header,
                   t_item,
                   t_mvke,
                   t_tvkov.
      CLEAR :    t_xls_file,
                 wa_header,
                 wa_item,
                 wa_mvke,
                 wa_tvkov.
    ***********Display Messages
      WRITE : /01 'Status',19 'Status Text'.
      WRITE  AT 0(150) sy-uline.
      LOOP AT t_mtab INTO wa_mtab.
        WRITE :/01 wa_mtab-msgtyp,19 wa_mtab-text.
      ENDLOOP.
      SKIP 2.
      SORT t_error BY matnr.
      WRITE  AT 0(150) sy-uline.
      WRITE 'ERROR MESSAGES'.
      WRITE  AT 0(150) sy-uline.
      WRITE :/01 'Material.No',20 'Status Text'.
      WRITE  AT 0(150) sy-uline.
      LOOP AT t_error INTO wa_error WHERE matnr NE ' '.
        WRITE:/01 wa_error-matnr,20 wa_error-text.
      ENDLOOP.
    *&      Form  get_filename
    *       text
    *      -->P_FILENAME  text
    FORM get_filename USING    p_fname.
    *****To read the file from Presentation Server
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
         program_name        =  repid
        dynpro_number      ! ; =   syst-dynnr
          field_name          = p_fname
    *   STATIC              = ' '
        mask                = '*.XLS'
        CHANGING
          file_name           = p_fname
    EXCEPTIONS
       mask_too_long       = 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.
    ENDFORM.                    " get_filename
    *&      Form  upload_file
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM upload_file.
      DATA : frow VALUE 2 TYPE i,
             fcol VALUE 1 TYPE i,
             erow VALUE 10000 TYPE i,
             ecol VALUE 7  TYPE i,
             ecol1 VALUE 1 TYPE i,
             c_col1 TYPE i VALUE '0001',
             c_col2 TYPE i VALUE '0002',
             c_col3 TYPE i VALUE '0003',
           &nb! sp; c_col4 TYPE i VALUE '0004',
             c_col5 TYPE i VALUE '0005',
             c_col6 TYPE i VALUE '0006',
             c_col7 TYPE i VALUE '0007'.
    ***FM used to UPLOAD data from Flat file
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = p_fname
                i_begin_col             = fcol
                i_begin_row             = frow
                i_end_col               = ecol
                i_end_row               = erow
           TABLES
                intern                  = t_xls_file
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        MESSAGE e000.
      ENDIF.
    ****T_XLS_FILE is initial, stop the process & throw message
      IF t_xls_file[] IS INITIAL.
        FORMAT COLOR 6 ON INTENSIFIED ON.
        WRITE:/ 'No Data  Exists '.
        FORMAT COLOR OFF INTENSIFIED OFF.
        STOP.
      ELSE.
    * Sort table by rows and colums
        SORT t_xls_file BY row col.
    * Get first row retrieved
        READ TABLE t_xls_file INDEX 1.
    * Set first row retrieved to current row
        v_currentrow = t_xls_file-row.
    **Loop  to move data in internal Table
        LOOP AT t_xls_file .
    *   Reset values for next row
          IF t_xls_file-row NE v_currentrow.
            APPEND wa_header TO t_header.
            CLEAR wa_header.
            v_currentrow = t_xls_file-row.
          ENDIF.
          CASE t_xls_file-col.
            WHEN  c_col1.                              "Kschl
              wa_header-kschl = t_xls_file-value.
            WHEN c_col2.                              "Vkorg
              wa_header-vkorg = t_xls_file-value.
            WHEN c_col3.                              "vtweg
              wa_header-vtweg = t_xls_file-value.
            WHEN c_col4.                              "Matnr
              wa_header-matnr = t_xls_file-value.
            WHEN c_col5.                              "Kbetr
              wa_header-kbetr = t_xls_file-value.
            WHEN c_col6.                              "FROm
              wa_header-datab   = t_xls_file-value.
            WHEN c_col7.                              "TO
              wa_header-datbi   = t_xls_file-value.
          ENDCASE.
        ENDLOOP.
        APPEND wa_header TO t_header.
        CLEAR wa_header.
      ENDIF.
    ****To process the data
      PERFORM f_process.
    ENDFORM.                    " upload_file
    *&      Form  READ_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM read_data.
    ****To make Uniq Records in Header Level
      SORT t_header BY kschl vkorg vtweg.
      DELETE ADJACENT DUPLICATES FROM t_header COMPARING
                                       kschl vkorg vtweg .
      SORT t_item BY vkorg vtweg matnr.
      DATA : wa1_item TYPE type_item.
      DATA : l_cnt TYPE i.
      DATA : flag(1) TYPE c. "to process the Line item.
    ***Looping Header Table.
      LOOP AT t_header INTO wa_header.
        PERFORM bdc_dynpro      US! ING 'SAPMV13A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RV13A-KSCHL'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ANTA'.
        PERFORM bdc_field       USING 'RV13A-KSCHL'
                                      wa_header-kschl.
        PERFORM bdc_dynpro      USING 'SAPLV14A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RV130-SELKZ(03)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=WEIT'.
        PERFORM bdc_field       USING 'RV130-SELKZ(03)'
                                      'X'.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '1004'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'KOMG-VKORG'.
        PERFORM bdc_field       USING 'KOMG-VKORG'
                                       wa_header-vkorg.
        PERFORM bdc_field       USING 'KOMG-VTWEG'
                                       wa_header-vtweg.
    ****To handle Line Items.
        LOOP AT t_item INTO wa1_item WHERE vkorg = wa_header-vkorg AND
                                      vtweg = wa_header-vtweg.
          wa_item = wa1_item.
    ******Flag Set only After processing  first 14 records .
          IF flag = ' '.
            v_lindx  = v_lindx + 01.
            SHIFT  v_lindx LEFT DELETING LEADING '0'.
            v_item  = v_lindx .
            CONCATENATE 'KOMG-MATNR(' v_item ')'  INTO v_matnr.
            PERFORM bdc_field           USING v_matnr
                                          wa_item-matnr.
            CONCATENATE 'KONP-KBETR(' v_item ')' INTO v_kbetr.
            PERFORM bdc_field       USING v_kbetr
                                          wa_item-kbetr.
            CONCATENATE 'RV13A-DATAB(' v_item ')' INTO v_dat.
            PERFORM bdc_field       USING  v_dat
                                          wa_item-datab.
            CONCATENATE 'RV13A-DATBI(' v_item ')' INTO v_dat1.
            PERFORM bdc_field       USING  v_dat1
                                          wa_item-datbi.
            IF  v_item = 14.
              flag = 'X'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                                  '/00'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                                 '=P+'.
              PERFORM bdc_dynpro      USING 'SAPMV13A' '1004'.
              CLEAR v_lindx.
              CLEAR v_item.
              CONTINUE.
            ENDIF.
          ENDIF.
    ***Flag is Set  after Processing of 14 records.
    ****** TO process rest of Records
          IF flag = 'X'.
            v_pgedwn2  = v_pgedwn2 + 1.
            v_lindx1  = v_lindx1 + 01.
            SHIFT  v_lindx1 LEFT DE! LETING LEADING '0'.
            v_item  = v_lindx1 .
            CONCATENATE 'KOMG-MATNR(' v_it! em ')'  INTO v_matnr.
            PERFORM bdc_field           USING v_matnr
                                          wa_item-matnr.
            CONCATENATE 'KONP-KBETR(' v_item ')' INTO v_kbetr.
            PERFORM bdc_field       USING v_kbetr
                                          wa_item-kbetr.
            CONCATENATE 'RV13A-DATAB(' v_item ')' INTO v_dat.
            PERFORM bdc_field       USING  v_dat
                                          wa_item-datab.
            CONCATENATE 'RV13A-DATBI(' v_item ')' INTO v_dat1.
            PERFORM bdc_field       USING  v_dat1
                                          wa_item-datbi.
            IF v_pgedwn2 = 13.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                                  '/00'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                                 '=P+'.
              PERFORM bdc_dynpro      USING 'SAPMV13A' '1004'.
              v_pgedwn2 = 0.
              v_lindx1 = 1.
              CLEAR v_item.
              CONTINUE.
            ENDIF.
          ENDIF.
        ENDLOOP.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                   '=SICH'.
    ****** Calling Transaction after Processing All items.
        CALL TRANSACTION 'VK11' USING bdctab
                           OPTIONS FROM c_params MESSAGES INTO tmess_mtab.
        REFRESH bdctab.
        CLEAR : bdctab.
        CLEAR : wa_item.
        CLEAR : wa1_item.
        CLEAR : wa_header.
        CLEAR : l_cnt.
        CLEAR : v_lindx1.
        CLEAR:  v_pgedwn2,v_lindx.
        LOOP AT tmess_mtab .
          l_cnt =  l_cnt + 1.
          READ TABLE t_item INTO wa_item INDEX l_cnt .
          CALL FUNCTION 'MASS_MESSAGE_GET' "To get the Message Text
               EXPORTING
                    arbgb             = tmess_mtab-msgid
                    msgnr             = tmess_mtab-msgnr
                    msgv1             = tmess_mtab-msgv1
                    msgv2             = tmess_mtab-msgv2
                    msgv3             = tmess_mtab-msgv3
                    msgv4           !   = tmess_mtab-msgv4
               IMPORTING
                    msgtext           = wa_mtab-text
               EXCEPTIONS
                    message_not_found = 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_mtab-matnr   = wa_item-matnr.
          wa_mtab-msgtyp  = tmess_mtab-msgtyp.
          wa_mtab-msgid   = tmess_mtab-msgid.
          wa_mtab-msgn! r   = tmess_mtab-msgnr.
          APPEND wa_mtab TO t_mtab.
          CLEAR wa_mtab-text.
          CLEAR wa_item.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " READ_DATA
    *&      Form  BDC_DYNPRO
    *       text
    *      -->P_0300   text
    *      -->P_0301   text
    *        Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdctab.
      bdctab-program  = program.
      bdctab-dynpro   = dynpro.
      bdctab-dynbegin = 'X'.
      APPEND bdctab.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
    *       text
    *      -->P_0305   text
    *      -->P_WA_HEADER_KSCHL  text
    *        Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdctab.
      bdctab-fnam = fnam.
      bdctab-fval = fval.
      APPEND bdctab.
    ENDFORM.                    " BDC_FIELD
    *&      Form  bdc_trc_ansaction
    *       text
    *      -->P_0527   text
    *&      Form  f_Process
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_process.
      DATA : l_todate(12) TYPE c,
             l_frdate(12) TYPE c.
    ***Select for all entries of material in Header "Flat File Materials".
      IF NOT t_header[] IS INITIAL.
       SELECT matnr vkorg vtweg FROM mvke INTO TABLE t_mvke FOR ALL ENTRIES
                               IN t_header WHERE matnr = t_header-matnr AND
                                                 vkorg = t_header-vkorg AND
                                                     vtweg = t_header-vtweg.
      ENDIF.
    *********select Sales.org & Dist.channel.
      IF NOT t_header[] IS INITIAL.
        SELECT vkorg vtweg FROM tvkov INTO TABLE t_tvkov FOR ALL ENTRIES IN
                                    t_header WHERE vkorg = t_header-vkorg
                                               AND vtweg = t_header-vtweg.
      ENDIF.
    ***Checking for material in Sales Master Table
      SORT t_mvke BY matnr vkorg vtweg.
      SORT t_tvkov BY vkorg vtweg.
      LOOP AT t_header INTO wa_header.
        READ TABLE t_mvke INTO wa_mvke WITH KEY matnr = wa_header-matnr
                                                 vkorg = wa_header-vkorg
                                    ! ;  vtweg = wa_header-vtweg BINARY SEARCH.
        IF sy-subrc <> 0.
          wa_error = wa_header.
        &nb! sp; MOVE text-011 TO  wa_error-text.
          APPEND wa_error TO t_error.
          DELETE TABLE t_header FROM wa_header.
        ELSE.
    ********Date Validations
          IF ( wa_header-datab  NE ' ! ;  '  AND  wa_header-datbi NE  '  ' ) .
            l_todate = wa_header-datab.
            l_frdate = wa_header-datbi.
            REPLACE '.' INTO l_toda! te WITH ''.
            REPLACE '.' INTO l_todate WITH ''.
            CONDENSE l_todate NO-GAPS.
            REPLACE '.' INTO l_frdate WITH ''.
            REPLACE '.' INTO l_frdate WITH ''.
            CONDENSE l_frdate NO-GAPS.
            IF l_frdate < l_todate.
              wa_error = wa_header .
              MOVE text-012 TO wa_error-text.
              APPEND wa_error TO t_error.
              DELETE TABLE t_header FROM wa_header.
            ENDIF.
          ELSE.
            wa_error = wa_header .
            MOVE text-016 TO wa_error-text.
            APPEND wa_error TO t_error.
            DELETE TABLE t_header FROM wa_header.
          ENDIF.
        ENDIF.
    ********Rate Validation.
        IF wa_header-kbetr = '   '.
          wa_error = wa_header .
          MOVE text-017 TO wa_error-text.
          APPEND wa_error TO t_error.
          DELETE TABLE t_header FROM wa_header.
        ENDIF.
        READ TABLE t_tvkov INTO wa_tvkov WITH KEY vkorg = wa_header-vkorg
                                                   BINARY SEARCH.
        IF sy-subrc  = 0.
          READ TABLE t_tvkov INTO wa_tvkov WITH KEY vtweg = wa_header-vtweg
                                                       BINARY SEARCH.
          IF sy-subrc  <> 0.
            wa_error = wa_header.
            MOVE text-015 TO  wa_error-text.
            WRITE wa_header-vtweg TO wa_error-text+13(4).
            APPEND wa_error TO t_error.
          ENDIF.
        ELSE.
          wa_error = wa_header.
          MOVE text-013 TO  wa_error-text.
          WRITE wa_header-vkorg TO wa_error-text+9(4).
          APPEND wa_error TO t_error.
        ENDIF.
        CLEAR wa_header.
      ENDLOOP.
    *****Deleting Duplicate Material  Form Header "Flat File Data".
      SORT t_header BY kschl vkorg vtweg matnr.
      DELETE ADJACENT DUPLICATES FROM t_header COMPARING
            kschl! vkorg vtweg matnr .
    *  ****Data Moving from Header to Item Level.
      t_item[] = t_header[].
    *To count No.of records in Item Table.
      DESCRIBE TABLE t_item  LINES v_count.
      CONCATENATE text-014 ' ' v_count INTO  v_bdc.
    ****Popup to get Confirmation from user to process BDC
      CALL FUNCTION 'POPUP_TO_CONFIRM'
           EXPORTING
                titlebar       = 'Confirmation of File Data'
                text_question  = v_bdc
                text_button_1  = 'Confirm'
                text_button_2  = 'Cancel Run'
                default_button = '1'
           IMPORTING
                answer         = c_ans.
      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.                    " f_Process
    *&      Form  f_Refresh
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_refresh.
      REFRESH :  t_xls_file,
                 t_header,
                 t_item,
                 t_mvke,
                 t_tvkov,
                 t_error,
                 t_mtab.
      CLEAR :    t_xls_file,
                 wa_header,
                 wa_item,
                 wa_mvke,
                 wa_tvkov,
                 wa_error,
                 wa_mtab.
    ENDFORM.                    " f_Refresh
    reward  point s  if it is usefull ....
    girish

  • Generic BDC for VK11

    Hi
    Can any one tell me how to create <b>Generic BDC for  transaction VK11 (Creating condition records)</b>
    My actual requirement is like we need to create <b>condition record</b> for  every  material  with all the condition types exist for that material  for different key combinations dynamically . <b>A condition record for  every material is to be created for different condition types and  different key combinations dynamically where material MATNR is a key field</b>  for example i need to create a conditon record for condition type <b>ZPR0,ZPR1</b> etc dynamically for different key combinations.
    can anyone of you point out a way to me?
    Thanks in advance
    Shivakumar

    Hi
    Can any one tell me how to create <b>Generic BDC for  transaction VK11 (Creating condition records)</b>
    My actual requirement is like we need to create <b>condition record</b> for  every  material  with all the condition types exist for that material  for different key combinations dynamically . <b>A condition record for  every material is to be created for different condition types and  different key combinations dynamically where material MATNR is a key field</b>  for example i need to create a conditon record for condition type <b>ZPR0,ZPR1</b> etc dynamically for different key combinations.
    can anyone of you point out a way to me?
    Thanks in advance
    Shivakumar

  • BAPI for VK11,VK12,MEK1,MEK2

    Hi,
    1) Is there a BAPI or standard function module for MEK1 and MEK2?
    2) I searched and found for VK11 and VK12 we have the following function modules
    BAPI_PRICE_CONDITIONS
    RV_KONDITION_SICHERN
    RV_KONDITION_SICHERN_V13A
    Please share if you has used the above

    Got it to work. With the sequence :
      <b>1.</b> RV_CONDITION_COPY
      <b>2.</b> RV_CONDITION_SAVE
      <b>3.</b> RV_CONDITION_RESET
      <b>4.</b> commit
    * At least the key fields of the conditiontable
    * (here 800) must be filled in structure ls_komg.
    ls_komg-vbeln = '1234567890'.  " document number
    ls_komg-posnr = '000010'.      " item number
    clear wt_komv.
    ls_komv-kappl = 'V '.        " Application V = Sales
    ls_komv-kschl = lc_kschl.    " Condition type
    ls_komv-waers = 'EUR'.       " Currency
    ls_komv-kmein = 'ST'.        " Unit of measurement
    ls_komv-kpein = '1'. 
    ls_komv-krech = 'M'.         " calculation type;
                                  "M = Quantity - monthy price
    ls_komv-kbetr = '1234.56'.   " new condition value
    append ls_komv to lt_komv.
    call function 'RV_CONDITION_COPY'
      exporting
        application              = 'V'
        condition_table          = '800'      " cond. table
        condition_type           = lc_kschl   " cond. type
        date_from                = '20061101' " valid on
        date_to                  = '20061130' " valid to
        enqueue                  = 'X'        " lock entry
        i_komk                   = ls_komk
        i_komp                   = ls_komp
        key_fields               = ls_komg    " key fields
        maintain_mode            = 'A'        " A= create
                                              " B= change,
                                              " C= display
                                              " D= create
      with reference
        no_authority_check       = 'X'
        keep_old_records         = 'X'
        overlap_confirmed        = 'X'
        no_db_update             = space
      importing
        e_komk                   = ls_komk
        e_komp                   = ls_komp
        new_record               = lv_new_record
      tables
        copy_records             = lt_komv
      exceptions
    call function 'RV_CONDITION_SAVE'.
    call function 'RV_CONDITION_RESET'.
    * necessary to write data
    commit work.
    Check data with transaction VK12
    Thank you for your support
    Thomas

  • BDC For VK11

    Hi All,
    I got a requirement to upload Condition records through trnx VK11 , but I have one doubt , how can we handle the radio buttons  ( Table ) dyamically for every Condition type???
    Ex : for condition type 'X' it has choose the table '111' and for condition type 'Y' it has to choose '222' and so on ...
    How to do the recording for this requirement ???
    I am really confused with this...Please suggest me
    Thanks in advance.

    Hi,
    Why don't you use BAPI BAPI_PRICES_CONDITIONS instead?
    Please check this sample code from other thread.
    wtable1-table_no = '306'.
    wtable1-applicatio = 'V'.
    wtable1-cond_type = 'ZPR0'.
    wtable1-operation = '009'.
    wtable1-varkey = '13001001USD 000000000050068946'.
    wtable1-valid_to = '99991231'.
    wtable1-valid_from = '20051101'.
    wtable1-cond_no = '$000000001'.
    APPEND wtable1 TO table1.
    wtable2-operation = '009'.
    wtable2-cond_no = '$000000001'.
    wtable2-created_by = sy-uname.
    wtable2-creat_date = '20051022'.
    wtable2-cond_usage = 'A'.
    wtable2-table_no = '110'.
    wtable2-applicatio = 'V'.
    wtable2-cond_type = 'ZPR0'.
    wtable2-varkey = '13001001USD 000000000050068946'.
    wtable2-valid_from = '20051101'.
    wtable2-valid_to = '99991231'.
    APPEND wtable2 TO table2.
    wtable3-operation = '009'.
    wtable3-cond_no = '$000000001'.
    wtable3-cond_count = '01'.
    wtable3-applicatio = 'V'.
    wtable3-cond_type = 'ZPR0'.
    wtable3-scaletype = 'A'.
    wtable3-scalebasin = 'C'.
    wtable3-scale_qty = '1'.
    wtable3-cond_p_unt = '1'.
    wtable3-cond_unit = 'EA'.
    wtable3-calctypcon = 'C'.
    wtable3-cond_value = '454'.
    wtable3-condcurr = 'USD'.
    APPEND wtable3 TO table3.
    CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
    EXPORTING
    PI_initialmode = 'X'
    PI_BLOCKNUMBER =
    TABLES
    ti_bapicondct = table1
    ti_bapicondhd = table2
    ti_bapicondit = table3
    ti_bapicondqs = table4
    ti_bapicondvs = table5
    to_bapiret2 = table6
    to_bapiknumhs = table7
    to_mem_initial = table8
    EXCEPTIONS
    update_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.
    READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.
    IF sy-subrc = 0.
    loop at table6 into ret.
    write: / ret-type, ret-message, ret-id, RET-LOG_NO, RET-LOG_MSG_NO,
    RET-MESSAGE_V1, RET-MESSAGE_V2, RET-MESSAGE_V3, RET-MESSAGE_V4,
    RET-PARAMETER,RET-ROW,RET-FIELD.
    endloop.
    ELSE.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    *EXPORTING
    WAIT =
    IMPORTING
    return = ret
    ENDIF.
    Also there are other options:
    - from LSMW the report RV14BTCI
    - batch input to transaction XK15
    - using FM modules RV_CONDITION* (e.g. _copy and _save)
    Hope this will help.
    Regards,
    Ferry Lianto

  • Bdc on vk11 using control break events

    hi
    have any one done bdc for vk11 using control break events.my flat file is
    ZTAX     X     IN     1000     1200     2000     A0
    ZTAX     X     IN     1000     1210     3000     A1
    ZTAX     X     US     7676     01     4000     L3
    ZTAX     X     US     7676     02     5000     s1
    i need the logic for this any sample code will be useful

    hi, check the sample code using Control break statements.
      LOOP AT IT_MAIN.
    WRITE : IT_MAIN.
    C_TABIX = SY-TABIX.
    <b>AT NEW LIFNR_001.</b>
    READ TABLE IT_MAIN INDEX C_TABIX.
    REFRESH IT_BDC.
    perform bdc_dynpro      using 'SAPMM06E' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-BSTNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EKKO-LIFNR'
                                  IT_MAIN-LIFNR_001.
    perform bdc_field       using 'RM06E-BSART'
                                  IT_MAIN-BSART_002.
    perform bdc_field       using 'RM06E-BEDAT'
                                  IT_MAIN-BEDAT_003.
    perform bdc_field       using 'EKKO-EKORG'
                                  IT_MAIN-EKORG_004.
    perform bdc_field       using 'EKKO-EKGRP'
                                  IT_MAIN-EKGRP_005.
    perform bdc_field       using 'RM06E-LPEIN'
                                  IT_MAIN-LPEIN_006.
    perform bdc_field       using 'RM06E-WERKS'
                                  IT_MAIN-WERKS_007.
    MOVE 1 TO CNT.
    <b>ENDAT.</b>
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKPO-TXZ01(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    CONCATENATE 'EKPO-EMATN(' CNT ')' INTO FLD.
    perform bdc_field       using FLD IT_MAIN-EMATN_01_008.
    CONCATENATE 'EKPO-TXZ01(' CNT ')' INTO FLD.
    perform bdc_field       using FLD IT_MAIN-TXZ01_01_009.
    CONCATENATE 'EKPO-MENGE(' CNT ')' INTO FLD.
    perform bdc_field       using FLD IT_MAIN-MENGE_01_010.
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-EBELP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    CNT = CNT + 1.
           IF CNT = 6.
            CNT = 1.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                                  '=P+'.
           ENDIF.
    <b>AT END OF LIFNR_001.</b>
    READ TABLE IT_MAIN INDEX C_TABIX.
    RECORD = IT_MAIN.
    perform bdc_dynpro      using 'SAPLSPO1' '0100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    CALL TRANSACTION 'ME21' USING IT_BDC MODE 'A' MESSAGES INTO IT_MESSAGES.
      clear: cnt, C_tabix .
    <b>ENDAT.</b>
    ENDLOOP.

  • VK11/VK12: Automatically create anothercondition record upon saving

    Hi,
    First of all this is my first time to post a question here.  I find every thread very helpful and other members helpful.
    We came with a requirement to automatically create another condition record after the user clicks the save buttons.  I'm not inclined in this module so to give you an idea in my requirement here are the following steps:
    1.  User go to VK11
    2.  Choose Selling Price List/Material access sequence
    3.  In the the screen the user enter a sales org, distribution channel, and price list.
    Ex: Sales Organization: 0024
          Distribution Channel: 00
          Price List: 03
    4.  User enter in grid, material, amount, conditoin pricing unit.
    Ex:
    Material: 4668
    Amount: 5,00
    Condition Pricing Unit: 1
    5.  User click saves.  Entries in tables KONH and KONP are populated.  Condition record is saved
    Now the requirement is create a duplicate conditoin record but with DIFFERENT price list-> 02 and amount.  The new amount will be computed manually in the enhancement.
    I did my part researching what can be done to solve this requirment.  In the old threads, some suggest to use BADI BADI SD_COND_SAVE_A BADI.  The problem is I am also not familiar in using BADI so I hope someone can tell me how I can learn BADI so I can implement the requirements.  For the creation of condition records, I still have no idea how to do it.
    So here are my current challenges:
    1.  How can I trap the save button in VK11/VK12.  I am also thinking if all required validations were done prior to the creation to the conditoin record.  I'm also thinking what are the things I should consider before creating a duplicate condition record with the different pricelist 03 and amount.
    2.  How can I create a condition records.  Should I use a BAPI? I am also not familiar with BAPI
    In addition to the requirement, I am thinking of some problems that might arise.  I think there should be checking before creating the duplicate condition records.  But I have no idea what are the things to consider.
    I hope I explained my requirment clearly. Please feel free to ask for clarifications or question in my requirement.  Thank you for your help.  I really appreciate any help.
    Thanks and God Bless.
    -binaryghost
    Edited by: binary ghost on Sep 9, 2010 10:46 AM

    Hi,
    Try these BTE'S:
    BusTrEvent     SAPMV13A     OPEN_FI_PERFORM_00503301_BOST     00503301     Updating conditions (Pricing)).               
    BusTrEvent     SAPLV13A-LV13AU02     OPEN_FI_PERFORM_00503301_E     00503301/P&S     Update conditions (usage A)                    
    BusTrEvent     SAPLV130-LV130U01     OPEN_FI_PERFORM_00503302_E     00503302/P&S     (Updating conditions (general)).               
    BusTrEvent     SAPMV13A     OPEN_FI_PERFORM_00503308_E     00503308/P&S     Maintain conditions: Default condition (Condition Maintenance Control).                    
    I hope this may helpfull.
    Thank you,
    Thanks,
    AMS

  • Error in BDC for VK-11

    Hi All,
    I have created a BDC for T-Code VK11. When I am loading the data then my BDC is throwing an error becoz for some materials Unit of Measurement(UOM) sceen is coming which I have not captured in BDC. This UOM is coming only for few materials and this screen is not coming when I m entering these materials manually.
    Can anybody plz help me out in solving this.
    Warm Regards,
    Nishu

    Do a recording with a material which is throwing u the UOM screen .
    IF ur flat file is not having Uom pick the values for the materials from MARA/ MARM table into a variable and submit it to the screen of UOM.
    See a recording will be done considering the fact that all the possible scenarios are handled . So If the screen is popping up with a UOM screen then it has to be handled .
    You have to capture this in ur BDC recording .
    Cause even it throws the UOM screen for one material u need to handle that .
    There is one more screen for UOM jsut do a select and pass the UOM for the material in the code
    if u r not intending to maintain the same in ur flat file.
    Regards,
    vijay

  • Set default value in VK11/VK12

    Hi, All
    I use the release status in material price maintain. I want to set default value for the field release status in tc VK11/VK12. I test the 
    BADI SD_COND_SAVE_A and BTE 00503305,but I cannot resolve the question. I do not want to use screen varient SHD0. Can anybody give me a suggestion ?
    thanks a lot!

    hi
    Suppose you have 2 radio buttons and values are 1 and 0 respectively
    So You should try this...
    <af:selectOneRadio id="sor1" layout="horizontal" value="1">//type default value 1 here den it is selected default on page
                <af:selectItem label="ID" value="1" id="si6"/>
                <af:selectItem label="Passport" value="0" id="si16"/>
              </af:selectOneRadio>
    // I hope this will help you....

  • HOW KIND OF Standard table related with vk11, vk12 and vk13?

    HI, EVERYONE,
    HOW KIND OF Standard table related with vk11, vk12 and vk13?
    I want to know about how many and how kind Standard table related with vk11, vk12, vk13.
    I'v found some table like konp and a601 ~ a609, also I want to know about those table of uses?
    I am starting to study about vk11.
    please help me.

    Hi Reena,
    Then main pricing related tables are KONH  header details, and KONP item details.
    The other tables your have mentioned like A601,A609.............. all these are condition tables, which stored the values which you save for access sequence combination.
    Eg : For condition type PR00, lets us assume one key combination customer/material, so these details will be saved in condition table which is initially generated with fields as a part of condition techinque.
    So here the table would be A005 i guess or its A006.
    So like wise there will be condition tables for each key combination.
    Regards
    v K

  • Error while running a BDC for the Transaction F-02

    Hi,
           I'm getting an error <b><i>"Parking not possible during Batch Input"</i></b> while running a BDC for the transaction F-02.
           When i click on the error message it displays the message [b<i>]"In Customizing, you can control whether an error message is issued."</b></i>
            How to solve this issue?.
            Waiting for ur replies.........
    Regards
    N.Senthil

    Hi,
    When you are doing the recording in SHDB, and in the same screen where the TCODE to be recorded is given, there are options that you can choose called "Recording Parameters"...Select the checkbox which says "Not a Batch Input Session", this will set the sy-binpt variable to " "(in a recording by default it is "X")...and you will not get this error...
    Also make sure while writing the BDC program to make use of the "bdc options" parameter which has this property to switch of sy-binpt...
        Refer below theard for sample bdc code for f-02.
    https://forums.sdn.sap.com/click.jspa?searchID=5126766&messageID=1538409
    Regards

  • Problem in creation of BDC for transaction phap_create

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

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

  • How to give line items in flatfile while doing BDC for Table control

    Hi all,
    I am writing BDC for Multiple line items and Transaction  is : FSE5N.
    How do i give the data in the flat file. I mean how do we give the multiple line items in flat file , i.e for second line item again we have to header data or not ?
    ex:
    1015;ALL;demo;kr;INR;01;0001;3000172;100
    1015;ALL;demo;kr;INR;01;0001;3000172;200
    for first lineitem  : 3000172;100
    for 2nd line item : 3000172; 200.
    header data : 1015;ALL;demo;kr;INR;01;0001.
    Thanks in advance
    krupali

    Hii ,
    u can give in the same format as u have done in the example.
    A       B    C     D  E    F   G        H          I
    1015;ALL;demo;kr;INR;01;0001;3000172;100
    1015;ALL;demo;kr;INR;01;0001;3000172;200
    and while writing the loop u can give
    loop at it_head.
    loop at it_head where a = it_head-A and b = it_head-B ..........upto G = it_head-G.
      endloop.
    endloop.
    check this
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Neeraj

Maybe you are looking for

  • 4SNS/1/40000000:TGOD-86.500 = Dead MacBook Pro?

    After getting checksum errors on any .dmg files downloaded from Apple and having the 'Mac OS X Update Combined' update fail to install, I ran disk utility and the Apple Hardware Test which revealed the error: 4SNS/1/40000000:TGOD-86.500 I'm guessing

  • Cant get JTextArea setText  working correctly

    I am developing an app where a user selects rows from a table, and the selections are listed in a textarea. if a user selects a row twice, he deselects that item -- because of this I use setText instead of append (easiest way to display selected rows

  • Users and Responsibilities

    Which tables in the database store information about the users and their associated responsibility?

  • PDF Optimizer and Java Scripts

    We have a custom Java Script that is at the bottom of each page of certain PDFs. The Java Script is setup to print the date on the bottom of each page if a selected PDF is printed to hard copy. Our problems lies in the fact that after adding the Java

  • How can I get iTunes 11 to Shuffle Playlists like old version?

    Anyone have any idea why they changed the shuffle function in the iTunes player?  I really liked being able to see what the shuffled playlist would be and reshuffle if I didn't like the way it was mixed up.  Is there a setting I can change to get it