Dynamic headers in table control
Hi,
How to create dynamic headers in table control headers?
I have to replace the header labels with internally computed headers.
I have created input fields for headers..
Regards,
Krutika
Hi Krutika,
Try this out,
Populate an internal tabel with all the dates and day in it and also populate the column position in it.
say you have populated all this in an internal table it_date----fields in the internal table
1. date
2. day
3. spot1 -
column name of the table control(spot1 represents the column position)
then do this ,
LOOP AT it_date INTO wa_date.
LOOP AT SCREEN .
*WHERE screen-name = wa_date-spot.
CASE wa_date-spot.
WHEN 'SPOTS1'.
spots1 = wa_date-dd.
WHEN 'SPOTS2'.
spots2 = wa_date-dd.
WHEN 'SPOTS3'.
spots3 = wa_date-dd.
WHEN 'SPOTS4'.
spots4 = wa_date-dd.
WHEN 'SPOTS5'.
spots5 = wa_date-dd.
WHEN 'SPOTS6'.
spots6 = wa_date-dd.
WHEN 'SPOTS7'.
spots7 = wa_date-dd.
WHEN 'SPOTS8'.
spots8 = wa_date-dd.
WHEN 'SPOTS9'.
spots9 = wa_date-dd.
WHEN 'SPOTS10'.
spots10 = wa_date-dd.
WHEN 'SPOTS11'.
spots11 = wa_date-dd.
WHEN 'SPOTS12'.
spots12 = wa_date-dd.
WHEN 'SPOTS13'.
spots13 = wa_date-dd.
WHEN 'SPOTS14'.
spots14 = wa_date-dd.
WHEN 'SPOTS15'.
spots15 = wa_date-dd.
WHEN 'SPOTS16'.
spots16 = wa_date-dd.
WHEN 'SPOTS17'.
spots17 = wa_date-dd.
WHEN 'SPOTS18'.
spots18 = wa_date-dd.
WHEN 'SPOTS19'.
spots19 = wa_date-dd.
WHEN 'SPOTS20'.
spots20 = wa_date-dd.
WHEN 'SPOTS21'.
spots21 = wa_date-dd.
WHEN 'SPOTS22'.
spots22 = wa_date-dd.
WHEN 'SPOTS23'.
spots23 = wa_date-dd.
WHEN 'SPOTS24'.
spots24 = wa_date-dd.
WHEN 'SPOTS25'.
spots25 = wa_date-dd.
WHEN 'SPOTS26'.
spots26 = wa_date-dd.
WHEN 'SPOTS27'.
spots27 = wa_date-dd.
WHEN 'SPOTS28'.
spots28 = wa_date-dd.
WHEN 'SPOTS29'.
spots29 = wa_date-dd.
WHEN 'SPOTS30'.
spots30 = wa_date-dd.
WHEN 'SPOTS31'.
spots31 = wa_date-dd.
ENDCASE.
Hope this helps you,
Regards,
Abhijit G. Borkar
Similar Messages
-
Dynamic extending of table control in bdc
hi frnds
I want an example of dynamic extension of table control i.e
for example:In xk01 there is table control with bank details.
i have to upload upto 10 bank details of a record. I have searched in forum.I got the hint of 'p+' but i cant understand that.so please send me sample code
Thanks
RaghavHai,
Chech this sample code.
Check the below link.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
THis is example to upload the Bank details of the Vendor which has the TC.
REPORT zprataptable2
NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA : BEGIN OF itab OCCURS 0,
i1 TYPE i,
lifnr LIKE rf02k-lifnr,
bukrs LIKE rf02k-bukrs,
ekorg LIKE rf02k-ekorg,
ktokk LIKE rf02k-ktokk,
anred LIKE lfa1-anred,
name1 LIKE lfa1-name1,
sortl LIKE lfa1-sortl,
land1 LIKE lfa1-land1,
akont LIKE lfb1-akont,
fdgrv LIKE lfb1-fdgrv,
waers LIKE lfm1-waers,
END OF itab.
DATA : BEGIN OF jtab OCCURS 0,
j1 TYPE i,
banks LIKE lfbk-banks,
bankl LIKE lfbk-bankl,
bankn LIKE lfbk-bankn,
END OF jtab.
DATA : cnt(4) TYPE n.
DATA : fdt(20) TYPE c.
DATA : c TYPE i.
INCLUDE bdcrecx1.
START-OF-SELECTION.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'C:\first1.txt'
filetype = 'DAT'
TABLES
data_tab = itab.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'C:\second.txt'
filetype = 'DAT'
TABLES
data_tab = jtab.
LOOP AT itab.
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-LIFNR'
itab-lifnr.
PERFORM bdc_field USING 'RF02K-BUKRS'
itab-bukrs.
PERFORM bdc_field USING 'RF02K-EKORG'
itab-ekorg.
PERFORM bdc_field USING 'RF02K-KTOKK'
itab-ktokk.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-LAND1'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LFA1-ANRED'
itab-anred.
PERFORM bdc_field USING 'LFA1-NAME1'
itab-name1.
PERFORM bdc_field USING 'LFA1-SORTL'
itab-sortl.
PERFORM bdc_field USING 'LFA1-LAND1'
itab-land1.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKN(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
cnt = 0.
LOOP AT jtab WHERE j1 = itab-i1.
cnt = cnt + 1.
CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
PERFORM bdc_field USING fdt jtab-banks.
CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
PERFORM bdc_field USING fdt jtab-bankl.
CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
PERFORM bdc_field USING fdt jtab-bankn.
IF cnt = 5.
cnt = 0.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
ENDIF.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-FDGRV'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LFB1-AKONT'
itab-akont.
PERFORM bdc_field USING 'LFB1-FDGRV'
itab-fdgrv.
PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFM1-WAERS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LFM1-WAERS'
itab-waers.
PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_transaction USING 'XK01'.
ENDLOOP.
PERFORM close_group.
Header file:
1 63190 0001 0001 0001 mr bal188 b in 31000 a1 inr
2 63191 0001 0001 0001 mr bal189 b in 31000 a1 inr
TC file:
1 in sb 11000
1 in sb 12000
1 in sb 13000
1 in sb 14000
1 in sb 15000
1 in sb 16000
1 in sb 17000
1 in sb 18000
1 in sb 19000
1 in sb 20000
1 in sb 21000
1 in sb 22000
2 in sb 21000
2 in sb 22000
REPORT zmm_pr_upload_mat
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Standard Include for Selection Screen
INCLUDE bdcrecx1.
Internal Table for Upload Data
DATA: BEGIN OF i_pr OCCURS 0,
Header Screen
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
lpein(001), " Category of Del Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
Item Details
matnr(018), " Material No
menge(017), " Quantity
badat(010),
frgdt(010),
preis(014), " Valuation Price
waers(005), " Currency
peinh(005),
wepos(001),
repos(001),
sakto(010), " GL Account
kostl(010), " Cost Center
bnfpo(005),
END OF i_pr.
Internal Table for header Data
DATA: BEGIN OF it_header OCCURS 0,
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
END OF it_header.
Internal Table for Item Data
DATA: BEGIN OF it_item OCCURS 0,
sno(3), " SNo
matnr(018), " Material No
menge(017), " Quantity
preis(014), " Valuation Price
sakto(010), " GL Account
kostl(010), " Cost Center
END OF it_item.
Data Variables & Constants
CONSTANTS : c_x VALUE 'X'. " Flag
DATA : v_l(2), " Counter
v_rowno(5), " Row No
v_2(2), " Counter
v_rows LIKE sy-srows, " Rows in TC
v_field(45). " String
Parameters
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start of Selection
START-OF-SELECTION.
Open the BDC Session
PERFORM open_group.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_pr
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT i_pr BY sno.
LOOP AT i_pr.
MOVE-CORRESPONDING i_pr TO it_item.
APPEND it_item.
CLEAR it_item.
AT END OF sno.
READ TABLE i_pr INDEX sy-tabix.
MOVE-CORRESPONDING i_pr TO it_header.
APPEND it_header.
CLEAR it_header.
ENDAT.
ENDLOOP.
SORT it_header BY sno.
SORT it_item BY sno.
v_rows = sy-srows - 6.
Upload the Data from Internal Table
LOOP AT it_header.
Header Data
PERFORM bdc_dynpro USING 'SAPMM06B' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-BEDNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-BSART'
it_header-bsart.
PERFORM bdc_field USING 'RM06B-EPSTP'
it_header-epstp.
PERFORM bdc_field USING 'EBAN-KNTTP'
it_header-knttp.
PERFORM bdc_field USING 'RM06B-EEIND'
it_header-eeind.
PERFORM bdc_field USING 'RM06B-LPEIN'
it_header-lpein.
PERFORM bdc_field USING 'EBAN-WERKS'
it_header-werks.
PERFORM bdc_field USING 'EBAN-LGORT'
it_header-lgort.
PERFORM bdc_field USING 'EBAN-EKGRP'
it_header-ekgrp.
PERFORM bdc_field USING 'EBAN-MATKL'
it_header-matkl.
PERFORM bdc_field USING 'EBAN-BEDNR'
it_header-bednr.
PERFORM bdc_field USING 'EBAN-AFNAM'
it_header-afnam.
Item Details
v_l = 0.
To add no. of rows
v_2 = 0 .
As the screen is showing 13 rows defaulted to 130
v_rowno = 130 .
LOOP AT it_item WHERE sno = it_header-sno.
v_l = v_l + 1.
IF v_l = 14 .
IF v_2 = 12 .
v_2 = 12 .
v_l = 2 .
From second time onwards it is displaying 12 rows only
v_rowno = v_rowno + 120 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ELSE.
V_2 initialized to 12 for second screen purpose
v_2 = 12 .
v_l = 2 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno .
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ENDIF.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CLEAR v_field.
CONCATENATE 'EBAN-MATNR(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-matnr.
CLEAR v_field.
CONCATENATE 'EBAN-MENGE(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-menge.
PERFORM bdc_dynpro USING 'SAPMM06B' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-PREIS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-PREIS'
it_item-preis.
PERFORM bdc_dynpro USING 'SAPMM06B' '0505'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBKN-SAKTO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'EBKN-SAKTO'
it_item-sakto.
Cost Center
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL'
it_item-kostl.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
Call The Transaction
PERFORM bdc_transaction USING 'ME51'.
ENDLOOP.
Close the BDC Session
PERFORM close_group.
with regards.
sowjanya.b. -
Dynamic display in table control
hi all,
i hav an issue regarding Module Pool programming. i wnt 2 disply table control with dynamic enteries both at header level and the content level, ie. the values of the heading shud com 4m an internal table and the values a user enters shud go 2 another internal tab. i cannot take the values of one column of d tab contrl in a diff internal tab n so on for all headers.See dis ll b design format,
Screen 1 delivrry no._________
In PAI itll find total no. of material no. n other details.
Screen 2. (header) <b>matnr1</b> <b>matnr2</b> <b>matnr3</b> (cmng from int tab 1 on which d loop is defined in PBO of screen 2)
<b>Ser1 Ser2 Ser3 </b> (entered by the user)
<b>Ser11 Ser22</b>
<b>Ser12</b>
<b>button</b>( to tk this combination in one int table in the followng format for running it in BDC)
matnr1 Ser1
matnr1 Ser11
matnr1 Ser12
matnr2 Ser2
matnr2 Ser22
matnr3 Ser3
revert if nt clear -
Hi Experts,
My Requirement is create a table control with 5 coloumns. The rows have to be displayed dynamically...
I created a screen , and placed a table control.
For eg :
if my internal table having 2 entries , then the table control should only have two rows....(no disable/greyout)
if internal table having say 40 entries , then the table control should have 40 rows...
Thanks,
Lakshmiraj.AHi,
Refer
table control dynamic rows
Dynamic rows increment according to user input in Table Control Module Pool
Hope this helps
Sumana -
Dynamic tabstrips and table control in custom infotype
Dear Experts,
I have a requirement to create a custom infotype using tabstrips and table control. The tabstripes should also be dynamically populated. For example we have infty 8(Basic pay) used table control and 24(Qualifications) for tabstripes.
Could you please tell me how to do this. Please do the needful ASAP.
Thanks,
Chaitanya.
Moderator message - Please don't just post your requirements and ask the forum to do your work for you...especially ASAP - Thread locked
Edited by: Rob Burbank on Oct 7, 2009 4:16 PMHi Partha,
Pls check the threads:
Best way to store a table control into an infotype
Re: Custom Infotype with table control - Overview/List Screen
Dilek -
Hi friends,
I am having a problem when sorting the table control dynamically based on the fields selectd.
sorting is not working, when you select multiple fields ( one numeric field and one character field ) I have written code for handling multiple field sort,gettting field names correctly, everything looks fine but internal table is not getting sorted.
Is it related unicode issue..?
Any help will be appreciated.
Sample code:
loop at tc_control into lc_cols.
case lc_cols-selected.
wehn 'X'.
split lc_cols-screen-name at '-' into gv_tabname gv_fieldname.
move gv_fieldname gs_struc+lv_off(20)
add 20 to lv_off.
endcase.
endloop.
if ok_code = 'ASCE'.
sort itab by (gs_struc-field1) (gs_struc-field2) ..... ascending
endif.
Thanks in advance
Thiru.pHi
Try using an internal table for the field names..
Example
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
WERKS TYPE WERKS_D,
END OF ITAB.
DATA: ITAB_FIELD(30) OCCURS 0 WITH HEADER LINE.
DATA
ITAB-MATNR = 'ABC'.
ITAB-WERKS = 'ABCD'.
APPEND ITAB.
ITAB-MATNR = 'ABC'.
ITAB-WERKS = 'ABC'.
APPEND ITAB.
SORT INTERNAL TABLE
ITAB_FIELD = 'MATNR'.
<b>APPEND ITAB_FIELD.</b>
ITAB_FIELD = 'WERKS'.
<b>APPEND ITAB_FIELD.</b>
<b>SORT ITAB BY (ITAB_FIELD).</b>
LOOP AT ITAB.
WRITE: / ITAB-MATNR,ITAB-WERKS.
ENDLOOP.
Thanks
Naren -
Listbox displaying dynamic values in table control
Hi Experts,
The requirement that I have is that there are two columns in an internal table out of which second one is a listbox.
There is a need of displaying dynamic values in a row in a listbox according to value entered in first column of the same row, not affecting the listbox values in other rows.
I am using VRM_SET_VALUES for populating listbox, but it results in populating the listbox in all other rows also.
Please help.
Thanks,
GarimaHi Thanks for the link..
But my problem is something else.
I want the same listbox of a column in a table control to show me different values in different rows on the basis of value in another column .
Regards,
Garima -
Adding dynamic columns in Table Control
Hi All,
Can we add dynamic columns in a table control? The requirement is something like this. When the user clicks a button it should add a column to the table. Also is it possible for the same column to refer to different fields of the Internal Table of the Database table. Example. The first row in the table control must refer to MARA-MATNR and the second row must refer to MAKT-MAKTX.
Regards,
SudhindraHello Sudhindra,
If you know all the columns that the table control will ever contain, then I suppose it is possible to add and delete the columns dynamically.
What cannot be dynamic, is the determination of which coulmn would be displayed in the table control.
To elaborate, In SE51, you have to define the table control with all the possible columns. In the program, during the PBO, you can choose to hide some of these columns. When the user performs certain action (PAI), you can determine which opf the hidden columns would be displayed in the table control after the next PBO.
Coming to your second requirement, I don't think it is directly possible in case of table conrols. You will have to do some manipulation to achieve it. But even if you can I think you should not. Because, It is not elegant from a good-UI design perspective. ANd during the course of the necessary manipulations, we might have to forgo some of the features like Automatic Field Validation, Automatic Input Help etc. You can use ALV for the same.
Please be judicious in deciding which approach to consider and if you run into some more problems, please do get back with some more details like how many columns you have, how many different row-types do you want, what are the features for the fields that you wish to provide (eg. F4 help) an so on...
Regards,
Anand Mandalika. -
Dynamic headings in table Control
Hey everybody,
I have a table control in which I need to fill the headings of the columns dynamically at runtime.
Is that possible? If yes, how?
Thanks for your suggestions, Kathrin!Hi Rob,
I appreciate your help.
Anybody other suggestions?
Screen painter won't let me change the text-fields in the column headings to I/O fields.
I get an error message 37 219 telling me switching from textfield to i/o field is not possible.
If I delete the text field, I can not create a I/O field in heading of the column.
Next, I tried changing the text-fields to 'input allowed' in the attributes, but it does not work.
If I write a "field" statement to ensure data transport for the text-fields in PBO of the dynpro, I get a syntax error.
Can anybody give me a hint?
Thanks and kind regards, Kathrin! -
Dynamic Fields in Table control......
hi friends,
i wan to knw , is it possible to add fields dynamically in table control? actually the requirement is like, it is not fixed how many fields will be their in table control, it may change depending upon date. so if u knw, please help me out....
good points will be awarded to helpful answer.....
Thanks,
BrijHi Harsha,
I generated a table control (ERP 6.2) and somewhere I found the coding like this (the name of the table control is TABLE_CONTROL):
*&spwizard: output module for tc 'TABLE_CONTROL'. do not change this lin
*&spwizard: get lines of tablecontrol
module TABLE_CONTROL_get_lines output.
g_TABLE_CONTROL_lines = sy-loopc.
If I do a loop at the screen at this place, I can control the individual input/output for the screen fields (the table fields). In my work area (WA_CONTROL) I can see the actual value of fields. Depending on this, I choose to enable/disable input via:
loop at screen.
if wa_control-material <> ' '.
screen-input = '0'.
modify screen.
endif.
endloop. -
Dynamic Coloumn in Table Control
Hi,
I have a requirement to create coloumns in table control at runtime.
For e.g. if we see transaction SM34.
click on one box displays one set of coloumns on right side and so on.
one way is, i take all the coloums that can be displayed (may be later) and hide them according to the click on the tree.
But i am not sure whether it is the right approach.
using ALV will be my last approach.
kindly guide me to resolve this.
thanks
gauravHi,
If you know maximum no of columns you have to display dynamically. You can put all the columns in the internal table and generate a table control. Then make it invisible. Enable it on the click event. Also you can name the columns in such a way that the ucomms and the internal table column name matches. Say like COl1 col 2 and so on. you can use Assign component structure to aid making it visible.
Good luck!!!
Cordially,
Shankar Narayanan. -
Hiding columns dynamically in a table control
Hello all,
Based on the selected value in a dropdown box, I want to hide some columns in a table control. The table control is generated using the wizard from a work area and itab in the program. I have tried things like
loop at screen.
if screen-name = <work area>-<field name>.
screen-invisible = 1.
modify screen.
endif.
endloop.
I have also tried screen-active = 0, but it is not working. Is there any other way to achieve this?
Thanks in advance.
Regards,
Nithyahi,
u cant make it invisible but u can make it disable by making one module in PBO...
MODULE init_screen OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'ITAB_DET-BILL_NO' AND zform_track_mast-comp_code = '1000'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE. " init_screen OUTPUT
reward if usefull... -
Dynamic columns in table control
hi,
I need to add some fields in table control in run time based on conditions given.I need to use CXTAB related ones.
Can anyone help me with some related codes with CXTAB.
Edited by: Ramya Ramya on Mar 8, 2011 11:21 AMPROCESS BEFORE OUTPUT.
module operation.
loop at i_vbap into wa_vbap with control tc.
MODULE STATUS_0100.
endloop.
module clear.
PROCESS AFTER INPUT.
loop at i_vbap.
module modify.
endloop.
field VBAK-VBELN MODULE USER_COMMAND_0100 on request.
module sub.
include mzsanpracticetop . " global Data
* INCLUDE MZSANPRACTICEO01 . " PBO-Modules
* INCLUDE MZSANPRACTICEI01 . " PAI-Modules
* INCLUDE MZSANPRACTICEF01 . " FORM-Routines
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
move-corresponding wa_vbap to vbap.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
case ok_code.
when ''.
*if tc-lines ne tc-current_line.
if lv_lines is initial.
select vbeln
erdat
posnr
matnr
matwa
matkl
arktx
from vbap
into corresponding fields of table i_vbap
where vbeln = vbak-vbeln.
*and erdat = vbak-erdat.
move : sy-dbcnt to tc-lines.
endif.
when 'SUB'.
delete i_vbap where mark eq 'X'.
tc-lines = tc-lines - tc-current_line.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Module operation OUTPUT
* text
module operation output.
describe table i_vbap lines lv_lines.
if tc-lines eq 0.
tc-lines = 1.
endif.
endmodule. " operation OUTPUT
*& Module modify INPUT
* text
module modify input.
clear lv_lines.
describe table i_vbap lines lv_lines.
if lv_lines ge tc-current_line.
if wa_vbap-mark eq 'X'.
v_index = tc-current_line .
endif.
modify i_vbap from wa_vbap index tc-current_line.
else.
if wa_vbap-mark eq 'X'.
v_index = tc-current_line .
endif.
append wa_vbap to i_vbap.
clear wa_vbap.
endif.
endmodule. " modify INPUT
*& Module clear OUTPUT
* text
module clear output.
clear : ok_code,
v_index.
endmodule. " clear OUTPUT
*& Module sub INPUT
* text
module sub input.
case ok_code.
when 'SUB'.
delete i_vbap where mark eq 'X'.
tc-lines = tc-lines - tc-current_line.
when 'ADD'.
*loop at i_vbap.
if v_index is not initial.
insert initial line into i_vbap index v_index.
else.
get cursor " field v_fname
line v_line
area v_area.
move : v_line to v_index.
v_index = v_index + 1.
insert initial line into i_vbap index v_index.
endif.
* endloop.
tc-lines = lv_lines + 1.
endcase.
endmodule. " sub INPUT
understand and use it -
Dynamic Changes in Table control
Hi
is that possible to change the table control dynamicallyHi Rob
my requirement is data upload from Excel to table control is over now
some of my TL said that if i add more fields and records in that Excel than uplod the data to table control -
Dynamic Screen in Table Control
Hello Guys,
I have a problem on screen dynpro. In the screen, i have a table control and i set all the field can be input.
But i have 2 t-code where 1 of the t-code can edited the data and another one only display.
So in screen status, i insert this code.
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 = 'ZKP'.
screen-input = 0.
screen-output = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
but when i execute, the screen still can be input. can anyone help me please...!!!!That coding i put it in "MODULE STATUS 0300." Those are the coding for the screen and the module status.
*************--code for the screen----******************
PROCESS BEFORE OUTPUT.
MODULE STATUS_0300.
*&spwizard: pbo flow logic for tablecontrol 'TBL_KWPP'
module TBL_KWPP_init.
*&spwizard: module TBL_KWPP_change_tc_attr.
*&spwizard: module TBL_KWPP_change_col_attr.
module TBL_KWPP_change_tc_attr.
loop at g_TBL_KWPP_itab
into g_TBL_KWPP_wa
with control TBL_KWPP
cursor TBL_KWPP-current_line.
*&spwizard: module TBL_KWPP_change_field_attr
module TBL_KWPP_move.
module TBL_KWPP_get_lines.
endloop.
module cal_sum2.
PROCESS AFTER INPUT.
MODULE returnexit AT EXIT-COMMAND.
*&spwizard: pai flow logic for tablecontrol 'TBL_KWPP'
loop at g_TBL_KWPP_itab.
chain.
field ZLMDL015A-ZRUMJEN.
field ZLMDL015A-ZRUMFAED.
field ZLMDL015A-ZRUMULA.
field ZLMDL015A-ZRUMAKH.
field ZLMDL015A-ZRUMAMB.
field ZLMDL015A-ZRUMTERIMA.
field ZLMDL015A-ZRUMBAYARAN.
field ZLMDL015A-ZRUMAMNOM.
field G_TBL_KWPP_WA-FLAG
MODULE tab_vot_mark1 ON REQUEST.
MODULE TBL_KWPP_modify ON CHAIN-REQUEST.
endchain.
endloop.
module TBL_KWPP_user_command.
*&spwizard: module TBL_KWPP_change_tc_attr.
*&spwizard: module TBL_KWPP_change_col_attr.
MODULE USER_COMMAND_0300.
*******---code for the module status---**********
MODULE STATUS_0300 OUTPUT.
SET PF-STATUS '0300'.
* SET TITLEBAR 'TITLE3' WITH 'Wujud/Kemaskini'.
* zlmfl030-zlmtkhlaras = w_ztksej.
perform set_tarikh.
* perform find_data.
IF sy-tcode = 'ZDLKWPP1'.
SET TITLEBAR 'TITLE' WITH 'Wujud/Kemaskini'.
SET PF-STATUS '0300'.
ELSE.
SET TITLEBAR 'TITLE' WITH 'Papar'.
SET PF-STATUS '0300' EXCLUDING 'SAVE'.
endif.
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 CS 'ZKP'.
screen-input = 0.
screen-output = 1.
MODIFY SCREEN.
CLEAR SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " STATUS_0300 OUTPUT
and as you can see i try ashavind code, it still not working.
Maybe you are looking for
-
How do I keep an image constrained in one size, and not become enlarged?
I would like to disable the feature where images on iweb will expand when clicked on. I had thought I edited the photos to keep them one size- 300 x 300 px. After I added them to a web page on iweb, I used the site inspector, and tried to put the inf
-
Orange Livebox & MacBook Pro Slow wireless connection
Hello, Looks like we are a lot experiencing a slow or sporadic wireless connection. I have done all updates, the MBP finds the livebox and connect properly but I have a very slow connection. Lan connection is working fine and quick. Please could some
-
Mac Os X 10.4 Bluetooth issu
Dears, I think I've found a possible bug in Mac Os X version 10.4.11 in conjunction with iPod Touch. When the iPod is connected during boot, my Bluetooth hardware fails to be detected. When I restart the portable without the iPod connected, my Blueto
-
I have some trouble with UT... 1) The cpu usage is VERY very high... arround 90-100% No matter if I idle in the game menu, or I play... 2) I can't alt + tab 3) Sound dies off after few minutes. Note that I'm using oss4 and to bring back sound I have
-
Hi all, I want to read xsd file(3 xsd file with namespaces). Each xsd file contains namespace uri. I want to read these xsd files and i want to get all the child node and attributes of given parent node. how to get the information about each and ever