answers.sap.com Open in urlscan Pro
3.67.212.164  Public Scan

URL: https://answers.sap.com/questions/6913122/problem-in-getting-selected-row-in-table-control.html
Submission: On May 22 via manual from DE — Scanned from DE

Form analysis 1 forms found in the DOM

https://community.sap.com/search/

<form action="https://community.sap.com/search/" class="ds-question-detail__search">
  <div class="ds-search"><label class="ds-input__box"><input type="hidden" name="ct" value="qa"><input class="ds-input__control" name="q" type="search" autocomplete="off" value=""><span class="ds-input__placeholder">Search Questions and
        Answers</span><button class="ds-search__button ds-search__button-submit" type="submit" title="Search"><i class="ds-icon-encoded--search"></i></button></label></div>
</form>

Text Content

Diese Website verwendet Cookies und verwandte Technologien, wie in
unserer Datenschutzrichtlinie beschrieben, für Zwecke, die den Betrieb der
Website, Analysen, eine verbesserte Benutzererfahrung oder Werbung umfassen
können. Sie können sich dafür entscheiden, unserer Verwendung dieser
Technologien zuzustimmen oder Ihre eigenen Einstellungen vornehmen.
Einstellungen verwalten Alle akzeptieren Alle verweigern Cookie-Erklärung

Skip to Content

SAP Community Log-in Update
In a few months, SAP Community will switch to SAP Universal ID as the only
option to login. Don’t wait, create your SAP Universal ID now! If you have
multiple accounts, use the Consolidation Tool to merge your content.
Get started with SAP Universal ID
 * Home
 * Community
 * Questions

 * Ask a Question
 * Write a Blog Post
 * Login / Sign-up
 * * Send a Message
   * Manage My Blog Posts
   * Quick Start Guide


Search Questions and Answers

Vote up0Vote down
Sham IGIT
13 01 2010 um 12:58


PROBLEM IN GETTING SELECTED ROW IN TABLE CONTROL

1681 Views
Follow
RSS Feed

Answers

Include Comments
Get RSS Feed

Hi guys,



I am really frustrated of getting the row, selected in table control. I can see
hudreds of post in the same topic in SDN. But I can't figure out where I went
wrong.



I have table control, in that I set the attribute w/Sel Column as MARK and I
created the same field in my internal table.



And on the execution, I selected a row and that row is not getting the value as
X for the field mark in my internal table. Please have a look at my code and
guide me where I was going wrong.



Please note that GET CURSOR LINE doesn't suit for my requirement.



PROCESS BEFORE OUTPUT.
  MODULE status_2000.
  LOOP AT gt_main INTO gwa_main WITH CONTROL tc_main.
    MODULE fill_table_control.
  ENDLOOP.
*

PROCESS AFTER INPUT.
  LOOP AT gt_main.
    MODULE read_table_conrol.
  ENDLOOP.
  MODULE user_command_2000.


CONTROLS: tc_main TYPE TABLEVIEW USING SCREEN 2000.

TYPES: BEGIN OF ty_main,
        rmsno  TYPE zmm_spa_item-rmsno,
        reqno  TYPE zmm_spa_item-reqno,
        mfnam  TYPE zmm_spa_item-mfnam,
        mfpcd  TYPE zmm_spa_item-mfpcd,
        magnt  TYPE zmm_spa_item-magnt,
        crdat  TYPE zmm_spa_item-crdat,
        fstat  TYPE zmm_spa_item-fstat,
        sirst  TYPE zmm_spa_item-sirst,
        purst  TYPE zmm_spa_item-purst,
        tecst  TYPE zmm_spa_item-tecst,
        qcvst  TYPE zmm_spa_item-qcvst,
        plnst  TYPE zmm_spa_item-plnst,
        prdst  TYPE zmm_spa_item-prdst,
        aslgr  TYPE zmm_spa_item-aslgr,
        lifnr  TYPE zmm_spa_item-lifnr,
        mark   TYPE c,
       END OF ty_main.



MODULE fill_table_control OUTPUT.

  READ TABLE gt_main INTO gwa_main INDEX tc_main-current_line.
  IF sy-subrc EQ 0.
    MOVE-CORRESPONDING gwa_main TO zmm_spa_item.
  ENDIF.

ENDMODULE.                 " FILL_TABLE_CONTROL  OUTPUT


MODULE read_table_conrol INPUT.

*      GET CURSOR LINE gv_curline.

      READ TABLE gt_main INTO gwa_main WIH KEY mark = 'X'.
      IF sy-subrc EQ 0.
        MOVE-CORRESPONDING gwa_main TO zmm_spa_item.
      ELSE.
        MESSAGE e001 WITH 'Please select a request number'.
      ENDIF.
      CALL SCREEN 2200.


