BDC Update 'S'

if i put update 'S' i. "N' mode in bdc does the transaction will take more time . is it a performance issue?

Hi,
<b>MODE</b>
The MODE addition determines the processing mode for batch input processing. As mode, you can specify a character-type data object. Its possible content and effect is displayed in the following table. Without use of one of the additions MODE or OPTIONS FROM, the effect is the same as if mode had the content "A".
mode Effect
"A" Processing with display of screens
"E" Display of screens only if an error occurs
"N" Processing without display of screens. If a breakpoint is reached in one of the called transactions, processing is terminated with sy-subrc same as 1001. The field sy-msgty contains "S", sy-msgid contains "00", sy-msgno contains "344", sy-msgv1 contains "SAPMSSY3", and sy-msgv2 contains "0131".
"P" Processing without display of the screens. If a breakpoint is reached in one of the called transactions, the system branches to the ABAP Debugger.
Others Like "A".
<b>UPDATE</b>
The UPDATE addition determines the processing mode for batch input processing. You can specify a character-type object for upd. Its possible content and its effect are displayed in the following table. Without use of one of the additions UPDATE or OPTIONS FROM, the effect is the same as if upd had the content "A".
update Effect
"A" Asynchronous update. Updates of called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition was not specified.
"S" Synchronous processing. Updates of the called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition had been specified.
"L" Local update. Updates of the called program are executed in such a way as if the SET UPDATE TASK LOCAL statement had been executed in it.
Other As for "A".
Regards
Gaurav

