BDC Help

hi all,
I am making a BDC program, for tcode MM01
I have done the recording, and generated the program.
I have a txt file on my desktop, and i am filling the internal table declared in the program from that txt file.
Its working fine uptill now. Can any one help me how to proceed from here.
I want to execute the program through call transasction method.
<b>Points will be rewarded.</b>

hi,
i am giving u code of report with Call Transaction method.
Hope it will b useful.
REPORT zbdc_call
       NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA: BEGIN OF record OCCURS 0,
data element: MATNR
        matnr_001(018),
data element: BRGEW
        brgew_008(017),
      END OF record.
End generated data section ***
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETER:file LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK blk1.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
  CALL FUNCTION 'F4_FILENAME'
    IMPORTING
      file_name = file.
START-OF-SELECTION.
  PERFORM data_upload.
  PERFORM bdcdata.
CALL TRANSACTION 'MM02' USING BDCDATA MODE 'A' UPDATE 'A'.
*&      Form  data_upload
      text
FORM data_upload.
  DATA:loc_file TYPE string.
  loc_file = file.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = loc_file
      filetype                = 'ASC'
      has_field_separator     = 'X'
    TABLES
      data_tab                = record
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      OTHERS                  = 17.
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    "data_upload
*&      Form  bdc_dynpro
      text
     -->PROGRAM    text
     -->DYNPRO     text
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.                    "bdc_dynpro
*&      Form  bdc_field
      text
     -->FNAM       text
     -->FVAL       text
FORM bdc_field USING fnam fval.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
ENDFORM.                    "bdc_field
*&      Form  bdcdata
      text
FORM bdcdata.
  LOOP AT record.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=AUSW'.
    PERFORM bdc_field       USING 'RMMG1-MATNR'
                                  record-matnr_001.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0070'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4004'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=BU'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARA-BRGEW'.
    PERFORM bdc_field       USING 'MARA-BRGEW'
                                  record-brgew_008.
  ENDLOOP.
ENDFORM.                    "bdcdata

