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

probelm in selecting Rows in Table Display

Hello Friends,

I created one screen and displaying data in table control display.

now my requirement is whn i selecte rows ( for example 3 rows) in table display

and i want to insert data only for that selected rows of table display.

so how can i compare this condition ?? means how can i knw which row is

selected or not selected?

Thanks

Marmik

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Feb 27, 2007 at 09:02 AM

    Hi Marmik,

    When you have a table control with selectable rows, there should be a Single character field in the internal table (Say MARK).

    It will be set to 'X' if it is chosen.

    Then you can recognize the chosen rows using the if condition.

    if itab-mark = 'X'.

    • Do something

    endif.

    Take this example program as a reference:

    DEMO_DYNPRO_TABLE_CONTROL_1

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      Probably you don't save the flag in your internal table.

      U should check:

      - U have inserted the field T_VBRK-MARK as mark field in the attribute of table control by screen painter;

      - U save the value in PAI modifying T_VBRK

      U should show the flow of your dynpro.

      Max

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 09:03 AM

    Hi

    U need to manage a field for selection and so check the record where that field is equal to X.

    So if you display 3 fields, adding a new field in your internal table and set it as field for MARK in screen-painter, so in PAI:

    PROCESS PAI
    
      LOOP AT ITAB.
        FIELD ITAB-MARK.
        MODULE MODIFY_ITAB.
      ENDLOOP.
    
    MODIFY_ITAB.
      MODIFY ITAB INDEX <TABLE CONTROL>-CURRENT_LINE.
    ENDMODULE.

    Now when a row is selected the field MARK'll have the value X.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 09:03 AM

    hi Shah,

    Check out these demo programs

    RSDEMO_TABLE_CONTROL

    DEMO_DYNPRO_TABLE_CONTROL_1

    DEMO_DYNPRO_TABLE_CONTROL_2

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 09:04 AM

    on that particualr screen 100 with tale control

    PROCESS BEFORE OUTPUT.

    MODULE STATUS_0100.

    LOOP AT IT_YAPTMAIN WITH CONTROL TC1 CURSOR TC1-TOP_LINE.

    MODULE SET_SCREEN.

    ENDLOOP.

    PROCESS AFTER INPUT.

    LOOP AT IT_YAPTMAIN .

    MODULE SET_CHECK.

    ENDLOOP.

    FIELD V_OBJECT MODULE CHECK.

    MODULE USER_COMMAND_0100.

    MODULE SET_SCREEN OUTPUT.

    V_CHECK = IT_YAPTMAIN-CHECK.

    ENDMODULE. " SET_SCREEN OUTPUT

    MODULE SET_CHECK INPUT.

    V_DIRTY = SY-LOOPC.

    IT_YAPTMAIN-CHECK = V_CHECK.

    MODIFY IT_YAPTMAIN INDEX TC1-CURRENT_LINE.

    ENDMODULE. " SET_CHECK INPUT

    form user_command.

    case ucomm.

    WHEN 'MODIFY'.

    PERFORM SET_UPDATE_TABLE.

    endcase.

    endform.

    FORM SET_UPDATE_TABLE.

    *TRACKING THE CHANGEBLE RECORDS ON THE TABLE CONTROL

    LOOP AT IT_YAPTMAIN WHERE CHECK = 'X'.

    CLEAR IT_MODIFY.

    MOVE-CORRESPONDING IT_YAPTMAIN TO IT_MODIFY.

    APPEND IT_MODIFY.

    IT_YAPTMAIN-CHECK = ' '.

    MODIFY IT_YAPTMAIN.

    ENDLOOP.

    READ TABLE IT_MODIFY INDEX 1.

    YAPTMAIN = IT_MODIFY.

    DESCRIBE TABLE IT_MODIFY LINES V_LINE.

    TC2-LINES = V_LINE .

    V_LINE = 1.

    IF NOT ( IT_MODIFY[] IS INITIAL ).

    CALL SCREEN 200.

    ELSE.

    MESSAGE I001 WITH 'Select the records for Modification'.

    ENDIF.

    ENDFORM. " SET_UPDATE_TABLE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 09:05 AM

    Hi,

    In the table control u have Current_line,whcih gives the curent line of the table control.Also there should be a Single character field in the internal table .It will be 'X' if it is chosen.

    Regards,

    nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 09:34 AM

    Hi,

    In the PAI use this logic, u need to assign the the screen selection field value to the internal table selection field i.e MARK in your case , in the PAI within a loop and endloop and modify.This way you can capture the selected rows.

    In the PAI.

    LOOP AT it_vbrk.

    MODULE MODIFY .

    ENDLOOP.

    MODULE MODIFY INPUT.

    MARK = <SCREEN FIELD>.

    MODIFY it_vbrk INDEX TC1-CURRENT_LINE.

    CLEAR it_vbrk.

    ENDMODULE. " MODIFY INPUT

    Hope this helps.

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 27, 2007 at 09:38 AM

    Hi

    In table control you have active SEL tab.

    Take SEL Tab active for the selected 3 rows.

    Now it can work i hope.

    Regards,

    kumar

    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.