Custom BAPI with BDC

hi guys
i have a custom BAPI with a BDC within it..however im getting an error on process screen saying input value is longer than screen field. i added the code below to go around that error but now again another error occurs
  DATA: BEGIN OF itab_amount OCCURS 0,
        turnover_local(29)   TYPE c,
        turnover_export(29)  TYPE c,
        interest(29)         TYPE c,
        other_income(29)     TYPE c,
        tax(29)              TYPE c,
        trading_acc_exp(29)  TYPE c,
        opening_v_assets(29) TYPE c,
        expenses(29)         TYPE c,
        closing_v_assets(29) TYPE c,
        capital_employed(29) TYPE c,
        non_ded_exp(29)      TYPE c,
        penalty(29)          TYPE c,
        cap_allowances(29)   TYPE c,
        withholding_tax(29)  TYPE c,
        non_taxable_inc(29)  TYPE c,
        directors_wh_tax(29) TYPE c,
        other_all_ded(29)    TYPE c,
        other_tax_paid1(29)  TYPE c,
        assessed_loss_bf(29) TYPE c,
        other_tax_paid2(29)  TYPE c,
        other_tax_paid3(29)  TYPE c,
        tax_on_taxable(29)   TYPE c,
        credits(29)          TYPE c,
        provisional_tax(29)  TYPE c,
        history(1),
  END OF itab_amount.
  MOVE-CORRESPONDING assessment_import TO itab_amount.
the fields have he same definition data element which is a currency field of 21.2
now i get the error that i shud enter values in the format __,___,___,___,___,___,___.__ since the output length is 29 for the domain of the data element.
please can i have some ideas on how to go around this error??
regards
prince

Hie gurus,
i have made some progress regarding my issue however i am experiencing another error. the requirement for the data is that i moved data to an internal table with data type with equivalent length however wen i pass that value which is coming from data type C i get the error that values shud be in currecy format...how can i solve this????

