Problem in doing BDC for XK01

Hi all,
i am doing BDC for XK01 with Line Item for Bank Details(Table Control..)
With 3 Internal table
IT_dummy to get the flat file
IT_vend  for Header details
IT_bank  for Item Details
in this there is a Nested loop
Loop at it_vend.
perform bdc
loop at it_bank.
concatenate................
endloop.
endloop.
because of the above nested loops..it's bit slow..
& i am trying to do with a single internal table..
The problem is..
with the header data it's not picking all the item data(it's picking only one..)..help me in resolving the problem..
Below the code..
REPORT  ZMM_BDCTC1 NO STANDARD PAGE HEADING LINE-SIZE 255.
PARAMETER:P_FILE TYPE RLGRAP-FILENAME.
DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF IT_DUMMY OCCURS 0,
      TYP,
      DES(255) TYPE C,
      END OF IT_DUMMY.
DATA:DELIMITER VALUE ',',
     cnt(4) TYPE N,
     L_FNAM(30) TYPE C,
     FILENAME TYPE STRING.
TYPES:BEGIN OF TY_FINAL,
      N(4) TYPE C,
      LIFNR TYPE RF02K-LIFNR,
      BUKRS TYPE RF02K-BUKRS,
      EKORG TYPE RF02K-EKORG,
      KTOKK TYPE RF02K-KTOKK,
      NAME1 TYPE LFA1-NAME1,
      SORTL TYPE LFA1-SORTL,
      LAND1 TYPE LFA1-LAND1,
      AKONT TYPE LFB1-AKONT,
      FDGRV TYPE LFB1-FDGRV,
      WAERS LIKE LFM1-WAERS,
      M(4) TYPE C,
      BANKS TYPE LFBK-BANKS,
      BANKL TYPE LFBK-BANKL,
      BANKN TYPE LFBK-BANKN,
      KOINH TYPE LFBK-KOINH,
      END OF TY_FINAL.
DATA: IT_FINAL TYPE TABLE OF TY_FINAL,
      WA_FINAL TYPE TY_FINAL.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
IMPORTING
   FILE_NAME           = P_FILE.
     FILENAME = P_FILE.
     CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
         filename                      = FILENAME
        FILETYPE                      = 'ASC'
       tables
         data_tab                      = IT_DUMMY.
START-OF-SELECTION.
LOOP AT it_dummy.
    IF it_dummy-typ = 'H'.
      SPLIT  it_dummy-des AT delimiter INTO WA_FINAL-lifnr "Populating Header Table
                                            WA_FINAL-bukrs
                                            WA_FINAL-ekorg
                                            WA_FINAL-ktokk
                                            WA_FINAL-name1
                                            WA_FINAL-sortl
                                            WA_FINAL-land1
                                            WA_FINAL-akont
                                            WA_FINAL-fdgrv
                                            WA_FINAL-waers.
      WA_FINAL-N = WA_FINAL-N + 1.
      WA_FINAL-M = WA_FINAL-M + 1.
    ELSEIF it_dummy-typ = 'I'.
      SPLIT it_dummy-des AT delimiter INTO WA_FINAL-BANKS
                                           WA_FINAL-BANKL
                                           WA_FINAL-BANKN
                                           WA_FINAL-KOINH.
      APPEND WA_FINAL TO IT_FINAL.
    ENDIF.
  ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
WRITE:/ WA_FINAL-N,
        WA_FINAL-LIFNR,
        WA_FINAL-BUKRS,
        WA_FINAL-EKORG,
        WA_FINAL-KTOKK,
        WA_FINAL-NAME1,
        WA_FINAL-SORTL,
        WA_FINAL-LAND1,
        WA_FINAL-AKONT,
        WA_FINAL-FDGRV,
        WA_FINAL-WAERS,
        WA_FINAL-M,
        WA_FINAL-BANKS,
        WA_FINAL-BANKL,
        WA_FINAL-BANKN,
        WA_FINAL-KOINH.
ENDLOOP.
data: WA_FINAL1 like line of IT_FINAL.
clear WA_FINAL1.
******************BDC STARTS***********************
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT      = SY-MANDT
GROUP       = 'ZMM_BDCTAB'
KEEP        = 'X'
USER        = SY-UNAME.
Clear wa_final.
LOOP AT IT_FINAL INTO WA_FINAL.
WA_FINAL1 = WA_FINAL.
CLEAR BDCDATA[].
AT NEW N.
cnt = 1.
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-LIFNR'
                              WA_FINAL1-LIFNR.
