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

how to select a row in table control..

hi..

we created a table control and given a selction colom as itab-mark,

but while running the prog itab-mark = 'x' is not taking any value.

and it is displaying the last row instead of the selected row...

as we r new to abap will anyone pls make it clear for us asap.

thanking u.

Add a comment
10|10000 characters needed characters exceeded

Related questions

9 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 09:47 AM

    Hi,

    In you PBO...

    you have maybe done that

    loop at itab with control myControl cursor myControl-current_line.

    module fill_screen.

    endloop.

    But in your process after input you have to do that.

    loop at itab.

    module update_internal_table.

    endloop.

    If you do not do that, the internal table never contains 'X' in the field mark.

    do you see the point ?

    If helped plz do not forget the rewrad.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 09:48 AM

    hi..

    u can find following useful to get ur query solved..

    Selecting Row in Table Control

    reward if it solves ur problem

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 09:50 AM

    hi,

    in the table control property did you mark the line sel - Multiple

    cheers,

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 09:52 AM

    Hi naveen,

    welcome to SDN.

    check this link it may help you...

    table-control-multiple-line-selection

    reward points for helpfull answers and close the thread if your question is solved by clicking radio buttons on the top left.

    regards,

    venu.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 09:55 AM

    Hi

    You should have a module to fix mark field (PAI) and a module to dysplay (PBO).

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2005 at 10:29 AM

    Hi,

    Check this link.It will help you regarding the selection.

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table control in abap.pdf

    Kindly reward points by clicking the star on the left of reply,if it helps.

    Message was edited by: Jayanthi Jayaraman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 11:05 AM

    Hi,

    This program code may help you.its also working same as you mentioned.try to implement you code in this by modifying the.

    control name

    flag

    etc..

    In this example look the PBO and PAI and the last module in the the below program.its about which element is marked

    PROCESS BEFORE OUTPUT.

    MODULE status_0120.

    MODULE auswahl_ferti_change_tc_attr.

    LOOP AT it_temp_fauf WITH

    CONTROL auswahl_ferti

    CURSOR auswahl_ferti-current_line.

    MODULE fill_table_control.

    ENDLOOP.

    CALL SUBSCREEN area1 INCLUDING sy-repid number1.

    *

    PROCESS AFTER INPUT.

    LOOP AT it_temp_fauf.

    FIELD it_temp_fauf-flag

    MODULE tabcon_mark ON REQUEST.

    MODULE read_table_control.

    ENDLOOP.

    CALL SUBSCREEN: area1.

    MODULE user_command_0120.

    *&----


    *

    *& Module STATUS_0120 OUTPUT

    *&----


    *

    • text

    *----


    *

    MODULE status_0120 OUTPUT.

    SET PF-STATUS '120'.

    SET TITLEBAR 'ENTNAHMEDETAIL1'.

    ENDMODULE. " STATUS_0120 OUTPUT

    *DECLARATION OF TABLECONTROL 'AUSWAHL_FERTI' ITSELF

    CONTROLS: auswahl_ferti TYPE TABLEVIEW USING SCREEN 0120.

    *DATA:g_auswahl_ferti_lines LIKE sy-loopc.

    ----


    • MODULE AUSWAHL_FERTI_CHANGE_TC_ATTR OUTPUT

    ----


    *

    ----


    MODULE auswahl_ferti_change_tc_attr OUTPUT.

    DESCRIBE TABLE it_temp_fauf LINES auswahl_ferti-lines.

    ENDMODULE. "AUSWAHL_FERTI_CHANGE_TC_ATTR OUTPUT

    ----


    • MODULE AUSWAHL_FERTI_GET_LINES OUTPUT

    ----


    *

    ----


    *

    MODULE auswahl_ferti_get_lines OUTPUT.

    • g_auswahl_ferti_lines = sy-loopc.

    ENDMODULE. "AUSWAHL_FERTI_GET_LINES OUTPUT

    *&----


    *

    *& Module FILL_TABLE_CONTROL OUTPUT

    *&----


    *

    • text

    *----


    *

    MODULE fill_table_control OUTPUT.

    READ TABLE it_temp_fauf INTO /cmd/wa_s_fauf

    INDEX auswahl_ferti-current_line.

    ENDMODULE. " FILL_TABLE_CONTROL OUTPUT

    *&----


    *

    *& Module read_table_control INPUT

    *&----


    *

    • text

    *----


    *

    MODULE read_table_control INPUT.

    lines = sy-loopc.

    MODIFY it_fauf FROM /cmd/wa_s_fauf INDEX

    auswahl_ferti-current_line.

    ENDMODULE. " read_table_control INPUT

    *&----


    *

    *& Module USER_COMMAND_0120 INPUT

    *&----


    *

    • text

    *----


    *

    MODULE user_command_0120 INPUT.

    save_ok = ok_code.

    CLEAR ok_code.

    CASE save_ok.

    WHEN 'BACK'.

    CALL SCREEN 100.

    WHEN 'EXIT'.

    LEAVE PROGRAM.

    WHEN 'CANCEL'.

    CALL SCREEN 100.

    WHEN 'F5'.

    LOOP AT it_aus_pos.

    DELETE it_aus_pos.

    ENDLOOP.

    • Moving the corresponding fields of the selected order.

    SELECT * FROM resb WHERE rsnum = afko-rsnum.

    MOVE-CORRESPONDING resb TO it_aus_pos.

    SELECT * FROM makt WHERE matnr = it_aus_pos-matnr.

    MOVE-CORRESPONDING makt TO it_aus_pos.

    ENDSELECT.

    APPEND it_aus_pos.

    ENDSELECT.

    CALL SCREEN 120.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0120 INPUT

    *&----


    *

    *& Module TABCON_MARK INPUT

    *&----


    *

    • text

    *----


    *

    MODULE tabcon_mark INPUT.

    MODIFY it_temp_fauf

    INDEX auswahl_ferti-current_line

    TRANSPORTING flag.

    IF it_temp_fauf-flag = 'X'.

    temp_aufnr = it_temp_fauf-aufnr.

    SELECT SINGLE * FROM afko WHERE aufnr = temp_aufnr.

    ENDIF.

    ENDMODULE. " TABCON_MARK INPUT

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 03:38 AM

    hello narashima..

    this is ur floe logic...

    process before output.

    module status_0100.

    loop at itab with control tc cursor tc-current_line.

    module fill_table_control.

    MODULE SET_SELECTED_ROW.

    endloop.

    process after input.

    loop at itab.

    module read_table_control.

    field ITAB-mark MODULE GET_SELECTED_ROW.

    endloop.

    module user_command_0100.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 22, 2019 at 10:53 AM

    PROCESS BEFORE OUTPUT.

    Step 1 - Declare ABAP variable to store line selection indicator.     DATA: MARK TYPE C.
    Step 2 - Assign created variable to dynpro table control. 
    
    
    Step 3 - Modify dialog screen Flow logic in-order to capture users line selection. 
    PROCESS BEFORE OUTPUT.
    * MODULE STATUS_0100.
      module data_retrieval.
      loop at it_ekko into wa_ekko with control TC100.
        module populate_screen.
      endloop.
    *
    
    PROCESS AFTER INPUT.
      loop at it_ekko.
           module update_table.
         endloop.
    * MODULE USER_COMMAND_0100.
     
    
    To create module update_table please Double click on it and select yes to the next pop-up. Ensure that a new include is created to hold all the PAI modules (default) and Press enter.
    
    Now insert the following ABAP code into this PAI module!
    *&---------------------------------------------------------------------*
    *&      Module  update_table  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module update_table input.
    
    read table it_ekko into wa_ekko index tc100-CURRENT_LINE.
     if not mark is initial.
       wa_ekko-SEL = 'X'.
       modify it_ekko from wa_ekko index tc100-CURRENT_LINE.
     endif.
    
    endmodule.                 
     
    
    
    
    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.