‎2015 May 28 3:40 PM
Hi experts ,
I have a requirement where i display a table control with coloum heading and pushbuttons only.
For example.
monday tuesday wednesday
[pushbutton] [pushbutton] [pushbutton]
This is nothing but column number changes based on day.
But main doubt is how to display a pushbutton on a table container(not manually as my code has to be dynamic).
Thanks in advance
SSK
‎2015 May 28 3:57 PM
Do you really need a table control for this? If there are only weekday names and pushbuttons, can't you create just 7 separate pushbuttons on the screen?
Thanks,
Juwin Thomas
‎2015 May 28 4:13 PM
My requirement is completly different, just cannot post the whole of it so i tried to explain with an example.
In my table control i need to populate push-buttons and i want to know how can i achieve this.
Regards,
SSK
‎2015 May 28 4:00 PM
They're just screen fields. You can hide them during the LOOP AT SCREEN.
Rob
‎2015 May 28 4:14 PM
Hi Rob,
Thanks for the reply and your time.
We can hide them or make them inactive ... that's fine , but i would like to populate push-buttons on table control first.
Can you please explain me how can i do this.
Regards
SSK
‎2015 May 28 4:21 PM
Like I said when you LOOP AT SCREEN XXXX WITH CONTROL myctl.
Rob
‎2015 May 28 4:38 PM
HI Rob,
My be i did not explain it clearly.
My internal table consists of 3 fields A,B and C and say 5 rows.
When i display the table i need output something like this
‎2015 May 28 6:17 PM
Hi
I don't know if you're looking something like this, but I hope it can help you
DATA: BEGIN OF ITAB OCCURS 0,
BUTTON_A(60),
BUTTON_B(60),
BUTTON_C(60),
END OF ITAB.
DATA: ICON_NAME(30) TYPE C,
ICON_TEXT(30) TYPE C.
DATA: ICON_CHECK TYPE FLAG.
CONTROLS T_CTRL TYPE TABLEVIEW USING SCREEN 100.
The field of internal table ITAB are assigned to a field of a table control, every field of table control is a pushbutton, so I can decide which icon a text assigned to every button:
DO 5 TIMES.
IF ICON_CHECK IS INITIAL.
ICON_NAME = 'ICON_PRINT'.
ELSE.
ICON_NAME = 'ICON_CHECKED'.
ENDIF.
ICON_TEXT = 'Button A'.
WRITE SY-INDEX TO ICON_TEXT+9 LEFT-JUSTIFIED.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
NAME = ICON_NAME
TEXT = ICON_TEXT
IMPORTING
RESULT = ITAB-BUTTON_A.
IF ICON_CHECK IS INITIAL.
ICON_NAME = 'ICON_BOOKING_OK'.
ELSE.
ICON_NAME = 'ICON_LOCKED'.
ENDIF.
ICON_TEXT = 'Button B'.
WRITE SY-INDEX TO ICON_TEXT+9 LEFT-JUSTIFIED.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
NAME = ICON_NAME
TEXT = ICON_TEXT
IMPORTING
RESULT = ITAB-BUTTON_B.
IF ICON_CHECK IS INITIAL.
ICON_NAME = 'ICON_CAR'.
ELSE.
ICON_NAME = 'ICON_CALCULATION'.
ENDIF.
ICON_TEXT = 'Button C'.
WRITE SY-INDEX TO ICON_TEXT+9 LEFT-JUSTIFIED.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
NAME = ICON_NAME
TEXT = ICON_TEXT
IMPORTING
RESULT = ITAB-BUTTON_C.
APPEND ITAB.
IF ICON_CHECK IS INITIAL.
ICON_CHECK = 'X'.
ELSE.
CLEAR ICON_CHECK .
ENDIF.
ENDDO.
CALL SCREEN 100.
The result will be this:
‎2015 May 29 1:23 PM
Hi Max,
Good morning. Hope you are doing good.
Thanks for the answer , i have done the same procedure as described and get the following result
May be i have missed something in the layout like field attributes or table control element.
I cannot even display images even though itab contains records.
Thanks and regards
SSK
‎2015 May 29 8:05 PM
Hi
You need to insert a pushbutton as colunm of your internal table as following images:
and then you need to change the attribute:
- The Name has to be the same of your internal table field (red circle)
- Field for Output has to be checked (blue circle)
- With Icon has to be checked (green circle)
In PBO you can move the data from internal table to table control
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
LOOP WITH CONTROL T_CTRL.
MODULE READ_ITAB.
ENDLOOP.
*
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
LOOP WITH CONTROL T_CTRL.
ENDLOOP.
MODULE READ_ITAB OUTPUT.
READ TABLE ITAB INDEX T_CTRL-CURRENT_LINE.
IF SY-SUBRC <> 0.
CLEAR ITAB.
ENDIF.
ENDMODULE. " READ_ITAB OUTPUT
Max
‎2015 Jun 01 7:30 AM
HI Max,
Thank you for the reply and your valuable time.
In layout , we can insert push-buttons and convert it into radio buttons or even check-boxes.
I am aware of this process. This can be done when we know the number of columns i need to display.
In my requirement i do not know how many columns i will display , so i cannot insert push-buttons or i cant even do anything manually.
Thanks once again Max for the descriptive answers and the help.
SSK
‎2015 Jun 01 10:15 AM
‎2015 Jun 18 10:22 AM
It is just right in the middle of cockpit development so i think i cannot just introduce an alv , creating disturbances in existing code
Regards
SSK
‎2015 Jun 18 11:19 AM
Hi
I don't know if it's possible to do it with a table control, probably you can create a "big" table control having a large number of colunms for pushbuttom, radiobuttom, checkbox in order to satisfy all your situations and you active only what you need
Max