perform bdc_field       using 'RF02K-BUKRS'
                              WA_FINAL1-BUKRS.
perform bdc_field       using 'RF02K-EKORG'
                              WA_FINAL1-EKORG.
perform bdc_field       using 'RF02K-KTOKK'
                              WA_FINAL1-KTOKK.
perform bdc_dynpro      using 'SAPMF02K' '0110'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-LAND1'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFA1-NAME1'
                              WA_FINAL1-NAME1.
perform bdc_field       using 'LFA1-SORTL'
                              WA_FINAL1-SORTL.
perform bdc_field       using 'LFA1-LAND1'
                              WA_FINAL1-LAND1.
perform bdc_dynpro      using 'SAPMF02K' '0120'. "ERROR CLEARED
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-KUNNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0130'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFBK-KOINH(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
ENDAT.
*ENDON.
IF WA_FINAL1-N = WA_FINAL1-M.
CONCATENATE  'LFBK-BANKS(' cnt ')'  INTO L_FNAM.
perform bdc_field       using L_FNAM
                              WA_FINAL1-BANKS.
CONCATENATE  'LFBK-BANKL(' cnt ')'  INTO L_FNAM.
perform bdc_field       using L_FNAM
                              WA_FINAL1-BANKL.
CONCATENATE  'LFBK-BANKN(' cnt ')'  INTO L_FNAM.
perform bdc_field       using L_FNAM
                              WA_FINAL1-BANKN.
CONCATENATE  'LFBK-KOINH(' cnt ')'  INTO L_FNAM.
perform bdc_field       using L_FNAM
                              WA_FINAL1-KOINH.
