Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to read new values in a Table Control?

Former Member

Hi Experts,

I am currently trying to build a table control for table T77UA.

I am facing some issues while implementing the New Entries functionality. I initially get a screen with all the values from the table, then when clicking on new entries I cleared the values from the internal table so I could get the new entries and then save them into the database table.

The thing is that I don't seem to have the new values nowhere, not the control or the internal table.t77ua.jpg
Can you tell me how do I retain the new values?
If you have an example or demo program for this would be much appreciated.

Thank you.

Best regards,
Elena

1 ACCEPTED SOLUTION

Former Member

Hi I've checked your code

PBO:

LOOP AT SDYN_ITAB INTO ZT77UA WITH CONTROL TABLE_CONTROL. 
ENDLOOP. 

PAI

LOOP AT SDYN_ITAB.   
  MODULE READ_TABLE_CONTROL.
ENDLOOP. 

And module READ_TABLE_CONTROL

MODULE READ_TABLE_CONTROL INPUT.   IF MARK = 'X' AND SAVE_OK = 'DELE'.
    READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
    IF SY-SUBRC = 0.
      DELETE TABLE SDYN_ITAB FROM ZT77UA.
      DESCRIBE TABLE SDYN_ITAB KINES TABLE_CONTROL-LINES.    
    ENDIF.
  ELSE.
    DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES. 
    MODIFY SDYN_ITAB FROM ZT77UA INDEX TABLE_CONTROL-CURRENT_LINE.
  ENDIF.
ENDMODULE. 

This code is ok if you need to change existing record, but if you insert a new record in table control, this won't automatically be in your internal table:

you need to append it

For example your module READ_TABLE_CONTROL can check if the record is or isn't in SDYN_ITAB

MODULE READ_TABLE_CONTROL INPUT.
  IF MARK = 'X' AND SAVE_OK = 'DELE'.
    READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
    IF SY-SUBRC = 0.
      DELETE TABLE SDYN_ITAB FROM ZT77UA.
      DESCRIBE TABLE SDYN_ITAB KINES TABLE_CONTROL-LINES.    
    ENDIF.
  ELSE.
    DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES. 
    MODIFY SDYN_ITAB FROM ZT77UA INDEX TABLE_CONTROL-CURRENT_LINE.
    IF SY-SUBRC <> 0.
      APPEND ZT77UA TO SDYN_ITAB.
    ENDIF.
  ENDIF.
ENDMODULE. 

Or something else like above

10 REPLIES 10

Jelena
Active Contributor

There are tons of examples that can be found in Google. But what on earth are you doing creating a table control with new entries for the standard authorization table?

Former Member
0 Kudos

Hello,

I've looked it up before posting the message and I couldn't locate the same example as in my scenario.

About the authorization table this is a customizing table where you can add entries only by using a transport request.

They want to be able to maintain it directly without changing the type of the standard table.
Getting back to my question, where is that the new values are being saved? Cause I cannot locate them anywhere in the backend structures.

Best,
Elena

Sandra_Rossi
Active Contributor
0 Kudos

Program DEMO_DYNPRO_TABCONT_LOOP_AT.

Former Member
0 Kudos

Hi,

I've looked up to programs like:

  1. DEMO_DYNPRO_TABCONT_LOOP Table Control with LOOP - ENDLOOP
  2. DEMO_DYNPRO_TABCONT_LOOP_AT Table Control with LOOP AT ITAB
  3. DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
  4. DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
  5. RSDEMO_TABLE_CONTROL
  6. RSDEMO02

And I couldn't locate the answer. After the tab get's cleared and I get the empty screen, the new introduced values are nowhere as it goes directly to PAI in the user_command module.

Best,

Elena

In the flow logic, both in PBO and PAI, you have a LOOP WITH CONTROL, which loops at every line on the screen, you must execute a module to transfer all fields in the current line of the internal table.

former_member182371
Active Contributor

Hi,

may be those requesting that change should read this OSS Note (search for T77UA):

2054808 - HR authorizations: Collective SAP Note with questions and answers

Best regards,

Pablo

Former Member
0 Kudos

Hi Pablo,

Appreciate the answer, I will pass it on.
They are using structural authorizations in CRM, and is only being used as fixed structural authorizations for Personnel administrators so they can get access to a certain part of the organization.
There are a few authorization profiles assigned to limited resources.

Table T77UA is already maintainable in production as the System attributes are setup to Live.
They need to be able to assign new administrators to their org unit also in dev or quality in the same way.

Best,
Elena

Former Member

Hi

You should post your PBO/PAI code, you can considerate the data are in two different layer:

- Screen

- Memory

In PBO the data have to be transfered from Memory (so your internal table) to Screen (so your table control)

In PAI the data have to be transfered from screen (so your table control) to memory (so your internal table)

Max

0 Kudos

Hi Max,
Thank you for the explanation. I am currently thinking that I am missing something in the PAI part because the data is not passed correctly from the screen to the internal table.
Once I clear the internal table and want to retain the new values it doesn't work.
My apologies if this is silly, but I haven't work with GUI screens that much.

I have attached my code, maybe you can notice what I am doing wrong.
Thanks in advance.
Best regards,

Elena

table-control.jpg

Former Member

Hi I've checked your code

PBO:

LOOP AT SDYN_ITAB INTO ZT77UA WITH CONTROL TABLE_CONTROL. 
ENDLOOP. 

PAI

LOOP AT SDYN_ITAB.   
  MODULE READ_TABLE_CONTROL.
ENDLOOP. 

And module READ_TABLE_CONTROL

MODULE READ_TABLE_CONTROL INPUT.   IF MARK = 'X' AND SAVE_OK = 'DELE'.
    READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
    IF SY-SUBRC = 0.
      DELETE TABLE SDYN_ITAB FROM ZT77UA.
      DESCRIBE TABLE SDYN_ITAB KINES TABLE_CONTROL-LINES.    
    ENDIF.
  ELSE.
    DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES. 
    MODIFY SDYN_ITAB FROM ZT77UA INDEX TABLE_CONTROL-CURRENT_LINE.
  ENDIF.
ENDMODULE. 

This code is ok if you need to change existing record, but if you insert a new record in table control, this won't automatically be in your internal table:

you need to append it

For example your module READ_TABLE_CONTROL can check if the record is or isn't in SDYN_ITAB

MODULE READ_TABLE_CONTROL INPUT.
  IF MARK = 'X' AND SAVE_OK = 'DELE'.
    READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
    IF SY-SUBRC = 0.
      DELETE TABLE SDYN_ITAB FROM ZT77UA.
      DESCRIBE TABLE SDYN_ITAB KINES TABLE_CONTROL-LINES.    
    ENDIF.
  ELSE.
    DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES. 
    MODIFY SDYN_ITAB FROM ZT77UA INDEX TABLE_CONTROL-CURRENT_LINE.
    IF SY-SUBRC <> 0.
      APPEND ZT77UA TO SDYN_ITAB.
    ENDIF.
  ENDIF.
ENDMODULE. 

Or something else like above