Skip to Content
author's profile photo Former Member
Former Member

Help on Table control

Hi,

I cretaed my own Z table and i ve to insert new records as well update them when necessary..

now i ve a table control for that..so how i can insert and update my ztable with table control..?

In PBO and PAI. what should i mention in Loop at ........?

Normally it allows only Itab which contains Ztable data. But here itab is empty. since i am not populating itab from Ztable,

I need to populate the Ztable from Table ctrl datas.

Is there any parameter which holds the number of rows entered in table Ctrl?

help me in this regard.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:24 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:25 AM

    hello Ram

    im sending one table contro program it may use ful top u..

    REPORT zsiva_bdctable .

    *include bdcrecx1.

    TYPES : BEGIN OF ty_head,

    auart(4),

    vkorg(4), "Sales Organization

    vtweg(2), "Distribution Channel

    spart(2), "Division

    kunnr(10), "sold-to-party

    bstkd(10), "Customer purchase order number

    END OF ty_head.

    TYPES: BEGIN OF ty_item,

    matnr(18) TYPE c, "Material

    kwmeng(13) TYPE c, "Quantity

    END OF ty_item.

    DATA: it_head TYPE TABLE OF ty_head.

    DATA: wa_head LIKE LINE OF it_head.

    DATA: it_item TYPE TABLE OF ty_item.

    DATA: wa_item LIKE LINE OF it_item.

    DATA :bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

    DATA:v_kwmeng(30) TYPE c,

    v_mabnr(30) TYPE c.

    DATA: val(2) TYPE n VALUE 01.

    DATA : w_file2 TYPE string,

    w_file1 TYPE string.

    PARAMETERS: filename LIKE rlgrap-filename.

    PARAMETERS: filenam1 LIKE rlgrap-filename.

    ****************************************************

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

    CALL FUNCTION 'F4_FILENAME'

    IMPORTING

    file_name = filename.

    ******************************************************

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filenam1.

    CALL FUNCTION 'F4_FILENAME'

    IMPORTING

    file_name = filenam1.

    *******************************************************

    START-OF-SELECTION.

    w_file2 = filename.

    w_file1 = filenam1.

                                • HEADER ************************

                                CALL FUNCTION 'GUI_UPLOAD'

                                EXPORTING

                                filename = w_file2

                                filetype = 'ASC'

                                has_field_separator = 'X'

                                TABLES

                                data_tab = it_head.

                                                            • ITEM *******************

                                                            CALL FUNCTION 'GUI_UPLOAD'

                                                            EXPORTING

                                                            filename = w_file1

                                                            filetype = 'ASC'

                                                            has_field_separator = 'X'

                                                            TABLES

                                                            data_tab = it_item.

                                                            **********CREATE SESSION***************

                                                            CALL FUNCTION 'BDC_OPEN_GROUP'

                                                            EXPORTING

                                                            client = sy-mandt

                                                            group = 'TABLECONT'

                                                            keep = 'X'

                                                            user = sy-uname.

                                                            ******POPULATE BDCDATABLE***************

                                                            • PERFORM open_group.

                                                            LOOP AT it_head INTO wa_head.

                                                            PERFORM bdc_dynpro USING 'SAPMV45A' '0101'.

                                                            PERFORM bdc_field USING 'BDC_CURSOR'

                                                            'VBAK-AUART'.

                                                            PERFORM bdc_field USING 'BDC_OKCODE'

                                                            '/00'.

                                                            PERFORM bdc_field USING 'VBAK-AUART'

                                                            wa_head-auart.

                                                            PERFORM bdc_field USING 'VBAK-VKORG'

                                                            wa_head-vkorg.

                                                            PERFORM bdc_field USING 'VBAK-VTWEG'

                                                            wa_head-vtweg.

                                                            PERFORM bdc_field USING 'VBAK-SPART'

                                                            wa_head-spart.

                                                            PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

                                                            PERFORM bdc_field USING 'BDC_OKCODE'

                                                            '/00'.

                                                            PERFORM bdc_field USING 'VBKD-BSTKD'

                                                            wa_head-bstkd.

                                                            PERFORM bdc_field USING 'VBKD-BSTDK'

                                                            '30.01.2006'.

                                                            PERFORM bdc_field USING 'KUAGV-KUNNR'

                                                            wa_head-kunnr.

                                                            PERFORM bdc_field USING 'RV45A-KETDAT'

                                                            '30.01.2006'.

                                                            PERFORM bdc_field USING 'RV45A-KPRGBZ'

                                                            'D'.

                                                            PERFORM bdc_field USING 'VBKD-ZTERM'

                                                            '0001'.

                                                            PERFORM bdc_field USING 'VBKD-INCO1'

                                                            'CIF'.

                                                            PERFORM bdc_field USING 'VBKD-INCO2'

                                                            ' COST INSUSRABCE FRIEGHT'.

                                                            LOOP AT it_item INTO wa_item .

                                                            CONCATENATE 'RV45A-MABNR(' '0' val ')' INTO v_mabnr.

                                                            CONCATENATE 'RV45A-KWMENG(' '0' val ')' INTO v_kwmeng.

                                                            • PERFORM bdc_field USING 'BDC_CURSOR'

                                                            • v_kwmeng.

                                                            PERFORM bdc_field USING v_mabnr

                                                            wa_item-matnr.

                                                            PERFORM bdc_field USING v_kwmeng

                                                            wa_item-kwmeng.

                                                            PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

                                                            PERFORM bdc_field USING 'BDC_OKCODE'

                                                            '/00'.

                                                            val = val + 1.

                                                            IF val > 5.

                                                            val = 5.

                                                            ENDIF.

                                                            ENDLOOP.

                                                            val = 01.

                                                            PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

                                                            PERFORM bdc_field USING 'BDC_OKCODE'

                                                            '=SICH'.

                                                            CALL FUNCTION 'BDC_INSERT'

                                                            EXPORTING

                                                            tcode = 'VA01'

                                                            TABLES

                                                            dynprotab = bdcdata.

                                                            REFRESH bdcdata.

                                                            *PERFORM bdc_transaction USING 'VA01'.

                                                            ENDLOOP.

                                                            • PERFORM close_group.

                                                            CALL FUNCTION 'BDC_CLOSE_GROUP'.

                                                            ----


                                                            • 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

                                                            Add a comment
                                                            10|10000 characters needed characters exceeded

                                                          • author's profile photo Former Member
                                                            Former Member
                                                            Posted on Jan 30, 2008 at 07:27 AM

                                                            Hi,

                                                            In ur table control put the selection box and then all the fields and keep one button on th screen say submit

                                                            in the PAi of the screen

                                                            case sy-ucomm.

                                                            when 'submit'.

                                                            If sel_text eq 'X'.

                                                            Insert z_table value ur field string.

                                                            endif.

                                                            endcase.

                                                            then ur record will automatically get updated in the ztable.

                                                            PLzz reward points if it helps.

                                                            Add a comment
                                                            10|10000 characters needed characters exceeded

                                                          Before answering

                                                          You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
                                                          You must be Logged in to submit an answer.

                                                          Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.