Similar Messages

  • BDC help req??

    Hi
    Can any one tell me to use 2 BDC simultaneously at a time in 1 single report.
    I had an req like to make a BDC for  MIGO & same time after its done the BDC for Tcode J1IEX has to be called,so can any one tell me some info for it.
    As its a reprot programing,I need to disply the  final data like GRN No. after MIGO had been done & Exc Invoice No after J1IEX had been done on a single page in an ALV form .
    Please help me in this,I had made a reprot for it,but I am  not able to make 2 BDC working at the same time.
    So plz tell me how to do ??
    Regds

    Hi,
      I had done in my previous project, that was production order creation, conformation and one more. You can check is there any BAPI's exist for you to update the data.
    Rgds,
    Bujji

  • Updating BDC: Help required...

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

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

  • BDC - help with passing values

    Hi,
    The BDC code works fine when the value(3) or any value is hard coded. But it is not working if I use 'RMQAM-AKTIV(p_insty)' where p_insty is the parameter value entered at selection screen. Please let me know how to pass this value.
    perform screen using: 'SAPLQPLS' '0100'.
    perform field using: 'RMQAM-AKTIV(3)' w1_aktiv,
    'BDC_OKCODE' '=WEIT',
    'RMQAM-AKTIV(3)' 'X'.
    Regards,
    bindazme

    Use this code instead.
    data lv_field(30).
    concatenate 'RMQAM-AKTIV(' p_insty ')' into lv_field.
    perform screen using: 'SAPLQPLS' '0100'.
    perform field using: lv_field w1_aktiv,
    'BDC_OKCODE' '=WEIT',
    lv_field 'X'.
    Please mark points if the solution was useful.
    Regards,
    Manoj
    Message was edited by:
            Manoj V Kumar

  • BDC help req for MM02??

    hi
    I made a BDC pgm for MM02,to update the Purchasing Group filed for a matnr,based on Plant.
    But i am facing an prob that,when in a Matnr views,my curcur is coming to  Purchsaing View ,it update the EKGRP filed,but  when it directly comes to MRP 1,its given an error,that MARC-EKGRP not exits.
    Moreover I had done only recording for Purchaing View,not for MRP 1 view,but not able to understand why its going there in MRP 1 view,some time for some materials.
    Can any one tell me,how to rectify this prob?
    Regds.

    Hi,
    This problem occurs because,
    Different materials have different types,
    so this view will not be same for all,
    so if you have done recording for 4th tab ,than for next material at 4th tab some other thing will be there,
    to rectify this problem,
    do the recording for basic data 1 (it will be present for very material ) and then goto the required tab,
    i hope  it fits to your requirement,
    Regards,
    Talwinder

  • Difference between sapscripts and BDCs

    what is the difference between sapscripts and BDCs

    BDC for data communication between sap to non sap(vice-versa)
    where scripts is a business layout(we create)
    <b>bdc help</b>
    They are the only 3 methods mostly we use in BDC.
    Call _Dialog is outdated. it is there in the intial stages of SAP.
    BDC:
    Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.
    Features :
    BDC is an automatic procedure.
    This method is used to transfer large amount of data that is available in electronic medium.
    BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).
    BDC uses normal transaction codes to transfer data.
    Types of BDC :
    CLASSICAL BATCH INPUT (Session Method)
    CALL TRANSACTION
    BATCH INPUT METHOD:
    This method is also called as ‘CLASSICAL METHOD’.
    Features:
    Asynchronous processing.
    Synchronous Processing in database update.
    Transfer data for more than one transaction.
    Batch input processing log will be generated.
    During processing, no transaction is started until the previous transaction has been written to the database.
    CALL TRANSACTION METHOD :
    This is another method to transfer data from the legacy system.
    Features:
    Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
    Updating the database can be either synchronous or asynchronous. The program specifies the update type.
    Transfer data for a single transaction.
    Transfers data for a sequence of dialog screens.
    No batch input processing log is generated.
    For BDC:
    http://myweb.dal.ca/hchinni/sap/bdc_home.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    Check these link:
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    http://www.planetsap.com/bdc_main_page.htm
    call Transaction or session method ?
    These are the Function modules used for the Session Method.
    BDC_OPEN_GROUP
    BDC_INSERT
    BDC_CLOSE_GROUP
    BDC_DELETE_SESSION to create a session
    You can schedule the execution of BDC session using the program RSBDCSUB.
    another one call transaction
    open dataset
    close dataset
    reward if it helps u
    vijay pawar

  • Program not working in background

    Hello,
    I have a Z program that uses open dataset stmts that writes the file out into a specified directory in the appl server path.
    The prgram runs fine in foreground.  But when scheduled in background it fails.
    The job logs are :
    Dierctory does not exist 
    Job cancelled after system exception ERROR_MESSAGE
    The destination path can read, write and edit files in the directory.
    i tried to create .txt file & also without any extension.
    Can someone suggest me what i am doing wrong.
    Thanks
    Ricky

    Hi,
    Has anyone got any solution to this problem. I'm able to create forlder and write some files using ABAP program in foreground process and also in background with JDBG but the same doesnt happen when run in backgroud.
    The user id used to run the program has SAP ALL access so doesnt seem to be an  authorisation issue.
    I'm using function module TMP_GUI_CREATE_DIRECTORY to create folder and
      GUI_DOWNLOAD to write files in designated folders. The program doesnt have any BDC
    Help would be appreciated.
    Regards,

  • Please  Help me How write the BDC program for the MIGO inbound Delivery

    Please help me how to write bdc program for the MIGO Inbound Delivery in 4.7EE Version. Please help me.
    Not in LSMW.  Required call transaction or Session Method. Please help me.
    Mohan

    Run transaction BAPI . Select Logistics Execution/Shipping/InboundDelivery/SaveReplica.. You can use function module BAPI_INB_DELIVERY_SAVEREPLICA in your ABAP program.

  • Upload Of Photographs with the help of BDC in ECC 6.0 (tcode : OAAD)

    Hi Experts,
       I am trying to upload the photographs in ECC 6.0 Employee data, I m using my old BDC which was perfectly running in 4.6C, but in ECC 6.0, it is not working.
    While uploading the photograph it is again asking for File name which i have already given during making the session of BDC into my FLAT File.
    My Old BDC code part :
        PERFORM bdc_dynpro      USING 'SAPLOPTM' '0105'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'SAPB-SAPPOOLINF'.
        "PERFORM bdc_field       USING 'SAPB-SAPPOOLINF'
                                      "'Sample.jpg'."i_tab-filename.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=OKAY'.
        PERFORM bdc_field       USING 'SAPB-SAPPOOLINF'
                                       i_tab-filename.
    When i checked this screen 'SAPLOPTM' '0105' in ECC 6.0, this screen is not available in ECC 6.0.
    I started new recording for BDC, but the part where we are giving the file path, it is not coming in recording code.
    What is the alternate of this code in ECC 6.0, please send the code if available.
    Thanks in advance.
    Ajay

    when you are recording check the background option. try this if it helps you.

  • Help me in bdc

    Hi frnd...
        i hav a doubt in bdc that when we go for call transaction or session method for inserting data into respective tables, we come through errors.
    so can anyone help me how to handle error.
    so we say that we delete successful records and reprocess the bdc.
    but can anyone tell how to delete those records.
    i dont think its possible manually.
    so plz reply me so that i can clarify my dpubt.
                                         regards,
                                          rajesh

    Hai Rahesh
    Check the following Code
    report Z_CALLTRANS_VENDOR_01
    no standard page heading line-size 255.
    Generated data section with specific formatting - DO NOT CHANGE ***
    data: begin of it_lfa1 occurs 0,
    KTOKK like lfa1-ktokk,
    NAME1 like lfa1-name1,
    SORTL like lfa1-sortl,
    LAND1 like lfa1-land1,
    end of it_lfa1.
    End generated data section ***
    data : it_bdc like bdcdata occurs 0 with header line.
    *DATA: IT_MESSAGES TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
    *DATA: LV_MESSAGE(255).
    <b>data : it_messages like bdcmsgcoll occurs 0 with header line.
    data : V_message(255).</b>
    data : V_flag.
    data : V_datum1 type sy-datum.
    data : begin of it_mesg occurs 0,
    message(100),
    end of it_mesg.
    *V_datum1 = sy-datum-1.
    parameters : P_Sess like APQI-GROUPID.
    start-of-selection.
    perform Get_data.
    *perform open_group.
    loop at it_lfa1.
    perform bdc_dynpro using 'SAPMF02K' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RF02K-KTOKK'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RF02K-KTOKK'
    it_lfa1-KTOKK.
    perform bdc_dynpro using 'SAPMF02K' '0110'.
    perform bdc_field using 'BDC_CURSOR'
    'LFA1-LAND1'.
    perform bdc_field using 'BDC_OKCODE'
    '=UPDA'.
    perform bdc_field using 'LFA1-NAME1'
    it_lfa1-name1.
    perform bdc_field using 'LFA1-SORTL'
    it_lfa1-sortl.
    perform bdc_field using 'LFA1-LAND1'
    it_lfa1-land1.
    <b>call transaction 'XK01' using it_bdc
    mode 'N'
    update 'S'
    messages into it_messages.</b>
    if sy-subrc <> 0.
    if V_flag <> 'X'.
    perform open_group.
    V_flag = 'X'.
    endif.
    perform bdc_transaction. "using 'XK01'.
    endif.
    <b>perform format_messages.</b>
    <b>refresh : it_bdc,it_messages.</b>.
    endloop.
    if V_flag = 'X'.
    perform close_group.
    endif.
    *& Form Get_data
    text
    --> p1 text
    <-- p2 text
    FORM Get_data .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = 'C:\srinu_vendor.txt'
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = it_lfa1
    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.
    ENDFORM. " Get_data
    *& Form bdc_dynpro
    text
    -->P_0061 text
    -->P_0062 text
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
    CLEAR it_BDC.
    it_BDC-PROGRAM = PROGRAM.
    it_BDC-DYNPRO = DYNPRO.
    it_BDC-DYNBEGIN = 'X'.
    APPEND it_BDC.
    ENDFORM.
    Insert field *
    FORM BDC_FIELD USING FNAM FVAL.
    CLEAR it_BDC.
    it_BDC-FNAM = FNAM.
    it_BDC-FVAL = FVAL.
    APPEND it_BDC.
    ENDFORM.
    *& Form format_messages
    text
    --> p1 text
    <-- p2 text
    <b>FORM format_messages .
    loop at it_messages.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = it_messages-MSGID
    LANG = 'EN'
    NO = it_messages-MSGNR
    V1 = it_messages-MSGV1
    V2 = it_messages-MSGV2
    V3 = it_messages-MSGV3
    V4 = it_messages-MSGV4
    IMPORTING
    MSG = V_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 : / V_message.
    clear : V_message.
    endloop.
    ENDFORM. " format_messages</b>
    *& Form open_group
    text
    --> p1 text
    <-- p2 text
    FORM open_group .
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = P_Sess
    HOLDDATE = V_datum1
    KEEP = 'X'
    USER = SY-UNAME
    IF SY-SUBRC = 0.
    write : / 'Session Creating wit Name : ',P_Sess.
    ENDIF.
    ENDFORM. " open_group
    *& Form close_group
    text
    --> p1 text
    <-- p2 text
    FORM close_group .
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    ENDFORM. " close_group
    *& Form bdc_transaction
    text
    -->P_0132 text
    FORM bdc_transaction. "USING VALUE(P_0132).
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = 'XK01'
    POST_LOCAL = NOVBLOCAL
    PRINTING = NOPRINT
    SIMUBATCH = ' '
    CTUPARAMS = ' '
    TABLES
    DYNPROTAB = it_bdc
    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_transaction
    Thanks & regards
    Sreenivasulu P

  • Problem to generate same VA01 search help screen in BDC Program

    Hi All,
              I have got one issue.
              The issue is that i need to generate the search (F4) help screen of VA01 search for articles in the program,.
              I tried to record using BDC, but the screen generated is different.
              Can anyone please guide me how to generate that same search help screen in Program using BDC or any other tool.

    Hi
    Just check the field in the VA01 for which you are using BDC , you may get the standard search help for that .
    It wuld be great if you elaborate your requierment .
    Regards
    Rahul

  • Error in bdc programing code-pls help

    hi friends,
                I was tring to do a bdc program.But it shows me an error. MY bdc program is jus to upload a 2 fields in vendoe master table.
    That is LIFNR,NAME1 field for the new vendors.
    I worked out an execl sheet for this, and jus copied it to the text file by selecting all and  pasting.
    Even then i get an error code that BDC_open does not exits.
    MY code is this, please help me if iam wrong.
    If anyone can help to make it more understandable,I Kindly  request you to try out this program with the screen shot and mail to this id [email protected] would be very thankful for your timely help.
    report Z_PK_BDC
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
    parameters: p_file like rlgrap-filename default
                    'C:\SAP TESTING\p_file.txt'.
       DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
      If it is nessesary to change the data section use the rules:
      1.) Each definition of a field exists of two lines
      2.) The first line shows exactly the comment
          '* data element: ' followed with the data element
          which describes the field.
          If you don't have a data element use the
          comment without a data element name
      3.) The second line shows the fieldname of the
          structure, the fieldname must consist of
          a fieldname and optional the character '_' and
          three numbers and the field length in brackets
      4.) Each field must be type C.
    Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record OCCURS 0,
    data element: LIF16
            LIFNR_001(016),
    data element: BUKRS
            BUKRS_002(004),
    data element: KTOKK
            KTOKK_003(004),
    data element: ANRED
            ANRED_004(015),
    data element: NAME1_GP
            NAME1_005(035),
    data element: SORTL
            SORTL_006(010),
    data element: NAME2_GP
            NAME2_007(035),
    data element: STRAS_GP
            STRAS_008(035),
    data element: ORT01_GP
            ORT01_009(035),
    data element: ORT02_GP
            ORT02_010(035),
    data element: PFORT_GP
            PFORT_011(035),
    data element: LAND1_GP
            LAND1_012(003),
    data element: SPRAS
            SPRAS_013(002),
          end of record.
    End generated data section ***
    start-of-selection.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = P_FILE
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = record
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                FILE_OPEN_ERROR         = 2
                FILE_READ_ERROR         = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC <> 0.
        WRITE:/ 'SY-SUBRC:', SY-SUBRC.
      ENDIF.
    LOOP AT RECORD.
    *perform open_dataset using dataset.
    *perform open_group.
    *do.
    *read dataset dataset into record.
    *if sy-subrc <> 0. exit. endif.
    perform bdc_dynpro      using 'SAPMF02K' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  record-LIFNR_001.
    perform bdc_field       using 'RF02K-BUKRS'
                                  record-BUKRS_002.
    perform bdc_field       using 'RF02K-KTOKK'
                                  record-KTOKK_003.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-SPRAS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_field       using 'LFA1-ANRED'
                                  record-ANRED_004.
    perform bdc_field       using 'LFA1-NAME1'
                                  record-NAME1_005.
    perform bdc_field       using 'LFA1-SORTL'
                                  record-SORTL_006.
    perform bdc_field       using 'LFA1-NAME2'
                                  record-NAME2_007.
    perform bdc_field       using 'LFA1-STRAS'
                                  record-STRAS_008.
    perform bdc_field       using 'LFA1-ORT01'
                                  record-ORT01_009.
    perform bdc_field       using 'LFA1-ORT02'
                                  record-ORT02_010.
    perform bdc_field       using 'LFA1-PFORT'
                                  record-PFORT_011.
    perform bdc_field       using 'LFA1-LAND1'
                                  record-LAND1_012.
    perform bdc_field       using 'LFA1-SPRAS'
                                  record-SPRAS_013.
    perform bdc_transaction using 'FK01'.
    **enddo.
    **perform close_group.
    endloop.
    **perform close_dataset using dataset.
    Thanks in Advance
    Rinky123

    Hi,
    If you are using GUI_UPLOAD in 4.7 then the file path whatever you are using currently it won't work. Replace the file path like this.
    P_FILE LIKE RLGRAP-FILENAME.
    DATA: V_FILE TYPE STRING.
    V_FILE = P_FILE.
    Now take this v_file for function module.Then only it will open the file otherwise you won't get unable to open file error message.
    I observerd that you are getting so many fields from the file to the internal table.

  • BDC Problem , Pls help

    Hi ,
    I am trying to create a BDC for routing opertaions update . During recording for a Screen ( that has subscreens )i get this :
    BDC_SUBSCR SAPLCPDO       1210GENERAL.
    I wanted to know Is there a special way to populate the subscreen fields ? I just copied the bdcdata-fnam = 'bdc_subscr' and fval = SAPLCPDO       1210GENERAL , but it looks like this is not the correct way as i get an error saying No transaction data for screen SAPLCPDO.
    I would appreciate if anyone can let me know how to code for this.
    Thank you very much

    Tamanna,
    If your requirement is how to code BDC program for a transaction which has subscreens in it...then refer to the example program I had created at one of my client places. But this is not for tcode CA02. Sorry I couldn't be of more help.
    * Table declaration
    TABLES:
      wyt3,
      /bay2/u7sxcrecce.
    *& Internal Table Declaration for Bushy Park Legacy data
    DATA : BEGIN OF i_leg OCCURS 0,
      po_nm(15),     " PO No - EBELN
      byrc(2),       " Purchasing group - buyer code - EKGRP
      vendor(10),    " LIFNR
      po_date(6),    " BEDAT
      cur(3),        " currency - WAERS
      zterm(2),      " terms code - ZTERM
      fob(2),        " FOB code - IINCO1
      mat(7),        " material - EMATN
      mat_pck(15),   " material PCK - ematn
      quant(15),     " quantity due - MENGE
      u_meas(2),     " Unit of measure - MEINS
      del_date(6),   " Item delivery date - EINDT
      ven_mat(30),   " Material # used by vendor
      net_pr(17),    " Net price - NETPR
      ship_via(3),   " Ship via
      del_loc(5),    " Delivery location -  ABLAD
      dist_acc(21),  " Distribution account
      txz01(55),     " Purchase Document Text
      recip(5),      " Recipient - WEMPF
      line_cd(3),    " Line code
      comp(2),       " Company
      line_num(4),   " PO line number
      indicator(1),  " Indictor as to what kind of PO's is being converted
      projnbr(30),   " filler
      works(2),      " Legacy works - WERKS
      work_ord(7),   " Work Order Number - AUFNR
      wbs(8),        " Project number - use for WBS x-ref
      cost_elem(7),  " G/L account for Project PO's w/o mat. master - SAKTO
      xref_wbs(23),  " WBS for manual load - SAKTO
      percent(12),   " Mara
    * Filler for NET PRICE
      filler(17),    " Mara - net price
      gl_act(7),     " GL acct for Work Order
      label(3),      " Label
      iwg_warehouse(9),
      cost_cen(5),   " Cost center
      expence_cl(4), " Expence class
      tax_code(2),   " Tax Code
      quan_gr(16),   " Quantity of goods received
      amt_gr(17),    " Amount of goods received
      quan_fi(16),   " Quantity invoiced
      amt_fi(17),    " Amount invoiced
      site(15),      " Site name - Added by Naren Somen
    *  flag(1),       " Indicator for valuted material - N/A
    *  commit_amt(14)," Commitment value
    END OF i_leg.
    *& Internal Table Declaration for SAP data
    DATA : BEGIN OF i_sap OCCURS 0,
              po_nm(15),            " PO No - EBELN
              ekgrp(3),             " Purchasing Group
              lifnr(10),            " Vendor Number
              zterm(4),             " Payment Terms
              werks(4),             " Plant
              txz01(40),            " Text
              netprice(14),         " Price
              commit_amt(14),       " Commitment values
           END OF i_sap.
    DATA: bdcdata LIKE bdcdata          OCCURS 0 WITH HEADER LINE.
    DATA: i_xleg LIKE i_leg OCCURS 0 WITH HEADER LINE.
    DATA: i_wyt3 LIKE wyt3 OCCURS 0 WITH HEADER LINE.
    DATA: p_itab LIKE i_leg OCCURS 0 WITH HEADER LINE.
    * Internal table to store the messages
    DATA: BEGIN OF i_mesage_tab OCCURS 0.
            INCLUDE STRUCTURE bdcmsgcoll .
    DATA END OF i_mesage_tab.
    *Begin of change by Naren Somen
    *Buffer to the hold the records from tab delimited text file
    DATA:  BEGIN OF i_record_buffer,
             record_buffer(4000)   TYPE c.
    DATA:  END OF i_record_buffer.
    *End of change by Naren Somen
    DATA: w_input_rec_count(6) TYPE n," Input File Record Counter
          w_address TYPE p,           " Count of vendor addresses found
          w_flg  TYPE c VALUE 'X',    " BDC Rec Indicator
          w_insert_line(1) TYPE c,    " Insert New Line Item in PO
          w_del_date(10),             " Delivery Date Format Changes
          w_year(4),                  " Year
          w_mon(2),                   " Month
          w_date(2),                  " Date
          w_purgrp(3),                " SAP Purchasing group
          w_vendor(10),               " SAP vendor
          w_payterm(4),               " SAP payment terms
          w_plant(4),                 " SAP plant
          w_acct(10),                 " SAP G/L acct - temp
          w_order(12),                " SAP Work Order Number
          w_aufnr LIKE ekkn-aufnr.    " Work Order
    DATA:  w_input LIKE swaexpdef-expr,
           w1_dec LIKE dfies-decimals,
           w_mul TYPE i,
           w_val TYPE i,
           w_val01 LIKE ekpo-netpr,
           w_netprice(11),                   " Net Price
           w_netprice_hold(11),              " hold variable for net price
           w_netprice1(14),                  " Net Price before dec. point
           w_netprice2(9),                   " Net Price after dec. point
           w_quant TYPE c VALUE '1',         " Quantity
           w_count LIKE sy-tabix,            " Loop Counter
           w_costcenter TYPE kostl,          " Costcenter
           w_glaccount TYPE kstar,           " G/L account
           w_item TYPE bstpo VALUE '0010',   " Line item number
           w_quote(1) TYPE x VALUE '27'.
    DATA: BEGIN OF i_epstp,
             field1(11) TYPE c VALUE 'RM06E-EPSTP',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_epstp.
    DATA: BEGIN OF i_knttp,
             field1(10) TYPE c VALUE 'EKPO-KNTTP',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_knttp.
    DATA: BEGIN OF i_txz01,
             field1(10) TYPE c VALUE 'EKPO-TXZ01',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_txz01.
    DATA: BEGIN OF i_eeind,
             field1(11) TYPE c VALUE 'RM06E-EEIND',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_eeind.
    DATA: BEGIN OF i_netpr,
             field1(10) TYPE c VALUE 'EKPO-NETPR',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_netpr.
    DATA: BEGIN OF i_matkl,
             field1(10) TYPE c VALUE 'EKPO-MATKL',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_matkl.
    DATA: BEGIN OF i_werks,
             field1(10) TYPE c VALUE 'EKPO-WERKS',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_werks.
    DATA: BEGIN OF i_ktext1,
             field1(11) TYPE c VALUE 'ESLL-KTEXT1',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_ktext1.
    DATA: BEGIN OF i_meins,
             field1(10) TYPE c VALUE 'ESLL-MEINS',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
          END OF i_meins.
    DATA: BEGIN OF i_ekpo_meins,
             field1(10) TYPE c VALUE 'EKPO-MEINS',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_ekpo_meins.
    DATA: BEGIN OF i_menge,
             field1(10) TYPE c VALUE 'ESLL-MENGE',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_menge.
    DATA: BEGIN OF i_ekpo_menge,
             field1(10) TYPE c VALUE 'EKPO-MENGE',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_ekpo_menge.
    DATA: BEGIN OF i_tbtwr,
             field1(10) TYPE c VALUE 'ESLL-TBTWR',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_tbtwr.
    DATA: BEGIN OF i_mkntm,
             field1(11) TYPE c VALUE 'RM11K-MKNTM',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_mkntm.
    DATA: BEGIN OF i_kostl,
             field1(10) TYPE c VALUE 'ESKN-KOSTL',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_kostl.
    DATA: BEGIN OF i_sakto,
             field1(10) TYPE c VALUE 'ESKN-SAKTO',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_sakto.
    DATA: BEGIN OF i_bstpo,
             field1(11) TYPE c VALUE 'RM06E-BSTPO',
             field2(1) TYPE c VALUE '(',
             field3(3) TYPE n VALUE 000,
             field4(1) TYPE c VALUE ')',
         END OF i_bstpo.
    DATA: BEGIN OF i_kstar,
             kstar TYPE kstar,
          END OF i_kstar.
    DATA: c_yb(2) VALUE 'YB'.
    DATA: c_partner_counter(3) TYPE c VALUE '002'. "Partner Counter -
    "Naren Somen
    CONSTANTS: c_185(4) TYPE c VALUE '0185',     " System ID - Walker
               c_202(4) TYPE c VALUE '0202',     " System ID - Bushy Park
               c_delimiter(1) TYPE x  VALUE '09'," tab character-Naren Somen
               c_unit(2) TYPE c VALUE 'PU',      " Unit of measure
               c_sq(2) TYPE c VALUE 'SQ',
               c_zero(1) TYPE c VALUE '0',
               c_loop(2) TYPE c VALUE '14',
               c_00(2) TYPE c VALUE '00'.
    *& Input Parameters / Selection Options
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-tx1.
    PARAMETERS : p_input  LIKE filename-fileextern OBLIGATORY,  " Input File
                 p_error  LIKE filename-fileextern OBLIGATORY. " Output File
    SELECTION-SCREEN END OF BLOCK bl1.
    SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-tx3.
    PARAMETERS : p_ekorg LIKE ekko-ekorg OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK bl3.
    SELECTION-SCREEN BEGIN OF BLOCK bl4 WITH FRAME TITLE text-tx4.
    PARAMETERS : p_uname LIKE apqi-userid OBLIGATORY,
                 p_sess LIKE bgr00-group OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK bl4.
    *& Main Program Logic
    START-OF-SELECTION.
      PERFORM open_input_output_files.
      PERFORM create_bdc_session.
      PERFORM write_results.
    END-OF-SELECTION.
    *&      Form  OPEN_INPUT_OUTPUT_FILES
    FORM open_input_output_files.
      PERFORM open_input_file.
      PERFORM open_output_error_file.
    ENDFORM.                    " OPEN_INPUT_OUTPUT_FILES
    *&      Form  CREATE_BDC_SESSION
    FORM create_bdc_session.
      PERFORM open_group.
      i_xleg[] = i_leg[].
      LOOP AT i_leg.
        IF i_leg-po_nm = i_xleg-po_nm.
          SKIP.
        ELSE.
          PERFORM read_xref_tables.
    *-- First screen
          CLEAR w_insert_line.
          PERFORM bdc_dynpro      USING 'SAPMM06E'    '0100'.
          PERFORM bdc_field       USING 'BDC_CURSOR'  'RM06E-BSART'.
          PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
          PERFORM bdc_field       USING 'EKKO-LIFNR'  i_sap-lifnr.
          PERFORM bdc_field       USING 'RM06E-BSART' c_yb.
          PERFORM bdc_field       USING 'EKKO-EKORG'  p_ekorg.
          PERFORM bdc_field       USING 'EKKO-EKGRP'  i_sap-ekgrp.
          PERFORM vendor_address.
          IF w_address EQ '3'.
            PERFORM bdc_dynpro      USING 'SAPMSSY0'    '0120'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  '04/02'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=SELV'.
            PERFORM bdc_dynpro      USING 'SAPMSSY0'    '0120'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  '04/02'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=SELV'.
            PERFORM bdc_dynpro      USING 'SAPMSSY0'    '0120'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  '04/02'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=SELV'.
          ENDIF.
          IF w_address EQ '2'.
            PERFORM bdc_dynpro      USING 'SAPMSSY0'    '0120'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  '04/02'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=SELV'.
            PERFORM bdc_dynpro      USING 'SAPMSSY0'    '0120'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  '04/02'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=SELV'.
          ENDIF.
          IF w_address EQ '1'.
            PERFORM bdc_dynpro      USING 'SAPMSSY0'    '0120'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  '04/02'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=SELV'.
          ENDIF.
          PERFORM bdc_dynpro      USING 'SAPMM06E'    '0120'.
          PERFORM bdc_field       USING 'BDC_CURSOR'  'RM06E-EBELP'.
          PERFORM bdc_field       USING 'BDC_OKCODE'  '=KOPF'.
          PERFORM bdc_dynpro      USING 'SAPMM06E'    '0101'.
          PERFORM bdc_field       USING 'BDC_CURSOR'  'EKKO-VERKF'.
          PERFORM bdc_field       USING 'BDC_OKCODE'  'AB'.
          PERFORM bdc_field       USING 'EKKO-VERKF'  i_leg-po_nm.
          PERFORM bdc_field       USING 'EKKO-ZTERM'  i_sap-zterm.
          PERFORM bdc_field       USING 'EKKO-SPRAS'  'EN'.
          PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLXM06'.
          PERFORM record_counter.
          LOOP AT i_xleg WHERE po_nm EQ i_leg-po_nm.
    *        w_count = w_count + 1.
            WRITE: i_leg-del_date TO w_del_date YYMMDD.
            CONCATENATE '20' w_del_date INTO w_del_date.
            MOVE w_del_date(4) TO w_year.
            MOVE w_del_date+4(2) TO w_date.
            MOVE w_del_date+6(2) TO w_mon.
            CONCATENATE w_date '/' w_mon '/' w_year INTO w_del_date.
            PERFORM item_xref_tables.
            IF w_insert_line EQ space.
    *-- Second Screen Line # 1
              PERFORM bdc_dynpro  USING 'SAPMM06E' '0120'.
              PERFORM bdc_field   USING 'BDC_CURSOR'  i_eeind.
              PERFORM bdc_field   USING 'BDC_OKCODE'  '/00'.
    *          PERFORM bdc_field   USING i_bstpo  w_item.
              PERFORM bdc_field   USING i_epstp  'D'.
              PERFORM bdc_field   USING i_knttp  'K'.
              PERFORM bdc_field   USING i_txz01  i_sap-txz01.
              PERFORM bdc_field   USING i_eeind  w_del_date.
              PERFORM bdc_field   USING i_netpr  i_sap-netprice.
              PERFORM bdc_field   USING i_matkl  '25080400'.
              PERFORM bdc_field   USING i_werks  i_sap-werks.
    **-- Second Screen Line # 2 Onwards.
            ELSE.
    *--- Call Insert Line.
              PERFORM line_item_data.
              IF i_epstp-field3 GT c_loop.
                PERFORM bdc_dynpro   USING 'SAPMM06E' '0120'.
                PERFORM bdc_field    USING 'BDC_CURSOR'  'RM06E-EBELP'.
                PERFORM bdc_field    USING 'BDC_OKCODE'  '=NP'.
                PERFORM record_counter.
                PERFORM line_item_data.
              ENDIF.
              PERFORM bdc_dynpro   USING 'SAPMM06E' '0120'.
              PERFORM bdc_field    USING 'BDC_CURSOR'  i_eeind.
              PERFORM bdc_field    USING 'BDC_OKCODE'  '/00'.
    *          PERFORM bdc_field    USING i_bstpo  w_item.
              PERFORM bdc_field    USING i_epstp  'D'.
              PERFORM bdc_field    USING i_knttp  'K'.
              PERFORM bdc_field    USING i_txz01  i_sap-txz01.
              PERFORM bdc_field    USING i_eeind  w_del_date.
              PERFORM bdc_field    USING i_netpr  i_sap-netprice.
              PERFORM bdc_field    USING i_matkl  '25080400'.
              PERFORM bdc_field    USING i_werks  i_sap-werks.
            ENDIF.
            w_insert_line = 'X'.
    *-- Third Screen.
            PERFORM bdc_dynpro      USING 'SAPLMLSP'    '0200'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSP'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSL'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSL'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSP'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  'ESLL-TBTWR(01)'.
            PERFORM bdc_field       USING i_ktext1 i_sap-txz01.
            PERFORM bdc_field       USING i_menge  i_xleg-quant.
            PERFORM bdc_field       USING i_meins  'PU'.
            PERFORM bdc_field       USING i_tbtwr  i_sap-netprice.
            PERFORM bdc_dynpro      USING 'SAPLMLSK'    '0200'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  'ESKN-SAKTO(01)'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
            PERFORM bdc_field       USING i_mkntm  w_quant.
            PERFORM bdc_field       USING i_kostl  w_costcenter.
            PERFORM bdc_field       USING i_sakto  w_glaccount.
            PERFORM bdc_dynpro      USING 'SAPLMLSK'    '0200'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  'ESLL-INTROW'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=BACK'.
            PERFORM bdc_dynpro      USING 'SAPLMLSP'    '0200'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=ESB'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSP'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSL'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSL'.
            PERFORM bdc_field       USING 'BDC_SUBSCR'  'SAPLMLSP'.
            PERFORM bdc_field       USING 'BDC_CURSOR'  'ESLL-KTEXT1(01)'.
            ENDLOOP.
            PERFORM bdc_dynpro      USING 'SAPMM06E' '0120'.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=BU'.
            PERFORM bdc_transaction USING 'ME21'.
        ENDIF.
      ENDLOOP.
      PERFORM close_group.
    ENDFORM.                    " CREATE_BDC_SESSION
    *&      Form  WRITE_RESULTS
    FORM write_results.
      WRITE: text-tx5, w_input_rec_count.
    ENDFORM.                    " WRITE_RESULTS
    *&      Form  OPEN_INPUT_FILE
    FORM open_input_file.
      OPEN DATASET p_input FOR INPUT IN TEXT MODE.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH p_input.
      ENDIF.
      DO.
        READ DATASET p_input INTO i_record_buffer.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          SPLIT i_record_buffer-record_buffer AT  c_delimiter INTO
                                                    i_leg-po_nm
                                                    i_leg-byrc
                                                    i_leg-vendor
                                                    i_leg-po_date
                                                    i_leg-cur
                                                    i_leg-zterm
                                                    i_leg-fob
                                                    i_leg-mat
                                                    i_leg-mat_pck
                                                    i_leg-quant
                                                    i_leg-u_meas
                                                    i_leg-del_date
                                                    i_leg-ven_mat
                                                    i_leg-net_pr
                                                    i_leg-ship_via
                                                    i_leg-del_loc
                                                    i_leg-dist_acc
                                                    i_leg-txz01
                                                    i_leg-recip
                                                    i_leg-line_cd
                                                    i_leg-comp
                                                    i_leg-line_num
                                                    i_leg-indicator
                                                    i_leg-projnbr
                                                    i_leg-works
                                                    i_leg-work_ord
                                                    i_leg-wbs
                                                    i_leg-cost_elem
                                                    i_leg-xref_wbs
                                                    i_leg-percent
                                                    i_leg-filler
                                                    i_leg-gl_act
                                                    i_leg-label
                                                    i_leg-iwg_warehouse
                                                    i_leg-cost_cen
                                                    i_leg-expence_cl
                                                    i_leg-tax_code
                                                    i_leg-quan_gr
                                                    i_leg-amt_gr
                                                    i_leg-quan_fi
                                                    i_leg-amt_fi
    "Added by Naren Somen
                                                    i_leg-site.
    *                                                i_leg-flag
    *                                                i_leg-commit_amt.
          APPEND i_leg.
        ENDIF.
      ENDDO.
      DESCRIBE TABLE i_leg LINES w_input_rec_count.
      CLOSE DATASET p_input.
    ENDFORM.                    " OPEN_INPUT_FILE
    *&      Form  OPEN_OUTPUT_ERROR_FILE
    FORM open_output_error_file.
      OPEN DATASET p_error FOR OUTPUT IN TEXT MODE.
      IF sy-subrc <> 0.
        MESSAGE e001 WITH p_error.
      ENDIF.
    ENDFORM.                    " OPEN_OUTPUT_ERROR_FILE
    *&      Form  OPEN_GROUP
    FORM open_group.
      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                client = sy-mandt
                group  = p_sess
                user   = p_uname
                keep   = 'X'.
    ENDFORM.                    " OPEN_GROUP
    *&      Form  BDC_DYNPRO
    FORM bdc_dynpro USING  program  dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = w_flg.
      APPEND bdcdata.
      CLEAR bdcdata.
    ENDFORM.                               " BDC_DYNPRO
    *&      Form  BDC_FIELD
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
      CLEAR bdcdata.
    ENDFORM.                               " BDC_FIELD
    *&      Form  BDC_transaction
    FORM bdc_transaction USING tran_code.
      CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                tcode     = tran_code
           TABLES
                dynprotab = bdcdata.
      CLEAR bdcdata.
      REFRESH bdcdata.
    ENDFORM.                               " BDC_TRANSACTION
    *&      Form  CLOSE_GROUP
    FORM close_group.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                not_open    = 0
                queue_error = 0
                OTHERS      = 0.
    ENDFORM.                               " CLOSE_GROUP
    *&      Form  READ_XREF_TABLES
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM read_xref_tables.
      CLEAR i_sap.
      PERFORM convert_pur_group            USING i_leg-byrc.
      PERFORM convert_vendor               USING i_leg-vendor.
      PERFORM convert_payterm              USING i_leg-zterm.
    ENDFORM.                    " READ_XREF_TABLES
    *&      Form  CONVERT_PUR_GROUP
    FORM convert_pur_group USING    p_byrc.
      SELECT SINGLE ekgrp FROM /bay2/u7emxrbuyr
         INTO w_purgrp
         WHERE system_id EQ c_185 AND leginp_cd EQ p_byrc.
      IF sy-subrc EQ 0.
        MOVE w_purgrp TO i_sap-ekgrp.
        CLEAR w_purgrp.
      ENDIF.
    ENDFORM.                    " CONVERT_PUR_GROUP
    *&      Form  CONVERT_VENDOR
    FORM convert_vendor USING    p_vendor.
      DATA : w_venfamily(8) TYPE c,
             w_vendor_temp(7) TYPE c,
             wa_vendor TYPE /bay2/u7pxxrvend,
             wa_vendor1 TYPE /bay2/u7pxxrvend.
      CLEAR: w_vendor, w_venfamily, w_vendor_temp.
    * Select with Full Vendor Number
      SELECT SINGLE * FROM /bay2/u7pxxrvend INTO wa_vendor
          WHERE leg_ven_num EQ p_vendor AND system_id = c_185.
      IF sy-subrc EQ 0.
        IF wa_vendor-ktokk EQ 'YKRD'.
          MOVE wa_vendor-lifnr TO w_vendor.
        ELSE.     " IF YSUP
    * Select the YKRD for corrusponding YSUP from WYT3
          SELECT ekorg lifnr
          INTO (wyt3-ekorg, wyt3-lifnr)
          FROM wyt3
          WHERE
          lifn2 EQ wa_vendor-lifnr.
            SELECT SINGLE lifnr
            INTO w_vendor
            FROM wyt3
            WHERE lifnr EQ wyt3-lifnr AND
                  ekorg EQ wyt3-ekorg AND
                  parvw EQ 'LF'.
            IF sy-subrc EQ 0.
              EXIT.
            ENDIF.
          ENDSELECT.                " SELECT ekorg lifnr
        ENDIF.                      " IF wa_vendor-ktokk EQ 'YKRD'.
      ENDIF.                        " IF SY-SUBRC EQ 0.
      IF w_vendor IS  INITIAL.
    * Select YKRD with Legacy Vendor Family Number
        MOVE p_vendor TO w_vendor_temp.
        CONCATENATE w_vendor_temp '%' INTO w_venfamily.
        SELECT SINGLE * FROM /bay2/u7pxxrvend INTO wa_vendor1
                WHERE leg_ven_num LIKE w_venfamily AND
                ktokk EQ 'YKRD' AND system_id = c_185.
        IF sy-subrc EQ 0.
          MOVE wa_vendor1-lifnr TO w_vendor.
          MOVE w_vendor TO i_sap-lifnr.
        ELSE.
          CONCATENATE p_vendor 'X' INTO i_sap-lifnr.
        ENDIF.
      ELSE.
        MOVE w_vendor TO i_sap-lifnr.
      ENDIF.
    ENDFORM.                    " CONVERT_VENDOR
    *&      Form  CONVERT_PAYTERM
    FORM convert_payterm USING    p_i_leg01_trms_code.
      SELECT SINGLE zterm
      INTO w_payterm
      FROM /bay2/u7emcpterm
      WHERE legpterm EQ p_i_leg01_trms_code AND system_id = c_185.
      IF sy-subrc = 0.
        MOVE w_payterm TO i_sap-zterm.
        CLEAR w_payterm.
      ENDIF.
    ENDFORM.                    " CONVERT_PAYTERM
    *&      Form  CONVERT_PLANT
    FORM convert_plant USING p_works.
      SELECT SINGLE werks FROM /bay2/u7smcpwerk
         INTO w_plant
         WHERE system_id EQ c_185
         AND legwerks EQ p_works.
      IF sy-subrc = 0.
        MOVE w_plant TO i_sap-werks.
      ENDIF.
    ENDFORM.                    " CONVERT_PLANT
    *&      Form  VENDOR_ADDRESS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM vendor_address.
      REFRESH i_wyt3.
      SELECT * FROM wyt3 INTO i_wyt3
      WHERE lifnr EQ i_sap-lifnr
      AND parza = c_partner_counter.
        APPEND i_wyt3.
        CLEAR i_wyt3.
      ENDSELECT.
      DESCRIBE TABLE i_wyt3 LINES w_address.
    ENDFORM.                    " VENDOR_ADDRESS
    *&      Form  ITEM_XREF_TABLES
    FORM item_xref_tables.
      PERFORM convert_plant                USING i_xleg-works.
      PERFORM convert_costcenter           USING i_xleg-cost_cen
    i_xleg-works.
      PERFORM convert_glacc                USING i_xleg-expence_cl.
      MOVE: i_xleg-txz01(40) TO i_sap-txz01,
            i_xleg-po_nm TO i_sap-po_nm,
            i_xleg-filler+3(14) TO i_sap-netprice.
    *        i_xleg-commit_amt TO i_sap-commit_amt.
    ENDFORM.                    " ITEM_XREF_TABLES
    *&      Form  RECORD_COUNTER
    FORM record_counter.
      i_epstp-field3 = 1.
      i_knttp-field3 = 1.
      i_txz01-field3 = 1.
      i_eeind-field3 = 1.
      i_netpr-field3 = 1.
      i_matkl-field3 = 1.
      i_werks-field3 = 1.
      i_ktext1-field3 = 1.
      i_meins-field3 = 1.
      i_menge-field3 = 1.
      i_tbtwr-field3 = 1.
      i_mkntm-field3 = 1.
      i_kostl-field3 = 1.
      i_sakto-field3 = 1.
      i_ekpo_meins-field3 = 1.
      i_ekpo_menge-field3 = 1.
      w_count = 0.
    ENDFORM.
    *&      Form  LINE_ITEM_DATA
    FORM line_item_data.
       i_epstp-field3 = i_epstp-field3 + 1.
       i_knttp-field3 = i_knttp-field3 + 1.
       i_txz01-field3 = i_txz01-field3 + 1.
       i_eeind-field3 = i_eeind-field3 + 1.
       i_netpr-field3 = i_netpr-field3 + 1.
       i_matkl-field3 = i_matkl-field3 + 1.
       i_werks-field3 = i_werks-field3 + 1.
       i_ekpo_menge-field3 = i_ekpo_menge-field3 + 1.
       i_ekpo_meins-field3 = i_ekpo_meins-field3 + 1.
       w_item = w_item + 10.
    ENDFORM.
    *&      Form  CONVERT_COSTCENTER
    FORM convert_costcenter           USING p_costcenter p_works.
       CONCATENATE c_sq p_works p_costcenter c_zero INTO w_costcenter.
    ENDFORM.
    *&      Form  CONVERT_COSTCENTER
    FORM convert_glacc                USING w_expence_cl.
       SELECT SINGLE kstar FROM /bay2/u7sxcrecce INTO i_kstar-kstar WHERE
    leginp_cd EQ w_expence_cl.
       MOVE i_kstar-kstar TO w_glaccount.
    ENDFORM.
    Thanks,

  • Please help give the BDC example for KZZ2, overhead rate BDC program

    Hi, All
    I have implemented notes 208474, and I need an add-on BDC program for KZZ2. Could anybody help me?
    Thanks in advance.
    <LOCKED BY MODERATOR - URGENT, PLEASE HELP OR SIMILAR ARE FORBIDDEN>
    Edited by: Alvaro Tejada Galindo on Aug 15, 2008 5:17 PM

    you might have got the details of what to extend for this customer n XD01. do a recording for those fields which have to be extended and call transaction XD01 and do a bdc. Other also after extending it do another recording to modify this using XD02 like the similar way taking the fields that you have to modify and do a bdc. Know from them if they need both of them in one BDC Prg or different BDC Progams. This is one way.
    The other way is to search if you have any BAPI's to do this and use those BAPI's.
    Award points if it helps.

  • Help in inbound idoc posting using bdc

    Hi,
    We are facing a problem during integration testing to post inbound idocs.
    The scenario is :
    A custom FM is written to process the inbound idocs, which does the following processes in sequence.
    1. BAPI used to create Goods Receipt
    2. BDC used to create Delivery using VL01N
    3. BDC used to create Handling Unit using VL02N
    4. BDC used to create Post Goods Issue using VL02N
    The VL01N creates a deivery, and using that delivery BDC calls VL02N to create HU.
    In unit testing the idocs are success, but when multiple idocs are used in integration testing, all fails either during delivery creation or HU creation.
    The error message we often get when HU is failed is  : "Runtime error RAISE_EXCEPTION has occured ".
    We have also incorporated a commit work and wait of 5 seconds after each BDC to avoid locking problem if any.
    The partner profile is set to ' trigger by background program'.
    Standard program RBDAPP01 is scheduled to collect the IDocs in status 64 and then to be processed.
    The package size used is 1,  inorder to process idocs one by one to avoid locking.
    Should any object type be given in RBDAPP01 ?
    If so, is it required to maintain any record for that object type in table TBD55 to process idocs serially in RBDAPP01 ?
    Any help in this regard is appreciated.
    Thanks in advance
    Regards
    Meena George

    Refer these links and see if they are useful:
    http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a66c9507d11d18ee90000e8366fc2/content.htm
    Regards,
    Ravi