*ENDDO.
cnt = cnt + 1.
ENDIF.
perform bdc_dynpro      using 'SAPMF02K' '0130'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFBK-BANKS(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_dynpro      using 'SAPMF02K' '0210'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-FDGRV'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
*AT NEW LIFNR.
perform bdc_field       using 'LFB1-AKONT'
                              WA_FINAL1-AKONT.
perform bdc_field       using 'LFB1-FDGRV'
                              WA_FINAL1-FDGRV.
perform bdc_dynpro      using 'SAPMF02K' '0215'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-ZTERM'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0220'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB5-MAHNA'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0310'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFM1-WAERS'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFM1-WAERS'
                              WA_FINAL1-WAERS.
perform bdc_dynpro      using 'SAPMF02K' '0320'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02K-LIFNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
AT END OF M.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE     = 'XK01'
TABLES
DYNPROTAB = BDCDATA.
ENDAT.
CLEAR WA_FINAL1.
CLEAR WA_FINAL.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
*********************BDC ENDS***********************
       Start new screen                                              *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = PROGRAM.
  BDCDATA-DYNPRO   = DYNPRO.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.
ENDFORM.
       Insert field                                                  *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
    CLEAR BDCDATA.
    BDCDATA-FNAM = FNAM.
    BDCDATA-FVAL = FVAL.
    APPEND BDCDATA.
ENDIF.
ENDFORM.
Flat File is..
HAAA45,1000,1000,0002,NAME45,N,IN,31000,A1,USD
IIN,1000,1021,Name45
IIN,1000,1022,Name45
HAAA50,1000,1000,0002,NAME50,N,IN,31000,A1,USD
IIN,1000,1023,Name50
IIN,1000,1024,Name50

Regarding avoiding the loop I have a suggestion, though I have not tried this .
SAP help says " Using the internal table bdc_tab, you can provide any number of screens of the called transaction with input and user actions. " .
Above implies you can load all records in the itab bdc_tab when doing call transaction. Say, your bdc_tabl has 30 records for 1 pass of the transaction. You need to update 10 vendor records. You simply load up all 300 records into bdc_tab. After every 30 record loads, you simulate a 'SAVE' press in your program but do not leave the transaction. Rather you simulate the keystroke that takes you to the first screen of XK01 after the save if not aready there, and start loading up the next transaction.

Similar Messages

  • Problem while doing bdc for fv60

    Hi frends,
       I got problem while doing BDC for fv60 tcode.i have given
    header items:
    vendor number
    invoice date
    posting date
    amount
    item data:
    g/l acc no: 100000
    amount 1000 whatever
    these are all given in recording
    in recording after all giving this data if we click on park it is telling "parking not possibe duiring batch input".
    can any body tell me the process for recording shdb and after that in bdc how can we give multiple line items for fv60
    thanks,
    naveen.

    I don't think you can use FV60 in batch input. Your options are to use transaction FBV1 or bapi BAPI_INCOMINGINVOICE_PARK.
    Rob

  • Program does BDC for transaction F-52 or f-53

    Hi GuruI am functional person and working with a developer in a program . The program does BDC for transaction F-52 or f-53 . I am uploading a file ,so that the program picks it and o either F-52 or F-53 based on condition. When i try to upload the program with mulitple record ,i am getting the message difference is too large to clear . If i execute the same program without doing any changes again i can see few more records getting posted . when i do next time remaining records are posted . Insted of getting posted in one ,I have to execute the program more than once .can any one help me out why this is happening

    i think you should ask  your programmer to use transaction SM35 to process the BDC in foreground mode (first changing the mode to A). I would think you will see what's going wrong then. There are a few transactions that look different in foreground mode than in background and you will see where the difference is if you use this method to process

  • Problem while doing PGI for Returns Delivery

    Hi,
    We are facing some problem which doing PGI for a returns delivery. Our scenario is HU and WM managed. After creation of delivery I have created a TO and has two different valuation type of same material. Total quantity in TO is 2, 1 of each valuation type. So, automatically, batch split happened for the line item in delivery.
    Now when I am trying to do PGI for this delivery, I get en error message saying "Enter Valuation Type". The movement type used here is 161 (Vendor Returns)
    Same thing is happening successfully for movement type 643 (Transfer inter company code).  What I can gather is that while creating 161 document against delivery system is not automatically taking the valuation types mentioned in line item of delivery.
    Let me know possible reasons for this error and resolution.
    Regards,
    Vishal

    Implement the OSS note 965985

  • How to access CIN tab in BDC for xk01

    I am developing a program using BDC of xk01,but the CIN tab which holds PAN in this transaction is not being accessed if I run the bdc in N mode.When I am running it in A mode,upon manually clicking the CIN tab the further proceedings are working fine. Please suggest how do I automate the access for CIN tab.

    Dear Pratik Ranadive   ,
    1. Go to XK01.
    2. Go to CIN tab which holds PAN number.
    3. Check F1 details for that particular Field. Note the Program Name & Screen Number (for Batch Input)
    For eg : see the fig,
    4. Now go to your BDC report, locate the recording regarding for above fields.
    PERFORM bdc_dynpro      USING 'SAPMV45A' '4003'.
    PERFORM bdc_field          USING 'BDC_OKCODE'
                                            '=T\05'.
    Here, '=T\05' stands for Tab number 5. Count the tab number in your CIN screen. If it comes at position 6. then Change the above line of code as follows.
    PERFORM bdc_dynpro      USING 'SAPMV45A' '4003'.
    PERFORM bdc_field          USING 'BDC_OKCODE'
                                            '=T\06'.
    Regards,
    NG

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

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

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

  • I am having problem while doing vf01 for credit memo

    I have done va01 for credit memo.
    but when i m doing vf01 for credit memo it is showing account detemination error.
    pls help me.

    Hi suchinder
    Go to t.code VKOA and check wheather for the credit memo billing document type your account determination procedure  KOFI00 has been assigned or not. If not assigned assign it and then save the billing document again then it will be forwarded to FI .
    Regards
    Srinath

  • Problem in doing BDC recording for Tcode FAGLSKF

    Hi All,
    I need to make postings for Statistical key figures. For this I need to make postings using transaction FAGLSKF.
    Now my problem is that when I try to make recording for transaction FAGLSKF I could not see the values recorded for ITEM Data Table control.
    Any one having any idea as what I am missing. Your suggestions would be really helpful.
    Regards,
    Lalit

    Hi Poorna,
    Thanks a lot for the valueable feedback.
    I checked the FMs mentioned by you. These FMs make the SKF posting but these FMs do not perform any kind of validations.
    Like for example if I use tcode FAGLSKF and try to make some posting. In case I am giving some invalid input to this transaction ( e.g. wrong Statistical Key Figure Value ) , this t code does not allow us to post and immediateley thorows some error.
    Where as I use FM FAGL_FAGLSKF_PN_POST, this FM makes an entry in the table FAGLSKF_PN without any validations.
    This FM simply insert an entry to the table FAGLSKF_PN.
    Any Idea how to overcome this. I want to make the validations in the same way as done using Tcode FAGLSKF.
    Thanks a lot for your valueable inputs.
    Regards,
    Lalit

  • BDC for XK01

    Hi All,
    iam creating & updating Vendor master details through BDC  Recording  by following syntax
          DATA :lt_bdcmsgcoll1 TYPE STANDARD TABLE OF bdcmsgcoll.
          DATA opt TYPE ctu_params.
          opt-dismode = 'N'.
          opt-updmode = 'X'.
          opt-cattmode ='N'.
          opt-defsize = 'X'.
          opt-racommit ='X'.
          opt-nobinpt = 'X'.
          opt-nobiend = 'X'.
          CALL TRANSACTION 'XK01' USING bdcdata OPTIONS FROM opt
                                                 MESSAGES INTO lt_bdcmsgcoll1 .
    i have given  opt-dismode = 'N' then vendor are NOT getting created.When i give opt-dismode = 'A'  or 'E' then vendors are getting created / updating .
    can any one suggest me how to proceed ?
    regards
    Fareed

    Hi Fareed
    >
    Shaik Mohd  Fareeduddin wrote:
        opt-updmode = 'X'.
    The update mode should be either:
    A, S, L or blank.
    Please see help excerpt below:
    The UPDATE addition determines the processing mode for batch input processing. You can specify a character-type object for upd. Its possible content and its effect are displayed in the following table. Without use of one of the additions UPDATE or OPTIONS FROM, the effect is the same as if upd had the content "A".
    "A"         Asynchronous update. Updates of called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition was not specified.
    "S"         Synchronous processing. Updates of the called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition had been specified.
    "L"          Local update. Updates of the called program are executed in such a way as if the SET UPDATE TASK LOCAL statement had been executed in it.
    Kind regards,
    Robert

  • Problem while doing GR for subcontracting

    This is Naresh. When Iam posting GR for subcontracting material an error is coming as "G/L account 400020 does not exist in chart of accounts INT". And when Iam trying to create G/L account in INT with my company code(using FS00) another error is coming as " description in language EN already created". Can anyone help me.

    you have chosen a pretty bad subject.
    with this subject you will find people that have knowledge in subcontracting, but your issue is in G/L account maintenance.
    Guys that are are experienced in that field will probably not open your thread.
    best you create your thread again with a better subject and in a different forum: in the finance forum.

  • Problem while doing invoice for Credit memo request

    Hi all
    I very well known that Out boud Delivery is not needed for Credit memo request but after saving the CMR and when i raise the Credit Memo (VF01) system is showing a error message saying "PGI not done for Outbound Delivery 30047402"
    In CMR document type i have set the order related billing and i have removed the billing block also
    I have raised the CMR based on Invoice
    Kindly help me in this regard
    Regards
    BMS

    Hi Raj Aryan Malhotra, Thanks for ur reply
    The setting which u said are already there
    The second one that is, change the copying requirement of header to 11. i did this but this time the message was different "The document is not relevant for billing" . After checking the log i could the follwoing info
    Client                                                   240
    Group Number
    Sales Document Number
    Item Number of the SD Document         000000
    Schedule Line Number                         0016
    Counter in Control Tables                     00
    Message Identification                         VF
    System Message Number                    016
    Output Type                                        I
    Message Variable 01
    Message Variable 02
    Message Variable 03
    Message Variable 04
    Group Type                                         F
    Kindly help me to resolve this also
    Regards
    BMS

  • BDC for ME22n vendor confirmation

    i am facing problem while doing BDC for ME22N . i am going for itemwise vendor confirmation.
    for first line item it is happening. but for 2nd line item it is not going.
    any help?
    this is my code. i guess some loop i have to add but where? can any body give idea?
    REPORT  ZMM_VC_UPLOAD.
    TABLES :  t100.
           Internal table declaration                                    *
    DATA : BEGIN OF it_upload OCCURS 0,
                  index(4),      "Index
                  EBELN(10),     "PO number
                 EBELP(5),      "line item PO
                  LIST(1),       "item number
                  BSTAE(4),      "Confirmation control key
                  EBTYP(2),      "Confirmation Category
                 BSTAE(4),      "Confirmation control key
                  LPEIN(1),      "Category of delivery date
                  EEIND(10),     "delivery date
                  MENGE(13),     "QTY Quantity as per vendor confirmation
                  XBLNR(20),     "ext doc
                  ERDAT(10),     "doc date
                  er_message(100),
           END OF it_upload.
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
          MSGDATA LIKE BDCMSGCOLL  OCCURS 0 WITH HEADER LINE.
    *Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER: P_FILE LIKE IBIPPARMS-PATH OBLIGATORY.  "to select a file.
    SELECTION-SCREEN END OF BLOCK B1.
    *Initialization
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE .
      PERFORM GET_FILENAME.
    start-of-selection
    START-OF-SELECTION.
      PERFORM MAKE_FILE_NAME .
      PERFORM UPLOAD_FILE.
        PERFORM BDC_PROCESS.
    perform read_messages.
    *&      Form  UPLOAD_FILE
    FORM UPLOAD_FILE .
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          FILENAME                = P_FILE
          FILETYPE                = 'DAT'
        TABLES
          DATA_TAB                = IT_UPLOAD .
            IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " UPLOAD_FILE
    *&      Form  bdc_process
    FORM BDC_PROCESS .
    loop at it_upload.
    LOOP AT IT_header.
    refresh bdcdata.
      perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MECHOB'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'DYN_6000-LIST'
                                  it_upload-list.    "'   1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO1319-MATKL'.
    perform bdc_field       using 'MEPO1319-SPINF'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MEOK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO_SELECT-EBELN'.
    perform bdc_field       using 'MEPO_SELECT-EBELN'
                                  it_upload-EBELN.              "'4500195517'.
    perform bdc_field       using 'MEPO_SELECT-BSTYP_F'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TABIDT14'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO_TOPLINE-BSART'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'DYN_6000-LIST'
                                  it_upload-list.    "'   1'.
    perform bdc_field       using 'MEPO1319-SPINF'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'             "first time
                                  '/00'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'DYN_6000-LIST'
                                 it_upload-list.    " '   1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO1334-BSTAE'.
    perform bdc_field       using 'MEPO1334-BSTAE'
                                  it_upload-BSTAE  .                "'0005'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    *loop at it_item where ebeln = it_upload-ebeln.
    perform bdc_field       using 'BDC_CURSOR'
                                  'DYN_6000-LIST'.
    perform bdc_field       using 'DYN_6000-LIST'
                                  it_upload-list.    "'   1'.
    perform bdc_field       using 'MEPO1334-BSTAE'
                                  it_upload-BSTAE.                 "'0005'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKES-ERDAT(01)'.
    perform bdc_field       using 'EKES-EBTYP(01)'
                                  it_upload-EBTYP.                 "'vc'.
    perform bdc_field       using 'RM06E-LPEIN(01)'
                                  it_upload-LPEIN.                 "'D'.
    perform bdc_field       using 'RM06E-EEIND(01)'
                                  it_upload-EEIND.                 "'15.02.2009'.
    perform bdc_field       using 'EKES-MENGE(01)'
                                  it_upload-MENGE.                 "'10'.
    perform bdc_field       using 'EKES-XBLNR(01)'
                                  it_upload-XBLNR.                 "'inv 9'.
    perform bdc_field       using 'EKES-ERDAT(01)'
                                  it_upload-ERDAT.                 "'15.02.2009'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MESAVE'.
    CALL TRANSACTION 'ME22N' USING BDCDATA MODE 'A' UPDATE 'A' MESSAGES INTO MSGDATA. 
        CLEAR: BDCDATA,BDCDATA[].
        refresh BDCDATA.
      ENDLOOP.
    ENDFORM.                    " bdc_process
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      IF FVAL <> ''.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.                    "BDC_FIELD
    *To get file name                                                      *
    FORM GET_FILENAME .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
        IMPORTING
          FILE_NAME     = P_FILE.
      IF SY-SUBRC NE 0  .
        WRITE : / 'Enter File Name'.
      ENDIF.
    ENDFORM.                    "GET_FILENAME

    Hi Dude,
      When ur looping the item information , in your code ur
    loop at it_item where ebeln = it_upload-ebeln.
    perform bdc_field using 'BDC_CURSOR'
    'DYN_6000-LIST'.
    perform bdc_field using 'DYN_6000-LIST'
    it_upload-list. "' 1'.
    perform bdc_field using 'MEPO1334-BSTAE'
    it_upload-BSTAE. "'0005'.
    perform bdc_field using 'BDC_CURSOR'
    'EKES-ERDAT(01)'.
    perform bdc_field using 'EKES-EBTYP(01)'
    it_upload-EBTYP. "'vc'.
    perform bdc_field using 'RM06E-LPEIN(01)'
    it_upload-LPEIN. "'D'.
    perform bdc_field using 'RM06E-EEIND(01)'
    it_upload-EEIND. "'15.02.2009'.
    perform bdc_field using 'EKES-MENGE(01)'
    it_upload-MENGE. "'10'.
    perform bdc_field using 'EKES-XBLNR(01)'
    it_upload-XBLNR. "'inv 9'.
    perform bdc_field using 'EKES-ERDAT(01)'
    it_upload-ERDAT. "'15.02.2009'.
    perform bdc_dynpro using 'SAPLMEGUI' '0014'.
    perform bdc_field using 'BDC_OKCODE'
    '=MESAVE'.
    ->(01) you have to replace to variable , and every loop pass increment the varialbe value with 1.
    ex : -
    V1 = 1.
    loop at item.
    perform bdc_data using 'xyz(V1)' 
                                   it_upload-variable.
    V1 = V1 + 1.
    endloop.
    This is called as index , the table control fields are differ the field name by index only...

  • Problem in BDC for CA02

    hello all,
             i am doing BDC for change routing (ca02) transaction.
    in that my need is to assign PRT allocation for operations.
    i have written a program for it but if suppose for a particlular operation i want to assign PRT and if there are no PRT assigned for that particular operation before that recording fails.and if already there is atleast one PRT assigned to that operation it runs fine. so i want to remove this error.for that may be i shd first record tha no of PRTS on screen and save that in particular counter and if suppose its greater than 0 then it will run the code and if not it will escape.
                    I know some of u will not understand the problem..in that case i have all screen shots and program ready for it ....plz send u r mail address to me and i will send u my problem with  all details on u r mail id.waiting for quick reply.
    Edited by: abhijeet shastri on Feb 5, 2008 9:01 AM

    hi,
    Here you have to take 2 perform statements, one is for PRT and another one is for without PRT
    After populating the input internal table, need check whether the particuler operation is having PRT values or not.
    if PRT values are available then go for PRT screen (Perform statement for PRT values).
    if not PRT values are available then go for not PRT screen.
    If the PRT screen is depedable on process operation values.
    then you have to make prevalidation . in prevalidation the appropriate operation containing any values for the same then call perform statement for the same. else skip that session through coding.
    Ask to your functional consultant regarding tables (In which table you will PRT screen values based on process operation fields) for PRT pre validation.
    I hope this message will clear your doubt
    Regards,
    Sreenivasa Babu

  • Problem in bdc for MB01

    We have developed a bdc for t-code MB01.  We want to genreate material documents in background.  For some reasons we are not in a position to use BAPI for MIGO (as we are not able to input data of two fields).  we are on ECC 6.0
    BDC for MB01 is working fine.  Only thing is we want to input "Goods recipient" also in this bdc.  But we are not able to find this field in MB01.  is it possible to get goods recipient also in MB01?  how to do it?
    Also is there any problem in using bdc for MB01 instead of MIGO?

    Hello,
    try LSMW with Object 0110 - Material movement.
    You can develop standard LSMW for this object in half an hour.
    Andrzej

  • BDC for every 80 records

    Dear All,
    I have one typical BDC problem.
    If the number of records in file are crossing 80,my bdc is giving problem. So I need to split total records into sets of 80 and submit them.
    So I need to create the session name dynamically, pass the data dynamically.
    IF you can send some example code for the above it will be great help for me.
    Many Thanks,
    Ranjan

    Please find my code..
    This info may be useful..
    I'm doing BDC for KB31N tcode,where i have two items in header(doc date, posting date).Multiple line items(each line item should consists of 4 fields namely cost center,statistical key figure,total qty,text).
    When i'm sending more than 80 rec records i'm being populated an error message "BDC_Close_group, session not opened"
    Kindly advice me how to handle this
    *& Report  ZCO_I025_WSKAZNIKI_STAT_DEV                                 *
    *& Interfejs wczytywania wskaŸników statystycznych                     *
    REPORT  zco_i025_wskazniki_stat_dev                                 .
    TYPES: BEGIN OF l_tab_dane,
        indic LIKE rk23f-stagr,
        quant LIKE rk23f-mbgbtr,
        mpk LIKE rk23f-ekostl,
        order LIKE rk23f-eaufnr,
        text LIKE rk23f-sgtxt,
      END OF l_tab_dane.
    DATA: it_excel TYPE TABLE OF alsmex_tabline,
      wa_excel TYPE alsmex_tabline,
      it_data TYPE TABLE OF l_tab_dane,
      wa_data TYPE l_tab_dane,
      error  TYPE C,
      msg TYPE string.
    DATA:iv_pole TYPE string,
      ddatum(10),
      kdatum(10),
    *Inserted By  Developer
       filelist    TYPE filetable,
            rc          TYPE i.
    DATA: BEGIN OF bdctab OCCURS 5.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdctab.
    SELECTION-SCREEN BEGIN OF BLOCK p1 WITH FRAME TITLE text-001.
    PARAMETERS:
      p_zakla LIKE tka01-kokrs DEFAULT '1000',
      p_ddate LIKE sy-datum DEFAULT sy-datum,
      p_kdate LIKE sy-datum DEFAULT sy-datum.
    SELECTION-SCREEN ULINE.
    PARAMETERS:
      p_fname LIKE rlgrap-filename.  " DEFAULT 'd:dane.xls'.
    SELECTION-SCREEN END OF BLOCK p1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          file_filter       = cl_gui_frontend_services=>filetype_excel
         multiselection    = 'X'
        CHANGING
          file_table        = filelist
          rc                = rc.
      IF LINES( filelist ) IS INITIAL.
        EXIT.
      ENDIF.
      READ TABLE filelist INDEX 1 INTO p_fname.
    START-OF-SELECTION.
    AUTHORITY-CHECK OBJECT 'TKA01'
      ID 'KOKRS' FIELD p_zakla.
    CONCATENATE p_ddate6(2) '.' p_ddate4(2) '.' p_ddate(4) INTO ddatum.
    CONCATENATE p_kdate6(2) '.' p_kdate4(2) '.' p_kdate(4) INTO kdatum.
    error = '0'.
    PERFORM wczytaj_dane.
    IF error = '0'.
      PERFORM utworz_sesje.
      PERFORM wprowadz_dane.
        PERFORM zamknij_sesje.   "comment by prav
    ENDIF.
    PERFORM zamknij_sesje.        "add by prav
    IF error = '1'.
      WRITE: msg, /.
    ENDIF.
    WRITE: 'Wykonano', /.
    *&      Form  wczytaj_dane
          text
    FORM wczytaj_dane.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_fname
          i_begin_col             = 1
          i_begin_row             = 1
          i_end_col               = 8
          i_end_row               = 65000
        TABLES
          intern                  = it_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE: / 'B³ad importu pliku wejsciowego: ', p_fname, ' - ',
        sy-subrc.
      ELSE.
        SORT it_excel BY row col.
        LOOP AT it_excel INTO wa_excel.
          IF wa_excel-row = 1.
            CONTINUE.
          ENDIF.
          iv_pole = wa_excel-value.
          CASE wa_excel-col.
            WHEN 1. wa_data-indic = iv_pole.
            WHEN 2.
              REPLACE ',' WITH '.' INTO iv_pole.
              wa_data-quant = iv_pole.
            WHEN 3. wa_data-mpk = iv_pole.
            WHEN 4. wa_data-order = iv_pole.
            WHEN 5. wa_data-text = iv_pole.
          ENDCASE.
          AT END OF row.
            IF wa_data-mpk IS INITIAL AND wa_data-order IS INITIAL.
              error = '1'.
              WRITE:
    'Musi byæ podane Stanowisko kosztów lub Zlecenie wewnêtrzne. Rekord: ',
              wa_excel-row, /.
              EXIT.
            ENDIF.
            IF wa_data-mpk IS NOT INITIAL AND wa_data-order IS NOT INITIAL.
              error = '1'.
              WRITE:
    'Musi byæ podane Stanowisko kosztów lub Zlecenie wewnêtrzne. Rekord: ',
              wa_excel-row, /.
              EXIT.
            ENDIF.
            IF wa_data-indic IS INITIAL.
              error = '1'.
              WRITE: 'Brak identyfikatora wskaŸnika. Rekord: ', wa_excel-row
              EXIT.
            ENDIF.
            IF wa_data-quant IS INITIAL.
              error = '1'.
              WRITE: 'Brak informacji o iloœci. Rekord: ', wa_excel-row, /.
              EXIT.
            ENDIF.
            APPEND wa_data TO it_data.
            CLEAR wa_data.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "wczytaj_dane
    *&      Form  wprowadz_dane
          text
    FORM wprowadz_dane.
      DATA:licznik TYPE i,
        l_txt TYPE string,
        pole(30) TYPE c,
        liczba(15) TYPE c.
      PERFORM bdc_dynpro      USING 'SAPLSPO4' '0300'.
      PERFORM bdc_field       USING 'BDC_CURSOR' 'SVALD-VALUE(01)'.
      PERFORM bdc_field       USING 'BDC_OKCODE' '=FURT'.
      PERFORM bdc_field       USING 'SVALD-VALUE(01)' p_zakla.
      PERFORM bdc_dynpro      USING 'SAPLK23F1' '1200'.
      PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
      PERFORM bdc_field       USING 'COHEADER-SEND_REC_REL' '03SAP'.
      PERFORM bdc_field       USING 'RK23F-STATUS' 'L'.
      PERFORM bdc_field       USING 'COHEADER-BLDAT' ddatum.
      PERFORM bdc_field       USING 'COHEADER-BUDAT' kdatum.
      PERFORM bdc_field       USING 'BDC_CURSOR' 'EKOSTL(1)'.
      licznik = 0.
      LOOP AT it_data into wa_data.
        ADD 1 TO licznik.
        l_txt = licznik.
        CONCATENATE 'EL4(' l_txt ')' INTO pole.
        condense pole no-gaps.
        PERFORM bdc_field USING pole wa_data-indic.
        CONCATENATE 'ELR1(' l_txt ')' INTO pole.
           condense pole no-gaps.
          liczba = wa_data-quant.
          if liczba <  0.
              shift liczba circular  left up to '-'.
          endif.
            condense liczba no-gaps.
        PERFORM bdc_field USING pole liczba.
        IF NOT wa_data-mpk IS INITIAL.
          CONCATENATE 'EL2(' l_txt ')' INTO pole.
             condense pole no-gaps.
          PERFORM bdc_field USING pole wa_data-mpk.
        ENDIF.
        IF NOT wa_data-order IS INITIAL.
          CONCATENATE 'EL3(' l_txt ')' INTO pole.
             condense pole no-gaps.
          PERFORM bdc_field USING pole wa_data-order.
        ENDIF.
        CONCATENATE 'EL8(' l_txt ')' INTO pole.
           condense pole no-gaps.
        PERFORM bdc_field USING pole wa_data-text.
      ENDLOOP.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode            = 'KB31N'
        TABLES
          dynprotab        = bdctab
        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.
        WRITE: / text-010 .
      ENDIF.
      REFRESH bdctab.
    clear:bdctab.        "by praveen
    ENDFORM.                    "wprowadz_dane
    *&      Form  bdc_dynpro
          text
         -->PROGRAM    text
         -->DYNPRO     text
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdctab.
      MOVE:
        program   TO bdctab-program,
        dynpro    TO bdctab-dynpro,
        'X'       TO bdctab-dynbegin.
      APPEND bdctab.
    ENDFORM.                    "bdc_dynpro
    *&      Form  bdc_field
          text
         -->POLE       text
         -->WARTOSC    text
    FORM bdc_field USING pole wartosc.
      CLEAR bdctab.
      MOVE:
        pole     TO bdctab-fnam,
        wartosc  TO bdctab-fval.
      APPEND bdctab.
    ENDFORM.                    "bdc_field
    *&      Form  utworz_sesje
          text
    FORM utworz_sesje.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = 'WSKASTAT'
          user   = sy-uname
          keep   = 'X'.
    ENDFORM.                    "utworz_sesje
    *&      Form  zamknij_sesje
          text
    FORM zamknij_sesje.
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
      IF sy-subrc NE 0.
        WRITE: /, 'B³ad podczas zamykania sesji'.
        EXIT.
      ENDIF.
    ENDFORM.                    "zamknij_sesje

Maybe you are looking for