Similar Messages

  • Create a Custom BAPI with inputs as Decimal values

    Hello Experts,
    I am new to BAPI creation, my requirment has two decimal inputs(as import parameters) and out output can be a simple add of these two numbers.
    Decimal Input has 9 characters with 7 decimals Ex: 10.0000000. How to create a structure or data type and use the same back in my BAPI.
    What is the ABAP code that, I should write to add these two inputs and export them.
    Please help ASAP, I am in a critcal position.
    Thanks,
    Suma

    Hello Suma,
    This error is caused because you are trying to use a data type rather a data element, it better if you follow the below process
    Start with creating a Structure with ZBAPI name, from SE11
    give a component name with Z and component type with Z and then double click on new component type and this will ask what to generate click on dataelement and enter discription then enter a Z new name in the Domain and double click on it, click on data type and enter DEC, no char 9 and decimal 7 then save activate, clikc on back save activate and again click on back and save activate now your sturcture will be saved. Follow the proces if have new data type or else the same for your next entres.
    For your Req....
    take component ZINPUT1 compenent type ZINPUT with domain as ZZINPUT...
    use the sam for ZINPUT2 and ZOUTPUT and then save activate. Now the structure is created.
    SE37 create new BAPI, In import parameters take parameters as T_INPUT1 and T_INPUT2 with ZBAPI_SUM-ZINPUT1 and ZBAPI_SUM-ZINPUT2.Then in export  if you wnat inputs also in there just give some export names and give the assoated type as what you have used in import, also add OUTPUT and RETURN with ZBAPI_SUM-ZOUTPUT and BAPIRETURN.Now write the source code as follows
    FUNCTION ZBAPI_TESTDEC1.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(T_INPUT1) TYPE  ZBAPI_SUM-ZINPUT OPTIONAL
    *"     VALUE(T_INPUT2) TYPE  ZBAPI_SUM-ZINPUT1 OPTIONAL
    *"  EXPORTING
    *"     VALUE(INPUT1) TYPE  ZBAPI_SUM-ZINPUT
    *"     VALUE(INPUT2) TYPE  ZBAPI_SUM-ZINPUT1
    *"     VALUE(OUTPUT) TYPE  ZBAPI_SUM-ZOUTPUT
    *"     VALUE(RETURN) TYPE  BAPIRETURN
    INPUT1 = T_INPUT1.
    INPUT2 = T_INPUT2.
    OUTPUT = T_INPUT1 + T_INPUT2.
    ENDFUNCTION.
    Now save it and then activate and then clikc on tables tab then functional module on main menu and then relase.
    Go to T-code SWO1 create new Obj with ZBAPI name and then clikc create enter Obj name,Name,Des,Program,and Application has to be * then enter.
    Click on methods,Utilites, API Methods, Add method, Select BAPI Name then contine for 3 times then click BAPI Added in the methods then on edit change relase status- object type To modeled, To impimented and To relased at 3 diff times then follow the same for Object Type component.
    Now click on red and white round button which is similar to BMW symbol. This will generate the BAPI and now you see it in BAPI T-Code.
    Hope this helps you ...
    Reward if helpfull....
    Thanks,
    Srikanth

  • BAPI with LSMW

    hi all,
    Any one has step by step procedure  BAPI with LSMW.
    BAPI with BDC.
    sri

    Hi Sri,
    Please Go through this Link ,
    BAPI And LSMW
    Regards,
    Ramganesan K.

  • I want purchase order bdc or bapi with full solution

    hi,
         if any one have purchase order bdc or bapi with full solution . plz send me .
         thanking u,

    hi
    Just take all required fields to create PO into one internal table . Just use BAPI_PO_CREATE1 function module. In that function module give internal table name. It will create the PO. Extra decorations like error messages and all you need to take care.
    Reward if it helpful.
    Thanks
    Siva Kumar

  • PROGRAM WITH BAPI and BDC's

    Hi All,
    I am using a 2 BAPI's and 3 BDC's in a program. I need all these BAPI and BDC's update the tanscations in a single bundled task? that is if any of BAPI or BDC failed the sucessful BAPI/BDC should be rolled back. How can I make it happen? Any sample code will be helpful
    All Suggestion will be rewarded.

    BAPI-step by step procedure
    http://www.sapgenie.com/abap/bapi/example.htm
    list of all BAPI's
    http://www.planetsap.com/LIST_ALL_BAPIs.htm

  • Standard or Customizing Bapi for T-code F-44

    Hi
    I need to clear vendor open invoices using BAPI's for T-code F-44 .I've got through various FM like <b>bapi_acc_document_post</b> and <b>bapi_ar_acc_getbalanceditems</b> but could'nt find solution because this FM's are for customer clearing the open items from table BSAD(cleared accounts of customer).Have any boby worked on this tcode to clear vendor accounts using bapi's or do we have any standard FM to use the scenario same as FM mentioned above for table BSAK(vendor clear items).
    Its really simple working with bdc's to transfer data from flat file to the above transaction.But as known every vendor has huge sets of items and this could be a huge performance issue....so to avoid this in future we need to work on this using exclusively BAPI's......Any suggestions or sample codes wud surely be appreciated....
    Thanks in Advance......

    hi,
    look here
    Re: BAPI for transaction F-03
    <b>Reward points</b>
    Regards

  • What is BAPI?How to create a BAPI? Difference b/w BAPI and BDC

    Hi all,
    Can some one help me regarding...
    What is an BAPI?where it is used?
    How to create a BAPI?
    What is the difference between BAPI and BDC Program?
    Iam in Initial stage regarding BAPI concept.
    Please respond me soon.
    Thanks,
    Lee

    HI,
    Here it is:
    BAPI Programming Guide
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    BAPI User Guide
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://ifr.sap.com/catalog/query.asp
    STEP BY STEP for BAPI
    http://sap-img.com/abap/bapi-step-by-step-guidance.htm
    <b>DIFFERENCE between BAPI and BDC</b>
    BDC is traditional way of coding the transactions for uploading the legacy data, Sap is changing all transactions to Object oriented programming. Since BAPI is Object based and supports all the new transactions it is preffered over BDC. More over BAPI's process data faster than BDC.
    BAPI is a SAP-supplied function module with a defined interface, which allows you to interact with various business objects. SAP guarantees the integrity of your database for anything updated using a BAPI. BDC is a method of driving screens programatically, for updating SAP data. BAPIs are generally faster than BDCs.
    A BAPI is faster because it is updating the DB "directly". Whereas BDC with call
    transaction goes through the whole screen sequence like any user would do, simply put, fills screens.
    However - there is not always a BAPI for a particular transaction and not all functions that are performed by a transaction can be done by a BAPI. BDCs produce error sessions which can be processed by the user, while BAPIs don't.
    First choose the BAPI ,if there is no BAPI go for BDC.
    why BAPI first not BDC.
    SAP comes up with Change in Version, so each and every time they will change the screens/number etc.
    so you have to change your BDC programs accordingly.
    and also Most of the Latest versions transactions are Enjoy Transaction. they will not support BDC's in Background.
    But Using BAPI's No such disadvantages.
    A BAPI is faster because it is updating the DB "directly" through ABAP code.
    A BDC with call transaction goes through the whole screen sequence like any user would do, simply put, it is filling screens.
    Actually it depends on your requirement but BAPI is more effective as it is standard function module to update SAP databases rather than BDC.
    using bdc over bapi has advantages and also disadvantages
    advantages:
    1. using bdc we can upload data into database tables using 2 ways
    1. foreground -
    means that user interaction is there for each and every record.
    2. back ground -
    no user interaction and tasks are done automatically.
    using these two options is one of the greatest advantage over bapi.
    2. in bdc call transaction method we can control the display of screen resolution which is not possible with bapi's
    3. bdc is generally used for transferring of large amount of data than bapi's
    4.session method of bdc allows us to place data directly in application server and then finally transfered into sap database tables
    disadvantages:
    1.bdc is only used for sap to sap system data transferring
    2. bapis's generally works more faster than bdc's
    3. using bapis we can connect to remote systems and also to non sap systems.
    if useful reward some points.
    A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate
    with each other at the Business Object / Process level.
    Check this link to know more about BAPI.
    http://www.sapgenie.com/abap/bapi/example.htm
    http://sappoint.com/abap/
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
    typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form
    of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The
    transaction is then started using this internal table as the input and executed in the background.
    In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
    It can also be used for real-time interfaces and custom error handling & logging features. .
    To know more about BDC,
    check the link.
    http://sappoint.com/abap/
    Main differences are...
    In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem
    where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.
    not only that...
    when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.
    <b><REMOVED BY MODERATOR></b>
    Manish
    Message was edited by:
            Alvaro Tejada Galindo

  • GTS BAPI or BDC FOR Tcode /SAPSLL/PRODUCT_02

    Hello All,
       I need a help to upload data's in T-code /SAPSLL/PRODUCT_02 (SAP GTS ) Custom Product maintenance, i can't do with BDC because this t-code is having GUI, So kindly guide me how we can upload the data's in this t-code, and there is no BAPI or IDOC for this t-code.
    Thanks in advance.

    hi
    try using this FM /sapsll/product_change
    cheers
    s.janagar

  • Proble with BDC

    Hi experts how to create  customer records in xd01?
    i.e sales office ,group,division,ales person?
    after how to prepare the flat file then upload thn build ITAB?
    could u forwad any demo for customer methods in bdc ,lsmw,bapi
    sample demo for customer in bdc ,lsmw ,bapi

    Hi,
    Go through this code
    REPORT Z_TABCTL_XD01 NO STANDARD PAGE HEADING LINE-SIZE 132
                                                         LINE-COUNT 60
                                                         MESSAGE-ID Z00.
                        Table/Structure declarations.                    *
    TABLES : KNA1.  "Customer master
                  Constants declarations.                                *
    CONSTANTS : C_MODE   VALUE 'A',
                C_UPDATE VALUE 'S',
                C_X      VALUE 'X',
                C_SESS   TYPE  APQI-GROUPID VALUE 'ZCUSTOMER', "Session Name
                C_XD01   LIKE  TSTC-TCODE   VALUE 'XD01'.
                  Variable declarations.                                 *
    DATA : V_FNAME(15)  VALUE  SPACE,      " Name of file to be created
           V_FAILREC    TYPE I,            " No of failed records
           V_MSG(255),                     " Message Text
           V_ERRREC     TYPE I,            " No of failed records
           V_LINES      TYPE I,            " No of records
           V_BANKS(15),                    " Table column BANKS
           V_BANKL(15),                    " Table column BANKL
           V_BANKN(15),                    " Table column BANKN
           V_TIDX(2)    TYPE N.            " Table row index
    *--             FLAG DECLARATIONS
    DATA : FG_DATA_EXIST   VALUE 'X',             " Check for data
           FG_SESSION_OPEN VALUE ' '.             " Check for Session Open
    *--              MACRO DEFINITIONS
    *-- Macro for BANKS
    DEFINE BANKS.
      CLEAR V_BANKS.
      CONCATENATE 'KNBK-BANKS(' &1 ')' INTO V_BANKS.
      CONDENSE V_BANKS.
    END-OF-DEFINITION.
    *-- Macro for BANKL
    DEFINE BANKL.
      CLEAR V_BANKL.
      CONCATENATE 'KNBK-BANKL(' &1 ')' INTO V_BANKL.
      CONDENSE V_BANKL.
    END-OF-DEFINITION.
    *-- Macro for BANKN
    DEFINE BANKN.
      CLEAR V_BANKN.
      CONCATENATE 'KNBK-BANKN(' &1 ')' INTO V_BANKN.
      CONDENSE V_BANKN.
    END-OF-DEFINITION.
                   Structures / Internal table declarations              *
    *-- Structure to hold BDC data
    TYPES : BEGIN OF T_BDCTABLE.
            INCLUDE STRUCTURE BDCDATA.
    TYPES  END OF T_BDCTABLE.
    *-- Structure to trap BDC messages
    TYPES : BEGIN OF T_MSG.
            INCLUDE STRUCTURE BDCMSGCOLL.
    TYPES : END OF T_MSG.
    *-- Structure to trap ERROR messages
    TYPES : BEGIN OF T_ERR_MSG,
              MESSAGE(255),
            END OF T_ERR_MSG.
    *--Internal table to store flat file data
    DATA : BEGIN OF IT_KNA1 OCCURS 0,
             KUNNR LIKE KNA1-KUNNR,
             KTOKD LIKE T077D-KTOKD,
             NAME1 LIKE KNA1-NAME1,
             SORTL LIKE KNA1-SORTL,
             ORT01 LIKE KNA1-ORT01,
             PSTLZ LIKE KNA1-PSTLZ,
             LAND1 LIKE KNA1-LAND1,
             SPRAS LIKE KNA1-SPRAS,
             LZONE LIKE KNA1-LZONE,
           END OF IT_KNA1.
    *--Internal table to store bank details
    DATA : BEGIN OF IT_BANK OCCURS 0,
             BANKS LIKE KNBK-BANKS,
             BANKL LIKE KNBK-BANKL,
             BANKN LIKE KNBK-BANKN,
           END OF IT_BANK.
    *-- Internal table to hold BDC data
    DATA: IT_BDCDATA TYPE STANDARD TABLE OF T_BDCTABLE WITH HEADER LINE,
    *-- Internal Table to store ALL messages
          IT_MSG     TYPE STANDARD TABLE OF T_MSG WITH HEADER LINE,
    *-- Internal Table to store error messages
          IT_ERR_MSG TYPE STANDARD TABLE OF T_ERR_MSG WITH HEADER LINE.
    Selection Screen.                                                    *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : P_FLNAME(15) OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R_LIST  RADIOBUTTON GROUP GRP1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003.
    PARAMETERS : R_SESS  RADIOBUTTON GROUP GRP1.
    SELECTION-SCREEN COMMENT 30(20) TEXT-004.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    Event:Initialization                                                 *
    INITIALIZATION.
    AT Selection Screen.                                                 *
    AT SELECTION-SCREEN.
    Event: Start-of-Selection                                            *
    START-OF-SELECTION.
      V_FNAME = P_FLNAME.
      PERFORM GET_DATA.
      PERFORM GET_BANKDATA.
      PERFORM GENERATE_DATASET.
    Event: End-of-Selection                                            *
    END-OF-SELECTION.
      IF FG_DATA_EXIST = ' '.
        MESSAGE I010 WITH TEXT-009.
        EXIT.
      ENDIF.
      PERFORM GENERATE_BDCDATA.
      PERFORM DISPLAY_ERR_RECS.
    Event: top-of-page
    TOP-OF-PAGE.
                          FORM DEFINITIONS                               *
    *&      Form  get_data
          Subroutine to get the data from mard
    -->  p1        text
    <--  p2        text
    FORM GET_DATA.
      CALL FUNCTION 'UPLOAD'
       EXPORTING
       CODEPAGE                      = ' '
         FILENAME                       = 'C:\XD01.TXT'
         FILETYPE                       = 'DAT'
       ITEM                          = ' '
       FILEMASK_MASK                 = ' '
       FILEMASK_TEXT                 = ' '
       FILETYPE_NO_CHANGE            = ' '
       FILEMASK_ALL                  = ' '
       FILETYPE_NO_SHOW              = ' '
       LINE_EXIT                     = ' '
       USER_FORM                     = ' '
       USER_PROG                     = ' '
       SILENT                        = 'S'
    IMPORTING
       FILESIZE                      =
       CANCEL                        =
       ACT_FILENAME                  =
       ACT_FILETYPE                  =
        TABLES
          DATA_TAB                      = IT_KNA1
    EXCEPTIONS
       CONVERSION_ERROR              = 1
       INVALID_TABLE_WIDTH           = 2
       INVALID_TYPE                  = 3
       NO_BATCH                      = 4
       UNKNOWN_ERROR                 = 5
       GUI_REFUSE_FILETRANSFER       = 6
       OTHERS                        = 7
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF IT_KNA1[] IS INITIAL.
        FG_DATA_EXIST = ' '.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  GENERATE_DATASET
          text
    -->  p1        text
    <--  p2        text
    FORM GENERATE_DATASET.
      MESSAGE I010 WITH 'OPENING FILE IN APPLICATION SERVER'.
    **--Creating a data set in application server
      OPEN DATASET V_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    **---Transfering data from internal table to dataset
      MESSAGE I010 WITH 'TRANSFERING DATA FROM INETERAL TABLE TO THE FILE'.
      LOOP AT IT_KNA1.
        TRANSFER IT_KNA1 TO V_FNAME.
      ENDLOOP.
    **--Closing the dataset
      MESSAGE I010 WITH 'CLOSING THE FILE'.
      CLOSE DATASET V_FNAME.
    ENDFORM.                    " GENERATE_DATASET
    *&      Form  BDC_DYNPRO
          text
         -->P_0467   text
         -->P_0468   text
    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.
    *&      Form  BDC_FIELD
          text
         -->P_0472   text
         -->P_0473   text
    FORM BDC_FIELD USING FNAM FVAL.
      IF NOT FVAL IS INITIAL.
        CLEAR IT_BDCDATA.
        IT_BDCDATA-FNAM = FNAM.
        IT_BDCDATA-FVAL = FVAL.
        APPEND IT_BDCDATA.
      ENDIF.
    ENDFORM.
    *&      Form  GENERATE_BDCDATA
          text
    -->  p1        text
    <--  p2        text
    FORM GENERATE_BDCDATA.
      REFRESH IT_KNA1.
    Opening dataset for reading
      OPEN DATASET V_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    Reading the file from application server
      DO.
        CLEAR:  IT_KNA1,IT_BDCDATA.
        REFRESH IT_BDCDATA.
        READ DATASET V_FNAME INTO IT_KNA1.
        IF SY-SUBRC <> 0.
          EXIT.
        ELSE.
      Populate BDC Data for Initial Screen
          PERFORM : BDC_DYNPRO USING 'SAPMF02D'    '0100',
                    BDC_FIELD  USING 'BDC_CURSOR'  'RF02D-KUNNR',
                    BDC_FIELD  USING 'BDC_OKCODE'  '/00',
                    BDC_FIELD  USING 'RF02D-KUNNR' IT_KNA1-KUNNR,
                    BDC_FIELD  USING 'RF02D-KTOKD' IT_KNA1-KTOKD.
      Populate BDC Data for Second Screen
          PERFORM : BDC_DYNPRO USING 'SAPMF02D'    '0110',
                    BDC_FIELD  USING 'BDC_CURSOR'  'KNA1-NAME1',
                    BDC_FIELD  USING 'BDC_OKCODE'  '/00',
                    BDC_FIELD  USING 'KNA1-NAME1'  IT_KNA1-NAME1,
                    BDC_FIELD  USING 'KNA1-SORTL'  IT_KNA1-SORTL,
                    BDC_FIELD  USING 'KNA1-ORT01'  IT_KNA1-ORT01,
                    BDC_FIELD  USING 'KNA1-PSTLZ'  IT_KNA1-PSTLZ,
                    BDC_FIELD  USING 'KNA1-LAND1'  IT_KNA1-LAND1,
                    BDC_FIELD  USING 'KNA1-SPRAS'  IT_KNA1-SPRAS.
      Populate BDC Data for Third Screen
          PERFORM : BDC_DYNPRO USING 'SAPMF02D'    '0120',
                    BDC_FIELD  USING 'BDC_CURSOR'  'KNA1-LZONE',
                    BDC_FIELD  USING 'BDC_OKCODE'  '/00',
                    BDC_FIELD  USING 'KNA1-LZONE'  IT_KNA1-LZONE.
      Populate BDC Data for Fourth Screen
          PERFORM : BDC_DYNPRO USING 'SAPMF02D'    '0125',
                    BDC_FIELD  USING 'BDC_CURSOR'  'KNA1-NIELS',
                    BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      Populate BDC Data for Table control for bank details.
          V_TIDX = '01'.
          LOOP AT IT_BANK.
            BANKS V_TIDX.
            BANKL V_TIDX.
            BANKN V_TIDX.
            PERFORM : BDC_DYNPRO USING 'SAPMF02D'   '0130',
                      BDC_FIELD  USING 'BDC_CURSOR' V_BANKN,
                      BDC_FIELD  USING 'BDC_OKCODE' '=ENTR',
                      BDC_FIELD  USING  V_BANKS     IT_BANK-BANKS,
                      BDC_FIELD  USING  V_BANKL     IT_BANK-BANKL,
                      BDC_FIELD  USING  V_BANKN     IT_BANK-BANKN.
            V_TIDX = V_TIDX + 1.
          ENDLOOP.
          PERFORM : BDC_DYNPRO USING 'SAPMF02D'   '0130',
                    BDC_FIELD  USING 'BDC_CURSOR' V_BANKS,
                    BDC_FIELD  USING 'BDC_OKCODE' '=UPDA'.
          CALL TRANSACTION C_XD01 USING  IT_BDCDATA
                                  MODE   C_MODE
                                  UPDATE C_UPDATE
                                  MESSAGES INTO IT_MSG.
          IF SY-SUBRC <> 0.
    *--In case of error list display
            IF R_LIST = C_X.
              V_ERRREC = V_ERRREC + 1.
              PERFORM FORMAT_MESSAGE.
              IT_ERR_MSG-MESSAGE = V_MSG.
              APPEND IT_ERR_MSG.
              CLEAR : V_MSG,IT_ERR_MSG.
            ENDIF.
    *--In case of session log
            IF R_SESS = C_X.
    *-- In case of  transaction fails.
              IF FG_SESSION_OPEN = ' '.
                FG_SESSION_OPEN = C_X.
                PERFORM BDC_OPEN_GROUP.
              ENDIF.  "      IF FG_SESSION_OPEN = ' '.
    *-- Insert BDC Data..
              PERFORM BDC_INSERT_DATA.
            ENDIF.    "                        IF R_SESS = C_X.
          ENDIF.      "                        IF SY-SUBRC <> 0.
        ENDIF.        "                        IF SY-SUBRC <> 0.
      ENDDO.
    Closing the dataset
      CLOSE DATASET V_FNAME.
    *-- Close the session if opened
      IF FG_SESSION_OPEN = C_X.
        PERFORM BDC_CLOSE_GROUP.
        CALL TRANSACTION 'SM35'.
      ENDIF.
    ENDFORM.                    " GENERATE_BDCDATA
    *&      Form  BDC_OPEN_GROUP
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_OPEN_GROUP.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
         CLIENT                     = SY-MANDT
      DEST                      = FILLER8
         GROUP                      = C_SESS
      HOLDDATE                  = FILLER8
         KEEP                       = C_X
         USER                       = SY-UNAME
      RECORD                    = FILLER1
    IMPORTING
      QID                       =
       EXCEPTIONS
         CLIENT_INVALID            = 1
         DESTINATION_INVALID       = 2
         GROUP_INVALID             = 3
         GROUP_IS_LOCKED           = 4
         HOLDDATE_INVALID          = 5
         INTERNAL_ERROR            = 6
         QUEUE_ERROR               = 7
         RUNNING                   = 8
         SYSTEM_LOCK_ERROR         = 9
         USER_INVALID              = 10
         OTHERS                    = 11
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " BDC_OPEN_GROUP
    *&      Form  BDC_INSERT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_INSERT_DATA.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE                  = C_XD01
      POST_LOCAL             = NOVBLOCAL
      PRINTING               = NOPRINT
        TABLES
          DYNPROTAB              = IT_BDCDATA
       EXCEPTIONS
         INTERNAL_ERROR         = 1
         NOT_OPEN               = 2
         QUEUE_ERROR            = 3
         TCODE_INVALID          = 4
         PRINTING_INVALID       = 5
         POSTING_INVALID        = 6
         OTHERS                 = 7
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " BDC_INSERT_DATA
    *&      Form  BDC_CLOSE_GROUP
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_CLOSE_GROUP.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                NOT_OPEN    = 1
                QUEUE_ERROR = 2
                OTHERS      = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " BDC_CLOSE_GROUP
    *&      Form  FORMAT_MESSAGE
          text
    -->  p1        text
    <--  p2        text
    FORM FORMAT_MESSAGE.
      CLEAR V_LINES.
      DESCRIBE TABLE IT_MSG LINES V_LINES.
      READ TABLE IT_MSG INDEX V_LINES.
      CLEAR V_MSG.
      CALL FUNCTION 'FORMAT_MESSAGE'
           EXPORTING
                ID        = IT_MSG-MSGID
                LANG      = IT_MSG-MSGSPRA
                NO        = IT_MSG-MSGNR
                V1        = IT_MSG-MSGV1
                V2        = IT_MSG-MSGV2
                V3        = IT_MSG-MSGV3
                V4        = IT_MSG-MSGV4
           IMPORTING
                MSG       = V_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.
      ENDIF.
    ENDFORM.                    " FORMAT_MESSAGE
    *&      Form  DISPLAY_ERR_RECS
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_ERR_RECS.
      LOOP AT IT_ERR_MSG.
        WRITE: / IT_ERR_MSG-MESSAGE.
      ENDLOOP.
    ENDFORM.                    " DISPLAY_ERR_RECS
    *&      Form  GET_BANKDATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_BANKDATA.
      IT_BANK-BANKS = 'AD'.
      IT_BANK-BANKL = '1000'.
      IT_BANK-BANKN = 'S.B A/C'.
      APPEND IT_BANK.
      IT_BANK-BANKS = 'AD'.
      IT_BANK-BANKL = 'CITY'.
      IT_BANK-BANKN = 'CURR. A/C'.
      APPEND IT_BANK.
      IT_BANK-BANKS = 'AD'.
      IT_BANK-BANKL = 'H001'.
      IT_BANK-BANKN = 'S.B A/C'.
      APPEND IT_BANK.
    reward points if useful
    regards
    suman

  • BAPI vs BDC for VI02/ VT02N and VL32N

    Hi All,
    I have the following questions to the experts.
    In our 4.6 version we had a custom program with in which using BDC we were doing.
    1) Delete Shipment Cost Documents ( VI02).
    2) Unpack and delete shipment ( Call Transaction to VT02N).
    3) Unpack and delete delivery (VL32N).
    Now in ECC version I want to confirm if these BDCs will work without any issues in future.
    Do we have appropriate BAPI or Function Module for replacing all these BDCs.
    I went through the forum and found many BAPIs like BAPI_SHIPMENT_CHANGE,BAPI_INB_DELIVERY_CHANGE and FMs WS_DELIVERY_CHANGE etc but want to make sure if Unpacking and Deletion both can be handled with the same BAPIs as mentioned?
    For Deleting SCD, have anyone faced any issues with using BDC in ECC or do we need to use some FM like SD_SCD_DELETE etc?
    Please advice.
    Best Regards,
    Ameesha

    Hi Amisha,
    I understand that you aalready have BDC Implementation in place for all these transactions.
    So is it Business requirement to change these to BAPIs. Yes, it is true that the implementaion should   have been done using BAPIs but as you have BDC in place Please perform testing to make sure the BDC code is still working fine.
    If code is fine then you are good otherwise you can either change BDC code to solve the Issues of go for fresh coding using BAPIs to upload/change the data.
    Regards'
    Shital

  • BAPI vs BDCs

    What is the difference between BAPIs and BDCs...why BAPIs are preferred...? i know you might have gone through this question a zillion times....but the thing that bugs me the most is the fact that...if BAPIs are a better choise to transfer data as compared to BDCs...then where on earth are the field validations done  in BAPIs.? ...how is data integrity maintained if data is transferred through BAPIs? ( since data is not passed through screens...no validations are done)

    Hi,
    Difference between BDC and BAPI
    BDC is traditional way of coding the transactions for uploading the legacy data, Sap is changing all transactions to Object oriented programming. Since BAPI is Object based and supports all the new transactions it is preffered over BDC. More over BAPI's process data faster than BDC.
    BAPI is a SAP-supplied function module with a defined interface, which allows you to interact with various business objects. SAP guarantees the integrity of your database for anything updated using a BAPI. BDC is a method of driving screens programatically, for updating SAP data. BAPIs are generally faster than BDCs.
    A BAPI is faster because it is updating the DB "directly". Whereas BDC with call
    transaction goes through the whole screen sequence like any user would do, simply put, fills screens.
    However - there is not always a BAPI for a particular transaction and not all functions that are performed by a transaction can be done by a BAPI. BDCs produce error sessions which can be processed by the user, while BAPIs don't.
    First choose the BAPI ,if there is no BAPI go for BDC.
    why BAPI first not BDC.
    SAP comes up with Change in Version, so each and every time they will change the screens/number etc.
    so you have to change your BDC programs accordingly.
    and also Most of the Latest versions transactions are Enjoy Transaction. they will not support BDC's in Background.
    But Using BAPI's No such disadvantages.
    A BAPI is faster because it is updating the DB "directly" through ABAP code.
    A BDC with call transaction goes through the whole screen sequence like any user would do, simply put, it is filling screens.
    Actually it depends on your requirement but BAPI is more effective as it is standard function module to update SAP databases rather than BDC.
    using bdc over bapi has advantages and also disadvantages
    advantages:
    1. using bdc we can upload data into database tables using 2 ways
    1. foreground
    means that user interaction is there for each and every record.
    2. back ground -
    no user interaction and tasks are done automatically.
    using these two options is one of the greatest advantage over bapi.
    2. in bdc call transaction method we can control the display of screen resolution which is not possible with bapi's
    3. bdc is generally used for transferring of large amount of data than bapi's
    4.session method of bdc allows us to place data directly in application server and then finally transfered into sap database tables
    disadvantages:
    1.bdc is only used for sap to sap system data transferring
    2. bapis's generally works more faster than bdc's
    3. using bapis we can connect to remote systems and also to non sap systems.
    if useful reward some points.
    A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate
    with each other at the Business Object / Process level.
    Check this link to know more about BAPI.
    http://www.sapgenie.com/abap/bapi/example.htm
    http://sappoint.com/abap/
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
    typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form
    of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The
    transaction is then started using this internal table as the input and executed in the background.
    In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
    It can also be used for real-time interfaces and custom error handling & logging features. .
    To know more about BDC,
    check the link.
    http://sappoint.com/abap/
    Main differences are...
    In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem
    where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.
    not only that...
    when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • How better bapi over bdc?

    hi experts?
    please give me the your valuble information.
    how better bapi over bdc?
    reward points apply for the best answer.
    thanks.
    naresh

    Hi,
    A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate
    with each other at the Business Object / Process level.
    Check this link to know more about BAPI.
    http://www.sapgenie.com/abap/bapi/example.htm
    http://sappoint.com/abap/
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
    typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form
    of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The
    transaction is then started using this internal table as the input and executed in the background.
    In ?Call Transaction?, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
    It can also be used for real-time interfaces and custom error handling & logging features. .
    To know more about BDC,
    check the link.
    http://sappoint.com/abap/
    Main differences are...
    In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem
    where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.
    not only that...
    when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.
    Regards,
    Shiva Kumar

  • Problem with BDC on VA02

    Hi All,
    I am facing a problem with bdc on va02. After hitting enter on the first screen it pops an info message "consider subsequent douments". It doesn't get recorded in recorded. Hence I am not able to run the transaction with no screen mode. Please help me to suppress the info message
    Navin

    Hi Navin,
    These kind of messages and pop ups are precisely the reason why use of BDC for updating transactions is NOT advisable.
    If you were to bypass such messages, you would have to put a check to see why the message appears (in this case probably because the sales document flow for the sales order in table VBFA has some documents) and then write a logic to either handle the message or not.
    Instead i would recommend you use the BAPI functions provided by SAP to change the sales order.
    Have a look the BAPI for sales order change attached to the business object BUS2012. For this goto transaction SWO1 and enter the BUS2012 business object. Then goto methods and look for the "change" method. Double click on the method and look at the BAPI used to implement the method. Go ahead and use this method in your program as against a BDC.
    I am sure it will be a much better option.
    Otherwise if you still want to proceed with a BDC, please debug at the point where the message/pop up appears to ascertain reason for the same and then incorporate the same check in your program to handle the pop up.
    Regards,
    Aditya

  • Vendor Invoices/Customer -BAPI

    Hi all
    Equivalnt bapis to postVendor Invoices/Customer Invoices through f-02 transaction.
    we need to post with and without special GL Indicator. Can anyone let me knw which is the suitable bapi with SAMPLE DATA and MANDATORY FIELDS.
    Thanks
    sha

    Hi,
    Pls try these BAPI's...
    <b>BAPI_ACC_GL_POSTING_POST
    BAPI_ACC_DOCUMENT_POST
    BAPI_ACC_GL_POSTING_CHECK
    FI_GET_POSTING_KEY</b>
    BAPI_ACC_GL_POSTING_POST
    More Information about this:
    Text
    Accounting: General G/L Account Posting Functionality
    You can use this method to update business transactions in Accounting which mainly affect the general ledger and are definitely not updated in subledgers which are relevant to the balance sheet.
    An example of this is a provision posting for an expected guarantee service.
    This can be produce debit or credit entries to balances which are not managed in one of the subledgers relevant to the balance sheet. This is especially applicable if the balances cannot be represented as assets, customers/vendors, materials, loans, etc.
    An example of this is a provision posting for an expected guarantee. However, this can also involve depreciation or write-ups in which values have a higher level of summarization than in the corresponding subledger relevant to the balance sheet in which they are managed.
    An example of this is foreign currency revaluation for receivables/ payables caused by considerable exchange rate fluctuations which is not updated in accounts payable or accounts receivable.
    A similar transaction may come about when revaluating balances for raw materials if the revaluation takes place at a corresponding level of summarization.
    The third cateogry is the reclassification of items to balance sheet accounts or income statement accounts, which is only undertaken in the general ledger in order to balance accounts (values are then finally reassigned to financial statement items).
    Example: Reclassifying balances of receivables with different return times for the balance sheet.
    Restrictions:
    This object cannot be used to update business transactions which are normally posted to one of the subledgers which affects the balance sheet (such as a billing document; for this see the business object AcctngBilling).
    This is especially applicable if the reason the relevant subledger cannot be updated is because it is an external system or is not in use.
    Notes
    If the currency fields have been entered in the CurrencyAmount parameter, the system runs a complete check for the document. Otherwise only the account assignment objects are validated.
    Messages are displayed in the Return parameter. You will find the return values and their meanings in the documentation for this parameter.
    Further Information
    For further information, see the documentation on "Interfaces to Accounting" in the R/3 Library (under "Cross-Application Functions -> Interfaces to External Systems").
    Parameters
    DOCUMENTHEADER
    OBJ_TYPE
    OBJ_KEY
    OBJ_SYS
    ACCOUNTGL
    CURRENCYAMOUNT
    RETURN
    EXTENSION1
    Exceptions
    Function Group
    ACC4
    <b>http://www.planetsap.com/LIST_ALL_BAPIs.htm
    Re: BAPI FOR POSTING FBS1 TRANSACTION</b>
    <b>***Reward Points if Useful</b>
    Regards
    Gokul

  • How to transport a custom bapi (written by me) to another server

    Hello friends,
    We have a software that is integrated with SAP. To make our software work with SAP, we have some custom bapis created on SAP side. We would like to transfer them to another server that is on a different network. After reading many documents and forums here is the what I have done and the problem that I am facing. Your help will be highly appreciated.
    1.Started Transaction 'SE80'.
    2.Created a test package called 'ZTRANSPORTTEST'.
    3.Created a function group called 'ZTRANSPORTTESTFN' under that package.
    4.Created a function module under the group called 'ZTRANSFUNCTION'
      NOTE: Just saved and activated without adding any code since I won't be using this function
                 for anything other than to test the Transport Feature.
    5. Clicked on the button that said 'Transport Organizer' and saw the list of requests including the
        EC1K900083one that I just created.
    6. I tried to release it by 'RIGHT CLICKING'
       It waited for few seconds with the message....."code inspector checks running.".
       Then it failed with an error message as follows
       Error in pre-export methods for request EC1K900083
      NOTE: I have made sure that everything is activated properly, since I read on a forum that this
                 error may occur if something is not activated properly. So I have done this step over
                 and over again making sure that everything is activated properly.
    7. I then started Transaction 'SE09' and saw the request 'EC1K900083' under the released tree with a 'CHECK' Mark.
    However, when I sent to /usr/SAP/trans/data and /usr/SAP/trans/Cofiles, I didn't find the transport data there.
    Has anyone done this before and if so what am I doing wrong? Your suggestions or feedback will be highly appreciated.
    Thanks
    Ram

    Hello Friends,
    Thanks for all the responses. I got the following response from SAP TECH SUPPORT which is not very encouraging and so I am just closing this.
    Thanks
    Ram
    ===========================================================================
    30.04.2009 - 11:40:29 EST - Reply by SAP
    Dear Mr Ram,
    Thanks for explaining it once again.
    The package is just container for development objects that belong together, in that they share the same system, transport layer, and
    customer delivery status. Please check the below link http://help.sap.com/saphelp_nw70/helpdata/en/ea/c05da3f01011d3964000a0c94260a5/frameset.htm
    As I understand correctly you want to 'export' your development outside of your SAP system domain. For that either you can do it using 'Externalsystems'. 'External systems' are a special form of virtual systems. A real SAP System is used in their place to perform actions on the transport directory. They are different from virtual systems in that they have their own transport directory that you can freely choose, you can use external systems to:
    -Write transport requests to exchangeable data media
    -Read transport requests from exchangeable data media
    -Send transports to other transport domains using an intermediate directory
    -Send transports to other transport domains using an intermediate directory
    If you want to transport between systems in different domains, we recommend that you link domains with 'domain links'. There must be a
    permanent network connection between the systems in the two domains, similar to the connection between systems within the same domain.
    I would recommend to take a look in the documentation available in SAP Online help for further information on how to setup this
    complex transport landscape. I hope this information helps you to setup the transport system.
    Or you simply create a transport request of type 'transport of copy' and input target system and client (which you should know) system as
    target system include the objects (bapi) in the request. This ensure that requests will only be imported into that system. Other systems willnot be touched.
    'Transport of copies' type transports do not get automatically added to the next buffer after they have been imported into a system. When creating a 'Transport of copies' transport the target system must be specified as this type of transport does not respect the defined transport routes outlined in TMS.
    You can use this request type to transport objects to a specified SAP System using Transports of copies. The objects are transported with the version they have in the current SAP System. The original location of the objects remains unchanged. There is no delivery to another SAP System.
    But we at AGS we cannot suggest, as the nature of your request indicates this is a consulting issue rather than a software error.
    Customer Support's charter, under the SAP maintenance agreement, is to handle software or system defects in the standard delivered R/3 product. Please refer the note 1054121.
    So you have to seek assistance from SAP's Remote Consulting Service which is billable.
    I am sorry that I could not give you more positive reply in this case.
    With warm regards,
    Sajiv
    Active Global Support - Technology
    =========================================================================