Maybe you are looking for

  • Duplicate email replies in Mail?

    When I reply to someone and I look at the 'chain' conversation, all of my replies are shown twice on my screen, but the other person is only seeing 1 of them like they should. What's going on?

  • Can we specify which fonts load in which applications

    Can't believe I never looked into this since the pre-X days. Is there a simple way to have particular fonts (or collections) load only in specific applications? As a basic example - I want all my fonts to load in Photoshop, but only web fonts in Drea

  • InDesign CC 2014.2 crashes on close

    Is there anyone, who may have experienced InDesign CC 2014.2 to crash on close. Just after the last INDD update, problems began to occur  when I quit/close InDesign. I have tried just about everything possible except "slapping" the monitor. The only

  • N85-1 WHAT ON EARTH IS WRONG?!

    I bought an N85-1, I am in USA on ATT 3G network. N85 from Dubai, all brand new. Phone works, but I can only hear connected calls when I use: 1. Bluetooth 2. Wired Headphone 3. Loudspeaker (Speakerphone) I CANT HEAR CALLS FROM THE HEADSET! WHAT IS WR

  • Tree node selection lost after returning from called page

    Hi in a default unbound task flow i have a Page1 calling Page2. Page1 displays a master-detail data using treetable component, while Page2 displays detail data (selected from Page1) as a read-only form. When coming back from Page2, Page1 tree node se