Skip to Content
0
Former Member
Jul 18, 2008 at 08:37 AM

TableControl: Check of marked line?

38 Views

Hi there,

I have a problem with programming a table control in a z-transaction.

I want to have a table control for selecting a transport request position... So it can only be selected one single line. I have defined a mark-column for this. The table is a global table in my program and I've generated the table control with the wizard from screen editor.

But now I have the problem that I have to validate that the user selects exactly one line (ok, more than one is not possible by TC). But how can I implement this? I've tried to implement a module in PAI that makes a READ on the global table with key MARK = 'X'.

If nothing is found, it shall bring an error-message.

But my problem is now that the dynpro isn't anymore editable after this error-message, so the user has no chance to really check one line after getting the error.

Here my coding:


PROCESS AFTER INPUT.

* Verlassen des Dynpros via Exit-Command
  MODULE exit_dynpro AT EXIT-COMMAND.

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_TB_POS'
  LOOP AT gt_tb_pos.
    CHAIN.
      FIELD gs_tb_pos-mark.
      MODULE modify_tc ON CHAIN-REQUEST.
    ENDCHAIN.
  ENDLOOP.
  MODULE tc_tb_pos_user_command.
*&SPWIZARD: MODULE TC_TB_POS_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TC_TB_POS_CHANGE_COL_ATTR.

  MODULE check_mark.


MODULE modify_tc INPUT.

  MODIFY gt_tb_pos FROM gs_tb_pos INDEX tc_tb_pos-current_line.

ENDMODULE.              

MODULE check_mark INPUT.


  READ TABLE gt_tb_pos
    INTO gs_sel_pos
    WITH KEY mark = 'X'.


  IF sy-subrc NE 0.
    MESSAGE e002(zh).
  ENDIF.

ENDMODULE.  

Thanks a lot for hints 😊

Regards

Markus

Edited by: Markus Glubka on Jul 18, 2008 10:38 AM