Maybe you are looking for

  • Error while creating a project from DTR.

    When i am creating a dc locally from DTR, It is giving an error message as follows;- generic VFS error com.sap.tc.devconf.SyncException: Unable to sync file or folder.: Sync request not at com.sap.tc.devconf.impl.DTRClientErrorMapper.toSyncException(

  • Mac - Windows Project Sharing: Media Linking issues

    I just got a Windows 7 machine to experiment with using both my old Mac Pro and Windows 7 CS 5.5 to work on the same project. I am using the Mac Pro as a server, a bunch of fast drives are hooked up to it. Right now I'm using Mac 10.7.3 and sharing t

  • Problems installing SVN or MySQL with Fink or apt-get

    I'm having problems with running SVN on my intel desktop. I primarily use Fink to install packages, and SVN installed just fine, but when I run it, I get svn: SSL is not supported I'm pretty sure SSL is not needed, but if I try to install the ssl pac

  • ML and Airplay mirroring

    I have just updated my Macbook air to ML. My ipod touch and iphone 4s can both airplay to me 2nd gen appletv. My Macbook ait 13-inch, Mid 2011 model cant detect any appletv devices. Any ideas?

  • Viewing SMS' transferred onto PC

    Hi, I've transferred my saved messages onto my PC using the PC Suite Content Copier (backup) button but i am unable to view these messages on my PC! I have the Nokia 6120 classic phone and i have looked in all of the other discussions that i could fi