ENDMODULE.                 " READ_TABLE_CONROL  INPUT





 * Add a Comment
   
   HELP TO IMPROVE THIS QUESTION BY ADDING A COMMENT. IF YOU HAVE AN ANSWER FOR
   THIS QUESTION, THEN PLEASE USE THE YOUR ANSWER FORM AT THE BOTTOM OF THE PAGE
   INSTEAD.

 * Alert Moderator
   
   REPORT AS OFFENSIVE (I.E. CONTAINING SPAM, ADVERTISING, MALICIOUS TEXT, ETC.)


ASSIGNED TAGS

 * ABAP Development

Similar Questions
 * Problem when get current row selected by double click in control table
   Former MemberJan 02, 2015
 * Get selected row in a table control
   Former MemberNov 13, 2006

3 Answers
Sort by:
Stimmen
Erstellt
Oldest
Vote up0Vote down
Kesavadas Thekkillath

Jan 13, 2010 at 01:13 PM

Before read control you need to modify the table control value with 'X'.

 * Add a Comment
   
   HELP TO IMPROVE THIS ANSWER BY ADDING A COMMENT. IF YOU HAVE A DIFFERENT
   ANSWER FOR THIS QUESTION, THEN PLEASE USE THE YOUR ANSWER FORM AT THE BOTTOM
   OF THE PAGE INSTEAD.

 * Alert Moderator
   
   REPORT AS OFFENSIVE (I.E. CONTAINING SPAM, ADVERTISING, MALICIOUS TEXT, ETC.)

 * Share

Vote up0Vote down
Guilherme Frisoni Machado

Jan 13, 2010 at 01:14 PM

Hi,



i think its missing a modify inside a chain for each line.

Try following:

PROCESS AFTER INPUT.
  LOOP AT gt_main.
    CHAIN.
      gwa_main-mark.
      MODULE update_fields ON CHAIN-REQUEST.
    ENDCHAIN.
  ENDLOOP.
  MODULE read_table_conrol.
  MODULE user_command_2000.

MODULE update_fields INPUT.
  MODIFY gtmain
    FROM gwa_main
    INDEX tc_main-current_line.
ENDMODULE.


MODULE read_table_conrol INPUT.
  LOOP AT gt_main INTO gwa_main
    WHERE mark = 'X'.
    ...
  ENDLOOP.
ENDMODULE.



Regards,

Frisoni

 * Add a Comment
   
   HELP TO IMPROVE THIS ANSWER BY ADDING A COMMENT. IF YOU HAVE A DIFFERENT
   ANSWER FOR THIS QUESTION, THEN PLEASE USE THE YOUR ANSWER FORM AT THE BOTTOM
   OF THE PAGE INSTEAD.

 * Alert Moderator
   
   REPORT AS OFFENSIVE (I.E. CONTAINING SPAM, ADVERTISING, MALICIOUS TEXT, ETC.)

 * Share

1 comment
Sham IGIT

Jan 13, 2010 at 02:03 PM

Hi Frisoni & Keshav,



I found out the problem. Instead of MARK, I made the field name as gwa_main-mark
in the table control attributes and it is capturing now. And changed the code as
below.



MODULE read_table_conrol INPUT.
  MODIFY gt_main FROM gwa_main INDEX tc_main-current_line.
ENDMODULE.





Thanks for your quick replies.



Yasin.

 * Like 0
 * Share
 * Alert Moderator
   
   REPORT AS OFFENSIVE (I.E. CONTAINING SPAM, ADVERTISING, MALICIOUS TEXT, ETC.)


Vote up0Vote down
Kesavadas Thekkillath

Jan 13, 2010 at 01:22 PM

In PAI



LOOP AT itab_table .

MODULE modify_int_table.

ENDLOOP.



In the MODULE call modify_int_table we can use



MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE







i think this will solve your issue.

 * Add a Comment
   
   HELP TO IMPROVE THIS ANSWER BY ADDING A COMMENT. IF YOU HAVE A DIFFERENT
   ANSWER FOR THIS QUESTION, THEN PLEASE USE THE YOUR ANSWER FORM AT THE BOTTOM
   OF THE PAGE INSTEAD.

 * Alert Moderator
   
   REPORT AS OFFENSIVE (I.E. CONTAINING SPAM, ADVERTISING, MALICIOUS TEXT, ETC.)

 * Share


Know someone who can answer? Share a link to this
question.


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
your answer complies with our Rules of Engagement.

 * Rules of Engagement


YOU MUST BE LOGGED IN TO SUBMIT AN ANSWER.

 * 
 * 
 * 
 * 
 * 
   Link einfügenLink entfernen
 * 
 * 
 * 
 * 

Please provide a distinct answer and use the comment option for clarifying
purposes.

10 characters required.
Submit your Answer

FIND US ON

 * 
 * 
 * 
 * 
 * 
 * 
 * 

 * Privacy
 * Terms of Use
 * Legal Disclosure
 * Copyright
 * Trademark
 * Cookie-Präferenzen
 * Newsletter
 * Support