Similar Messages

  • BDC Update 'S' option?

    Would this cause a problem if not in my BDC statement? Because we have had issues where the BDC will only process sometimes, or after so many runs?
    Thank-You.

    By default the Update mode is 'A' - Asynchronous update. If you use the results from this first BDC to some other BDC than you must specify the BDC Update mode to 'S'.
    I would suggest, use the BDC update mode to 'S' always, unless you need fast response.
    Regards,
    Naimesh Patel

  • BDC Update Type

    Hi All,
    What is the difference between update BDC update type Local and Asynchronous?
    Thank you in Advance,
    Danny

    HI,
    SYNCHRONOUES: when ever u execute the transaction the flat file record can be filled in database record by record while in the middle there is an error comes entire transaction is stopped.There is no updation of Database.
    ASYNCHRONOUS: when ever u execute the transaction the flat file recored can be filled in database record by record while in the middle there is an error comes, the records upto to now can be processed can be updated in the database and the transaction is stopped.
    DIFFERENCE BT SESSION AND CALL TRANSACTION.
    CALL TRANSACTION:
    1. only synchronous updation
    2. errors can handled
    3. faster
    4. less amount of data
    5. updation takes place during program execution .
    6.At a time we can process only one TRANSACTION.
    SESSION METHOD:
    1. Only synchronous updation.
    2. Error log is created.
    3. slower.
    4. Huge Amount of data is Transfer.
    5. Updation takes place once the session being created
    Synchronous Update – The program wait for the work process to finish the update. Commit Work and Wait.
    Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.
    Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.
    If you use asynchronous updating, then you will need to use the update management facility (Transaction SM12) to check whether updates have been terminated abnormally during session processing. Error analysis and recovery is less convenient than with synchronous updating.
    Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • HR BDC updates Infty 40 and 15 in Quality but only Infty 40 in production.

    Hi SDNers,
    I am facing a peculiar problem . I have a program which updates infotype 0040 and thereafter Infotype 0015 with the remaining amount value for a employee card when the employee is doing his settlement post-resignation . This program works absolutely fine in Quality and Test system and updates both infotypes bbut in production , it updates infotype 0040 only .Here is the program given below.
    I have debugged and analyzed various scenarios in dev. and quality where it works fine
    - Running BDC after resignation action
    - Locking the payroll area for which the employee belongs .I had a hunch that BAPI_EMPLOYEE_ENQUEUE would be giving a non-zero return message since the payroll area of the employee is locked and therefore ; the program might not be going to the Infotype 0015 update loop . However, I got no error in quality and dev. for the same.
    Please let me know the solution . Points are assured for helpful as well as correct solution.
    *& Report  ZRHRBDC                                             *
    REPORT  ZRHRBDC
        NO STANDARD PAGE HEADING LINE-SIZE 255.
    **************Includes And Types****************
    INCLUDE <icon>.
    TABLES: t100.
    *include bdcrecx1.
    TYPE-POOLS: slis.
    TABLES: zhr_loan_obj,zhr_loan_stat.
    **************Data Declaration***************
    DATA: itab_alv_fieldcat TYPE slis_t_fieldcat_alv,
          itab_alv_layout   TYPE slis_layout_alv,
          itab_lt_sort      TYPE slis_t_sortinfo_alv,
          itab_ls_sort      TYPE slis_sortinfo_alv,
          v_stru_disvar     TYPE disvariant,
          v_header          TYPE slis_listheader,
          v_t_header        TYPE slis_t_listheader,
          v_ld_lines        TYPE i,
          v_t_line          LIKE v_header-info,
          v_ld_linesc(10) TYPE c.
    DATA: v_tcode LIKE sy-tcode.
    DATA: v_lin(6).
    DATA: v_lin1(6).
    DATA: v_lin2(6).
    DATA: v_path(3) TYPE c VALUE 'C:\'.
    DATA: v_mask(6) TYPE c VALUE ',.,.'.
    DATA: v_mode(1) TYPE c VALUE 'O'.
    ****************Internal Table************
    DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
          messages of call transaction
    DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
    DATA: itab_msgtab    LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
    DATA: itab_up_data LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA: fieldtab TYPE slis_t_fieldcat_alv.
    DATA: BEGIN OF itab_rec_data OCCURS 0,
           pernr(8),
           lobnr(20),
          zz_reason(20),
          zz_status(20),
           zz_remain(10),
           stat(1),
          mstring(480),
          END OF itab_rec_data.
    DATA: BEGIN OF st_display,
          pernr LIKE p0001-pernr,
          lobnr LIKE p0040-lobnr,
         zz_reason LIKE zhr_loan_obj-description,
         zz_status LIKE zhr_loan_stat-description,
          zz_remain LIKE p0040-zz_depositamt,
          stat(4),
          etype TYPE bdcmsgcoll-msgtyp,
          mstring(480),
          END OF st_display.
    DATA: itab_display LIKE st_display OCCURS 0 WITH HEADER LINE,
          itab_display_suc LIKE st_display OCCURS 0 WITH HEADER LINE,
          itab_display_err LIKE st_display OCCURS 0 WITH HEADER LINE.
    DATA: v_ucomm LIKE sy-ucomm.
    ***********Selection Screen****************
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: filename LIKE rlgrap-filename.
    PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
    PARAMETERS: cupdate LIKE ctu_params-updmode DEFAULT 'S' NO-DISPLAY.
    "S: synchronously
    "A: asynchronously
    "L: local
    PARAMETERS: nodata DEFAULT '/' LOWER CASE NO-DISPLAY.
    SELECTION-SCREEN: END OF BLOCK b1.
    PARAMETERS: p_test AS CHECKBOX DEFAULT 'X'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      PERFORM getfile_f4help.
    INITIALIZATION.
    ctu = 'X'.
      v_tcode = 'PA30'.
    *****************Start of Selection***********
    START-OF-SELECTION.
      PERFORM status_indicator.
      PERFORM upload_data."To upload data
      IF  p_test IS INITIAL.
        PERFORM bdc_update. "To perform bdc
      ENDIF.
    END-OF-SELECTION.
      PERFORM process_display.
      PERFORM fieldcat_init.
      PERFORM display_report.
    *&      Form  upload_data
    FORM upload_data .
    ****To Upload the data
      DATA : wrk_pcfile TYPE string.
      IF sy-batch = 'X'.
        MESSAGE e000(ztibs) WITH text-007.
      ENDIF.
      MOVE filename TO wrk_pcfile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = wrk_pcfile
         filetype                      = 'ASC'
         has_field_separator           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
        TABLES
          data_tab                      = itab_rec_data
    EXCEPTIONS
       file_open_error               = 1
       file_read_error               = 2
       no_batch                      = 3
       gui_refuse_filetransfer       = 4
       invalid_type                  = 5
       no_authority                  = 6
       unknown_error                 = 7
       bad_data_format               = 8
       header_not_allowed            = 9
       separator_not_allowed         = 10
       header_too_long               = 11
       unknown_dp_error              = 12
       access_denied                 = 13
       dp_out_of_memory              = 14
       disk_full                     = 15
       dp_timeout                    = 16
       OTHERS                        = 17
      IF sy-subrc <> 0.
        MESSAGE e000(zhr) WITH text-005.
      ENDIF.
      IF itab_rec_data[] IS INITIAL.
        MESSAGE e000(zhr) WITH text-006 .
      ENDIF.
    ENDFORM.                    " upload_data
    *&      Form  bdc_update
          text
    -->  p1        text
    <--  p2        text
    FORM bdc_update .
      DATA: p0040 LIKE p0040 OCCURS 0 WITH HEADER LINE,
            p0015 LIKE p0015 OCCURS 0 WITH HEADER LINE,
            l_return       LIKE bapireturn1,
            l_pernr LIKE p0040-pernr,
            l_begda(10),
            l_endda(10).
      DATA:  options TYPE ctu_params.
      CLEAR options .
      options-dismode  = ctumode.
      options-updmode  = cupdate.
      options-cattmode = ' '.
      options-defsize  = 'X'.
      options-racommit = 'X'.
      options-nobinpt  = ' '.
      options-nobiend  = ' '.
      LOOP AT itab_rec_data.
        REFRESH: bdcdata, itab_msgtab.
       IF itab_rec_data-zz_status = '01'  " Issued
         OR itab_rec_data-zz_status = '03'  " Worn Out
         OR itab_rec_data-zz_status = '05'. " Employee left
        REFRESH: p0040.
        MOVE itab_rec_data-pernr TO l_pernr.
        CALL FUNCTION 'HR_READ_INFOTYPE'
          EXPORTING
            pernr           = l_pernr
            infty           = '0040'
          TABLES
            infty_tab       = p0040
          EXCEPTIONS
            infty_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.
        IF p0040[] IS INITIAL.
          MOVE: 'E' TO itab_rec_data-stat.
               text-e02 TO itab_rec_data-mstring.
          MOVE: itab_rec_data-pernr TO itab_display_err-pernr,
              itab_rec_data-lobnr TO itab_display_err-lobnr,
             itab_rec_data-zz_reason TO itab_display-zz_reason,
             itab_rec_data-zz_status TO itab_display-zz_status,
              itab_rec_data-zz_remain TO itab_display_err-zz_remain,
              text-e03 TO itab_display_err-mstring.
          itab_display_err-etype = 'E'.
          APPEND itab_display_err.
          CLEAR: itab_display_err.
          MODIFY itab_rec_data TRANSPORTING stat. " mstring.
        ENDIF.
        DELETE p0040 WHERE ( subty NE '9021' AND subty NE '9023' ).
        IF p0040[] IS INITIAL.
          MOVE: 'E' TO itab_rec_data-stat.
               text-e02 TO itab_rec_data-mstring.
          MOVE: itab_rec_data-pernr TO itab_display_err-pernr,
              itab_rec_data-lobnr TO itab_display_err-lobnr,
             itab_rec_data-zz_reason TO itab_display-zz_reason,
             itab_rec_data-zz_status TO itab_display-zz_status,
              itab_rec_data-zz_remain TO itab_display_err-zz_remain,
              text-e04 TO itab_display_err-mstring.
          itab_display_err-etype = 'E'.
          APPEND itab_display_err.
          CLEAR: itab_display_err.
          MODIFY itab_rec_data TRANSPORTING stat. " mstring.
        ENDIF.
        LOOP AT p0040 WHERE lobnr = itab_rec_data-lobnr.
          CONCATENATE p0040-begda6(2) '.' p0040-begda4(2) '.'
            p0040-begda(4) INTO l_begda.
          CONCATENATE p0040-endda6(2) '.' p0040-endda4(2) '.'
            p0040-endda(4) INTO l_endda.
         SELECT SINGLE * FROM zhr_loan_obj
                WHERE reasoncode = itab_rec_data-zz_reason.
         SELECT SINGLE * FROM zhr_loan_stat
                    WHERE statuscode =  itab_rec_data-zz_status.
          PERFORM bdc_dynpro      USING 'SAPMP50A' '1000'.
          PERFORM bdc_field       USING 'RP50G-PERNR'
                                        p0040-pernr.
          PERFORM bdc_field       USING 'RP50G-BEGDA'
                                        l_begda.
          PERFORM bdc_field       USING 'RP50G-ENDDA'
                                        l_endda.
          PERFORM bdc_field       USING 'RP50G-CHOIC'
                                        '0040'.
          PERFORM bdc_field       USING 'RP50G-SUBTY'
                                        p0040-subty.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=MOD'.
          PERFORM bdc_dynpro      USING 'MP004000' '2000'.
         PERFORM bdc_field       USING 'P0040-ZZ_REASON'
                                       zhr_loan_obj-description.
         PERFORM bdc_field       USING 'P0040-ZZ_STATUS'
                                       zhr_loan_stat-description.
          PERFORM bdc_field       USING 'P0040-ZZ_REMAIN'
                                        itab_rec_data-zz_remain.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_dynpro      USING 'MP004000' '2000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=UPD'.
          CALL TRANSACTION  v_tcode USING bdcdata
                              OPTIONS FROM options
                               MODE   ctumode
                               UPDATE cupdate
                              MESSAGES INTO  itab_msgtab.
          IF sy-subrc = 0.  "Success
            MOVE: 'S' TO itab_rec_data-stat.
            CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
              EXPORTING
                number = l_pernr
              IMPORTING
                return = l_return.
            IF sy-subrc NE  0.
              MOVE: 'E' TO itab_rec_data-stat.
              PERFORM process_list USING itab_rec_data-stat.
            ELSE.
              p0015-pernr = l_pernr.
              p0015-subty = '6004'.
              p0015-infty = '0015'.
              p0015-begda = sy-datum.
              p0015-endda = sy-datum.
              p0015-betrg = itab_rec_data-zz_remain.
              p0015-aedtm = sy-datum.
              p0015-uname = sy-uname.
              CALL FUNCTION 'HR_INFOTYPE_OPERATION'
                EXPORTING
                  infty         = '0015'
                  number        = l_pernr
                  subtype       = '6004'
                  validityend   = sy-datum
                  validitybegin = sy-datum
                  record        = p0015
                  operation     = 'INS'
                  tclas         = 'A'
                  dialog_mode   = '1'
                  nocommit      = 'X'  "nocommit
                IMPORTING
                  return        = l_return
                EXCEPTIONS
                  OTHERS        = 0.
              IF sy-subrc = 0.
                COMMIT WORK.
                MOVE: 'S' TO itab_rec_data-stat.
                PERFORM process_list USING itab_rec_data-stat.
              ENDIF.
              CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
                EXPORTING
                  number = l_pernr
                IMPORTING
                  return = l_return.
            ENDIF.
          ELSE.             "Error
            MOVE: 'E' TO itab_rec_data-stat.
            PERFORM process_list USING itab_rec_data-stat.
          ENDIF.
         PERFORM move_msgdata CHANGING itab_rec_data-stat
                                        itab_rec_data-mstring.
         IF itab_rec_data-stat = 'S'. " no errors found.
            create infotype 0015
           CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
             EXPORTING
               number = l_pernr
             IMPORTING
               return = l_return.
           IF l_return-type = 'E'.
             MOVE l_return-message TO itab_rec_data-mstring.
           ELSE.
             p0015-pernr = l_pernr.
             p0015-subty = '6004'.
             p0015-infty = '0015'.
             p0015-begda = sy-datum.
             p0015-endda = sy-datum.
             p0015-betrg = itab_rec_data-zz_remain.
             p0015-aedtm = sy-datum.
             p0015-uname = sy-uname.
             CALL FUNCTION 'HR_INFOTYPE_OPERATION'
               EXPORTING
                 infty         = '0015'
                 number        = l_pernr
                 subtype       = '6004'
                 validityend   = sy-datum
                 validitybegin = sy-datum
                 record        = p0015
                 operation     = 'INS'
                 tclas         = 'A'
                 dialog_mode   = '1'
                 nocommit      = 'X'  "nocommit
               IMPORTING
                 return        = l_return
               EXCEPTIONS
                 OTHERS        = 0.
             IF sy-subrc = 0.
               COMMIT WORK.
             ENDIF.
             CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
               EXPORTING
                 number = l_pernr
               IMPORTING
                 return = l_return.
           ENDIF.
         ENDIF.
          MODIFY itab_rec_data TRANSPORTING stat. " mstring.
          CLEAR: l_begda, l_endda.
        ENDLOOP.
        IF sy-subrc <> 0.
          MOVE: 'E' TO itab_rec_data-stat.
               text-e02 TO itab_rec_data-mstring.
          MOVE: itab_rec_data-pernr TO itab_display_err-pernr,
              itab_rec_data-lobnr TO itab_display_err-lobnr,
             itab_rec_data-zz_reason TO itab_display-zz_reason,
             itab_rec_data-zz_status TO itab_display-zz_status,
              itab_rec_data-zz_remain TO itab_display_err-zz_remain,
              text-e02 TO itab_display_err-mstring.
          itab_display_err-etype = 'E'.
          APPEND itab_display_err.
          CLEAR: itab_display_err.
          MODIFY itab_rec_data TRANSPORTING stat. " mstring.
        ENDIF.
    ELSE.
       MOVE: 'E' TO itab_rec_data-stat,
             text-e01 TO itab_rec_data-mstring.
       MODIFY itab_rec_data TRANSPORTING stat mstring.
       ENDIF.
        CLEAR: itab_rec_data.
      ENDLOOP.
    ENDFORM.                    " bdc_update
    *&      Form  getfile_f4help
          text
    -->  p1        text
    <--  p2        text
    FORM getfile_f4help .
    ****for upload file path.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = v_path
          mask             = v_mask
          mode             = v_mode
        IMPORTING
          filename         = filename
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
    ENDFORM.                    " getfile_f4help
    *&      Form  fieldcat_init
          text
    -->  p1        text
    <--  p2        text
    FORM fieldcat_init .
      REFRESH itab_alv_fieldcat.
      IF sy-ucomm NE '&REJECT' AND sy-ucomm NE '&SUCCESS'.
        PERFORM fieldcat_write USING 'STAT' 'Status' space space 'X'.
      ENDIF.
      PERFORM fieldcat_write USING 'PERNR' 'Personnel No.' space
        space space.
      PERFORM fieldcat_write USING 'LOBNR' 'CSC ID' space space space.
    PERFORM fieldcat_write USING 'ZZ_REASON' 'Reason' space space space.
    PERFORM fieldcat_write USING 'ZZ_STATUS' 'Status' space space space.
      PERFORM fieldcat_write USING 'ZZ_REMAIN' 'RV confirmed by TL'
        space space space.
      IF sy-ucomm = '&REJECT'.
        PERFORM fieldcat_write USING 'ETYPE' 'Error Type' space space space.
        PERFORM fieldcat_write USING 'MSTRING' 'Error Message' space space
          space.
      ENDIF.
    ENDFORM.                    " fieldcat_init
    *&      Form  fieldcat_write
          text
         -->field   text
         -->label   text
         -->key     text
    FORM fieldcat_write  USING    field
                                  label
                                  key
                                  sum
                                  icon.
      DATA: l_alv_fieldcat TYPE slis_fieldcat_alv.
      l_alv_fieldcat-fieldname = field.
      l_alv_fieldcat-seltext_l = label.
      l_alv_fieldcat-key  = key.
      l_alv_fieldcat-do_sum  = sum.
      l_alv_fieldcat-icon  = icon.
      APPEND l_alv_fieldcat TO itab_alv_fieldcat.
    ENDFORM.                    " fieldcat_write
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
    IF fval <> nodata.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDIF.
    ENDFORM.                    "BDC_FIELD
    *&      Form  display_report
          text
    -->  p1        text
    <--  p2        text
    FORM display_report .
      itab_alv_layout-colwidth_optimize = 'X'.
      itab_alv_layout-zebra   = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'SET_PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_top_of_page   = 'ALV_HEADER'
          is_layout                = itab_alv_layout
          it_fieldcat              = itab_alv_fieldcat
          it_sort                  = itab_lt_sort
          is_variant               = v_stru_disvar
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = itab_display
        EXCEPTIONS
          program_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.
    ENDFORM.                    " display_report
    *&      Form  alv_header
          text
    -->  p1        text
    <--  p2        text
    FORM alv_header .
      CLEAR: v_t_header.
      MOVE sy-ucomm TO v_ucomm.
      IF sy-ucomm = '&SUCCESS'.
        v_header-typ  = 'H'.
        v_header-info = text-015.
        APPEND v_header TO v_t_header.
        CLEAR v_header.
       v_header-typ  = 'S'.
       v_header-key = 'Success List'.
       v_header-info = sy-repid.
       APPEND v_header TO v_t_header.
       CLEAR: v_header.
      ELSEIF sy-ucomm = '&REJECT'.
        v_header-typ  = 'H'.
        v_header-info = text-017.
        APPEND v_header TO v_t_header.
        CLEAR v_header.
       v_header-typ  = 'S'.
       v_header-key = 'Error List'.
       v_header-info = sy-repid.
       APPEND v_header TO v_t_header.
       CLEAR: v_header.
      ELSE.
        v_header-typ  = 'H'.
        v_header-info = text-016.
        APPEND v_header TO v_t_header.
        CLEAR v_header.
      ENDIF.
    Title
    v_header-typ  = 'H'.
    v_header-info = 'Upload Program To Update Infotype 0040'.
    APPEND v_header TO v_t_header.
    CLEAR v_header.
    Date
      v_header-typ  = 'S'.
      v_header-key = 'Date / Time'.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) ' /  '
                   sy-uzeit(2) ':'
                   sy-uzeit+2(2) ':'
                   sy-uzeit+4(2) INTO v_header-info.   "todays
      APPEND v_header TO v_t_header.
      CLEAR: v_header.
    *Program Name
      v_header-typ  = 'S'.
      v_header-key = 'Program:'.
      v_header-info = sy-repid.
      APPEND v_header TO v_t_header.
      CLEAR: v_header.
    Run by
      v_header-typ  = 'S'.
      v_header-key = 'Run by:'.
      v_header-info = sy-uname.
      APPEND v_header TO v_t_header.
      CLEAR: v_header.
      CASE v_ucomm.
       WHEN '&ALLREC'.
         v_header-typ  = 'S'.
         v_header-key = 'Records:'.
         v_header-info = 'All'.
         APPEND v_header TO v_t_header.
         CLEAR: v_header.
         DESCRIBE TABLE itab_display LINES v_ld_lines.
         v_ld_linesc = v_ld_lines.
         CONCATENATE 'Total No. of Records: ' v_ld_linesc
                           INTO v_t_line SEPARATED BY space.
         v_header-typ  = 'A'.
         v_header-info = v_t_line.
         APPEND v_header TO v_t_header.
         CLEAR: v_header, v_t_line.
        WHEN '&SUCCESS'.
         v_header-typ  = 'S'.
         v_header-key = 'Records:'.
         v_header-info = 'Successful'.
         APPEND v_header TO v_t_header.
         CLEAR: v_header.
         DESCRIBE TABLE itab_display_suc LINES v_ld_lines.
         v_ld_linesc = v_ld_lines.
         CONCATENATE 'Total No. of Successful Records: ' v_ld_linesc
                           INTO v_t_line SEPARATED BY space.
         v_header-typ  = 'A'.
         v_header-info = v_t_line.
         APPEND v_header TO v_t_header.
         CLEAR: v_header, v_t_line.
        WHEN '&REJECT'.
         v_header-typ  = 'S'.
         v_header-key = 'Records:'.
         v_header-info = 'Rejected'.
         APPEND v_header TO v_t_header.
         CLEAR: v_header.
         DESCRIBE TABLE itab_display_err LINES v_ld_lines.
         v_ld_linesc = v_ld_lines.
         CONCATENATE 'Total No. of Rejected Records: ' v_ld_linesc
                           INTO v_t_line SEPARATED BY space.
         v_header-typ  = 'A'.
         v_header-info = v_t_line.
         APPEND v_header TO v_t_header.
         CLEAR: v_header, v_t_line.
        WHEN OTHERS.
         v_header-typ  = 'S'.
         v_header-key = 'Records:'.
         v_header-info = 'All'.
         APPEND v_header TO v_t_header.
         CLEAR: v_header.
          DESCRIBE TABLE itab_display LINES v_ld_lines.
          v_ld_linesc = v_ld_lines.
          CONCATENATE 'Total No. of Records: ' v_ld_linesc
                            INTO v_t_line SEPARATED BY space.
          v_header-typ  = 'A'.
          v_header-info = v_t_line.
          APPEND v_header TO v_t_header.
          CLEAR: v_header, v_t_line.
      ENDCASE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = v_t_header.
    ENDFORM.                    " alv_header
    *&      Form  SET_PF_STATUS
          text
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'STATUS' EXCLUDING rt_extab.
      REFRESH: rt_extab.
      IF p_test = 'X'.
        APPEND '&ALLREC' TO rt_extab.
        APPEND '&SUCCESS' TO rt_extab.
        APPEND '&REJECT' TO rt_extab.
      ENDIF.
      SET PF-STATUS 'STATUS' EXCLUDING rt_extab.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_PF_STATUS
          text
    FORM set_pf_status_s USING rt_extab TYPE slis_t_extab.
      REFRESH: rt_extab.
      IF p_test = 'X'.
        APPEND '&ALLREC' TO rt_extab.
        APPEND '&SUCCESS' TO rt_extab.
        APPEND '&REJECT' TO rt_extab.
      ENDIF.
      SET PF-STATUS 'STATUS_SUCC' EXCLUDING rt_extab.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_PF_STATUS
          text
    FORM set_pf_status_e USING rt_extab TYPE slis_t_extab.
      REFRESH: rt_extab.
      IF p_test = 'X'.
        APPEND '&ALLREC' TO rt_extab.
        APPEND '&SUCCESS' TO rt_extab.
        APPEND '&REJECT' TO rt_extab.
      ENDIF.
      SET PF-STATUS 'STATUS_ERROR' EXCLUDING rt_extab.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  user_command
          text
         -->R_UCOMM    text
         -->RS_SELFIELDtext
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                                       rs_selfield TYPE slis_selfield.
      itab_alv_layout-colwidth_optimize = 'X'.
      itab_alv_layout-zebra   = 'X'.
      v_ucomm = r_ucomm.
      CASE r_ucomm.
        WHEN '&ALLREC'.
         CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
             i_callback_program       = sy-repid
             i_callback_pf_status_set = 'SET_PF_STATUS'
             i_callback_user_command  = 'USER_COMMAND'
             i_callback_top_of_page   = 'ALV_HEADER'
             is_layout                = itab_alv_layout
             it_fieldcat              = itab_alv_fieldcat
             it_sort                  = itab_lt_sort
             is_variant               = v_stru_disvar
             i_default                = 'X'
             i_save                   = 'A'
           TABLES
             t_outtab                 = itab_display
           EXCEPTIONS
             program_error            = 1
             OTHERS                   = 2.
         IF sy-subrc <> 0.
         ENDIF.
        WHEN '&SUCCESS'.
         REFRESH itab_display_suc.
         itab_display_suc[] = itab_display[].
         DELETE itab_display_suc WHERE stat <> icon_green_light.
          PERFORM fieldcat_init.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
              i_callback_program       = sy-repid
              i_callback_pf_status_set = 'SET_PF_STATUS_S'
              i_callback_user_command  = 'USER_COMMAND'
              i_callback_top_of_page   = 'ALV_HEADER'
              is_layout                = itab_alv_layout
              it_fieldcat              = itab_alv_fieldcat
              it_sort                  = itab_lt_sort
              is_variant               = v_stru_disvar
              i_default                = 'X'
              i_save                   = 'A'
            TABLES
              t_outtab                 = itab_display_suc
            EXCEPTIONS
              program_error            = 1
              OTHERS                   = 2.
          IF sy-subrc <> 0.
          ENDIF.
        WHEN '&REJECT'.
         REFRESH itab_display_err.
         itab_display_err[] = itab_display[].
         DELETE itab_display_err WHERE stat <> icon_red_light.
          PERFORM fieldcat_init.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
              i_callback_program       = sy-repid
              i_callback_pf_status_set = 'SET_PF_STATUS_E'
              i_callback_user_command  = 'USER_COMMAND'
              i_callback_top_of_page   = 'ALV_HEADER'
              is_layout                = itab_alv_layout
              it_fieldcat              = itab_alv_fieldcat
              it_sort                  = itab_lt_sort
              is_variant               = v_stru_disvar
              i_default                = 'X'
              i_save                   = 'A'
            TABLES
              t_outtab                 = itab_display_err
            EXCEPTIONS
              program_error            = 1
              OTHERS                   = 2.
          IF sy-subrc <> 0.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
          text
    -->  p1        text
    <--  p2        text
    FORM move_msgdata CHANGING p_stat p_mstring.
      DATA: l_mstring(255).
      CLEAR: p_stat, p_mstring.
      LOOP AT itab_msgtab WHERE msgtyp = 'E'.
        SELECT SINGLE * FROM t100 WHERE sprsl = itab_msgtab-msgspra
                                  AND   arbgb = itab_msgtab-msgid
                                  AND   msgnr = itab_msgtab-msgnr.
        IF sy-subrc = 0.
          l_mstring = t100-text.
          IF l_mstring CS '&1'.
            REPLACE '&1' WITH itab_msgtab-msgv1 INTO p_mstring.
            REPLACE '&2' WITH itab_msgtab-msgv2 INTO p_mstring.
            REPLACE '&3' WITH itab_msgtab-msgv3 INTO p_mstring.
            REPLACE '&4' WITH itab_msgtab-msgv4 INTO p_mstring.
          ELSE.
            REPLACE '&' WITH itab_msgtab-msgv1 INTO p_mstring.
            REPLACE '&' WITH itab_msgtab-msgv2 INTO p_mstring.
            REPLACE '&' WITH itab_msgtab-msgv3 INTO p_mstring.
            REPLACE '&' WITH itab_msgtab-msgv4 INTO p_mstring.
          ENDIF.
          CONDENSE l_mstring.
          CONCATENATE p_mstring l_mstring INTO p_mstring SEPARATED BY space.
        ENDIF.
        CLEAR: itab_msgtab, l_mstring.
      ENDLOOP.
      IF sy-subrc = 0.
        CONDENSE p_mstring.
        p_stat = 'E'.
      ELSE.
        p_stat = 'S'.
      ENDIF.
    ENDFORM.                    " move_msgdata
    *&      Form  process_display
          text
    -->  p1        text
    <--  p2        text
    FORM process_display .
      LOOP AT itab_rec_data.
        MOVE: itab_rec_data-pernr TO itab_display-pernr,
              itab_rec_data-lobnr TO itab_display-lobnr,
             itab_rec_data-zz_reason TO itab_display-zz_reason,
             itab_rec_data-zz_status TO itab_display-zz_status,
              itab_rec_data-zz_remain TO itab_display-zz_remain,
              itab_rec_data-mstring TO itab_display-mstring.
        CASE itab_rec_data-stat.
          WHEN 'S'.
            MOVE icon_green_light TO itab_display-stat.
          WHEN 'E'.
            MOVE icon_red_light TO itab_display-stat.
          WHEN OTHERS.
            MOVE icon_yellow_light TO itab_display-stat.
        ENDCASE.
        APPEND itab_display.
        CLEAR: itab_rec_data, itab_display.
      ENDLOOP.
    ENDFORM.                    " process_display
    *&      Form  status_indicator
          text
    -->  p1        text
    <--  p2        text
    FORM status_indicator .
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          percentage = 50
          text       = text-s11.
    ENDFORM.                    " status_indicator
    *&      Form  process_list
          text
         -->P_STAT  text
    FORM process_list  USING    p_stat.
      DATA: v_info LIKE einfo.
      DATA: st_return LIKE bapireturn.
      CASE p_stat.
        WHEN 'S'.
          MOVE: itab_rec_data-pernr TO itab_display_suc-pernr,
              itab_rec_data-lobnr TO itab_display_suc-lobnr,
             itab_rec_data-zz_reason TO itab_display-zz_reason,
             itab_rec_data-zz_status TO itab_display-zz_status,
              itab_rec_data-zz_remain TO itab_display_suc-zz_remain,
              itab_rec_data-mstring TO itab_display_suc-mstring.
          APPEND itab_display_suc.
          CLEAR itab_display_suc.
        WHEN 'E'.
          LOOP AT itab_msgtab.
            MOVE: itab_rec_data-pernr TO itab_display_err-pernr,
               itab_rec_data-lobnr TO itab_display_err-lobnr,
              itab_rec_data-zz_reason TO itab_display-zz_reason,
             itab_rec_data-zz_status TO itab_display-zz_status,
               itab_rec_data-zz_remain TO itab_display_err-zz_remain.
            CLEAR v_info.
            v_info-msgid = itab_msgtab-msgid.
            v_info-msgty = itab_msgtab-msgtyp.
            itab_display_err-etype = itab_msgtab-msgtyp.
            v_info-msgno = itab_msgtab-msgnr.
            v_info-msgv1 = itab_msgtab-msgv1.
            v_info-msgv2 = itab_msgtab-msgv2.
            v_info-msgv3 = itab_msgtab-msgv3.
            v_info-msgv4 = itab_msgtab-msgv4.
            CALL FUNCTION 'MESSAGE_GET_TEXT'
              EXPORTING
                ieinfo        = v_info
                ilangu        = 'E'
              IMPORTING
                etext         = st_return-message
              EXCEPTIONS
                no_t100_found = 1
                OTHERS        = 2.
            itab_display_err-mstring = st_return-message.
            APPEND itab_display_err.
            CLEAR: itab_display_err.
          ENDLOOP.
      ENDCASE.
    ENDFORM.                    "process_list

    Hi,
    R U working without the functional, see once you lock the payroll area then you cant update Payroll Infotypes...as you have in production it is locked hence you cant update infotype 15. I guess the payroll area is not locked in Dev and Quality therefor it allows you to update infotype 15.
    Do one thing create a function module in update task to update infotype 40 and 15.. hence it will take care of updating both the infotype together.. or else not.
    Regards,
    Bhawanidutt.

  • Help on KO22 - BDC Update - Very Urgent

    Dear Gurues,
    Im writing a program for mass update the Budget Price in Transaction Code KO22 using a BDC.
    I have complete my codings but,when i execute in foreground i found that the amount is not updated in the field.I belived is something wrong with my codings which i dont know how to solve it.
    Can anyone review my BDC codes and let me know whats wrong with my code. Im only having problem in updating BPDY-WERT1(01) field. ( Which is Amount Field ).
    Below is my codes for BDC :-
        LOOP AT ITAB_BDC.
              perform bdc_dynpro      using 'SAPMKBUD' '0300'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '/EEOKS'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'CODIA-AUFNR'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'SVALD-VALUE(01)'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '=FURT'.
              perform bdc_field       using 'SVALD-VALUE(01)'
                                             p_kokrs.
              perform bdc_dynpro      using 'SAPMKBUD' '0300'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'CODIA-AUFNR'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '/00'.
              perform bdc_field       using 'CODIA-AUFNR'
                                             ITAB_BDC-order.
                                           'E11101000100'.
              perform bdc_dynpro      using 'SAPLKBPP' '0320'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'BPDY-WERT1(01)'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '=POST'.
              perform bdc_field       using 'DROPT-PTIME'
                                            '1'.
              perform bdc_field       using 'BPDY-WERT1(01)'
                                            ITAB_BDC-amt.
                                    '               110.00'.
              perform bdc_transaction using 'KO22'.
          PERFORM BDC_REPORT.
        ENDLOOP.

    Hi Gurues,
    Thanks for your reply,But im not able to get the value in the amount field.When debug i saw the value.But somehow when execute the bdc in sm35 in foreground, im not able to see the amount value.
    Below is my detail codes :- pls advise if i have coded anything wrong ...
    REPORT zfilbi082 NO STANDARD PAGE HEADING LINE-SIZE 255.
      Program name : ZFILBI080
      ERN          : 050001702
      Title        : MASS UPLOAD INTERNAL ORDER BUDGETTING
      Purpose      : MASS UPLOAD INTERNAL ORDER BUDGETTING
      Author       : VASANTHAN KRISHNAN
      Date         : 07 OCT 2005
      Amendment                                                          *
      Date        Who        ERN      Description                        *
    Tables: coas.
    DATA:
      BEGIN OF ITAB_BDC OCCURS 0,
        order(14),
        amt(12),
      END OF ITAB_BDC.
    data L_amount(12) type c.
    Declaration **************************
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
          NO TYPE I.
    Screen Selection **********************
    11/02/2003 IPC ENHANCEMENT STARTS ERN 090000577 **
    SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-002.
    PARAMETERS :P_kokrs LIKE coas-kokrs DEFAULT 'HCPM' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK bl3.
    11/02/2003 IPC ENHANCEMENT ENDS   ERN 090000577 **
    SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-001.
    PARAMETERS :P_INPUT LIKE RLGRAP-FILENAME DEFAULT 'C:\io07102005.txt'.
    SELECTION-SCREEN END OF BLOCK bl2.
    SELECTION-SCREEN BEGIN OF BLOCK bl1
    WITH FRAME TITLE TEXT-002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS SESSION(12) DEFAULT 'IOBUDGET'.
    PARAMETERS USER(12) DEFAULT SY-UNAME.
    SELECTION-SCREEN END OF BLOCK bl1.
    SELECTION-SCREEN BEGIN OF BLOCK bl0 WITH FRAME TITLE text-003.
    PARAMETER: p_test AS CHECKBOX DEFAULT 'X'.
    PARAMETERS KEEP AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK bl0.
    *******Start Of Selection ***********
    START-OF-SELECTION.
      CLEAR NO.
      PERFORM UPLOAD.
      PERFORM PROCESS.
    *&      Form  process
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS.
      IF P_TEST <> 'X'.
        PERFORM OPEN_GROUP.
        data :date(10) type c,
              date1(10) type c.
        LOOP AT ITAB_BDC.
        l_amount = ITAB_BDC-amt.
              perform bdc_dynpro      using 'SAPMKBUD' '0300'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '/EEOKS'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'CODIA-AUFNR'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'SVALD-VALUE(01)'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '=FURT'.
              perform bdc_field       using 'SVALD-VALUE(01)'
                                             p_kokrs.
              perform bdc_dynpro      using 'SAPMKBUD' '0300'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'CODIA-AUFNR'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '/00'.
              perform bdc_field       using 'CODIA-AUFNR'
                                             ITAB_BDC-order.
                                           'E11101000100'.
              perform bdc_dynpro      using 'SAPLKBPP' '0320'.
              perform bdc_field       using 'BDC_CURSOR'
                                            'BPDY-WERT1(01)'.
              perform bdc_field       using 'BDC_OKCODE'
                                            '=POST'.
              perform bdc_field       using 'DROPT-PTIME'
                                            '1'.
              perform bdc_field       using 'BPDY-WERT1(01)'
                                             l_amount.
                                            ITAB_BDC-amt.
                                    '               110.00'.
              perform bdc_transaction using 'KO22'.
          PERFORM BDC_REPORT.
        ENDLOOP.
        PERFORM CLOSE_GROUP.
      ELSE.
        WRITE:/'NO BATCH PROCESS UPDATES' COLOR COL_HEADING.
        WRITE:/ 'NO Of Internal Order BUdget' COLOR COL_HEADING.
        LOOP AT ITAB_BDC.
          PERFORM BDC_REPORT.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    *&      Form  popup
          text
    -->  p1        text
    <--  p2        text
    FORM POPUP CHANGING E_PFILE LIKE RLGRAP-FILENAME.
      DATA LD_PFILE LIKE RLGRAP-FILENAME.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
               def_filename     = ''
                DEF_PATH         = 'C:\io.TXT'
                MASK             = ',.txt,.txt,.,..'
                MODE             = 'O'
                TITLE            = TEXT-T01
           IMPORTING
                FILENAME         = LD_PFILE
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
      CHECK SY-SUBRC EQ 0.
      E_PFILE = LD_PFILE.
    ENDFORM.
    *&      Form  upload
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = P_INPUT
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = ITAB_BDC
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                FILE_OPEN_ERROR         = 2
                FILE_READ_ERROR         = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      iF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_READ_ERROR               = 2
        UNKNOWN_ERROR                 = 3
        CUSTOMER_ERROR                = 4
        OTHERS                        = 5.
    ENDFORM.
    *&      Form  OPEN_GROUP
          text
    -->  p1        text
    <--  p2        text
      create batchinput session                                          *
      (not for call transaction using...)                                *
    FORM OPEN_GROUP.
      IF SESSION EQ SPACE.
        MESSAGE e010(ad) WITH 'Create BDC session failed'.
      ELSE.
        SKIP.
        WRITE: /(20) 'Create group'(I01), SESSION.
        SKIP.
      open batchinput group
        CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING
                  CLIENT = SY-MANDT
                  GROUP  = SESSION
                  USER   = USER
                  KEEP   = KEEP.
                       HOLDDATE = HOLDDATE.
        WRITE: /(30) 'BDC_OPEN_GROUP'(I02),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ENDIF.
    ENDFORM.
    *&      Form  CLOSE_GROUP
          text
    -->  p1        text
    <--  p2        text
      end batchinput session                                             *
      (call transaction using...: error session)                         *
    FORM CLOSE_GROUP.
    close batchinput group
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
      WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
              (12) 'returncode:'(I05),
                   SY-SUBRC.
    ENDFORM.
    *&      Form  BDC_TRANSACTION
          text
    -->  p1        text
    <--  p2        text
           Start new transaction according to parameters                 *
    FORM BDC_TRANSACTION USING TCODE.
    batch input session
      IF SESSION EQ SPACE.
        MESSAGE e010(ad) WITH 'Create BDC session failed'.
      ELSE.
        CALL FUNCTION 'BDC_INSERT'
             EXPORTING
                  TCODE     = TCODE
             TABLES
                  DYNPROTAB = BDCDATA.
      ENDIF.
      REFRESH BDCDATA.
    ENDFORM.
    *&      Form  BDC_DYNPRO
          text
    -->  p1        text
    <--  p2        text
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
    *&      Form  BDC_FIELD
          text
    -->  p1        text
    <--  p2        text
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR BDCDATA.
      BDCDATA-FNAM = FNAM.
      BDCDATA-FVAL = FVAL.
      APPEND BDCDATA.
    ENDFORM.
    *&      Form  BDC_REPORT
          text
    -->  p1        text
    <--  p2        text
           REPORT
    WRITE:/ 'NO Of Internal Order Budget for Controlling Area',
             '(',P_kokrs,')'.
          FORM BDC_REPORT                                               *
    FORM BDC_REPORT.
      NO = NO + 1.
      WRITE:/ NO,
              p_kokrs(4),
              ITAB_BDC-order(12),
              ITAB_BDC-AMT(10).
    ENDFORM.

  • BDC update MOdes.

    Wht is the UPDATE mode in BDC?What is the imporatance for that.

    <b>A</b> Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.
    Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.
    If you use asynchronous updating, then you will need to use the update management facility (Transaction SM12) to check whether updates have been terminated abnormally during session processing. Error analysis and recovery is less convenient than with synchronous updating.
    <b>S</b> Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.
    <b>L</b> Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program. (See the ABAP keyword documentation on SET UPDATE TASK LOCAL for more information.)
    plz  close the thread if got the answer...
    reward if it helps u...
    sai ramesh.

  • BDC update using KE21N

    Hello all,
    I have a request that I need to create a program to update data via KE21N.
    However, according to the old post here and by my experience after online running this transaction, it is not really suitable for batch updating.
    Is the old transaction KE21 suitable to replace KE21N in the program?  Is there any side effect to use KE21 in updating?
    Edited by: Ezra Kwan on Mar 19, 2008 9:58 AM

    hi,
    hi,
    Enjoy transactions use Enjoy SAP Controls like ALV Grid, ALV Tree. If you run BDC in background these Controls would not be able to communicate front-end since they need some files in front-end (client - PC), so BDC fails.
    Therefore what can be done? There are two possibilities:
    1- ) There might be a alternative, usually older version, transaction. You can use it. For example ME22N is a Enjoy transaction, but ME22 is the older one, does the same thing. So ME22 can be used.
    2- ) If it is available, a BAPI can be used. Whatever you want to do, you can search BAPIs and use it instead of BDC technique.
    Hope this helps, Do reward.

  • BDC update - XD02

    While Updating XD02 using BDC, data gets uploaded while in 'A' mode.
    In 'N' mode, the update doesn't happen.
    Any suggestions please!!

    Hi,
    Many SAP transactions behave differently in online mode and in Batch mode and this mode is determined by the SY-BINPT variable that can be controlled using the OPTIONS command in addition to the CALL TRANSACTION.
    For example, the error message that usually comes in status bar while you are running the transaction online might appear in a popup window when you are running that in batch. This will make your fields disabled for input. This OPTIONS addition will remove this problem
    The way to use the OPTIONS addition.
    Declare a work area of type CTU_PARAMS.
    Fill the fields of CTU_PARAMS. The field NOBINPT should be set to ‘X’.
    This will set the SY-BINPT to space. So now the transaction which you will be calling will run in online mode.
    Example.
    clear X_OPTIONS.
    X_OPTIONS-DISMODE = 'E'.
    X_OPTIONS-UPDMODE = 'S'.
    X_OPTIONS-CATTMODE = ' '.
    X_OPTIONS-DEFSIZE = ' '.
    X_OPTIONS-RACOMMIT = ' '.
    X_OPTIONS-NOBINPT = 'X'.
    X_OPTIONS-NOBIEND = ' '.
    call transaction 'BP' using T_BDCDATA[] options from X_OPTIONS.
    Note:
    Do not use the MODE & UPDATE additions when you are using OPTIONS. The mode & update values are passed in the CTU_PARAMS structure.
    or
    Just give COMMIT WORK after your call transaction.
    Regards

  • BDC Updates Methods

    Hi All,
    Can some one explain me abt the difference between
    *Local
    *synchronous
    *Asynchronous updates in details...
    why Local update is necessary...
    Please specify the complete process for the Recording of all the Updates in details.
    *Specify the difference between session & calltransaction methods
    Thanks,
    Lee

    Hi,
    Session Method::::::::::::::
    Session method we use when there is large no of recorsd to be uploaded into database then we do recording thru SHDB tcode and provide tcode like mara.then recording takes place automatically.you just give correct data in final recording.before that you check data is creting recrod in datbase or not.
    errors will be captured in session method.unless we process session in sm35 data will not be uploaded to database.
    Structure BDCDAT will have values like this :
    PROGRAM 
    DYNPRO  
    DYNBEGIN 
    FNAM                 
    FVAL
    Creating, Filling, and Closing a Batch Input Session
    1.      Open the batch input session using function module
                BDC_OPEN_GROUP .
    2.      For each transaction in the session:
         a. Fill the BDCDATA structure
         b. Transfer to the session with BDC_INSERT .
    3.      Close the batch input session with BDC_CLOSE_GROUP.
    CALL FUNCTION ’BDC_OPEN_GROUP’
    EXPORTING
    CLIENT   =         (in which the session is to be processed)
    GROUP   =   (Name of the session that is to be created)
    HOLDDATE  =  (Lock date) 
    KEEP  =   (Retain session after successful processing)
    USER  =  (Authorizations user for background processing)
    CALL FUNCTION ’BDC_INSERT’
    EXPORTING
    TCODE =              (code of transaction to be run)
    TABLES
    DYNPROTAB =   (BDC data structure having values
    CALL FUNCTION ’BDC_CLOSE_GROUP’
    EXCEPTIONS
    NOT_OPEN            = 1
    QUEUE_ERROR    = 2
    A session must be closed before opening another session from the same program. A new call to BDC_OPEN_GROUP with the same session name creates a new session with the same name.
    CALL TRANSACTION <transaction code> USING …
    MODE ...
    UPDATE ..
    MESSAGES INTO …...
    A Display all
    N No display
    E Display only error
    S Continue processing when update is completed     (synchronous)
    A Continue processing immediately
    L Local update
    The Mode Parameter
    A      Display everything. All screens and the data that goes in them appears on screen. This is the default setting.
    N      Display nothing. All screens are processed invisibly, regardless of whether there are errors or not.
    E      Display errors only. The transaction goes into display mode as soon as an error in one of the screens is detected.
    S Continue processing when update is completed (synchronous)
    A Continue processing immediately
    L Local update
    The Update Parameter
    A Asynchronous updating. Faster execution of batch input program but no completion message from the SAP update service.
    Not suitable for large amount of data
    S Synchronous updating. Called transaction returns update error message.
    L Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program.
    Differences:::::::::::::::::::::::::::::::::
    Mainly Call Transaction used for small sets of data because in Call Transaction we have to Handle the Processing errors explicitly. We can do this by BDCMSGCOLL structure.
    In Session method seperate session will crate for errors. Calll Transaction will update the Database fastly compare with Session Method.
    Regds
    Sivaparvathi
    Please reward points if helpful....

  • BDC Updates

    Hi All,
    Can some one explain me  abt the difference between
    *Local
    *synchronous
    *Asynchronous  updates in details...
    why Local update is necessary...
    Please specify the complete process for the Recording of all the Updates in details.
    Thanks,
    Lee

    Hi,
    simply
    S Continue processing when update is completed (synchronous)
    A Continue processing immediately
    L Local update
    The Update Parameter
    A      Asynchronous updating. Faster execution of  batch input program but no completion message from the SAP update service.
    Not suitable for large amount of data
    S      Synchronous updating. Called transaction returns update error message.
    L      Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program.
    Regds
    Sivaparvathi
    Please reward points if helpful....

  • Bdc-update

    Hi all,
    Can anybody give the differenc between synchronus and asynchronu method  with good example. (Flow)
    with regards
    anand

    Hi Anand
    Synchronous: calling program doesnot continue to execute until the called program has finished execution
    ASynchronous calling program continue to execute irrespective of the fact that the called program has finished execution or not.
    example
    CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'TEST'
      EXPORTING
        tcode                   = 'SM59'
      EXCEPTIONS
        call_transaction_denied = 1
        tcode_invalid           = 2
        OTHERS                  = 3.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CASE sy-subrc.
      WHEN 2.
        WRITE :/ ' transaction doesnot exist'.
    ENDCASE.
    WRITE: / ' Demo For Asynchronous Transaction End'
    if u dont write STARTING NEW TASK 'TEST' then its synchronous call because the transaction sm59 will open in another session in case of asynch call rest of the prog continues to execute . while in sync call sm59 opens in same session ie until the trxn doesnot execute the prog does execute further. hope it clears ur doubt.
    reagrds
    ravish
    <b>plz reward if helpful</b>
    Regards,
    Sree

  • Updating BDC: Help required...

    Hi All,
        I have a requirement to update a Transaction 'FD32' using BDC. But in my case the user doesnt have authorization to this Transaction.
    My question is...
    Can the BDC update the transaction for an unauthorized user.
    If NO...What is the way to update the Transaction for this unauthorized user...
    Thanks in Advance
    Nanda

    Hi Nanda,
    Have you looked standard program RFBIDE00?
    Please check program documentation perhaps it may help.
    Regards,
    Ferry Lianto

  • How to resolve the error in bdc call transaction in ALV report

    Dear Experts, i am executing the alv report program and in alv report program one bdc is there..
    after executing output is showing in alv format but one button is there (update master)..when i am clicking update button the bdc is run but is not updated in the material master..after executing my bdc is not updated in mm02.
    how to resove it?
    CALL TRANSACTION 'MM02' USING BDCDATA MODE MODE
                                                              UPDATE 'S'
                                                      MESSAGES INTO MESSTAB.

    Hi Kaustav,
    Looking at the code you attached, it appears to me that your BDC (Form  USER_COMMAND) is not executed at all as you haven't passed the 'USER_COMMAND' in FM REUSE_ALV_GRID_DISPLAY for ALV display.
    You must pass the importing parameter  I_CALLBACK_USER_COMMAND of this FM as 'USER_COMMAND', only then this form will be executed and your BDC will run.
    Thereafter, in case your BDC update fails, you can put a break-point in the form (at CALL TRANSACTION statement) and analyze the message table MESSTAB.
    Hope it helps.
    Regards,
    Sapeksh

  • BDC FOR PO CREATE USING ME21

    Iam Creating BDC Program bu using ME21 for Uploading PO.
    Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
    Let me know what are the mandotory fields for creating PO using Me21.
    Here iam also attaching the code, Please help us because it is very urgent.
    report ZPOUPLOADME21
    no standard page heading line-size 255.
    *include bdcrecx1.
    INCLUDE YMM_BDCRECX1.
    •     Internal Table T_BDCDATA to store BDC data
    •     Batchinputdata of single transaction
    DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    •     Internal Table T_BDC_MSG to store BDC messages
    DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
    SIZE 0 WITH HEADER LINE.
    DATA: V_FILE LIKE RLGRAP-FILENAME ,
    V_COUNT(5) TYPE C,
    V_MESSAGE_CNT(5) TYPE C .
    DATA : BEGIN OF IT_DATA OCCURS 0,
    LIFNR LIKE EKKO-LIFNR, " Vendor
    BSART LIKE RM06E-BSART, " Order Type
    BEDAT(10) TYPE C, " Date
    EKORG LIKE EKKO-EKORG, " Purchasing Organization
    EKGRP LIKE EKKO-EKGRP, " Purchasing Group
    WERKS LIKE RM06E-WERKS, " Plant
    INCO2 LIKE EKKO-INCO2, " Inco Terms
    KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category
    EMATN LIKE EKPO-EMATN, " Material Number
    MENGE LIKE EKPO-MENGE, " Purchase Order Quantity
    NETPR LIKE EKPO-NETPR, " Net Price
    MWSKZ LIKE EKPO-MWSKZ, " Tax Code
    NPLNR LIKE MSEG-NPLNR, " Network
    VORNR LIKE PSORDER-VORNR, " Operation
    END OF IT_DATA.
    START-OF-SELECTION.
    PERFORM OPEN_GROUP.
    PERFORM DATA_UPLOAD.
    PERFORM CALL_TRANSACTION.
    PERFORM CLOSE_GROUP.
    PERFORM WRITE_ERROR.
    *& Form DATA_UPLOAD
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM DATA_UPLOAD.
    *call function ws_upload to retrieve data from a flat file in the
    *presentation server into an internal table
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    FILENAME = V_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_DATA
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    OTHERS = 7.
    •     if ws_upload fails then display appropriate message
    IF SY-SUBRC 0.
    •     MESSAGE E000 WITH 'Data not Uploaded into internal table'.
    ENDIF.
    ENDFORM. " DATA_UPLOAD
    *& Form CALL_TRANSACTION
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CALL_TRANSACTION.
    DATA : V_IVDAT(10) TYPE C,
    V_AKTIV(10) TYPE C,
    V_MESSAGE(404) TYPE C.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    V_COUNT = 0.
    V_MESSAGE_CNT = 0.
    LOOP AT IT_DATA .
    V_COUNT = V_COUNT + 1.
    *perform open_group.
    perform bdc_dynpro using 'SAPMM06E' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-WERKS'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EKKO-LIFNR'
    IT_DATA-LIFNR.
    perform bdc_field using 'RM06E-BSART'
    IT_DATA-BSART.
    *perform bdc_field using 'RM06E-BEDAT'
    •     '24.01.2008'.
    perform bdc_field using 'RM06E-BEDAT'
    IT_DATA-BEDAT.
    perform bdc_field using 'EKKO-EKORG'
    IT_DATA-EKORG.
    perform bdc_field using 'EKKO-EKGRP'
    IT_DATA-EKGRP.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'T'.
    perform bdc_field using 'RM06E-WERKS'
    IT_DATA-WERKS.
    perform bdc_dynpro using 'SAPMM06E' '0101'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKO-INCO2'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKKO-EKGRP'
    •     IT_DATA-EKGRP1. "'SP3'.
    *perform bdc_field using 'EKKO-PINCR'
    •     IT_DATA-PINCR. "'10'.
    *perform bdc_field using 'EKKO-SPRAS'
    •     IT_DATA-SPRAS. "'EN'.
    *perform bdc_field using 'EKKO-UPINC'
    •     IT_DATA-UPINC. "'1'.
    *perform bdc_field using 'EKKO-ZTERM'
    •     IT_DATA-ZTERM.
    *perform bdc_field using 'EKKO-WAERS'
    •     IT_DATA-WAERS. "'INR'.
    *perform bdc_field using 'EKKO-ZBD1T'
    •     IT_DATA-ZBD1T. "'44'.
    *perform bdc_field using 'EKKO-WKURS'
    •     IT_DATA-WKURS. "' 1.00000'.
    *perform bdc_field using 'EKKO-INCO1'
    •     IT_DATA-INCO1.
    perform bdc_field using 'EKKO-INCO2'
    IT_DATA-INCO2.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-NETPR(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP(01)'
    •     'N'.
    perform bdc_field using 'EKPO-KNTTP(01)'
    IT_DATA-KNTTP.
    perform bdc_field using 'EKPO-EMATN(01)'
    IT_DATA-EMATN.
    perform bdc_field using 'EKPO-MENGE(01)'
    IT_DATA-MENGE.
    perform bdc_field using 'EKPO-NETPR(01)'
    IT_DATA-NETPR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-MWSKZ'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP'
    •     'N'.
    *perform bdc_field using 'EKPO-TXZ01'
    •     'Clamps & Connector'.
    *perform bdc_field using 'EKPO-MENGE'
    •     '4'.
    *perform bdc_field using 'EKPO-SPINF'
    •     'A'.
    *perform bdc_field using 'EKPO-NETPR'
    •     '100.00'.
    *perform bdc_field using 'EKPO-PEINH'
    •     '1'.
    *perform bdc_field using 'EKPO-BPRME'
    •     'NO'.
    *perform bdc_field using 'EKPO-BPUMN'
    •     '1'.
    *perform bdc_field using 'EKPO-BPUMZ'
    •     '1'.
    *perform bdc_field using 'EKPO-PRSDR'
    •     'X'.
    *perform bdc_field using 'RM06E-EEIND'
    •     '24.01.2008'.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'D'.
    *perform bdc_field using 'EKPO-WEPOS'
    •     'X'.
    perform bdc_field using 'EKPO-MWSKZ'
    IT_DATA-MWSKZ.
    *perform bdc_field using 'EKPO-REPOS'
    •     'X'.
    perform bdc_dynpro using 'SAPMM06E' '0511'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKN-SAKTO'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    *perform bdc_field using 'EKKN-SAKTO'
    •     '6034025'.
    *perform bdc_field using 'DKACB-FMORE'
    •     'X'.
    perform bdc_dynpro using 'SAPLKACB' '0002'.
    *perform bdc_field using 'BDC_CURSOR'
    •     'COBL-VORNR'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    perform bdc_field using 'COBL-NPLNR'
    IT_DATA-NPLNR.
    perform bdc_field using 'COBL-VORNR'
    IT_DATA-VORNR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-EBELP'.
    perform bdc_field using 'BDC_OKCODE'
    '=BU'.
    *perform bdc_field using 'RM06E-EBELP'
    •     '10'.
    perform bdc_dynpro using 'SAPLSPO1' '0300'.
    perform bdc_field using 'BDC_OKCODE'
    '=YES'.
    perform bdc_transaction using 'ME21'.
    perform close_group.
    LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
    AT FIRST.
    V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
    T_MESSTAB-REC_NO = V_COUNT.
    ENDAT.
    MODIFY T_MESSTAB TRANSPORTING REC_NO.
    ENDLOOP.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    ENDLOOP.
    SKIP.
    WRITE : /10 'Record Number ', 30 'Error Message'.
    SKIP.
    endform.
    *& Form WRITE_ERROR
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM WRITE_ERROR.
    LOOP AT T_MESSTAB.
    WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
    ENDLOOP.
    ULINE /10(100).
    WRITE : /10 'No of Records : ' , V_COUNT.
    WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
    ULINE /10(100).
    ENDFORM. " WRITE_ERROR
    *& Form CHECK_BDC
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CHECK_BDC.
    DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
    SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
    WHERE PROGRAMM EQ SY-REPID
    AND YCHECK EQ 'X'.
    IF SY-SUBRC NE 0.
    MESSAGE S000(YM) WITH 'Execution not possible'.
    STOP.
    ENDIF.
    ENDFORM. " CHECK_BDC
    Your Help will be highly appreciated.
    If any bapi code you have please send me.
    Thanks
    Rahul

    Hi.
    ckeck this.
    *Code used to create BDC
    *& Report ZBDC_EXAMPLE *
    *& Example BDC program, which updates net price of item 00010 of a *
    *& particular Purchase order(EBELN). *
    REPORT ZBDC_EXAMPLE NO STANDARD PAGE HEADING
    LINE-SIZE 132.
    Data declaration
    TABLES: ekko, ekpo.
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekko-ebeln,
    waers TYPE ekko-waers,
    netpr TYPE ekpo-netpr,
    err_msg(73) TYPE c,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko,
    it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_error TYPE t_ekko,
    it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_success TYPE t_ekko.
    DATA: w_textout LIKE t100-text.
    DATA: gd_update TYPE i,
    gd_lines TYPE i.
    *Used to store BDC data
    DATA: BEGIN OF bdc_tab OCCURS 0.
    INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.
    *Used to stores error information from CALL TRANSACTION Function Module
    DATA: BEGIN OF messtab OCCURS 0.
    INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF messtab.
    *Screen declaration
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
    TITLE text-001. "Purchase order Num
    SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
    TITLE text-002. "New NETPR value
    PARAMETERS: p_newpr(14) TYPE c obligatory. "LIKE ekpo-netpr.
    SELECTION-SCREEN END OF BLOCK block2.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Retrieve data from Purchase order table(EKKO)
    SELECT ekkoebeln ekkowaers ekpo~netpr
    INTO TABLE it_ekko
    FROM ekko AS ekko INNER JOIN ekpo AS ekpo
    ON ekpoebeln EQ ekkoebeln
    WHERE ekko~ebeln IN so_ebeln AND
    ekpo~ebelp EQ '10'.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Check data has been retrieved ready for processing
    DESCRIBE TABLE it_ekko LINES gd_lines.
    IF gd_lines LE 0.
    Display message if no data has been retrieved
    MESSAGE i003(zp) WITH 'No Records Found'(001).
    LEAVE TO SCREEN 0.
    ELSE.
    Update Customer master data (instalment text)
    LOOP AT it_ekko INTO wa_ekko.
    PERFORM bdc_update.
    ENDLOOP.
    Display message confirming number of records updated
    IF gd_update GT 1.
    MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
    ELSE.
    MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
    ENDIF.
    Display Success Report
    Check Success table
    DESCRIBE TABLE it_success LINES gd_lines.
    IF gd_lines GT 0.
    Display result report column headings
    PERFORM display_column_headings.
    Display result report
    PERFORM display_report.
    ENDIF.
    Display Error Report
    Check errors table
    DESCRIBE TABLE it_error LINES gd_lines.
    If errors exist then display errors report
    IF gd_lines GT 0.
    Display errors report
    PERFORM display_error_headings.
    PERFORM display_error_report.
    ENDIF.
    ENDIF.
    *& Form DISPLAY_COLUMN_HEADINGS
    Display column headings
    FORM display_column_headings.
    WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
    SKIP.
    WRITE:2 'The following records updated successfully:'(013).
    WRITE:/ sy-uline(42).
    FORMAT COLOR COL_HEADING.
    WRITE:/ sy-vline,
    (10) 'Purchase Order'(004), sy-vline,
    (11) 'Old Netpr'(005), sy-vline,
    (11) 'New Netpr'(006), sy-vline.
    WRITE:/ sy-uline(42).
    ENDFORM. " DISPLAY_COLUMN_HEADINGS
    *& Form BDC_UPDATE
    Populate BDC table and call transaction ME22
    FORM bdc_update.
    PERFORM dynpro USING:
    'X' 'SAPMM06E' '0105',
    ' ' 'BDC_CURSOR' 'RM06E-BSTNR',
    ' ' 'RM06E-BSTNR' wa_ekko-ebeln,
    ' ' 'BDC_OKCODE' '/00', "OK code
    'X' 'SAPMM06E' '0120',
    ' ' 'BDC_CURSOR' 'EKPO-NETPR(01)',
    ' ' 'EKPO-NETPR(01)' p_newpr,
    ' ' 'BDC_OKCODE' '=BU'. "OK code
    Call transaction to update customer instalment text
    CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
    MESSAGES INTO messtab.
    Check if update was succesful
    IF sy-subrc EQ 0.
    ADD 1 TO gd_update.
    APPEND wa_ekko TO it_success.
    ELSE.
    Retrieve error messages displayed during BDC update
    LOOP AT messtab WHERE msgtyp = 'E'.
    Builds actual message based on info returned from Call transaction
    CALL FUNCTION 'MESSAGE_TEXT_BUILD'
    EXPORTING
    msgid = messtab-msgid
    msgnr = messtab-msgnr
    msgv1 = messtab-msgv1
    msgv2 = messtab-msgv2
    msgv3 = messtab-msgv3
    msgv4 = messtab-msgv4
    IMPORTING
    message_text_output = w_textout.
    ENDLOOP.
    Build error table ready for output
    wa_error = wa_ekko.
    wa_error-err_msg = w_textout.
    APPEND wa_error TO it_error.
    CLEAR: wa_error.
    ENDIF.
    Clear bdc date table
    CLEAR: bdc_tab.
    REFRESH: bdc_tab.
    ENDFORM. " BDC_UPDATE
    FORM DYNPRO *
    stores values to bdc table *
    --> DYNBEGIN *
    --> NAME *
    --> VALUE *
    FORM dynpro USING dynbegin name value.
    IF dynbegin = 'X'.
    CLEAR bdc_tab.
    MOVE: name TO bdc_tab-program,
    value TO bdc_tab-dynpro,
    'X' TO bdc_tab-dynbegin.
    APPEND bdc_tab.
    ELSE.
    CLEAR bdc_tab.
    MOVE: name TO bdc_tab-fnam,
    value TO bdc_tab-fval.
    APPEND bdc_tab.
    ENDIF.
    ENDFORM. " DYNPRO
    *& Form DISPLAY_REPORT
    Display Report
    FORM display_report.
    FORMAT COLOR COL_NORMAL.
    Loop at data table
    LOOP AT it_success INTO wa_success.
    WRITE:/ sy-vline,
    (10) wa_success-ebeln, sy-vline,
    (11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
    (11) p_newpr, sy-vline.
    CLEAR: wa_success.
    ENDLOOP.
    WRITE:/ sy-uline(42).
    REFRESH: it_success.
    FORMAT COLOR COL_BACKGROUND.
    ENDFORM. " DISPLAY_REPORT
    *& Form DISPLAY_ERROR_REPORT
    Display error report data
    FORM display_error_report.
    LOOP AT it_error INTO wa_error.
    WRITE:/ sy-vline,
    (10) wa_error-ebeln, sy-vline,
    (11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
    (73) wa_error-err_msg, sy-vline.
    ENDLOOP.
    WRITE:/ sy-uline(104).
    REFRESH: it_error.
    ENDFORM. " DISPLAY_ERROR_REPORT
    *& Form DISPLAY_ERROR_HEADINGS
    Display error report headings
    FORM display_error_headings.
    SKIP.
    WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
    SKIP.
    WRITE:2 'The following records failed during update:'(008).
    WRITE:/ sy-uline(104).
    FORMAT COLOR COL_HEADING.
    WRITE:/ sy-vline,
    (10) 'Purchase Order'(009), sy-vline,
    (11) 'Netpr'(010), sy-vline,
    (73) 'Error Message'(012), sy-vline.
    WRITE:/ sy-uline(104).
    FORMAT COLOR COL_NORMAL.
    ENDFORM. " DISPLAY_ERROR_HEADINGS
    regards.
    sowjanya.b.

  • In RFC how to uploading data using bdc

    Hi, Experts
    In RFC how to use bdc program for uploading data
    any example plz.
    my requrement for tcode ME21.
    thank you in advance.
    with best regards
        sai

    Thank u  reply
    my requirement is in function moudle 
    ( Program will be called from non-sap system with the data in the form of table as per the structure given above. Then the program will do the some validation for the data.  If data validated correct, BDC will be run for creating DO
    condition is )
    ex:
    if T_itab –KNTTP = ‘K’,
    Run BDC for transaction ME21.
    ( in that you should not use upload and ws_upload )
    in put paramer is taking value for structure (non- sap ) run the bdc update in sap system.
    plz any sample program
    regards
    sai

Maybe you are looking for