Bulk GR posting through BDC from table control - Multiple GRs posted

Hi all,
I have a GR interface which is actually a module pool screen containing a table control.Where i give the users an option to select multiple rows and click on a button called 'POST' and i use the contents of the ITAB connected to the table control to fire a BDC on 'POST'' s click.i use a field gate entry no as the primary key and controller of operations in my app.
Now, The issue i am facing is that once in 500 entries that the user posts. there is a case of multiple GR's being posted in the system.cud not trace it why is it happening.
Can any one help me out on this.
Eagerly Waiting,
Sachin Soni

any one.please let me knw if i am unclear anywhr

Similar Messages

  • Field is not populating in BDC from Table Control value????

    Hi Experts,
    After adding a new Quantity (MY_QUANTITY) field to the existing Table control, I populated the data from SAP into it.
    Now, the user will change (if he wants) its value, then he clicks the Push Button by expecting the posting of the Document i.e.in other words. the Control encounters the statement of MY_FORM_CREATE_ABAVN_VIA_BDC in my Prog.
    But, MY_QUANTITY (changed, even not changed too) value/s is not passing in to my BDC_DATA table/code?
    I am doing BDC for ABAVN transaction and wanting the Quantity filed of ''Partial Retirement'' tab to b populated in BDC. So, I am using as,
    SAPLAMDP--Screen 100--Field as ANLA-MENGE (its a Subscreen/Tabs of SAP Screen)
    So,
    1) Problem is with my BDC code?
    2) or, ''SAPLAMDP--Screen 100--Field as ANLA-MENGE'' is this wrong?
    3) or else any other?
    Message was edited by:
            Sridhar
    Message was edited by:
            Sridhar
    Message was edited by:
            Sridhar

    Hai sridhar,
    The problem is within the BDC  Code.
    Because For the effect of adding the field there is no correspong change in bdc is done.So record one more time use the latest one(After adding the field)
    Hope this helps you.
    Regds,
    Rama.Pammi

  • How to create bdc with table control

    hi all.
    please some body tell me how to create bdc with table control
    or suggest any www with screen shots
    thanks in advance ,
    aparna

    Hi AParna,
    Its very Simple.
    ALl you have to do is set up a counter based on the number of lines in the tabke. when the counter reaches the number of lines in the table hit the next page button which is at the top of every screen in SAP.
    Please refer to the following BDC program I had developed using Table control,
    this is for ME01 transaction.
      LOOP AT T_EORD_HED.
        SELECT SINGLE * FROM MARA WHERE MATNR = T_EORD_HED-MATNR.
        IF SY-SUBRC = 0.
          PERFORM BDC_DYNPRO      USING 'SAPLMEOR' '0200'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EORD-MATNR'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM BDC_FIELD       USING 'EORD-MATNR'
                                        T_EORD_HED-MATNR.       "'58335'.
          PERFORM BDC_FIELD       USING 'EORD-WERKS'
                                        T_EORD_HED-WERKS.       "'0253'.
          L_COUNT = 1.
          LOOP AT T_EORD WHERE MATNR = T_EORD_HED-MATNR
                           AND WERKS = T_EORD_HED-WERKS.
            SELECT SINGLE * FROM LFA1 WHERE LIFNR = T_EORD-LIFNR.
            IF SY-SUBRC = 0.
    * Look into the if condition below
              IF L_COUNT = 010.
                L_COUNT = 1.
                PERFORM BDC_DYNPRO      USING 'SAPLMEOR' '0205'.
                PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'EORD-MATNR'.
                PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                       '=NS'.
                L_COUNT = L_COUNT + 1.
              ENDIF.
              PERFORM BDC_DYNPRO      USING 'SAPLMEOR' '0205'.
              PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                            'EORD-AUTET(01)'.
              PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                            '/00'.
              CONCATENATE 'EORD-VDATU' '(' L_COUNT ')' INTO OPR_FIELD.
              WRITE SY-DATUM TO T_EORD-VDATU.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            T_EORD-VDATU.
              CONCATENATE 'EORD-BDATU' '(' L_COUNT ')' INTO OPR_FIELD.
              WRITE T_EORD-BDATU TO V_BDATU.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            V_BDATU.
              CONCATENATE 'EORD-LIFNR' '(' L_COUNT ')' INTO OPR_FIELD.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            T_EORD-LIFNR.
              CONCATENATE 'EORD-EKORG' '(' L_COUNT ')' INTO OPR_FIELD.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            '0001'.
              CONCATENATE 'EORD-RESWK' '(' L_COUNT ')' INTO OPR_FIELD.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            T_EORD-RESWK.
              WRITE T_EORD-MEINS TO V_MEINS.
              CONCATENATE 'EORD-MEINS' '(' L_COUNT ')' INTO OPR_FIELD.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            V_MEINS.
    *          CONCATENATE 'EORD-EBELN' '(' L_COUNT ')' INTO OPR_FIELD.
    *          PERFORM BDC_FIELD       USING 'OPR_FIELD'
    *                                        T_EORD-EBELN.
              CONCATENATE 'EORD-EBELP' '(' L_COUNT ')' INTO OPR_FIELD.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            T_EORD-EBELP.
              IF T_EORD-FLIFN NE SPACE OR T_EORD-FRESW NE SPACE OR
                 T_EORD-FEBEL NE SPACE.
                CONCATENATE 'RM06W-FESKZ' '(' L_COUNT ')' INTO OPR1_FIELD.
                PERFORM BDC_FIELD       USING OPR1_FIELD
                                              'X'.
              ENDIF.
              IF T_EORD-NOTKZ <> ''.
                CONCATENATE 'EORD-NOTKZ' '(' L_COUNT ')' INTO OPR_FIELD.
                PERFORM BDC_FIELD       USING OPR_FIELD
                                              'X'.
              ENDIF.
              CONCATENATE 'EORD-AUTET' '(' L_COUNT ')' INTO OPR_FIELD.
              PERFORM BDC_FIELD       USING OPR_FIELD
                                            T_EORD-AUTET.
              L_COUNT = L_COUNT + 1.
            ENDIF.
          ENDLOOP.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EORD-MATNR'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '=BU'.
          CALL TRANSACTION 'ME01' USING I_BDCDATA
                        MODE UP_MODE
    *                     optIONS  FROM l_opt
                        MESSAGES INTO I_BDCMSGCOLL.
          PERFORM FORMAT_OUTPUT.
        ENDIF.
      ENDLOOP.

  • Deleting the values from table control

    HI,
    I need to remove the selected line from the Table control on my screen.
    The point is that the Internal table does not have any records,.
    for example in the Customer Create screen,
    while entering the bank details we will enter it in a tbale contraol.
    but the records doesnt exist in the database. but the record gets deleted from the table control only if we press delete button.
    please guide me.
    please note : I want to delete the record from Table Control on the screen and I dont have any corresponding database records..
    regards

    Hi..
    The solution to your problem - deleting values from table control.
    Here: it_wizard is the internal table which is holding the value of table control.
             wa_wizard is the work are of the internal table it_wizard.
             it_delete is the internal table which holds the deleted record of table control.
             wa_delete is the work area of the internal table it_delete
    Also here the field ZSEL is the character field which is used to select the entire record in the table control.
    LOOP AT it_wizard into wa_wizard WHERE zsel = 'X'.
           MOVE-CORRESPONDING wa_wizard TO wa_delete.
           APPEND wa_delete TO it_delete.
           delete table it_wizard from wa_wizard.
    DELETE  FROM zfin_goods WHERE ZFG = WA_delete-ZFG.
    ENDLOOP
    if sy-subrc eq 0.
    Message 'Delete Successful' type 'S'.
    endif.
    The above code will delete the record from both the table control.internal table and the database table.
    I think this will help you to great extent.
    Ward regards,
    Bhuvaneswari
    Edited by: BHUVANESWARI THIRUNAVUKKARASU on Jan 7, 2009 10:39 AM

  • Remove vertical scroll bar from table control

    hi,
    i had used table control in my application. i want remove vertical scroll bar from table control.
    At initial time in table control there is no vertical scroll bar. In my table control lines are dependent on internal table which i was used to fill it.
    i was used these code for to set table control lines.
    DESCRIBE TABLE IT_RISK_ZINRISEXC LINES EXC_LINE.
    TC_RISK_EX-LINES =   EXC_LINE .
    Initially there is no data in internal table so there is no vertical scroll bar. After getting value i am filling internal table. and there is scroll bar in my table control. but i does not want that.
    i was not selected RESIZING-VERTICAL OR -HORIZONTAL.

    Hi,
    From Scroll Bars in Table Control
    You can remove the scroll bar in the table control by switching off horizontal and vertical scrolling in the properties of the table control. The properties can be accessed from the screen painter by double clicking on the table control. Regarding the page up and page down functions, I believe you add those buttons in the screen layout and code for them. You can use the standard function code for the page up and page down functions.
    or
    You can get rid of the vertical scroll bars by not setting table control lines. This way the user can only see the visible lines of the table control. As for the horizontal scrollbar, just make sure that your table control doesn't contain too many fields.
    Regards,
    Raj.

  • Sample pgm for moving data from table control to internal table

    Hi Experts,
          I am newbi to ABAP. I don't have good material for Table control . Appreciate if you direct me to some good source of knowledge on Table control.
    The problem at hand : I am trying to move info/data from table control (in screen painter/ input and output mode ) to ITAB but couldn't . Sample pgm if possible.
    <b>Modify ITAB index TC-Current_Line .</b>
    The above statement is not inserting new lines to ITAB . Help me!
    Thanks for your time

    hi,
    do like this...
    <b>PROCESS AFTER INPUT.</b>
    *&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'
      LOOP AT itab_det.
        CHAIN.
         FIELD itab_det-comp_code.
          FIELD itab_det-bill_no.
          FIELD itab_det-bill_date.
          FIELD itab_det-vend_cust_code.
          FIELD itab_det-bill_amt.
          MODULE <b>tab1_modify</b> ON CHAIN-REQUEST.
        ENDCHAIN.
        FIELD itab_det-mark
          MODULE tab1_mark ON REQUEST.
      ENDLOOP.
    <b>MODULE tab1_modify INPUT.</b>
      APPEND itab_det.
    <b>ENDMODULE.                    "TAB1_MODIFY INPUT</b>

  • How to save the selected records from Table control in dialog programming

    Hiiiiiiii Every1
    Actually the problem is like this:-
    I have to select some records from table control and then want to save the selected records in DB table.
    Example
    I have some rows having inforamtion bout employees...
    Now what i want is that when i click on 'SAVE' button then these selected rows should be moved into DB table.
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    SELECT * FROM spfli INTO TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
        WHEN 'INSERT'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              itab1 = itab.
              modify itab1.
            ENDLOOP.
          ENDIF.
          if not itab1 is initial.
            INSERT dbtab FROM TABLE itab1.
          endif.
      ENDCASE.
    ENDMODULE.

  • Take input from table control using wizard

    Dear experts,
    I am trying to take data from table control into internal table using wizard.
    In main report program i defined the internal table and used wizard after  that.
    I could see internal table there and i picked the fields i wanted.
    Also i defined a workarea of same time.Further i made a push button.
    In PAI user command module i specified
    loop at itab. (one used for table control data)
    endloop.
    Here i put break point and find that no data is coming from grid.
    With wizard what additional i have to do ?

    Hi
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_2209.  "do processing
    loop at itab.
       module UPDATE.                           "read from tbl ctl into db table using wa.
    endloop.
    DATA:   itab TYPE TABLE OF YSTUDENT WITH HEADER LINE,
                WA LIKE LINE OF ITAB.
    MODULE UPDATE INPUT.
    WA-ID = YSTUDENT-ID.
    WA-NAME = YSTUDENT-NAME.
    INSERT YSTUDENT FROM WA.  
    ENDMODULE.
    Instead of Insert into table, you can write: APPEND WA TO ITAB.    
    Also YSTUDENT-ID is the name of the column in your tbl ctrl.
    Make sure your PBO also loops thro the itab:
    loop at itab with control tab1.
    endloop.
    Hope this helps
    Regards,
    Jayanthi.K

  • Can I have multiple graphs from tables of multiple reports?

    Hi!
    I want to design a custom dashboard that contains multiple graphs but these graphs are coming from tables of multiple reports. It is like displaying multiple graphs that are coming from different tables. Is this possible? How?
    Thanks.

    Hi
    *Play all resp one chapter at a time*
    Play All Button
    1. There are NO - Play All - button in any version of iDVD
    2. It can be faked in several ways
    • Easies and most fault proof way is to make a doublet movie containing All and with
    Chapters set to match. It will take up x2 space but is easy to understand and produce.
    • It's said that one can put all movies into a Photo/SlideShow and this will also
    give the function of a Play All button - Never tested though.
    Mike Evangelist1
    You might be able to get close to what you want by using a slideshow in iDVD. (It's not widely known, but you can put videos in a slideshow.) If you set the slide duration to manual, playback will pause after each movie/slide, and you can continue with the 'next' button.
    3. Using another program to do this eg. Roxio Toast™ where there ia a Play All button option.
    Yours Bengt W

  • How to delete record from table control in BDC?

    Hello friends,
    I am running a BDC program to delete records.
    I have file with following records and i got these records into t_itab.
    Material     Plant     Start date     End date     Cost
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100004     S002     09/01/2008     09/31/2008     56.00
    MQ100008     S003     09/01/2008     09/31/2008     57.00
    Now, I have BDC transaction in which table control screen which contains following structure.
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100002     S002     09/01/2008     09/31/2008     56.00
    MQ100004     S003     09/01/2008     09/31/2008     47.00     
    MQ100005     S004     09/01/2008     09/31/2008     25.00
    MQ100006     S012     09/01/2008     09/31/2008     76.00
    MQ100007     S033     09/01/2008     09/31/2008     17.00
    MQ100008     S011     09/01/2008     09/31/2008     95.00
    MQ100009     S002     09/01/2008     09/31/2008     46.00
    I have recorded from SHDB in which first record will be delete.
    So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
    it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
    Which i don't want to.
    Is there any facility in BDC to put records on top which i want to delete?
    Please guide me.
    Regards,
    RH

    Hi,
    While doing recording check for Filter button available for the table control, if it available then do the recording for the same.
    Once it is done while passing the data from internal table put the value into Filter field.
    Hope it resolves your issue.
    Thanks & Regards.
    Nagaraj Kalbavi

  • How to delete record from table control using BDC?

    Hello friends,
    I am running a BDC program to delete records.
    I have file with following records and i got these records into t_itab.
    Material     Plant     Start date     End date     Cost
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100004     S002     09/01/2008     09/31/2008     56.00
    MQ100008     S003     09/01/2008     09/31/2008     57.00
    Now, I have BDC transaction in which table control screen which contains following structure.
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100002     S002     09/01/2008     09/31/2008     56.00
    MQ100004     S003     09/01/2008     09/31/2008     47.00     
    MQ100005     S004     09/01/2008     09/31/2008     25.00
    MQ100006     S012     09/01/2008     09/31/2008     76.00
    MQ100007     S033     09/01/2008     09/31/2008     17.00
    MQ100008     S011     09/01/2008     09/31/2008     95.00
    MQ100009     S002     09/01/2008     09/31/2008     46.00
    I have recorded from SHDB in which first record will be delete.
    So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
    it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
    Which i don't want to.
    Is there any facility in BDC to put records on top which i want to delete?
    Please guide me.
    Regards,
    RH

    One option is to identify the table and find out the location as the number of row which should be deleted from the table and then in the bdc program instead of postioning the cursor on the row 1(using the statement perform bdc_cursor ....(01)), replace the 01 with the row number.
    Second option is that if a filter control is available for the table control, then filter the data each and every time with the material number to be deleted and then delete the first row.
    Regards
    Farzan

  • How to read the field value from Table Control

    Hello Experts,
    I am creating my first Table Control Screen. Basically I have to create a screen (102) with a table control which has 2 fields: A_QTY, B_QTY and 2 Buttons: SAVE, EXIT.
    When Clicked on 'SAVE' the data (MATNR) from a previous screen (101)  and the data (A_QTY, B_QTY) from the new screen (102) should be saved into a Z-table.
    Internal table t_data has 3 fields.
    MATNR
    A_QTY
    B_QTY.
    Table Control TC_RACK was declared like this:
    controls tc_rack type tableview using screen 0102.
    I/0 Fields:
    A_QTY type ZQTY.
    B_QTY type ZQTY.
    The screen Flow Logic:
    process before output.
    module status_0102.
      loop at t_data into w_data with control tc_rack.
      endloop.
    process after input.
      module exit_0102 at exit-command.
      loop at tc_rack.
      endloop.
    module user_command_0102.
    module status_0102output.
      set pf-status 'STATUS_102'.
      set titlebar 'TITLE_102'.
      describe table t_rack lines tc_rack-lines.
    endmodule.                 "status_0102 output
    process after input.
    module user_command_0615 input.
    case ok_code.
       when 'SAVE_RK'.
       when others.
    endcase.
    endmodule.                 "user_command_0102 input
    Now for eg, when the users enter values for A_QTY and B_QTY like this:
    A_QTY     B_QTY
    1000         2000
    3000         4000
    How can I read these values and pass them to T_DATA so that I can save it into Z-table?
    I greatly appreciate your help.
    I've gone through some previously posted threads and could not understand because my knowledge in this area is preliminary.
    Thanks a lot.
    Could you please let me know
    Edited by: dev a on Jan 13, 2010 2:46 PM

    Hi dev a
    You should use
      DATA: lv_name(30) TYPE c.
      FIELD-SYMBOLS: <QTY> type ZQTY.
    GET CURSOR FIELD lv_name.   "Get the field name in table control
    check sy-subrc = 0.
    assign  (lv_name) to <QTY>.  "Here you get the value in <QTY>
    check sy-subrc = 0.
    Also use <your table control>-current_line to get the table index uo're currently on.
    Hint: Do not use GET CURSOR LINE if you want to get table index since this gives you the line relative to dialog screen
    Good luck
    Dean Q.
    Edited by: Dean Q on Jan 13, 2010 11:11 PM

  • Problem in bdc for table control for line items

    Hi experts,
    I am runnig a bdc for ME52.
    i am just entering PR number, in the second screen i have got all the line items. I need to select these line item 10 and double click or hit enter, it takes me to screen 3, there im just checking a checkbox and saving.
    Again i need to select the line item 20 and double click or hit enter. again the same process.
    Again repeat for all the line items.
    But my problem is it is updating everytime for only line item  10. for line item 20 and others it say "no chnge in the data".
    I am pasting my code here. please check and revert me back .plz.
    DATA: w_output LIKE LINE OF i_output.
      REFRESH I_ITAB[].
      SELECT * FROM EBAN
               INTO TABLE i_itab
               WHERE banfn in s_banfn AND
                     bsart in s_bsart AND
                     bstyp in s_bstyp AND
                     matnr in s_matnr AND
                     werks in s_werks AND
                     lfdat in s_lfdat AND
                     pstyp in s_pstyp AND
                     knttp in s_knttp AND
                     estkz in s_estkz AND
                     loekz eq ' '.
      IF sy-subrc = 0.
        CLEAR: w_itab,
                 i_poitab[].
        SORT i_itab by banfn.
        LOOP AT i_itab INTO w_itab where menge GT eban-bsmng.
          IF p_close = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = 'X'.
              w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = ' '.
              w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_close = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
      LOOP AT i_poitab into w_output.
        APPEND w_output to i_output.
       PERFORM CALL_BDC.
      endloop.
    IF p_rep = 'X'.
    PERFORM CALL_BDC.
    ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  CALL_BDC
          text
    -->  p1        text
    <--  p2        text
    FORM CALL_BDC.
    DATA: seltab(5) TYPE N,
          seltab1(2) TYPE N,
          tempvar(30) TYPE N,
          cnt TYPE N.
    LOOP AT i_output.
    clear: seltab,
           seltab1.
    seltab = i_output-bnfpo.
    seltab1 = seltab+2(2).
    perform bdc_dynpro      using 'SAPMM06B' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-BANFN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EBAN-BANFN'
                                  i_output-banfn.
    perform bdc_dynpro      using 'SAPMM06B' '0106'.
    clear tempvar.
    *cnt = 1.
    concatenate 'EBAN-BNFPO(' seltab1 ')' into tempvar.
    perform bdc_field       using 'BDC_CURSOR'
                                 'EBAN-BNFPO(seltab1)'.
                                    tempvar.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DETA'.
    perform bdc_field       using 'RM06B-BNFPO'
                                  i_output-bnfpo.
    perform bdc_field       using 'RM06B-TCSELFLAG(seltab1)'
                                 'X'.
    perform bdc_dynpro      using 'SAPMM06B' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-EBAKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'EBAN-EBAKZ'
                                  i_output-ebakz.
    CALL TRANSACTION 'ME52' USING bdc_data MODE 'A'
                                   MESSAGES INTO i_bdcmsg.
        COMMIT WORK AND WAIT.
    ENDLOOP.
    ENDFORM.                    " CALL_BDC
    *&      Form  bdc_dynpro
          text
         -->P_0686   text
         -->P_0687   text
    FORM bdc_dynpro USING    program dynpro.
    CLEAR bdc_data.
      bdc_data-program  = program.
      bdc_data-dynpro   = dynpro.
      bdc_data-dynbegin = 'X'.
      APPEND bdc_data.
      CLEAR bdc_data.
    ENDFORM.   
    thanks,
    N

    Looks like table control logic is wrong -- do compare with below program...
    only table contril area
    REPORT ZPadmam
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    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'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-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-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    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'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-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'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Thanks
    Seshu

  • Bdc in table control

    hi friends,
    can any body plz send me one example in table contols in bdc.STEP BY STEP.
    thanks & regards
    ram

    hi,
    Here is the code.
    report zmm_update_contracts_cpy no standard page heading
                                    line-count 45
                                    line-size  115
                                    message-id zmm.
    *                  Types Declarations                                 
    types: begin of ty_ekko,
            ebeln type ekko-ebeln,
            bukrs type ekko-bukrs,
            kdate type ekko-kdate,
            kdatb type ekko-kdatb,
           end of   ty_ekko,
    *-- Structure for success and failed records
           begin of ty_status,
            bukrs type ekko-bukrs,
            ebeln type ekko-ebeln,
            kdate type ekko-kdate,
            kdatb type ekko-kdatb,
           end   of ty_status.
    *                  Internal Table Declarations                         *
    data : it_ekko    type standard table of ty_ekko    with header line,
           it_ekpo    type standard table of ekpo       with header line,
           it_success type standard table of ty_status  with header line,
           it_fail    type standard table of ty_status  with header line,
           bdcdata    type standard table of bdcdata    with header line,
           msgtab     type standard table of bdcmsgcoll with header line.
    *                  Structure  Declarations                             *
    *-- Structure for Parameter string for runtime of CALL TRANSACTION
    data : x_ctu_params type ctu_params.
    *                  Data Declarations                                   *
    data : v_bukrs      type ekko-bukrs, "Company code
           v_ebeln      type ekko-ebeln, "Contract no
           v_ekorg      type ekko-ekorg, "Purchasing Org
           v_bsart      type ekko-bsart, "Document Type
           v_kdatb      type ekko-kdatb,
           v_counter(2) type n ,"value '01',
           v_first(5)   type n,
           v_field      type string.
    *                        Selection Screen                              *
    *-- Selection screen Details
    selection-screen begin of block b1 with frame title text-001.
    select-options :
       s_bukrs for v_bukrs obligatory default '0111', "Company code
       s_ebeln for v_ebeln obligatory,                "Contract no
       s_ekorg for v_ekorg,
       s_bsart for v_bsart,
       s_dats  for v_kdatb.
    selection-screen end of block b1.
    *               Start-of-Selection                                     *
    start-of-selection.
    *-- Get data from DB table ekko based on selection-screen
      perform fetch_data.
    *-- for each record found process BDC
      perform process_bdc.
      perform init_page_head.
    *               End-of-Selection                                     *
    end-of-selection.
    *-- Display report
      perform display_report.
    *                      Top-of-page
    top-of-page.
    *--  Subroutine to print header on top of the page
      perform print_header.
      skip.
      uline.
    *&      Form  fetch_data
    *       text
    form fetch_data.
      select ebeln bukrs kdate kdatb
        from ekko
        into table it_ekko
        where ebeln in s_ebeln
          and bukrs in s_bukrs
          and bstyp = 'K'
          and bsart in s_bsart
          and ekorg in s_ekorg
          and kdatb in s_dats
          and kdate in s_dats.
      if sy-subrc <> 0.
        exit.
      else.
        select * from ekpo
          into table it_ekpo
          for all entries in it_ekko
          where ebeln = it_ekko-ebeln
            and bukrs = it_ekko-bukrs.
    *        and loekz = ''.
      endif.
    endform.                    " fetch_data
    *&      Form  process_bdc
    *       text
    form process_bdc.
      sort it_ekko by ebeln.
      sort it_ekpo by ebeln ebelp.
      loop at it_ekko.
        clear   : bdcdata.
    *              v_counter.
        refresh : bdcdata.
        perform fill_bdctable.
      endloop.
    endform.                    " process_bdc
    *        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 <> ' '.
        clear bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        append bdcdata.
      endif.
    endform.
    *&      Form  fill_bdctable
    *       text
    form fill_bdctable.
    * To have default screen size, mode and update
      x_ctu_params-defsize = 'X'.
      x_ctu_params-dismode = 'E'.
      x_ctu_params-updmode = 'S'.
      v_first = 1.
      shift v_first left DELETING leading '0'.
      perform bdc_dynpro      using 'SAPMM06E' '0205'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RM06E-EVRTN'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'RM06E-EVRTN'
                                    it_ekko-ebeln.
    *reading item data table based on header data table
      loop at it_ekpo where ebeln = it_ekko-ebeln.
        clear v_field.
        v_counter = v_counter + 1.
    *Page Down
        if v_counter = '15' .
          v_counter = '01'.
          concatenate 'RM06E-EVRTP('
                      v_counter
                      into v_field.
          perform bdc_dynpro      using 'SAPMM06E' '0220'.
          perform bdc_field       using 'BDC_CURSOR'
                                         v_field.
          perform bdc_field       using 'BDC_OKCODE'
                                        '=P+'.
          perform bdc_field       using 'RM06E-EBELP'
                                         v_first.
          v_first = v_first + 14.
    *Compare first entry in table control with line item
    *As there are some missing line items in Purchasing Document Item table
          IF V_FIRST <> IT_EKPO-EBELP.
            V_FIRST = IT_EKPO-EBELP.
          ENDIF.
        endif.
    * Check for deletion indicator
        if it_ekpo-loekz is initial.
          concatenate 'RM06E-EVRTP('
                      v_counter
                      into v_field.
          perform bdc_dynpro      using 'SAPMM06E' '0220'.
          perform bdc_field       using 'BDC_CURSOR'
                                         v_field.
          perform bdc_field       using 'BDC_OKCODE'
                                        '=DETZ'.
          perform bdc_field       using 'RM06E-EBELP'
                                         v_first."it_ekpo-ebelp.
          clear v_field.
          concatenate 'RM06E-TCSELFLAG('
                      v_counter
                      into v_field.
          perform bdc_field       using v_field
                                        'X'.
          perform bdc_dynpro      using 'SAPMM06E' '0212'.
          perform bdc_field       using 'BDC_CURSOR'
                                        'EKPO-BRGEW'.
          perform bdc_field       using 'BDC_OKCODE'
                                        '=BACK'.
          perform bdc_field       using 'EKPO-NTGEW'    "netweight
                                        '0'.
          perform bdc_field       using 'EKPO-GEWEI'    "unit
                                        'LB'.
          perform bdc_field       using 'EKPO-BRGEW'    "gross weight
                                        '0'.
        endif.
      endloop.
      perform bdc_dynpro      using 'SAPMM06E' '0220'.
      concatenate 'RM06E-EVRTP('
                  v_field
                  into v_field.
      perform bdc_field       using 'BDC_CURSOR'
                                    v_field.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      perform bdc_dynpro      using 'SAPLSPO1' '0300'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=YES'.
    *  PERFORM BDC_FIELD       USING 'RM06E-EBELP'
    *                                '10'.
      call transaction 'ME32K' using bdcdata
                          options from x_ctu_params
                            messages into msgtab.
      clear v_counter.
      if sy-subrc = 0.
    *-- populate the success records
        clear it_success.
        it_success-ebeln = it_ekko-ebeln.
        it_success-bukrs = it_ekko-bukrs.
        it_success-kdate = it_ekko-kdate.
        it_success-kdatb = it_ekko-kdatb.
        append it_success.
      else.
    *-- populate the error records
        clear it_fail.
        it_fail-ebeln = it_ekko-ebeln.
        it_fail-bukrs = it_ekko-bukrs.
        it_fail-kdate = it_ekko-kdate.
        it_fail-kdatb = it_ekko-kdatb.
        append it_fail.
      endif.
    endform.                    " fill_bdctable
    *&      Form  display_report
    *       text
    form display_report.
      data : lv_success type i,
             lv_failure type i,
             lv_lines   type i.
      clear : lv_success,
              lv_failure,
              lv_lines.
      describe table it_success lines lv_success.
      describe table it_fail    lines lv_failure.
      lv_lines = lv_failure + lv_success.
      write : / 'Total no of records uploaded :'(002) .
      write : lv_lines.
      write : / 'Total no of successes        :'(003).
      write : lv_success.
      write : / 'Total no of errors           :'(004).
      write : lv_failure.
      if not it_success[] is initial.
        sort it_success by bukrs.
        skip 2.
        write : / 'Success Records'(005).
        loop at it_success.
          at new bukrs.
            write : /    'Company Code '(006) , it_success-bukrs.
            write : /1   'Contract'(007),
                     13  'Validity Dates'(008).
          endat.
          write : /1  it_success-ebeln,
                   13 it_success-kdatb,
                   26 it_success-kdate.
        endloop.
      endif.
      if not it_fail[] is initial.
        sort it_fail by bukrs.
        skip 2.
        write : / 'Error Records'(009).
        loop at it_fail.
          at new bukrs.
            write : /    'Company Code '(006) , it_fail-bukrs.
            write : /1   'Contract'(007),
                     13  'Validity Dates'(008).
          endat.
          write : /1  it_fail-ebeln,
                   13 it_fail-kdatb,
                   26 it_fail-kdate.
        endloop.
      endif.
    endform.                    " display_report
    Regards,
    Richa

  • BDC in table control of  MM02

    Hi
    I have problem while inserting values in UNIT of measure in MM02 transaction. I recorded transaction for second field of table control , but while running BDC it inserts value in 2nd row only. How to increase counter while inserting values.
    Plz do needful.

    hi,
    *& Report  ZMMGB_MM02PLANPRICE_BDC
    report  zmmgb_mm02planprice_bdc.
    tables : marc.
    data: begin of bdcdata occurs 0.
            include structure bdcdata.
    data: end of bdcdata.
    data: w_tcode     like sy-tcode,      " Transaction code
          w_tkstatus  like t130m-pstat,   " SAP Transaction status
          w_anzgstatus like t130m-pstat,   " Summary Display status
          w_t130m     like t130m,         " Transaction control: mat.master
          w_bilds     like t133a-bilds,   " Screen sequence
          w_dytxt     like t133b-dytxt,   " View description
          w_linex(5)  type c,             " View # in table
          w_line      like sy-tabix,      " View # on selection screen
          w_num       like sy-tabix,
          w_matnr     like mara-matnr,    " Material
          w_mtart     like mara-mtart,    " Material type
          w_vpsta     like mara-vpsta,    " Material maintenance status
          w_pstat     like t134-pstat.    " Material type maintenance status
    data: begin of it_views occurs 30.
            include structure mbildtab.   " Selection Views
    data: end of it_views.
    data : mbrsh(1) type c,
           mtart(4) type c,
           kzsel(20) type c,
           price(14) type c,
           pdate(10) type c,
           dytxt(20) type c,
           pos(2) type n.
    data : begin of itab occurs 0,
              matnr like mara-matnr,     "Material
              werks like t001w-werks,    "Plant
              zplp1 like mbew-zplp1,    "Planned Price1
              zpld1 like mbew-zpld1,    "Planned Price1 Date
           end of itab.
    parameters : upd as checkbox.
    start-of-selection.
      check upd eq 'X'.
      perform upload_data.
      loop at itab.
        refresh bdcdata.
        perform get_viewpos.
    w_linex = w_linex - 17 .
    pos = w_linex+2(2).
        concatenate 'MSICHTAUSW-KZSEL('  pos ')' into kzsel.
    concatenate 'MSICHTAUSW-DYTXT('  pos ')' into dytxt.
      perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  itab-matnr .            "'93110989'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(08)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=P+'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  dytxt.                  "'MSICHTAUSW-DYTXT(05)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using kzsel                   "'MSICHTAUSW-KZSEL(05)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMGMM' '0080'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-WERKS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'RMMG1-WERKS'
                                  itab-werks.                   "'7100'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    move itab-zplp1 to price.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MBEW-ZPLP1'.
    perform bdc_field       using 'MBEW-ZPLP1'
                                  price.              "'103.00'.
    PERFORM convert_date_external.
    perform bdc_field       using 'MBEW-ZPLD1'
                                  pdate.              "'27.03.2008'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
        call transaction 'MM02' using bdcdata mode 'A' update 'S'.
        clear : itab,price,pdate,pos,w_linex.
      endloop.
    *        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.
      clear bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      append bdcdata.
    endform.                    "BDC_FIELD
    *&      Form  GET_VIEWPOS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form get_viewpos .
      if itab-matnr na sy-abcde.
        unpack itab-matnr to itab-matnr.
      endif.
      select single * from marc where matnr = itab-matnr and
                                       werks = itab-werks.
      if sy-subrc eq 0.
        w_tcode = 'MM02'.           "Change view
      endif.
      call function 'MATERIAL_INIT'
        exporting
          tcode                     = w_tcode
          kz_berprf                 = 'X'
        importing
          it130m                    = w_t130m
          tkstatus                  = w_tkstatus
        exceptions
          no_authority              = 1
          wrong_call                = 2
          kstatus_empty             = 3
          tkstatus_empty            = 4
          aktyp_tcode_mismatch      = 5
          tcode_not_found           = 6
          material_article_mismatch = 7
          others                    = 8.
      if sy-subrc <> 0.
        write: 'MATERIAL_INIT error code =', sy-subrc.
        exit.
      endif.
    * 2. Get Material type and maintenance statuses
      select single matnr mtart vpsta from mara
             into (w_matnr, w_mtart, w_vpsta)
             where matnr = itab-matnr.
    *  if sy-subrc <> 0.
    *    write: 'Material', material, 'not in material master'.
    *    exit.
    *  endif.
      select single pstat from t134 into w_pstat
             where mtart = w_mtart.
      if sy-subrc <> 0.
        write: 'Material type', w_mtart, 'not found'.
      endif.
    * 3. Get Screen Sequence for Tcode/Material
      call function 'BILDSEQUENZ_IDENTIFY'
        exporting
          materialart = w_mtart
          tcode_ref   = w_t130m-trref
        importing
          bildsequenz = w_bilds
        exceptions
          wrong_call  = 1
          not_found   = 2
          others      = 3.
      if sy-subrc <> 0.
        write: 'BILDSEQUENZ_IDENTIFY error code =', sy-subrc.
        exit.
      endif.
    * 4. Get Summary status (Transaction+Material+Material Type)
      call function 'ANZGSTATUS_SETZEN'
        exporting
          aktyp            = w_t130m-aktyp
          marastatus       = w_vpsta
          t134status       = w_pstat
          tkstatus         = w_tkstatus
        importing
          anzgstatus       = w_anzgstatus
        exceptions
          anzgstatus_empty = 1
          wrong_call       = 2
          others           = 3.
      if sy-subrc <> 0.
        write: 'ANZGSTATUS_SETZEN error code =', sy-subrc.
        exit.
      endif.
    * 5. Get all selection views:
      call function 'SELECTION_VIEWS_FIND'
        exporting
          bildsequenz     = w_bilds
          pflegestatus    = w_anzgstatus
        tables
          bildtab         = it_views
        exceptions
          call_wrong      = 1
          empty_selection = 2
          others          = 3.
      if sy-subrc <> 0.
        write: 'SELECTION_VIEWS_FIND error code =', sy-subrc.
        exit.
      endif.
    * 5. Get view #:
      read table it_views with key auswg = 35 .   "35  - Costing View 2
      if sy-subrc = 0.
        w_linex = sy-tabix.
    *  else.
    *    write: 'View', view, 'not found'.
    *    exit.
      endif.
    endform.                    " GET_VIEWPOS
    *&      Form  CONVERT_DATE_EXTERNAL
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form convert_date_external .
      call function 'CONVERT_DATE_TO_EXTERNAL'
        exporting
          date_internal            = itab-zpld1
        importing
          date_external            = pdate
        exceptions
          date_internal_is_invalid = 1
          others                   = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " CONVERT_DATE_EXTERNAL
    *&      Form  UPLOAD_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form upload_data .
      data : file_table type file_table occurs 0,
               fwa type file_table,
               filename type string,
               rc type i.
      call method cl_gui_frontend_services=>file_open_dialog
        exporting
          window_title            = 'Open File'
    *    DEFAULT_EXTENSION       =
    *    DEFAULT_FILENAME        =
    *    FILE_FILTER             =
    *    INITIAL_DIRECTORY       =
    *    MULTISELECTION          =
    *    WITH_ENCODING           =
        changing
          file_table              = file_table
          rc                      = rc
    *    USER_ACTION             =
    *    FILE_ENCODING           =
        exceptions
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          others                  = 5
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
      read table file_table index 1 into fwa.
      filename = fwa-filename.
      call function 'GUI_UPLOAD'
           exporting
                filename                = filename
                filetype                = 'DAT'
    *        IMPORTING
    *             FILELENGTH              =
           tables
                data_tab                = itab
           exceptions
                file_open_error         = 1
                file_read_error         = 2
                no_batch                = 3
                gui_refuse_filetransfer = 4
                invalid_type            = 5
                others                  = 6 .
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " UPLOAD_DATA
    Regards,
    Morris Bond.
    Reward Points if Helpful.

Maybe you are looking for