Error in BDC CALL TRANSACTION METHOD..

hai i got an error in  doing BDC  CALL TRANSACTION METHOD
Error:diffrent number of parameters in  FORM  and PERFORM(routine :FILL_SCREEN_DETAILS:,number of formal parameters :3,number of actual parameters:1)
PROGRAM
REPORT  ZDEMO_UPLOAD_COST_CENTER_DATA.
DATA:BEGIN OF WA_DATA,
KOKRS TYPE KOKRS,"CONTROLLING AREA
KOSTL TYPE KOSTL,"COST CENTER
DATAB TYPE DATAB,"START DATE
DATBI TYPE DATBI,"END DATE
KTEXT TYPE KTEXT,"NAME
LTEXT TYPE LTEXT,"DESCRIPTION
VERAK TYPE VERAK,"PERSON RESPONSIBLE
KOSAR TYPE KOSAR, "COST CENTER CATEGORY
KHINR TYPE KHINR,"HIERARCHY AREA
BUKRS TYPE BUKRS,"COMPANY CODE
GSBER TYPE GSBER,"BUISINESS AREA
END OF WA_DATA.
*TYPES:IT_DATA TYPE STANDARD TABLE OF TY_DATA.
DATA:IT_DATA LIKE TABLE OF WA_DATA,
      IT_BDCDATA LIKE TABLE OF BDCDATA,
      WA_BDCDATA LIKE LINE OF IT_BDCDATA,
      IT_BDCMSGCOLL LIKE TABLE OF BDCMSGCOLL,
      WA_BDCMSGCOLL LIKE LINE OF IT_BDCMSGCOLL.
DATA :V_FILE TYPE STRING.
CONSTANTS :C_KS01(4) TYPE C  VALUE 'KS01',
            C_X(1) TYPE C VALUE 'X',
            C_A(1) TYPE C VALUE 'A'.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETER :PA_FILE LIKE FC03TAB-PL00_FILE OBLIGATORY.
SELECTION-SCREEN:END OF BLOCK B1.
*AT SELECTION SCREEN ON VALUE REQUEST
* EVENT TO BE TRIGGERED WHEN WE PRESS F4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FILE.
PERFORM GET_F4_FOR_FILE USING PA_FILE.
*         START-OF-SELECTION
START-OF-SELECTION.
*WE NEED TO MOVE THE PA_FILE INTO ANOTHER VARIABLE OF TYPE STRING
*AS WE ARE GOING TO USE THE SAME IN THE FM:GUI_UPLOAD THERE THE FILE TYPE IS STRING
V_FILE = PA_FILE.
PERFORM UPLOAD_FILE_T0_ITAB USING V_FILE CHANGING IT_DATA.
*FILL THE SCREEN AND FIELD DETAILS
LOOP AT IT_DATA INTO WA_DATA.
REFRESH IT_BDCDATA.
*FIRST SCREEN DETAILS
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1''0200''X'.
*CURSOR DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_CURSOR''CSKSZ-KOKRS'.
*OK CODE DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_OKCODE''/00'.
*CONTROLLING AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KOKRS' WA_DATA-KOKRS.
*COST CENTER DETAILS
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KOSTL' WA_DATA-KOSTL.
* START DATE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-DATAB_ANFO' WA_DATA-DATAB.
*END DATE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-DATBI_ANFO' WA_DATA-DATBI.
*NEXT SCREEN DETAILS
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1''0299''X'.
*OKCODE DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_OKCODE''=BU'.
*SUBSCRN FIELD DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_SUBSCR''BDC-SUBSCR'.
*CURSOR DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_CURSOR''CSKSZ-WAERS'.
*NAME
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KTEXT' WA_DATA-KTEXT.
*DESCRIPTION
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-LTEXT' WA_DATA-LTEXT.
*PERSON RESPONSIBLE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-VERAK' WA_DATA-VERAK.
*COST CENTER CATEGORY
PERFORM FILL_FIELD_DETAILS USING'CSKSZ-KOSAR' WA_DATA-KOSAR.
*HIERARCHY AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KHINR' WA_DATA-KHINR.
*COMPANY CODE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-BUKRS' WA_DATA-BUKRS.
*BUISINESS AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-GSBER' WA_DATA-GSBER.
*CALL THE TRANSACTION
CALL TRANSACTION C_KS01 USING IT_BDCDATA
                          MODE C_A "ALL SCREENS
                                   "N-NO SCREENS
                                   "E-ERROR SCREENS ONLY
                          UPDATE 'A' "ASYNCHRONOUS
                                      "SYNCHRONOUS
                          MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
* FORM FILL SCREEN_DETAILS
FORM FILL_SCREEN_DETAILS  USING PROGRAM LIKE BDCDATA-PROGRAM
                       DYNPRO LIKE BDCDATA-DYNPRO
                       DYNBEGIN LIKE BDCDATA-DYNBEGIN.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = DYNBEGIN.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDOFRM.
* FORM FILL_FIELD_DETAILS
FORM FILL_FIELD_DETAILS USING FNAM FVAL.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDFORM.
* FORM GETE_F4_FOR_FILE
*DISPLAY ALL THE  FILES IN THE SYSTEM FOR SELECTION
*P_PA_FILE NAME OF THE FILE
FORM GET_F4_FOR_FILE USING P_PA_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
*  EXPORTING
*    PROGRAM_NAME        = SYST-REPID
*    DYNPRO_NUMBER       = SYST-DYNNR
    FIELD_NAME          = 'PA_FILE'
*    STATIC              = ' '
*    MASK                = ' '
   CHANGING
     FILE_NAME           = PA_FILE.
*  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.
* FORM UPLOAD_FILE_TO_ITAB
* FP_V_FILE = FILE NAME
*FP_IT_DATA =  INTERNAL TABLE TO STORE THE DATA
FORM UPLOAD_FILE_TO_ITAB USING FP_V_FILE CHANGING FP_IT_DATA LIKE IT_DATA.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = FP_V_FILE
  HAS_FIELD_SEPARATOR           = ' X'
  TABLES
    DATA_TAB                      =FP_IT_DATA.
ENDFORM.
Edited by: saifudheenc on Aug 7, 2010 5:09 PM

hi
try to add spaces between parameters :
example:
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1' '0200' 'X'.
regards,darek

Similar Messages

  • Error in BDC Call transaction

    Hi,
    I am uplaoding CoA profile data using BDC call transaction method, but records could not be uplaoded because of the error " Screen  0000 is too large for internal batch input Area". I didnt understand what is the reason for  this error.
    Could you plesae help in this?

    Hi,
    Keep the REFRESH KTAB after first Endloop.
    Like
    LOOP AT ITAB.
         LOOP AT KTAB.
        ENDLOOP.
        REFRESH KTAB.
    ENDLOOP.
    Edited by: subas  Bose on Mar 26, 2010 7:17 PM

  • Reg Vendor master upload using BDC Call Transaction Method

    Hi All,
    Thanks in advance.
    I am uploading vendor master data using bdc call transaction method for XK01. In that  i am getting an error message that the fields " smtp_addr" ( for email) and "time_zone" (for time zone) doesnot exist on the screen '0110' ( this is the second screen) . the field timezone will be displayed on the screen only when we go for communications button and select the URL field .
    Do anybody have the solution for this problem. if possible can you give me the code for that screen.

    Create a recording via SM35 (menu go to=>recording), this will generate automatically the code for filling your bdcdata-table...

  • Local mode update in bdc -Call transaction method

    what is LOCAL MODE UPDATE in BDC- Call transaction methods ?

    Hi,
    Try to understand from the below CODE
    CALL TRANSACTION 'ZBDCSINGLE' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES INTO IT_BDCMSGCOLL.
    REFRESH IT_BDCDATA.
    Cheers!!

  • Holder(A008) is not maintaing in HRP1001 (BDC - Call Transaction Method)

    Dear Friends,
    Holder (A008) in HRP1001 is not maintained for some hiried persons through BDC - Call Transaction Method.
    Except Holder update eveything is updated in the hrp1001.
    When we hire a perosn through PA40, then its automatically maintaining Holder ( A008 ) in HRP1001. But for the same case through BDC program with Call Transaction method, its not maintaining Holder.
    What can be reason behind not updating holder in HRP1001. How we can maintain Holder in this case.
    Thanks
    Rav
    Edited by: Rav Jordan on Jan 10, 2012 8:03 AM

    Hi Keshav,
    Thanks for your response.
    After running
       CALL TRANSACTION 'PA40' USING BDCDATA
                               MODE CTUMODE " 'A'
                             UPDATE 'A'
                           MESSAGES INTO MESSTAB.
    if sy-subrc eq '0'.
    i am selecting perner created from pa0002.
    now to update holder i am using fucntion module.
         WA_HOLD-AEDTM = SY-DATUM.
          WA_HOLD-UNAME = SY-UNAME.
          WA_HOLD-OBJID = P_PLANS.
          WA_HOLD-BEGDA = DT.
          WA_HOLD-ENDDA = '99991231'.
          WA_HOLD-OTYPE = 'S'.
          WA_HOLD-PLVAR = '01'.
          WA_HOLD-RSIGN = 'A'.
          WA_HOLD-RELAT = '008'.
          WA_HOLD-SCLAS = 'P'.
          WA_HOLD-SOBID = GD_PERNR.
          CALL FUNCTION 'RH_INSERT_INFTY'
            EXPORTING
             FCODE                     = 'INSE'
             VTASK                     =  'A'
      ORDER_FLG                 = 'X'
      COMMIT_FLG                = 'X'
      AUTHY                     = 'X'
      PPPAR_IMP                 =
      OLD_TABNR                 = ' '
      REPID                     = ' '
      FORM                      = ' '
      KEEP_LUPD                 =
      WORKF_ACTV                = 'X'
            TABLES
              INNNN                     = WA_HOLD
      ILFCODE                   =
    EXCEPTIONS
      NO_AUTHORIZATION          = 1
      ERROR_DURING_INSERT       = 2
      REPID_FORM_INITIAL        = 3
      CORR_EXIT                 = 4
      BEGDA_GREATER_ENDDA       = 5
      OTHERS                    = 6
          IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    endif.
    This also not updating holder in the hrp1001 postion in the table.
    May i know where to do change in the code so that holder can be maintained.
    Thanks
    Rav

  • Hi all, BDC call transaction METHOD, trapping ERRORS

    hi
    i have developed BDC (recording via call transaction method) for VB01. 
    could u please tell me how to display records having errors after running recording or to give index of records having errors.
    and is it possible to give transaction code for recording since my bdc is executable program.
    plase answer both the questions.
    thanx

    Here is the flow that Raja is explaining to you.
    DATA: v_index LIKE sy-tabix.
    LOOP AT itab.
      v_index = sy-tabix.
    *-- prepare the BDC data
      CALL TRANSACTION 'VB01' USING bdcdata
                               MODE 'N'
                              MESSAGES INTO bdcmsgcoll.
      READ TABLE bdcmsgcoll WITH KEY msgtyp = 'E'.
      IF sy-subrc = 0.
    *-- Error occured for the record with index <b>v_index</b>
      ELSE.
    *-- unless there is a success message with this number,
    *   it is not succesfull because 'No data for screen xxx'
    *   will not show up as an error message type, but will be
    *  a success message type
        READ TABLE bdcmsgcoll WITH KEY msgnr = '312'.
        IF sy-subrc = 0.
    *-- success
        ELSE.
    *-- error with index <b>v_index</b>
        ENDIF.
      ENDIF.
    ENDLOOP.
    As you can see, now you have the index of the record where the error occured. Now this will become complicated if you are combining several records into one transaction call. In that case you need to find how you can know all the records that you just accumulated.
    As an example, let us say you have an internal table with external number, customer, material, quantity and at every new external number, you want to create a sales order. Until you get a new external number, you will not do the call transaction because until then it will be items of the same sales order. So in this case, after the call transaction, you will have get all the records that belong to making this sales order by using the external number and then prepare your messages.
    I hope this is clear.
    Srinivas
    Message was edited by: Srinivas Adavi

  • Error Capturing in BDC Call Transaction Method

    How does the Errors in BDC Call Transactin is captured ....can you please give same examples of using BDCMSGCOLL and FORMAT_MESSAGES..
    Please explain clearly when to used these in real time..
    Thankyou

    hi,
    Here is hte sample code
            call transaction  'ME22' using  it_bdc
                    options from x_ctu_params
                    messages into lt_message.
           clear w_success.
           if sy-subrc <> 0.
           w_success = 'N'.
           endif.
            loop at lt_message where msgtyp = 'E' or
                                     msgtyp = 'A'.
            endloop.
            if sy-subrc = 0.
              perform format_messages tables lt_message
                                      using lv_msg lv_lines.
    *         To append error messages
              perform append_message tables lt_message
                                            return
                                     using  lv_msg.
            else.
              if w_success = 'N'.
              perform format_messages tables lt_message
                                      using lv_msg lv_lines.
              perform append_message_err tables lt_message
                                            return
                                     using  lv_msg.
              else.
              perform format_messages tables lt_message
                                      using lv_msg lv_lines.
    *         To append success messages
              perform append_message tables lt_message
                                            return
                                     using  lv_msg.
              endif.
            endif.
            refresh: it_bdc,
                     lt_message.
          endat.
        endloop.
      endif.
    form format_messages tables  pt_messages structure bdcmsgcoll
                         using   pv_msg pv_lines.
      clear : pv_lines,pt_messages,pv_msg.
      describe table pt_messages lines pv_lines.
      read table pt_messages index pv_lines.
      check not pt_messages-msgid is initial.
    *-- Function module to format the message given
      call function 'FORMAT_MESSAGE'
           exporting
                id        = pt_messages-msgid
                lang      = sy-langu
                no        = pt_messages-msgnr
                v1        = pt_messages-msgv1
                v2        = pt_messages-msgv2
                v3        = pt_messages-msgv3
                v4        = pt_messages-msgv4
           importing
                msg       = pv_msg
           exceptions
                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  into pv_msg.
      endif.
    endform.                    " format_messages
    Regards,
    Richa

  • Track error records in Call Transaction method

    Hi
    I have used call transaction method for uploading legacy data.
    I need to track the error record.
    Please help me to find out the solution.
    Thanks in advance
    Reagards
    shriraam

    HI,
    !. Obtain  the  messaged into an Interal table of type BDCMSGCOLL using Call Transaction  syntax..
                   Call Transactio <Tcode>
                           using <BDC Table>
                          mode  <A/N/P>
                          update  <A/S>
                         messages  INTO <mSGTAB>
    2. Read the Msg table for eroors and success messages
    3. Then format the messge with the help of Function Module  :'Format_messages'.
    4. Display the respective messges with the help of write statements or with the help of ALV.
    Rgds
    Umakanth

  • Handling Warning pop up windows in BDC call transaction method

    Hi All,
    Iam using a BDC to automate the Costing Process i.e. Transaction CK40N using call transaction method. In a particular Screen after i perform the execute action, a warning pop up window appears. Only if I click on OK, the execution continues or else it will not proceed. How to handle this situation in case a warning pop up window appears based on the input which is given? In other words a Dynamic warning message. Thanks in advance....
    Regards,
    Nirmal

    Hello,
    U can either use NO_DIALOG or SUPPRESS DIALOG to avaid this,.
    Regards,
    Vasanth

  • Screen no change in BDC call transaction method

    Hi experts
    Greetings!
    I have a BDC created in call transaction method for t-code FB01.
    Data passed successfully to the first screen but when it navigates to the second screen I am not able to pass any data.
    After debugging I found that the issue was because of the DYNPRO value.
    It was 8500 when I created this recording but now the screen number shows 350.
    Is is possible that screen nos change because of any support stack or OSS notes implementation.
    In run time i tried to change the value to 350 and it works fine..
    Thanks
    Jay

    Hi,
    LSMW Direct input method is better for your quiry. Becasuse i wrote BDC for FB01 but not working properly.
    So i used LSMW, helped me a lot. Progmra name is RFBIBL00. Or else i will export and send you if you want. It can handle multiple line items upto 950.
    Thanks,
    Sriram

  • How will you  collect error records in call transaction method

    hello
    how will handle errors in call transaction method...

    DATA: BEGIN OF ITAB OCCURS 0,
          F1(10) TYPE C,
          F2(18) TYPE C,
          F3(15) TYPE C,
          END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0,
          F1(2) TYPE C,
          F2(10) TYPE C,
          F3(18) TYPE C,
          F4(15) TYPE C,
          END OF ITAB1.
    DATA : ITAB2 LIKE ITAB OCCURS 0 WITH HEADER LINE,
                IT_SUCCESS LIKE ITAB OCCURS 0 WITH HEADER LINE,
                IT_ERROR LIKE ITAB OCCURS 0 WITH HEADER LINE.
    DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
               T_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
      CALL TRANSACTION 'VA01' USING BDCDATA MODE 'N' UPDATE 'S'
                                MESSAGES INTO T_BDCMSGCOLL.
      PERFORM ERRORHANDLING TABLES ITAB2 USING COUNT1 COUNT2.
      REFRESH BDCDATA.
    FORM ERRORHANDLING TABLES   P_ITAB2 STRUCTURE ITAB
                       USING    P_COUNT1
                                 P_COUNT2.
      IF SY-SUBRC <> 0.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = SY-MSGID
            LANG      = '-D'
            NO        = SY-MSGNO
            V1        = SY-MSGV1
            V2        = SY-MSGV2
            V3        = SY-MSGV3
            V4        = SY-MSGV4
          IMPORTING
            MSG       = T_BDCMSGCOLL
          EXCEPTIONS
            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 P_COUNT1 = 1.
          WRITE : / ' The records not loaded are '.
          P_COUNT1 = P_COUNT1 + 1.
        ENDIF.
        LOOP AT P_ITAB2.
          WRITE : / P_ITAB2-F1 , P_ITAB2-F2 , P_ITAB2-F3 .
          CLEAR P_ITAB2.
          DELETE P_ITAB2 INDEX 1.
        ENDLOOP.
        WRITE : /.
      ELSE.
        IF P_COUNT2 = 1.
          WRITE : /  ' The records loaded are '.
          P_COUNT2 = P_COUNT2 + 1.
        ENDIF.
        LOOP AT P_ITAB2.
          WRITE : / P_ITAB2-F1 , P_ITAB2-F2 , P_ITAB2-F3 .
          CLEAR P_ITAB2.
          DELETE P_ITAB2 INDEX 1.
        ENDLOOP.
        WRITE : /.
      ENDIF.
    ENDFORM.                    " errorhandling

  • How can we update mk01 with BDC call transaction method

    can any one send the sample code for upload of MK01 using call transaction method.
    its urgent..

    Use the following code.
    *& Report  ZMK01_VA01                                                  *
    REPORT  Z_MK01                              .
    SOURCE INTERNAL TABLE
    DATA: BEGIN OF T_SOURCE OCCURS 0,
            LIFNR TYPE LIFNR,
            EKORG TYPE EKORG,
            KTOKK TYPE KTOKK,
            NAME1 TYPE NAME1,
            SORTL TYPE SORTL,
            LAND1 TYPE LAND1,
            WAERS TYPE WAERS,
          END OF T_SOURCE.
    *DATA: E_MESSAGE TYPE C.
    ERROR MESSAGE TABLE
    DATA: T_ERRORMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    TARGET TABLE LIKE BDCDATA
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    TO UPLOAD DATA FROM LEGACY SYSTEM
          CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
            CODEPAGE                      = ' '
             FILENAME                      = 'D:\MK01.TXT'
             FILETYPE                      = 'DAT'
          IMPORTING
            FILELENGTH                    =
            TABLES
              data_tab                      = T_SOURCE
           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
             NO_AUTHORITY                  = 10
             OTHERS                        = 11
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    TRANSFERING DATA FROM INTERNAL SOURCE TABLE TO TARGET TABLE
    LOOP AT T_SOURCE.
    REFRESH BDCDATA.
    perform bdc_dynpro      using 'SAPMF02K' '0107'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-LIFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  T_SOURCE-LIFNR.
    perform bdc_field       using 'RF02K-EKORG'
                                  T_SOURCE-EKORG.
    perform bdc_field       using 'RF02K-KTOKK'
                                  T_SOURCE-KTOKK.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-LAND1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-NAME1'
                                  T_SOURCE-NAME1.
    perform bdc_field       using 'LFA1-SORTL'
                                  T_SOURCE-SORTL.
    perform bdc_field       using 'LFA1-LAND1'
                                  T_SOURCE-LAND1.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0310'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFM1-WAERS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFM1-WAERS'
                                  T_SOURCE-WAERS.
    perform bdc_dynpro      using 'SAPMF02K' '0320'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-LIFNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    CALL TRANSACTION 'MK01' USING BDCDATA MODE 'A' MESSAGES INTO T_ERRORMSG.
    ENDLOOP.
    LOOP AT T_ERRORMSG.
    WRITE:/ 'MESSAGE TYPE',T_ERRORMSG-MSGTYP,
             'FIELDNAME WERE ERROR OCCURED', T_ERRORMSG-FLDNAME.
    *CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
      ID              = T_ERRORMSG-MSGID
      LANG            = SY-LANGU
      NO              = T_ERRORMSG-MSGNR
      V1              = T_ERRORMSG-MSGV1
      V2              = T_ERRORMSG-MSGV2
      V3              = T_ERRORMSG-MSGV3
      V4              = T_ERRORMSG-MSGV4
    IMPORTING
      MSG             = E_MESSAGE
    EXCEPTIONS
      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.
    *WRITE:/ E_MESSAGE.
    ENDLOOP.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      IF FVAL <> SPACE.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.
    With Regards
    K Srinivas

  • In bdc call transaction method which one ll prefer synchronous or asynchron

    hi could anybody tel me
    call transaction method which one is preferred synchronous or asynchronous..?
    what ll happen if we do other method..?
    foreground or background which one ll prefer..?
    what ll happen if we do otehr method..?
    on which condition we have to use synchronous and asynchronous
    on which condition we have to use foreground and background
    thanx
    kals.

    Hi,
    if you haven't done yet please visit for general information:
    http://help.sap.com/saphelp_nw70/helpdata/en/d2/f8f3393bef4604e10000000a11402f/frameset.htm
    for further information:
    http://help.sap.com/saphelp_nw70/helpdata/en/69/c2501a4ba111d189750000e8322d00/frameset.htm
    This will hopefully answer your question.
    Regards
    Bernd

  • Pls tell me how to check the errors in  BDC CALL TRANSACTION

    lemme know

    HI ,
    check for the bold part..
    REPORT ZCONCUR_UPLOAD_TO_SAP NO STANDARD PAGE HEADING
                                 LINE-SIZE 170
                                 LINE-COUNT 58
                                 MESSAGE-ID ZM.
                 Internal Table                                         *
    *-Internal table for the Header input data from the Comma Delimited file
    DATA: BEGIN OF IT_DATA_HEADER OCCURS 0,
              ID    TYPE C,      "Identifier
              BUKRS(6),          "Company Code
              WAERS(7),          "Currency
              NEWKO(12),         "Vendor
              XBLNR(16),         "First Name
              XBLNR1(16),        "Last Name
              BLDAT(12),         "Document/Posting date
              PK(15),            "Reference
              WRBTR(15),         "Amount
              BKTXT(27),         "Doc.header text
              BKTXT1(27),        "Item text
              SELNO(8),          "Serial No
          END OF IT_DATA_HEADER.
    *-Internal table for the item input data from the Comma Delimited file
    DATA: BEGIN OF IT_DATA_ITEM OCCURS 0,
              ID    TYPE C,      "Identifier
              NEWKO(19),         "Vendor
              BUKRS(6),          "Company Code
              KOSTL(12),         "Cost center
              WRBTR(15),         "Amount
              SGTXT(50),         "Text
              SELNO(8),          "Serial No Header
              SELNO1(8),         "Serial No item
          END OF IT_DATA_ITEM      .
    *-Internal table for the Header input data from the Comma Delimited file
    *-Removing " " From Comma Delimited file
    DATA: BEGIN OF IT_FINAL_HEADER OCCURS 0,
              ID     TYPE C,           "Identifier
              BUKRS  LIKE BKPF-BUKRS,  "Company Code
              WAERS  LIKE BKPF-WAERS,  "Currency
              NEWKO  TYPE RF05A-NEWKO, "Vendor
              XBLNR  LIKE BKPF-XBLNR,
              XBLNR1 LIKE BKPF-XBLNR,
              BLDAT(10), " LIKE BKPF-BLDAT,  "Date
              PK(15),                  "Reference
              WRBTR(15),               "Amount
              BKTXT  LIKE BKPF-BKTXT,  "Doc.header text
              BKTXT1 LIKE BKPF-BKTXT,  "Item text
              SELNO  TYPE I,           "Serial No
              FLAG   TYPE C,
          END OF IT_FINAL_HEADER.
    *-Internal table for the Item input data from the Comma Delimited file
    *-Removing " " From Comma Delimited file
    DATA: BEGIN OF IT_FINAL_ITEM OCCURS 0,
              ID     TYPE C,           "Identifier
              NEWKO  TYPE RF05A-NEWKO, "Account
              BUKRS  LIKE BKPF-BUKRS,  "Company Code
              KOSTL  LIKE BSEG-KOSTL,  "Cost Center
              WRBTR(15),               "Amount
              SGTXT  LIKE BSEG-SGTXT,  "Text
              SELNO  TYPE I,           "Serial No
              SELNO1 TYPE I,           "Serial No
          END OF IT_FINAL_ITEM.
    **-Internal table for the  input data from the file
    DATA : BEGIN OF P_DOWNLOAD  OCCURS 0,
            V_FILEREC(1000) TYPE C,
           END OF P_DOWNLOAD.
    *--- Internal Table for Success messages
    DATA : BEGIN OF I_SUCC OCCURS 0,
             HEADER(50),
             MSG(100),                     "SUCCESS message
           END OF I_SUCC.
    *--- Internal Table for error messages
    DATA : BEGIN OF I_ERROR_LOG OCCURS 0,
             HEADER(50),
             MSG(100),                     "Error message
           END OF I_ERROR_LOG.
    *--- Internal table for getting the BDC data
    DATA : BEGIN OF IT_BDCDATA OCCURS 0.
            INCLUDE STRUCTURE BDCDATA.     " Table to hold BDC data
    DATA : END OF IT_BDCDATA.
    *--- Internal table for reading the messages of call transaction
    DATA : BEGIN OF IT_MESSAGE_TAB OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.  "Table to hold messages
    DATA : END OF IT_MESSAGE_TAB.
                          DATA DECLARATIONS                              *
    DATA:
          V_ERROR_COUNTER   TYPE I,        " error records counter
          V_MSG(100),                      " used for Error message
          V_LINES TYPE I,                  " used for format message
          V_HEAD LIKE SY-CPROG,            " Heading for report
          XMODE VALUE 'N',                 " EXECUTION MODE
          V_SUCCESS_COUNTER TYPE I,        " Success records counter
          V_UNAME LIKE APQI-USERID,        " User Name
          V_TOTAL TYPE I.                  " Total records uploaded
    DATA : V_SELNO TYPE I.
    DATA : V_CHECK TYPE I.
    DATA : V_HEADER(50) TYPE C.             "Header Information
    DATA : V_SUCC_MSG LIKE BDCMSGCOLL-MSGV1."Success Message
    DATA : V_ZERO(4) VALUE '0.00'.          "Checking Zero
    DATA : V_CHECK_ZERO  LIKE BSEG-WRBTR.   "Checking Zero
    DATA : V_CHECK_ZERO1 LIKE BSEG-WRBTR.   "Checking Zero
    DATA : V_SYSTEMDATE  LIKE BKPF-BUDAT.
    DATA : V_VALUE TYPE I.
    DATA : V_VALUE1 TYPE I.
    DATA : V_VALUE2 TYPE I.
    Flags
    DATA:
           F_BDC_OPEN,                   " BDC session open check.
           F_CONTINUE_PROCESSING.        " To continue further processing
                             CONSTANTS                                   *
    CONSTANTS:
           C_SESSION_NAME LIKE APQI-GROUPID VALUE 'F-43',  "Session
           C_X VALUE 'X'.                                  " Used for falgs
                        SELECTION SCREEN                                 *
    *--- Selection Screen with Block and title
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-038.
    PARAMETER: P_FNAME LIKE RLGRAP-FILENAME DEFAULT
                       'C:\Concur.txt'.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION SCREEN ON VALUE-REQUEST
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
      CALL FUNCTION 'F4_FILENAME'
           IMPORTING
                FILE_NAME = P_FNAME
           EXCEPTIONS
                OTHERS    = 1.
      IF SY-SUBRC <> 0.
        MESSAGE E999 WITH 'Error in opening a file'(009).
      ENDIF.
                              Top-of-page                                *
    TOP-OF-PAGE .
    *---perform to display the standard header
      PERFORM STANDARD_HEADER.
    --START OF SELECTION--
    START-OF-SELECTION.
    Upload data
      PERFORM UPLOAD_DATA.
    move data to bdcdata internal table
      PERFORM MOVE_DATA_F43.
    *--- Posting the valid data to F-43
      IF F_BDC_OPEN = C_X.
    *---perform to close bdc group
        PERFORM CLOSE_GROUP.
      ENDIF.
                             END OF SELECTION                            *
    END-OF-SELECTION.
      CHECK F_CONTINUE_PROCESSING IS INITIAL.
      PERFORM DISPLAY_REPORT.
    *&      Form  MESSAGE_FORMAT
                MESSAGE FORMAT
    FORM MESSAGE_FORMAT.
      CLEAR V_MSG.
      CALL FUNCTION 'FORMAT_MESSAGE'
           EXPORTING
                ID        = IT_MESSAGE_TAB-MSGID
                LANG      = 'EN'
                NO        = IT_MESSAGE_TAB-MSGNR
                V1        = IT_MESSAGE_TAB-MSGV1
                V2        = IT_MESSAGE_TAB-MSGV2
                V3        = IT_MESSAGE_TAB-MSGV3
                V4        = IT_MESSAGE_TAB-MSGV4
           IMPORTING
                MSG       = V_MSG
           EXCEPTIONS
                NOT_FOUND = 1
                OTHERS    = 2.
      IF SY-SUBRC <> 0.
        V_MSG = SPACE.
      ENDIF.
    ENDFORM.                               " MESSAGE_FORMAT
    *&      Form  F4_HELP
    FORM F4_HELP.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_FILENAME     = ' '
                DEF_PATH         = 'C:\'
                MODE             = 'O'
                TITLE            = TEXT-025  "'Upload File'
           IMPORTING
                FILENAME         = P_FNAME
           EXCEPTIONS
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4.
      CASE SY-SUBRC.
        WHEN 3.
          MESSAGE I000 WITH TEXT-007.      " Selection Cancel.
        WHEN 4.
          MESSAGE I000 WITH TEXT-008.      " Selection Error.
      ENDCASE.
    ENDFORM.                                                    " F4_HELP
    *&      Form  STANDARD_HEADER
           STANDARD_HEADER
    FORM STANDARD_HEADER.
      FORMAT COLOR COL_HEADING INTENSIFIED OFF.
      CASE V_HEAD.
        WHEN 'Summary Report'(001).
        WHEN 'SUCC_REPORT'.
    **---To display the field headings for Success report.
          ULINE (154).
          WRITE : /001 SY-VLINE,
                   002 'Header Details '(011),
                   052 SY-VLINE,
                   053 'Document Number'(036),
                  154 SY-VLINE.
          ULINE (154).
        WHEN 'Error Report'.
    **---To display the field headings for error report.
          ULINE (154).
          WRITE : /001 SY-VLINE,
                   002 'Header Details '(011),
                   052 SY-VLINE,
                   053 'Error Message/Text'(035),
                  154 SY-VLINE.
          ULINE (154).
      ENDCASE.
    ENDFORM.                               " STANDARD_HEADER
    *&      Form  DISPLAY_REPORT
          Display Report Details
    FORM DISPLAY_REPORT.
      PERFORM SUMMARY_REPORT.
      PERFORM SUCC_REPORT.
      PERFORM ERROR_REPORT.
    ENDFORM.                               " DISPLAY_REPORT
    *&      Form  SUMMARY_REPORT
           Success & Error Count Number
    FORM SUMMARY_REPORT.
      WRITE : /030 SY-TITLE.
      SKIP 1.
      WRITE : /005 'Program Name : '(032),
               024 SY-REPID,
               080 'Date :'(033),
               088 SY-DATUM.
      SKIP 1.
      V_HEAD = 'Summary Report'(001).
      ULINE (132).
      WRITE : /1 SY-VLINE,
               5 'No. of Records read from the Data file'(014),
               45 ':', V_TOTAL LEFT-JUSTIFIED,
               132 SY-VLINE,
              /1 SY-VLINE,
               5 'No. of Records successfully posted'(015),
               45 ':', V_SUCCESS_COUNTER LEFT-JUSTIFIED,
               132 SY-VLINE,
              /1 SY-VLINE,
               5 'No. of Records Failed'(023),
               45 ':'(031), V_ERROR_COUNTER LEFT-JUSTIFIED,
               132 SY-VLINE.
      IF NOT F_BDC_OPEN IS INITIAL.
        WRITE:  /1 SY-VLINE,
                5 'Session Name'(022),
                45 ':'(031), C_SESSION_NAME LEFT-JUSTIFIED,
                132 SY-VLINE.
      ENDIF.
      ULINE (132).
      IF NOT F_BDC_OPEN IS INITIAL.
        WRITE:  /1 SY-VLINE,
                5 'Session Name'(022),
                45 ':'(031), C_SESSION_NAME LEFT-JUSTIFIED,
                132 SY-VLINE.
      ENDIF.
    ULINE (132).
    ENDFORM.                               " SUMMARY_REPORT
    *&      Form  ERROR_REPORT
          Error Report
    FORM ERROR_REPORT.
      IF NOT I_ERROR_LOG[] IS INITIAL.
        SORT I_ERROR_LOG.                  " by tcode.
        V_HEAD = 'Error Report'(013).
        NEW-PAGE.
        LOOP AT I_ERROR_LOG.
          WRITE: /001 SY-VLINE,
                  002 I_ERROR_LOG-HEADER,
                  052 SY-VLINE,
                  053 I_ERROR_LOG-MSG,
                  154 SY-VLINE.
          ULINE (154).
        ENDLOOP.
      ENDIF.
    ENDFORM.                               " ERROR_REPORT
    *&      Form  ERROR_REPORT
          Success Report
    FORM SUCC_REPORT.
      IF NOT I_SUCC[] IS INITIAL.
        SORT I_SUCC.                  " by tcode.
        V_HEAD = 'SUCC_REPORT'(034).
        NEW-PAGE.
        LOOP AT I_SUCC.
          WRITE: /001 SY-VLINE,
                  002 I_SUCC-HEADER,
                  052 SY-VLINE,
                  053 I_SUCC-MSG,
                  154 SY-VLINE.
          ULINE (154).
        ENDLOOP.
      ENDIF.
    ENDFORM.                               " SUCC_REPORT
    *&      Form  OPEN_SESSION
    FORM OPEN_SESSION.
      DATA : V_DATE LIKE SY-DATUM.         " For Hold Date.
      V_DATE = SY-DATUM - 1.               " Hold date
      V_UNAME = SY-UNAME.                  " User name
      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                CLIENT              = SY-MANDT
                GROUP               = C_SESSION_NAME
                HOLDDATE            = V_DATE
                KEEP                = 'X'
                USER                = V_UNAME
           EXCEPTIONS
                CLIENT_INVALID      = 1
                DESTINATION_INVALID = 2
                GROUP_INVALID       = 3
                GROUP_IS_LOCKED     = 4
                HOLDDATE_INVALID    = 5
                INTERNAL_ERROR      = 6
                QUEUE_ERROR         = 7
                RUNNING             = 8
                SYSTEM_LOCK_ERROR   = 9
                USER_INVALID        = 10
                OTHERS              = 11.
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'Session can not be opened'(019).
        STOP.
      ENDIF.
      F_BDC_OPEN = 'X'.
    ENDFORM.                               " OPEN_SESSION
    *&      Form  BDC_INSERT
    FORM BDC_INSERT USING P_TCODE TYPE ANY.
      CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                TCODE            = P_TCODE
           TABLES
                DYNPROTAB        = IT_BDCDATA
           EXCEPTIONS
                INTERNAL_ERROR   = 1
                NOT_OPEN         = 2
                QUEUE_ERROR      = 3
                TCODE_INVALID    = 4
                PRINTING_INVALID = 5
                POSTING_INVALID  = 6
                OTHERS           = 7.
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'Unable to insert, Error record'(037).
        STOP.
      ENDIF.
    ENDFORM.                               " BDC_INSERT
    *&      Form  CLOSE_GROUP
    FORM CLOSE_GROUP.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                NOT_OPEN    = 1
                QUEUE_ERROR = 2
                OTHERS      = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'Session can not be closed'(021).
        STOP.
      ENDIF.
    ENDFORM.                               " CLOSE_GROUP
    *&      Form  UPLOAD_DATA
          Upload Data From the text file
    FORM UPLOAD_DATA.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = P_FNAME
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = P_DOWNLOAD
           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
                OTHERS                  = 10.
      IF SY-SUBRC NE 0.
        MESSAGE E000 WITH 'File does not Exist'(003).
      ELSEIF P_DOWNLOAD[] IS INITIAL.
        MESSAGE E000 WITH 'Input file is empty'(004).
      ENDIF.
      DATA: V_INDEX LIKE SY-TABIX.
      IF NOT P_DOWNLOAD[] IS INITIAL.
        LOOP AT P_DOWNLOAD.
          V_INDEX = SY-TABIX.
    *Removing double quotes
          DO.
            REPLACE '"' WITH '' INTO P_DOWNLOAD.
            IF SY-SUBRC NE 0.
              EXIT.
            ENDIF.
          ENDDO.
          MODIFY P_DOWNLOAD INDEX V_INDEX.
          CONDENSE P_DOWNLOAD.
          IF P_DOWNLOAD(1) = '1'.
    *Finding the header information, creating key field
            V_SELNO =  SY-TABIX.
          ENDIF.
    WE ARE NOT HAVING KEY FIELD IN HEADER/ITEM IN THE FILE.
    SO WE ARE CREATING MANUAL KEY FIELD IN INTERNAL TABLE (SELNO).
          IF P_DOWNLOAD(1) = '1'.
    Moving header information into IT_DATA_HEADER Internal Table
            SPLIT P_DOWNLOAD AT ',' INTO
                  IT_DATA_HEADER-ID
                  IT_DATA_HEADER-BUKRS
                  IT_DATA_HEADER-WAERS
                  IT_DATA_HEADER-NEWKO
                  IT_DATA_HEADER-XBLNR
                  IT_DATA_HEADER-XBLNR1
                  IT_DATA_HEADER-BLDAT
                  IT_DATA_HEADER-PK
                  IT_DATA_HEADER-WRBTR
                  IT_DATA_HEADER-BKTXT
                  IT_DATA_HEADER-BKTXT1.
            IT_DATA_HEADER-SELNO = V_SELNO.
            CONDENSE : IT_DATA_HEADER-ID,     IT_DATA_HEADER-BUKRS,
                       IT_DATA_HEADER-WAERS,  IT_DATA_HEADER-NEWKO,
                       IT_DATA_HEADER-XBLNR,  IT_DATA_HEADER-XBLNR1,
                       IT_DATA_HEADER-BLDAT,  IT_DATA_HEADER-PK,
                       IT_DATA_HEADER-WRBTR,  IT_DATA_HEADER-BKTXT,
                       IT_DATA_HEADER-BKTXT1, IT_DATA_HEADER-SELNO.
            APPEND IT_DATA_HEADER.
            CLEAR  IT_DATA_HEADER.
          ELSEIF P_DOWNLOAD(1) = '2'.
    Moving header information into IT_DATA_ITEM Internal Table
            SPLIT P_DOWNLOAD AT ',' INTO
                  IT_DATA_ITEM-ID
                  IT_DATA_ITEM-NEWKO
                  IT_DATA_ITEM-BUKRS
                  IT_DATA_ITEM-KOSTL
                  IT_DATA_ITEM-WRBTR
                  IT_DATA_ITEM-SGTXT.
            IT_DATA_ITEM-SELNO  = V_SELNO.
            IT_DATA_ITEM-SELNO1 = SY-TABIX.
            CONDENSE: IT_DATA_ITEM-ID,IT_DATA_ITEM-NEWKO,IT_DATA_ITEM-BUKRS,
                      IT_DATA_ITEM-KOSTL,IT_DATA_ITEM-WRBTR,
                      IT_DATA_ITEM-SGTXT,IT_DATA_ITEM-SELNO,
                      IT_DATA_ITEM-SELNO1.
            APPEND IT_DATA_ITEM.
            CLEAR  IT_DATA_ITEM.
          ENDIF.
        ENDLOOP.
    *SORT HEADER & ITEM INTERNAL Table
        SORT IT_DATA_HEADER BY SELNO.
        SORT IT_DATA_ITEM   BY SELNO SELNO1.
    *Header Information
        LOOP AT IT_DATA_HEADER.
          IT_FINAL_HEADER-ID    = IT_DATA_HEADER-ID.
          IT_FINAL_HEADER-BUKRS = IT_DATA_HEADER-BUKRS.
          IT_FINAL_HEADER-WAERS = IT_DATA_HEADER-WAERS.
          IT_FINAL_HEADER-NEWKO = IT_DATA_HEADER-NEWKO.
          CONCATENATE IT_DATA_HEADER-XBLNR IT_DATA_HEADER-XBLNR1
                      INTO IT_FINAL_HEADER-XBLNR.
          IT_FINAL_HEADER-BLDAT  = IT_DATA_HEADER-BLDAT.
          IT_FINAL_HEADER-PK     = IT_DATA_HEADER-PK.
          IT_FINAL_HEADER-WRBTR  = IT_DATA_HEADER-WRBTR.
          IT_FINAL_HEADER-BKTXT  = IT_DATA_HEADER-BKTXT.
          IT_FINAL_HEADER-BKTXT1 = IT_DATA_HEADER-BKTXT1.
          IT_FINAL_HEADER-SELNO  = IT_DATA_HEADER-SELNO.
          APPEND IT_FINAL_HEADER.
          CLEAR  IT_FINAL_HEADER.
        ENDLOOP.
    *Item Information
        LOOP AT IT_DATA_ITEM.
    CHECKING ZERO IN THE IT_DATA_ITEM-WRBTR FIELD
    It will not append the IT_FINAL_ITEM
          V_CHECK_ZERO = IT_DATA_ITEM-WRBTR.
          IF V_CHECK_ZERO NE V_CHECK_ZERO1. "V_ZERO.
            IT_FINAL_ITEM-ID     = IT_DATA_ITEM-ID.
            IT_FINAL_ITEM-NEWKO  = IT_DATA_ITEM-NEWKO.
            IT_FINAL_ITEM-BUKRS  = IT_DATA_ITEM-BUKRS.
            IT_FINAL_ITEM-KOSTL  = IT_DATA_ITEM-KOSTL.
            IT_FINAL_ITEM-WRBTR  = IT_DATA_ITEM-WRBTR.
            IT_FINAL_ITEM-SGTXT  = IT_DATA_ITEM-SGTXT.
            IT_FINAL_ITEM-SELNO  = IT_DATA_ITEM-SELNO.
            IT_FINAL_ITEM-SELNO1 = IT_DATA_ITEM-SELNO1.
            APPEND IT_FINAL_ITEM.
            CLEAR  IT_FINAL_ITEM.
            CLEAR : V_CHECK_ZERO,V_CHECK_ZERO1.
          ENDIF.
        ENDLOOP.
        SORT IT_FINAL_HEADER BY SELNO.
        SORT IT_FINAL_ITEM BY SELNO.
      ENDIF.
    ENDFORM.                    " UPLOAD_DATA
    *&      Form  MOVE_DATA_F43
          Call Transaction F-43
    FORM MOVE_DATA_F43.
    *MOVE THE SYSTEM DATE TO
      CLEAR V_SYSTEMDATE.
      V_SYSTEMDATE = SY-DATUM.
      LOOP AT IT_FINAL_HEADER.
        CLEAR V_CHECK.
        V_CHECK = IT_FINAL_HEADER-SELNO.
      MOVE HEADER DATA TO BDCDATA INTERNAL TABLE
        PERFORM BDC_BUILD_HEADER.
      MOVE ITEM DATA TO BDCDATA INTERNAL TABLE
        PERFORM BDC_BUILD_ITEM.
    <b>*   Call Transcation (F-43)
        CALL TRANSACTION 'F-43' USING IT_BDCDATA
                                MODE XMODE
                                UPDATE 'S'
                                MESSAGES INTO IT_MESSAGE_TAB.</b>
    IF error record found, it will move to batch Input session
        IF SY-SUBRC <> 0.
          V_ERROR_COUNTER = V_ERROR_COUNTER + 1.      " Inc the counter
          CLEAR V_LINES.
          DESCRIBE TABLE IT_MESSAGE_TAB LINES V_LINES.
          READ TABLE IT_MESSAGE_TAB INDEX V_LINES.
    *--- <b>Perform to read the messages
          PERFORM MESSAGE_FORMAT.</b>*--- Appending the error records into error table
          CONDENSE IT_FINAL_HEADER-BUKRS.
          CONDENSE IT_FINAL_HEADER-NEWKO.
          CONDENSE IT_FINAL_HEADER-XBLNR.
          CONDENSE IT_FINAL_HEADER-BLDAT.
          CONCATENATE IT_FINAL_HEADER-BUKRS ','
                      IT_FINAL_HEADER-NEWKO ','
                      IT_FINAL_HEADER-XBLNR ','
                      IT_FINAL_HEADER-BLDAT
                      INTO V_HEADER.
          I_ERROR_LOG-HEADER = V_HEADER.
          I_ERROR_LOG-MSG = V_MSG.
          APPEND I_ERROR_LOG.
          CLEAR I_ERROR_LOG.
    *--  Posting the error record to Session
          IF F_BDC_OPEN IS INITIAL.
            PERFORM OPEN_SESSION.
          ENDIF.
          PERFORM BDC_INSERT USING 'F-43'.
        ELSE.
          V_SUCCESS_COUNTER = V_SUCCESS_COUNTER + 1.
    *--  READING ONLY SUCCESS MESSAGE(MSGNR 312)
          LOOP AT IT_MESSAGE_TAB WHERE MSGNR = '312'.
            V_SUCC_MSG = IT_MESSAGE_TAB-MSGV1.
          ENDLOOP.
    *--- Perform to read the messages
          PERFORM MESSAGE_FORMAT.
    *--- Appending the Success records into Success table
          CONDENSE IT_FINAL_HEADER-BUKRS.
          CONDENSE IT_FINAL_HEADER-NEWKO.
          CONDENSE IT_FINAL_HEADER-PK.
          CONDENSE IT_FINAL_HEADER-XBLNR.
          CONDENSE IT_FINAL_HEADER-BLDAT.
          CONCATENATE IT_FINAL_HEADER-BUKRS ','
                      IT_FINAL_HEADER-NEWKO ','
                      IT_FINAL_HEADER-PK ','
                      IT_FINAL_HEADER-XBLNR ','
                      IT_FINAL_HEADER-BLDAT
                      INTO V_HEADER.
          I_SUCC-HEADER = V_HEADER.
          I_SUCC-MSG = V_SUCC_MSG.
          APPEND I_SUCC.
          CLEAR  I_SUCC.
        ENDIF.
        V_TOTAL = V_TOTAL + 1.
        REFRESH: IT_BDCDATA,
                 IT_MESSAGE_TAB.
        CLEAR:   IT_BDCDATA,
                 IT_MESSAGE_TAB.
      ENDLOOP.
    ENDFORM.                    " MOVE_DATA_F43
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-PROGRAM  = PROGRAM.
      IT_BDCDATA-DYNPRO   = DYNPRO.
      IT_BDCDATA-DYNBEGIN = 'X'.
      APPEND IT_BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-FNAM = FNAM.
      IT_BDCDATA-FVAL = FVAL.
      APPEND IT_BDCDATA.
    ENDFORM.
    *&      Form  BDC_BUILD_HEADER
          Header Information
    FORM BDC_BUILD_HEADER.
    Header Details
      PERFORM BDC_DYNPRO      USING 'SAPMF05A'    '0100'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'  '/00'.
      PERFORM BDC_FIELD       USING 'BKPF-BLDAT'
                                     IT_FINAL_HEADER-BLDAT.
      PERFORM BDC_FIELD       USING 'BKPF-BLART'
                                    'KR'.
      PERFORM BDC_FIELD       USING 'BKPF-BUKRS'
                                    IT_FINAL_HEADER-BUKRS.
    Moveing System date to Posting date in the document
      CLEAR IT_FINAL_HEADER-BLDAT.
      CONCATENATE V_SYSTEMDATE4(4) V_SYSTEMDATE0(4)
                       INTO  IT_FINAL_HEADER-BLDAT.
      PERFORM BDC_FIELD       USING 'BKPF-BUDAT'
                                  IT_FINAL_HEADER-BLDAT.
      PERFORM BDC_FIELD       USING 'BKPF-WAERS'
                                    IT_FINAL_HEADER-WAERS.
      PERFORM BDC_FIELD       USING 'BKPF-XBLNR'
                                    IT_FINAL_HEADER-PK.
      PERFORM BDC_FIELD       USING 'BKPF-BKTXT'
                                    IT_FINAL_HEADER-BKTXT.
      PERFORM BDC_FIELD       USING 'FS006-DOCID'  '*'.
      IF IT_FINAL_HEADER-WRBTR CA '-'.
        REPLACE '-' WITH SPACE INTO IT_FINAL_HEADER-WRBTR.
        CONDENSE IT_FINAL_HEADER-WRBTR.
        PERFORM BDC_FIELD       USING 'RF05A-NEWBS'  '25'.
      ELSE.
        PERFORM BDC_FIELD       USING 'RF05A-NEWBS'  '31'.
      ENDIF.
      PERFORM BDC_FIELD       USING 'RF05A-NEWKO'
                                     IT_FINAL_HEADER-NEWKO.
    *-- Item Vendor Details
      PERFORM BDC_DYNPRO      USING 'SAPMF05A' '0302'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'BSEG-WRBTR'
                                    IT_FINAL_HEADER-WRBTR.
      PERFORM BDC_FIELD       USING 'BSEG-SGTXT'
                                    IT_FINAL_HEADER-BKTXT1.
    ENDFORM.                    " BDC_BUILD_HEADER
    *&      Form  BDC_BUILD_ITEM
          Item Information
    FORM BDC_BUILD_ITEM.
      DATA L_FIRST TYPE C.
      LOOP AT IT_FINAL_ITEM WHERE SELNO = V_CHECK.
        IF L_FIRST IS INITIAL.
          L_FIRST = C_X.
    Line Item ( PstKy,Account & New Company Code)
         CONDENSE IT_FINAL_HEADER-BLDAT.
          IF IT_FINAL_ITEM-WRBTR CA '-'.
            REPLACE '-' WITH SPACE INTO IT_FINAL_ITEM-WRBTR.
            CONDENSE IT_FINAL_ITEM-WRBTR.
            PERFORM BDC_DYNPRO    USING  'SAPMF05A'    '0302'.
            PERFORM BDC_FIELD     USING: 'BDC_OKCODE'   '/00',
                                         'RF05A-NEWBS'  '50',
                                         'RF05A-NEWKO'  IT_FINAL_ITEM-NEWKO,
                                         'RF05A-NEWBK'  IT_FINAL_ITEM-BUKRS.
          ELSE.
            PERFORM BDC_DYNPRO    USING  'SAPMF05A'    '0302'.
            PERFORM BDC_FIELD     USING: 'BDC_OKCODE'   '/00',
                                         'RF05A-NEWBS'  '40',
                                         'RF05A-NEWKO'  IT_FINAL_ITEM-NEWKO,
                                         'RF05A-NEWBK'  IT_FINAL_ITEM-BUKRS.
          ENDIF.
    Amount & Text
          PERFORM BDC_DYNPRO    USING  'SAPMF05A' '0300'.
          PERFORM BDC_FIELD     USING: 'BDC_OKCODE'   '/00',
                                       'BSEG-WRBTR'   IT_FINAL_ITEM-WRBTR,
                                       'BSEG-SGTXT'   IT_FINAL_ITEM-SGTXT,
                                       'DKACB-FMORE'  'X'.
    Cost Center
          PERFORM BDC_DYNPRO    USING  'SAPLKACB'    '0002'.
          PERFORM BDC_FIELD     USING: 'BDC_OKCODE' 'ENTE',
                                       'COBL-KOSTL' IT_FINAL_ITEM-KOSTL.
        ELSE.
    Line Item ( PstKy,Account & New Company Code)
          IF IT_FINAL_ITEM-WRBTR CA '-'.
            REPLACE '-' WITH SPACE INTO IT_FINAL_ITEM-WRBTR.
            CONDENSE IT_FINAL_ITEM-WRBTR.
            PERFORM BDC_DYNPRO    USING  'SAPMF05A'    '0300'.
            PERFORM BDC_FIELD     USING: 'BDC_OKCODE'   '/00',
                                         'RF05A-NEWBS'  '50',
                                         'RF05A-NEWKO'  IT_FINAL_ITEM-NEWKO,
                                         'RF05A-NEWBK'  IT_FINAL_ITEM-BUKRS.
          ELSE.
            PERFORM BDC_DYNPRO    USING  'SAPMF05A'    '0300'.
            PERFORM BDC_FIELD     USING: 'BDC_OKCODE'   '/00',
                                         'RF05A-NEWBS'  '40',
                                         'RF05A-NEWKO'  IT_FINAL_ITEM-NEWKO,
                                         'RF05A-NEWBK'  IT_FINAL_ITEM-BUKRS.
          ENDIF.
          PERFORM BDC_DYNPRO    USING  'SAPLKACB'   '0002'.
          PERFORM BDC_FIELD     USING: 'BDC_OKCODE' 'ENTE'.
    Amount & Text
          PERFORM BDC_DYNPRO    USING  'SAPMF05A'    '0300'.
          PERFORM BDC_FIELD     USING: 'BDC_OKCODE'  '/00',
                                       'BSEG-WRBTR'  IT_FINAL_ITEM-WRBTR,
                                       'BSEG-SGTXT'  IT_FINAL_ITEM-SGTXT,
                                       'DKACB-FMORE' 'X'.
    Cost Center
          PERFORM BDC_DYNPRO    USING  'SAPLKACB'    '0002'.
          PERFORM BDC_FIELD     USING: 'BDC_OKCODE' 'ENTE',
                                       'COBL-KOSTL' IT_FINAL_ITEM-KOSTL.
        ENDIF.
      ENDLOOP.
    *Save Details
      PERFORM BDC_DYNPRO        USING  'SAPMF05A' '0300'.
      PERFORM BDC_FIELD         USING  'BDC_OKCODE'
                                       '=BU'.
      PERFORM BDC_DYNPRO        USING  'SAPLKACB'    '0002'.
      PERFORM BDC_FIELD         USING: 'BDC_OKCODE' 'ENTE'.
    ENDFORM.                    " BDC_BUILD_ITEM
    Thanks
    Mahesh

  • Runtime error on BDC call transaction.

    Hi Everyone,
    I'm getting a run time error: "Runtime error SYNTAX_ERROR has occurred"
    Diagnosis
    Error texts from the batch input are not output
    Only a placeholder
    while debugging the error comes at the following line:
    CALL TRANSACTION 'DSZ46C_DSAL' USING bdcdata.
    can anyone help me out..
    Regards
    Rishika Bawa

    Hi ,
    There might be a problem in transaction but not in BDC. Please run the transaction, out of the program and try to post the data.
    Regards,
    Sai

Maybe you are looking for

  • How do I connect my Xbox 360 to my iMac

    I want to use my imac as a TV so i want to know how to connect the xbox 360 to my imac. Thank you for your support

  • Airlive USB WiFi - dhcpcd timed out

    Hi all, I'm trying to get working wireless connection with AirLive Turbo-g USB Wifi. I've installed wifi-radar and tried to connect to my AP. Firstly, output says Invalid argument to my WPA key and then it's trying to get an IP adress by dhcpcd which

  • ALV Excel Output - Formatting of Columns

    Hi guys, I have a requirement to format the date column output from an alv grid to a spreadsheet. The date in the alv is 01.01.2007 and they want this to appear as 01/01/2007 in the spreadsheet. I noticed in SE16N that this functionality exists, as t

  • How to execute workflow with pl/sql?

    My foregoing work has been done with owb including building dimension table, face table, mappings, and workflow process. if I don't install workflow server/client program module, how to execute the workflow process? Can PL/SQL do this and how to?

  • Clear reservation at the production order confirmation

    Hi All,           In the confirmation of the production order, does clear reversation - clear all the reservations of the BOM Components ? What could be possible reason for non clearance of the reversation of the BOM components, when the header mater