Reg Table Control ---- URGENT
HI to ALL,
i have a table control with some fields.On that,
if Form type = F, then program allows user to enter vendor code in vendor field.
if form type = E, then program didnt allow users to enter vendor in vendor field.
How will i do it for that vendor field???? for form type = E, the vendor field doesnt allow input
i tried in PBO.but it doesnt works fine.
Why you say you tried PBO what did you try in that event.
You need to use the logic of LOOP AT SCREEN.........
Similar Messages
-
Last_page button is not working in table control-urgent
hi all,
iam displaying the data in table control.in my pf-status i have first_page,next_page,prev_page and last_page.out of 4 buttons 3 buttons are working finr except last_page. any body can send me the code for this program.iam sending my program below.
REPORT ZMAHI_TABLE_CONTROL .
TABLES : VBAK,VBAP.
DATA : BEGIN OF ITAB OCCURS 0,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
ERZET TYPE VBAK-ERZET,
REASON(40) TYPE C,
END OF ITAB.
DATA : FILL TYPE I VALUE 1.
DATA : N TYPE I .
DATA : BEGIN OF XVALUES OCCURS 50,
BUTXT LIKE T001-BUTXT,
END OF XVALUES.
DATA : BEGIN OF XFIELDS OCCURS 50.
INCLUDE STRUCTURE HELP_VALUE.
DATA : END OF XFIELDS.
DATA : BEGIN OF SEL_VAL OCCURS 50.
INCLUDE STRUCTURE HELP_VTAB.
DATA : END OF SEL_VAL.
TABLE CONTROL DECLARATIONS------
CONTROLS : CONTROL_DATA TYPE TABLEVIEW USING SCREEN '100'.
DATA : OK_CODE TYPE SY-UCOMM,
LIN TYPE I,
LIN1 TYPE I,
LIN2 TYPE I,
LIN3 TYPE I.
DATA: LINES TYPE I,
LIMIT TYPE I VALUE 1.
DATA : LINE_COUNT TYPE I,
LINEI TYPE I,
LINEJ TYPE I,
LINE1 TYPE I,
LINE2 TYPE I,
LN1 TYPE I.
SELECTION-SCREEN : BEGIN OF BLOCK B1.
SELECT-OPTIONS : P_VBELN FOR VBAK-VBELN.
SELECTION-SCREEN : END OF BLOCK B1.
START-OF-SELECTION.
SELECT VBELN
ERDAT
ERNAM
ERZET
FROM VBAK
INTO TABLE ITAB
WHERE VBELN IN P_VBELN.
CALL SCREEN 100.
*& Module F4_HELP INPUT
MODULE F4_HELP INPUT.
FREE : XFIELDS,SEL_VAL,XVALUES.
MOVE : 'ZMAHI' TO XFIELDS-TABNAME,
'REASON' TO XFIELDS-FIELDNAME,
'X' TO XFIELDS-SELECTFLAG.
APPEND XFIELDS.
XVALUES = 'Non Trade F&F'.
APPEND XVALUES .
XVALUES = 'Non Trade Retention'.
APPEND XVALUES .
XVALUES = 'Oldbills Accnt cntmnt'.
APPEND XVALUES .
XVALUES = 'Non Trade Not claimed'.
APPEND XVALUES .
XVALUES = 'Non Trade Dispute'.
APPEND XVALUES .
XVALUES = 'Non Trade Payment Block'.
APPEND XVALUES .
XVALUES = 'N/T Subsntly Cleared'.
APPEND XVALUES .
XVALUES = 'N/T Unstld Advances'.
APPEND XVALUES .
XVALUES = 'N/T OThers'.
APPEND XVALUES .
XVALUES = 'Trade Non Receipt OF BOE'.
APPEND XVALUES .
XVALUES = 'Trade OEM Adjustments'.
APPEND XVALUES .
XVALUES = 'Trade Reject Of Material'.
APPEND XVALUES .
XVALUES = 'Trade NOt Claimed'.
APPEND XVALUES .
XVALUES = 'Trade Dispute'.
APPEND XVALUES .
XVALUES = 'Trade Payment BLock'.
APPEND XVALUES .
XVALUES = 'Trade Subsntly Cleared'.
APPEND XVALUES .
XVALUES = 'Trade Non Submission of bills'.
APPEND XVALUES .
XVALUES = 'Trade others'.
APPEND XVALUES .
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE_EXT'
EXPORTING
CUCOL = 0
CUROW = 0
DISPLAY = ' '
FIELDNAME = 'REASON'
TABNAME = 'ZIFIOD011'
IMPORTING
SELECT_VALUE = ITAB-REASON
TABLES
FIELDS = XFIELDS
SELECT_VALUES = SEL_VAL
VALUETAB = XVALUES.
ENDMODULE. " F4_HELP INPUT
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'CANCEL' OR 'EXIT' OR 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'NEXT_LINE'.
CONTROL_DATA-top_line = CONTROL_DATA-top_line + 1.
limit = fill - lines + 1.
IF CONTROL_DATA-top_line > limit.
CONTROL_DATA-top_line = limit.
ENDIF.
WHEN 'PREV_LINE'.
CONTROL_DATA-top_line = CONTROL_DATA-top_line - 1.
IF CONTROL_DATA-top_line < 0.
CONTROL_DATA-top_line = 0.
ENDIF.
WHEN 'NEXT_PAGE'.
CONTROL_DATA-TOP_LINE = CONTROL_DATA-TOP_LINE + LINES.
LIMIT = LIMIT + 1.
CONTROL_DATA-TOP_LINE = LIMIT.
WHEN 'PREV_PAGE'.
CONTROL_DATA-TOP_LINE = CONTROL_DATA-TOP_LINE - LINES.
LIMIT = LIMIT - 1.
CONTROL_DATA-TOP_LINE = LIMIT.
WHEN 'LAST_PAGE'.
CONTROL_DATA-TOP_LINE = FILL - LINES + 1.
WHEN 'FIRST_PAGE'.
CONTROL_DATA-TOP_LINE = 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module SCROLL_BAR INPUT
MODULE SCROLL_BAR INPUT.
DESCRIBE TABLE ITAB LINES CONTROL_DATA-LINES.
ENDMODULE. " SCROLL_BAR INPUT
thanks,
maheedhar.THi Ravi,
The code which u sent to me is not working for next page and previous page.
can u plz resend me the code.
iam sending my code below.
REPORT ZMAHI_TABLE_CONTROL .
TABLES : VBAK,VBAP.
DATA : BEGIN OF ITAB OCCURS 0,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
ERZET TYPE VBAK-ERZET,
REASON(40) TYPE C,
END OF ITAB.
DATA : FILL TYPE I VALUE 1.
DATA : N TYPE I .
DATA : BEGIN OF XVALUES OCCURS 50,
BUTXT LIKE T001-BUTXT,
END OF XVALUES.
DATA : BEGIN OF XFIELDS OCCURS 50.
INCLUDE STRUCTURE HELP_VALUE.
DATA : END OF XFIELDS.
DATA : BEGIN OF SEL_VAL OCCURS 50.
INCLUDE STRUCTURE HELP_VTAB.
DATA : END OF SEL_VAL.
TABLE CONTROL DECLARATIONS------
CONTROLS : CONTROL_DATA TYPE TABLEVIEW USING SCREEN '100'.
DATA : OK_CODE TYPE SY-UCOMM,
LIN TYPE I,
LIN1 TYPE I,
LIN2 TYPE I,
LIN3 TYPE I.
DATA: LINES TYPE I,
LIMIT TYPE I VALUE 1.
DATA : LINE_COUNT TYPE I,
LINEI TYPE I,
LINEJ TYPE I,
LINE1 TYPE I,
LINE2 TYPE I,
LN1 TYPE I.
SELECTION-SCREEN : BEGIN OF BLOCK B1.
SELECT-OPTIONS : P_VBELN FOR VBAK-VBELN.
SELECTION-SCREEN : END OF BLOCK B1.
START-OF-SELECTION.
SELECT VBELN
ERDAT
ERNAM
ERZET
FROM VBAK
INTO TABLE ITAB
WHERE VBELN IN P_VBELN.
CALL SCREEN 100.
*& Module F4_HELP INPUT
MODULE F4_HELP INPUT.
FREE : XFIELDS,SEL_VAL,XVALUES.
MOVE : 'ZMAHI' TO XFIELDS-TABNAME,
'REASON' TO XFIELDS-FIELDNAME,
'X' TO XFIELDS-SELECTFLAG.
APPEND XFIELDS.
XVALUES = 'Non Trade F&F'.
APPEND XVALUES .
XVALUES = 'Non Trade Retention'.
APPEND XVALUES .
XVALUES = 'Oldbills Accnt cntmnt'.
APPEND XVALUES .
XVALUES = 'Non Trade Not claimed'.
APPEND XVALUES .
XVALUES = 'Non Trade Dispute'.
APPEND XVALUES .
XVALUES = 'Non Trade Payment Block'.
APPEND XVALUES .
XVALUES = 'N/T Subsntly Cleared'.
APPEND XVALUES .
XVALUES = 'N/T Unstld Advances'.
APPEND XVALUES .
XVALUES = 'N/T OThers'.
APPEND XVALUES .
XVALUES = 'Trade Non Receipt OF BOE'.
APPEND XVALUES .
XVALUES = 'Trade OEM Adjustments'.
APPEND XVALUES .
XVALUES = 'Trade Reject Of Material'.
APPEND XVALUES .
XVALUES = 'Trade NOt Claimed'.
APPEND XVALUES .
XVALUES = 'Trade Dispute'.
APPEND XVALUES .
XVALUES = 'Trade Payment BLock'.
APPEND XVALUES .
XVALUES = 'Trade Subsntly Cleared'.
APPEND XVALUES .
XVALUES = 'Trade Non Submission of bills'.
APPEND XVALUES .
XVALUES = 'Trade others'.
APPEND XVALUES .
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE_EXT'
EXPORTING
CUCOL = 0
CUROW = 0
DISPLAY = ' '
FIELDNAME = 'REASON'
TABNAME = 'ZIFIOD011'
IMPORTING
SELECT_VALUE = ITAB-REASON
TABLES
FIELDS = XFIELDS
SELECT_VALUES = SEL_VAL
VALUETAB = XVALUES.
ENDMODULE. " F4_HELP INPUT
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'CANCEL' OR 'EXIT' OR 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'NEXT_LINE'.
CONTROL_DATA-top_line = CONTROL_DATA-top_line + 1.
limit = fill - lines + 1.
IF CONTROL_DATA-top_line > limit.
CONTROL_DATA-top_line = limit.
ENDIF.
WHEN 'PREV_LINE'.
CONTROL_DATA-top_line = CONTROL_DATA-top_line - 1.
IF CONTROL_DATA-top_line < 0.
CONTROL_DATA-top_line = 0.
ENDIF.
WHEN 'NEXT_PAGE'.
CONTROL_DATA-TOP_LINE = CONTROL_DATA-TOP_LINE + LINES.
LIMIT = LIMIT + 1.
CONTROL_DATA-TOP_LINE = LIMIT.
WHEN 'PREV_PAGE'.
CONTROL_DATA-TOP_LINE = CONTROL_DATA-TOP_LINE - LINES.
LIMIT = LIMIT - 1.
CONTROL_DATA-TOP_LINE = LIMIT.
WHEN 'LAST_PAGE'.
DESCRIBE TABLE ITAB LINES LIMIT.
CONTROL_DATA-TOP_LINE = LIMIT.
WHEN 'FIRST_PAGE'.
CONTROL_DATA-TOP_LINE = 0.
WHEN 'P--'.
CLEAR ok_code.
PERFORM paging USING 'P--'.
WHEN 'P-'.
CLEAR ok_code.
PERFORM paging USING 'P-'.
WHEN 'P+'.
CLEAR ok_code.
PERFORM paging USING 'P+'.
WHEN 'P++'.
CLEAR ok_code.
PERFORM paging USING 'P++'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module SCROLL_BAR INPUT
MODULE SCROLL_BAR INPUT.
DESCRIBE TABLE ITAB LINES CONTROL_DATA-LINES.
ENDMODULE. " SCROLL_BAR INPUT
*& Form paging
text
-->P_0356 text
*FORM paging USING VALUE(P_0356).
FORM paging USING code.
DATA: i TYPE i,
j TYPE i.
CASE code.
WHEN 'P--'.
CONTROL_DATA-top_line = 1.
WHEN 'P-'.
CONTROL_DATA-top_line = CONTROL_DATA-top_line - line_count.
IF CONTROL_DATA-top_line LE 0.
CONTROL_DATA-top_line = 1.
ENDIF.
WHEN 'P+'.
i = CONTROL_DATA-top_line + line_count.
j = CONTROL_DATA-lines - line_count + 1.
IF j LE 0. j = 1. ENDIF.
IF i LE j.
CONTROL_DATA-top_line = i.
ELSE.
CONTROL_DATA-top_line = j.
ENDIF.
WHEN 'P++'.
CONTROL_DATA-top_line = CONTROL_DATA-lines - line_count + 1.
IF CONTROL_DATA-top_line LE 0.
CONTROL_DATA-top_line = 1.
ENDIF.
ENDCASE.
ENDFORM. " PAGING
*ENDFORM. " paging
thanks,
maheedhar.t -
Reg:Table Control in Custom Screen
Hi All,
I am having a requirement of adding a custom screen in vendor master,interms of adding field i done it successfully by using BADI's,but now i added a table control in the custom screen,now whenever am trying to create a new vendor its showing vendor successfully created for the company code,but if i try to open any transaction after that am getting an error like "Express document "Update was terminated" received from author "Reference User Development"" , and if i go for transcation code XK03 if i try to open the particular vendor its showing error "Vendor has not been created".
Regards
ArpitamHi Suchithra,
For each and every fields in the screen will have by default properties as Group number which Group1 and Group3 but when u create a table control manually you might have forgot to maintain the the Group number details because of which it is showing in display rather in change.
Please maintain the Group details in screen field properties and check. I think it will work.
Regards,
Aditya. -
hi,
Created table control with 10 lines, if user enters first line and presses enter , second line is getting disbled.
i need all the lines in the table control to be in enable mode and if he enters second line it should be captured.
please help me in sorting out this problem.HI Sudha,
This has been answered many a times, Please do search before posting.
in PBO.
MODULE status_0100.
in Program.
MODULE status_0100.
describe table itab lines tc-lines.
if tc-lines = 0.
tc-lines = 100.
else.
tc-lines = tc-lines + 100.
endif.
endmodule.
Cheerz
Ram -
Reg : Table control row settings to change mode
Hi geeks.
I am working on a requirement where the table control has to be in display mode at the time of prepopulating(initial display).This works fine and could get all columns in display mode for which i used column properties of table control. I could select a row from the table control and created a button above the table control for copy of the row which is added to the last row of the TC. I could get this with out any issues. They want the added row to be in changed mode whereas the other rows selected previously should remain in the display mode. Can anybody help me out to solve.Timely help will be appreciated <removed by moderator>
Regards ,
Kumar.
Edited by: Vinod Kumar on Aug 2, 2011 9:21 AMThis thread will assist you.
[Table control with non editable rows;
Make use of some flag for identifying the new records that will be appended in itab on the press of the button.
Then in PBO,
loop at itab with control tc cursor tc-current_line.
module editnewrow.
endloop.
module editnewrow output.
if itab-flag = 'X'.
loop at screen.
screen-input = 1.
modify screen.
endloop.
itab-flag = ' '. (resetting back to non-editable state for consequent press of the button)
modify itab index tc_4000-current_line.
endif.
endmodule. -
Hi,
i have 2 fields in table control.
flag ship1
if flag =y then i should have this column enabled for writing in table control other wise disable
how to implement logic for itif flag = 'X'.
loop at screen.
if screen-name = 'flag'.
screen-invisible = 1.
modify screen.
endif.
endloop.
else.
loop at screen.
if screen-name = 'flag'.
screen-invisible = 0.
modify screen.
endif.
endloop.
check with various screen options..... -
Reg: table control values to be updated during POV event
Hi all,
i need to design the screen for table control. which should contain Four input fields and input should be selected by F4 help. So i have used POV event to handle this. Once the user selected values from the F4 help, Immediately it has to populate the Table control fields based on input selection. I have tried several ways but it was not successful.
Please help me regarding this will be appreciated .
Regards,
Sreenivasa Sarma K.Hi,
Make use of the 'SEARCH HELP' property of the fields in the table control.
Just get the search help names for those 4 fields and place it to this property.
Also change the 'Poss. Entries Key' property as 1 or 2.
Regards,
R.Nagarajan. -
Reg: Table control list box
Hi All,
Can anyone please explain with sample code how to get values from the table control list box and save it the internal table.
regards,
karthik*& Report ZTABLEC
REPORT ZTABLEC.
tables : mara.
data : it like mara occurs 0 with header line.
data : begin of it1 occurs 0 ,
matnr like mara-matnr ,
end of it1 .
data: OK_CODE type SY-UCOMM .
data :STATUS like zaiod3-status .
controls : t1 type tableview using screen 1000.
call screen 1000.
*& Module STATUS_1000 OUTPUT
text
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
select * from mara into table it up to 10 rows.
ENDMODULE. " STATUS_1000 OUTPUT
*& Module USER_COMMAND_1000 INPUT
text
MODULE USER_COMMAND_1000 INPUT.
IF SY-UCOMM = 'SAVE'.
IT-MATNR.
append it .
modify MARA from it.
ENDIF.
ENDMODULE. " USER_COMMAND_1000 INPUT
*& Module create_dropdown_box INPUT
text
MODULE create_dropdown_box INPUT.
SELECT matnr FROM mara
INTO CORRESPONDING FIELDS OF TABLE it1.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MATNR'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT1
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " create_dropdown_box INPUT
IN PAI & PBO SECTION...
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
loop at it with control t1.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
loop at it.
endloop.
MODULE USER_COMMAND_1000.
PROCESS ON VALUE-REQUEST.
FIELD mara-matnr MODULE create_dropdown_box.
FOR LAYOUT SECTION .......................
CREATE A TABLE CONTROL SELECT A FIELD OF TABLE CONTROL ON WHICH YOU WANT TO CREATE A LIST BOX
DOUBLE click on that open a tool box click the drop down list box select the list box .
save check activate
regards
Aniruddh Singh -
Hi,
Can anyone please tell me how to do table controls with screen shots .Hi,
Check the following link:
http://www.****************/Tutorials/ABAP/TableControl/Demo.htm
Regards,
Bhaskar -
I am calling modal dialog screen(9002) from my normal screen(9001).
In the modal dialog i have container which iam using class TEXTEDIT_CUSTOM_CONTAINER for displaying long text.
My question's are,
1) In the normal screen i.e 9001 in user command i am using a button called text to call 9002.
I tried to change values as below , i didnot noticed any difference in my out put.
call screen '9002' starting at 1 1
ending at 111 5.
call screen '9002' starting at 7 30
ending at 1 50.
2) my word wrap length is 80, iam able to see only 50 and to see the next 30 character i need to use horizontal scroll bar, which is ok.
But my requirement is i want to see all the 80 characters without using horizontal scroll.
I thought of increasing the container width but the window size is limiting the container view.
so at max i can viewing 50 char per line without using horizontal bar.
if i reduce the container , i see less than 50 char per line then i have to use horizontal scroll to see remains char in the line.
i have to see 80 chars without using the horizontal scroll.
can anyone tell what the solution for this.
i THOUGHT OF THIS
1)Increasing the size of container in layout.
2) Incresing the values in call screen starting code.
3)Is there any thing that i can use just like we use
WORDWRAP_POSITION = '85' to limit the 85 char per line
Let me know.
SWATHIFor example, I have gotton this to work in my system, but changing the screen size to 82 columns, then making my control 82 wide. Then here is my code.
report zrich_0001 .
data: text_container type ref to cl_gui_custom_container,
text_editor type ref to cl_gui_textedit.
<b>call screen 100 starting at 1 1
ending at 80 20.</b>
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
create object text_container
exporting
container_name = 'TEXT_CONTAINER' .
CREATE OBJECT text_EDITOR
EXPORTING
PARENT = TEXT_CONTAINER
<b>WORDWRAP_POSITION = '79'</b>
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>false.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module USER_COMMAND_0100 input.
leave program.
endmodule. " USER_COMMAND_0100 INPUT
Works good, 80 characters and no scroll bar.
Regards,
Rich Heilman -
Hi All, How we can handle a table control in bdc - in detail its urgent pls
Hi All, How we can handle a table control in bdc - in detail its urgent. Please send me the explanation in detail.
Thanks®ards.
Bharathi,
Create Table Control
Step 1 (Create new structure for table control)
Type is name of structure (ZTC_EKKO) and press create
Step 2 (Create Program)
Goto transaction SE80(Object Navigator) -> Repository Browser -> Program.
Enter your program name, please ensure that is begins with SAPMZ as this is a module pool (dialog program).
Press enter to create, and press yes!
Ensure that you create a top include, and press Enter.
Accept the name created for the top include.
Press Enter.
Press Save
Step 3 (Create TOP include)
Double click on the top include and enter following ABAP code:
Tables: ZTC_EKKO.
controls: tc100 type tableview using screen 100.
data: ok_code type sy-ucomm.
data: it_ekko type standard
table of ZTC_EKKO initial size 0,
wa_ekko type ZTC_EKKO.
data: ok_code type sy-ucomm.
Press Save and Activate
Step 4 (Create screen)
Right click the program to create a screen 100 for the dialog. Enter Short description, set screen type to Normal and enter 0 or blank into Next screen. Then move to Element List tab and enter the OK code as OK_CODE (i.e. the same as what you declared in the top include with data: ok_code type sy-ucomm).
Step 5 (Create table control)
Press the Layout button to bring up the screen painter editor.
Press table control button and drag it on to the screen, enter the name of table control created in TOP include (TC100). Now press the yellow button for attributes and set the table control as below options
Step 6 (Populate table control )
Press the orange button (Fields). On the next screen enter ZTC_EKKO and press the Get from Dict button. Select the fields you want (all) and press enter. Now drag them onto your Table Control.
Below is the result, there will been syntax errors if we check now! So Save and go back into the flow logic tab.
Step 7 (Create flow control )
Within the flow logic of screen 100 and create two modules, one to select the data from the database and the other to move the selected fields into the table control. Also insert the two loop statements to populate and retrieve the lines of the table control.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
module data_retrieval.
loop at it_ekko into wa_ekko with control TC100.
module populate_screen.
endloop.
PROCESS AFTER INPUT.
loop at it_ekko.
endloop.
MODULE USER_COMMAND_0100.
Double click the module data_retrieval to create and click yes to get past the popup. Ensure that a new include is created to hold all the PBO modules (default). Press enter.
Select 10 rows of data from the EKKO table and load into the internal table it_ekko. Go back to the flow logic to load this data into the Table Control.
check this one
REPORT ZCALL_TRANS_TAB1 .
TABLES: LFA1,LFBK,lfb1.
data: BEGIN OF it_vendor occurs 0,
LIFNR LIKE LFA1-LIFNR,
bukrs like lfb1-bukrs,
END OF it_vendor.
DATA: BEGIN OF IT_BANK occurs 0,
LIFNR LIKE LFA1-LIFNR,
BANKS LIKE LFBK-BANKS,
BANKL LIKE LFBK-BANKL,
BANKN LIKE LFBK-BANKN,
koinh like lfbk-koinh,
END OF IT_BANK.
data: it_bdcdata like bdcdata occurs 0 with header line.
data: it_messages like bdcmsgcoll occurs 0 with header line.
*selection screen.
selection-screen: begin of block b1 with frame.
parameters: p_file like rlgrap-filename default 'c:/vendor.txt'
obligatory.
parameters: p_file1 like rlgrap-filename default 'c:/xyz.txt'
obligatory.
selection-screen: end of block b1.
*at selection screen.
at selection-screen on value-request for p_file.
perform f4_help using p_file.
at selection-screen on value-request for p_file1.
perform f4_help1 using p_file1.
*start of selection
start-of-selection.
*******uploading file
perform upload_file using p_file P_FILE1.
******open session.
perform populate_data.
*& Form f4_help
form f4_help using p_p_file.
data: l_file type ibipparms-path.
call function 'F4_FILENAME'
importing
file_name = l_file.
p_file = l_file.
endform. " f4_help
*& Form POPULATE_DATA
form populate_data .
DATA: L_STRING TYPE STRing.
DATA: L_COUNTER(2) TYPE n.
loop at it_vendor.
perform bdc_dynpro using 'SAPMF02K' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-D0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
it_vendor-lifnr.
perform bdc_field using 'RF02K-BUKRS'
it_vendor-bukrs.
perform bdc_field using 'RF02K-D0130'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-bankn(03)'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
*********bank details
CLEAR l_COUNTER.
LOOP AT IT_BANK WHERE LIFNR = IT_VENDOR-LIFNR.
l_COUNTER = l_COUNTER + 1.
clear l_string.
CONCATENATE 'lfbk-banks(' l_counter ')' into l_string.
perform bdc_field using l_string
it_bank-banks.
clear l_string.
CONCATENATE 'lfbk-bankl(' l_counter ')' into l_string.
perform bdc_field using l_string
it_bank-bankl.
clear l_string.
CONCATENATE 'lfbk-bankn(' l_counter ')' into l_string.
perform bdc_field using l_string
it_bank-bankn.
endloop.
******CALL TRANSACTION.
call transaction 'FK02' using it_bdcdata mode 'A'
messages into it_messages.
write:/ sy-subrc.
perform format_messages.
clear it_bdcdata.
refresh it_bdcdata.
endloop.
endform. " POPULATE_DATA
*& Form FORMAT_MESSAGES
form format_messages .
data: l_msg(100).
loop at it_messages.
call function 'FORMAT_MESSAGE'
exporting
id = it_messages-msgid
lang = sy-langu
no = it_messages-msgnr
v1 = it_messages-msgv1
v2 = it_messages-msgv2
v3 = it_messages-msgv3
v4 = it_messages-msgv4
importing
msg = l_msg
exceptions
not_found = 1
others = 2
write:/ l_msg.
endloop.
endform. " FORMAT_MESSAGES
*& Form bdc_dynpro
form bdc_dynpro using value(p_program)
value(p_screen).
it_bdcdata-program = p_program.
it_bdcdata-dynpro = p_screen.
it_bdcdata-dynbegin = 'X'.
append it_bdcdata.
clear it_bdcdata.
endform. " bdc_dynpro
*& Form bdc_field
form bdc_field using value(p_fnam)
value(p_fval).
it_bdcdata-fnam = p_fnam.
it_bdcdata-fval = p_fval.
append it_bdcdata.
clear it_bdcdata.
endform. " bdc_field
*& Form upload_file
form upload_file using p_p_file
p_p_file1.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = P_P_FILE
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = IT_VENDOR
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE I000(ZZ) WITH 'UNABLE TO UPLOAD'.
STOP.
ENDIF.
*******UPLOADING BANK DETAILS
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = P_P_FILE1
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = IT_BANK
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE I000(ZZ) WITH 'UNABLE TO UPLOAD'.
STOP.
ENDIF.
endform. " upload_file
*& Form f4_help1
-->P_P_FILE1 text
form f4_help1 using p_p_file1.
data:l_file1 type ibipparms-path.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = l_file1.
p_file1 = l_file1.
endform. " f4_help1
http://sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Regards,
Sankar -
Table control...? its urgent
Hi friends,
Can anyone gve me example table control program..
My requirement is I have to display blank table control.....but when user enetrs value.. and submits it should be added to the inetrnal table in my program please help......
Also if he wants to see the records in table control..which he enetered earlier the table should be displayed as populated..
Please help its urgent....points will be rewarded....Seet he following ex:
Created table control using wizard.
*& Module pool ZTEST_TBLCTRL
PROGRAM ZTEST_TBLCTRL.
***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TC1'
*&SPWIZARD: DEFINITION OF DDIC-TABLE
TABLES: ZFG_SRNO, ZFIH0004.
*&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TC1'
*TYPES: BEGIN OF T_TC1,
ZSRNO LIKE ZFG_SRNO-ZSRNO,
SCRNAME LIKE ZFIH0004-SCRNAME,
END OF T_TC1.
*TYPES: BEGIN OF T_TC1.
STRUCTURE ZFG_SRNO.
END OF T_TC1.
*&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TC1'
*DATA: G_TC1_ITAB TYPE T_TC1 OCCURS 0 WITH HEADER LINE,
G_TC1_WA TYPE T_TC1. "work area
DATA: G_TC1_ITAB LIKE ZFG_SRNO OCCURS 0 WITH HEADER LINE,
G_TC1_WA LIKE G_TC1_ITAB. "work area
DATA: G_TC1_COPIED. "copy flag
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TC1' ITSELF
CONTROLS: TC1 TYPE TABLEVIEW USING SCREEN 0100.
*&SPWIZARD: LINES OF TABLECONTROL 'TC1'
DATA: G_TC1_LINES LIKE SY-LOOPC.
DATA: OK_CODE LIKE SY-UCOMM,
S_CODE LIKE SY-UCOMM,
MARK.
DATA: T1(10).
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: COPY DDIC-TABLE TO ITAB
MODULE TC1_INIT OUTPUT.
IF G_TC1_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZFG_SRNO'
*&SPWIZARD: INTO INTERNAL TABLE 'g_TC1_itab'
SELECT * FROM ZFG_SRNO
INTO CORRESPONDING FIELDS
OF TABLE G_TC1_ITAB.
G_TC1_COPIED = 'X'.
REFRESH CONTROL 'TC1' FROM SCREEN '0100'.
IF T1 <> SPACE.
G_TC1_ITAB-ZSRNO = T1.
CLEAR T1.
APPEND G_TC1_ITAB.
REFRESH CONTROL 'TC1' FROM SCREEN '0100'.
ENDIF.
*TC1-TOP_LINE = 1.
ENDIF.
ENDMODULE.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MOVE ITAB TO DYNPRO
MODULE TC1_MOVE OUTPUT.
MOVE-CORRESPONDING G_TC1_WA TO ZFG_SRNO.
if sy-subrc ne 0.
*append G_TC1_WA to G_TC1_ITAB.
*endif.
READ TABLE G_TC1_ITAB INDEX TC1-CURRENT_LINE.
IF SY-SUBRC = 0.
G_TC1_WA-ZSRNO = G_TC1_ITAB-ZSRNO.
ENDIF.
MOVE-CORRESPONDING G_TC1_ITAB TO ZFG_SRNO.
REFRESH CONTROL 'TC1' FROM SCREEN '8001'.
tc1-lines = G_TC1_LINES + 100.
ENDMODULE.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: GET LINES OF TABLECONTROL
MODULE TC1_GET_LINES OUTPUT.
G_TC1_LINES = SY-LOOPC.
ENDMODULE.
*&SPWIZARD: INPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE TC1_MODIFY INPUT.
*break-point.
MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_ITAB.
MODIFY G_TC1_ITAB INDEX TC1-CURRENT_LINE.
G_TC1_COPIED = 'X'.
REFRESH CONTROL 'TC1' FROM SCREEN '8001'.
MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_WA.
MODIFY G_TC1_ITAB
FROM G_TC1_WA
INDEX TC1-CURRENT_LINE.
G_TC1_COPIED = 'X'.
if sy-subrc ne 0.
append G_TC1_WA to G_TC1_ITAB.
endif.
*modify G_TC1_ITAB INDEX TC1-CURRENT_LINE.
ENDMODULE.
*&SPWIZARD: INPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: PROCESS USER COMMAND
MODULE TC1_USER_COMMAND INPUT.
OK_CODE = SY-UCOMM.
PERFORM USER_OK_TC USING 'TC1'
'G_TC1_ITAB'
'FLAG'
CHANGING OK_CODE.
SY-UCOMM = OK_CODE.
ENDMODULE.
INCLUDE TABLECONTROL_FORMS *
*& Form USER_OK_TC *
FORM USER_OK_TC USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME
CHANGING P_OK LIKE SY-UCOMM.
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA: L_OK TYPE SY-UCOMM,
L_OFFSET TYPE I.
&SPWIZARD: END OF LOCAL DATA----
*&SPWIZARD: Table control specific operations *
*&SPWIZARD: evaluate TC name and operations *
SEARCH P_OK FOR P_TC_NAME.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
L_OFFSET = STRLEN( P_TC_NAME ) + 1.
L_OK = P_OK+L_OFFSET.
*&SPWIZARD: execute general and TC specific operations *
CASE L_OK.
WHEN 'INSR'. "insert row
PERFORM FCODE_INSERT_ROW USING P_TC_NAME
P_TABLE_NAME.
CLEAR P_OK.
WHEN 'DELE'. "delete row
PERFORM FCODE_DELETE_ROW USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
CLEAR P_OK.
WHEN 'P--' OR "top of list
'P-' OR "previous page
'P+' OR "next page
'P++'. "bottom of list
PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
L_OK.
CLEAR P_OK.
WHEN 'L--'. "total left
PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
WHEN 'L-'. "column left
PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
WHEN 'R+'. "column right
PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
WHEN 'R++'. "total right
PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
WHEN 'MARK'. "mark all filled lines
PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.
WHEN 'DMRK'. "demark all filled lines
PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.
WHEN 'SASCEND' OR
'SDESCEND'. "sort column
PERFORM FCODE_SORT_TC USING P_TC_NAME
l_ok.
ENDCASE.
ENDFORM. " USER_OK_TC
*& Form FCODE_INSERT_ROW *
FORM fcode_insert_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_LINES_NAME LIKE FELD-NAME.
DATA L_SELLINE LIKE SY-STEPL.
DATA L_LASTLINE TYPE I.
DATA L_LINE TYPE I.
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE CXTAB_CONTROL.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <LINES> TYPE I.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
ASSIGN (L_LINES_NAME) TO <LINES>.
*&SPWIZARD: get current line *
GET CURSOR LINE L_SELLINE.
IF SY-SUBRC <> 0. " append line to table
L_SELLINE = <TC>-LINES + 1.
*&SPWIZARD: set top line *
IF L_SELLINE > <LINES>.
<TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
ELSE.
<TC>-TOP_LINE = 1.
ENDIF.
ELSE. " insert line into table
L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
ENDIF.
*&SPWIZARD: set new cursor line *
L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
<TC>-LINES = <TC>-LINES + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE L_LINE.
ENDFORM. " FCODE_INSERT_ROW
*& Form FCODE_DELETE_ROW *
FORM fcode_delete_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: delete marked lines *
DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
LOOP AT <TABLE> ASSIGNING <WA>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
IF <MARK_FIELD> = 'X'.
DELETE <TABLE> INDEX SYST-TABIX.
IF SY-SUBRC = 0.
<TC>-LINES = <TC>-LINES - 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " FCODE_DELETE_ROW
*& Form COMPUTE_SCROLLING_IN_TC
text
-->P_TC_NAME name of tablecontrol
-->P_OK ok code
FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
P_OK.
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_TC_NEW_TOP_LINE TYPE I.
DATA L_TC_NAME LIKE FELD-NAME.
DATA L_TC_LINES_NAME LIKE FELD-NAME.
DATA L_TC_FIELD_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <LINES> TYPE I.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
ASSIGN (L_TC_LINES_NAME) TO <LINES>.
*&SPWIZARD: is no line filled? *
IF <TC>-LINES = 0.
*&SPWIZARD: yes, ... *
L_TC_NEW_TOP_LINE = 1.
ELSE.
*&SPWIZARD: no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = <TC>-TOP_LINE
ENTRY_FROM = 1
ENTRY_TO = <TC>-LINES
LAST_PAGE_FULL = 'X'
LOOPS = <LINES>
OK_CODE = P_OK
OVERLAPPING = 'X'
IMPORTING
ENTRY_NEW = L_TC_NEW_TOP_LINE
EXCEPTIONS
NO_ENTRY_OR_PAGE_ACT = 01
NO_ENTRY_TO = 02
NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = 0.
ENDIF.
*&SPWIZARD: get actual tc and column *
GET CURSOR FIELD L_TC_FIELD_NAME
AREA L_TC_NAME.
IF SYST-SUBRC = 0.
IF L_TC_NAME = P_TC_NAME.
*&SPWIZARD: et actual column *
SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
ENDIF.
ENDIF.
*&SPWIZARD: set the new top line *
<TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
ENDFORM. " COMPUTE_SCROLLING_IN_TC
*& Form FCODE_TC_MARK_LINES
marks all TableControl lines
-->P_TC_NAME name of tablecontrol
FORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
&SPWIZARD: EGIN OF LOCAL DATA----
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: mark all filled lines *
LOOP AT <TABLE> ASSIGNING <WA>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
<MARK_FIELD> = 'X'.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
*& Form FCODE_TC_DEMARK_LINES
demarks all TableControl lines
-->P_TC_NAME name of tablecontrol
FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: demark all filled lines *
LOOP AT <TABLE> ASSIGNING <WA>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
<MARK_FIELD> = SPACE.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
*& Module D20XX_INIT OUTPUT
text
MODULE D20XX_INIT OUTPUT.
*if screen-name = 'ZSRNO'.
SCREEN-INPUT = 0.
SCREEN-COLOR = 0.
MODIFY SCREEN.
endif.
ENDMODULE. " D20XX_INIT OUTPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
*CLEAR R1_REF.
DO 30 TIMES.
APPEND G_TC1_ITAB.
ENDDO.
DESCRIBE TABLE G_TC1_ITAB LINES TC1-LINES.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module TAB1_INIT OUTPUT
text
MODULE TAB1_INIT OUTPUT.
ENDMODULE. " TAB1_INIT OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module MESSAGE INPUT
text
MODULE MESSAGE INPUT.
OK_CODE = SY-UCOMM.
S_CODE = OK_CODE.
CLEAR OK_CODE.
if S_CODE = 'DELE'.
loop at G_TC1_ITAB.
if G_TC1_ITAB-scrname = 'X'.
delete g_tc1_itab.
endif.
endloop.
ELSEIF S_CODE = 'SAVE'.
G_TC1_WA-ZSRNO = T1.
MOVE-CORRESPONDING G_TC1_WA TO ZFG_SRNO.
REFRESH CONTROL 'TC1' FROM SCREEN '0100'.
ENDIF.
ENDMODULE. " MESSAGE INPUT
*& Module DELETE_RECORD INPUT
text
MODULE DELETE_RECORD INPUT.
IF MARK = 'X' AND S_CODE = 'DELE'.
DELETE TABLE G_TC1_ITAB FROM ZFG_SRNO.
DESCRIBE TABLE G_TC1_ITAB LINES TC1-LINES.
ENDIF.
ENDMODULE. " DELETE_RECORD INPUT
*********************Screen modules*********************
PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC1'
MODULE TC1_INIT.
*&SPWIZARD: MODULE TC1_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TC1_CHANGE_COL_ATTR.
LOOP AT G_TC1_ITAB
INTO G_TC1_WA
WITH CONTROL TC1
CURSOR TC1-CURRENT_LINE.
*&SPWIZARD: MODULE TC1_CHANGE_FIELD_ATTR
MODULE TC1_MOVE.
MODULE TAB1_INIT.
MODULE TC1_GET_LINES.
ENDLOOP.
MODULE D20XX_INIT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC1'
*BREAK POINT.
LOOP AT G_TC1_ITAB.
CHAIN.
FIELD ZFG_SRNO-ZSRNO.
MODULE TC1_MODIFY ON CHAIN-REQUEST.
MODULE TC1_MODIFY.
ENDCHAIN.
MODULE MESSAGE .
MODULE DELETE_RECORD.
ENDLOOP.
MODULE TC1_USER_COMMAND.
*&SPWIZARD: MODULE TC1_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TC1_CHANGE_COL_ATTR.
MODULE USER_COMMAND_0100. -
Reg:How to delete the column in table control also from database table.
Hi Experts,
Once again thank u all for giving the responses.
one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
With Regards,
Saroja.P.Hi,
If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
"This portion of code inside the LOOP...ENDLOOP.
IF sy-ucomm eq 'F_DELETE'.
gt_itab2-check = mark. " Store the MARK field status into your internal table's correspoding field 'check'
MODIFY gt_itab INDEX tabcontrol-current_line.
ENDIF.
iF sy-ucomm eq 'DELETE1'.
DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
ENDIF.
Now you can modify your database table using the MODIFY statement.
MODIFY ZDB FROM TABLE gt_itab. -
Urgent: Table control validation of defaulted values
Hi All,
I have 5 fields in my table control. I have provided a button on the screen, if the user clicks that button, one of the fields( checkbox) is set as 'X'.
Now , I want to validate the value in this field.
The issue I have is that it is not going into the CHAIN ENCHAIN module logic to do the validation, if the value is updated through the button, but it performs validation if I update the field manually.
Please advice.
Thanks.
K KTry this in the PAI process of screen:
LOOP AT itab.
CHAIN.
FIELD: ...
MODULE CHECK_MODIFIED ON CHAIN-INPUT.
ENDCHAIN.
ENDLOOP.
Oherwise,you can add the check logic into the flow logic of the button,if the value is not valid,block it.
Edited by: Liang Zhang on May 28, 2008 4:34 AM -
Urgent!!!!Add a Horizontal Scroll Bar for Table Control
Hi Experts,
I want to have a Horizontal Scroll Bar on my Table control.
I tried with few properties for the Table UI Element but not able to solve it.
If any one who had already done this please help me out.
Thanks in advance..
Regards, Kishore KHI Koen,
Thanks for early Reply.
When I use this I get
Page Down ( ->!!, Arrown with lines pointing Down)
Page UP
Page Top ( ->, Arrown with lines pointing Top)
Page Down ( ->, Arrown with lines pointing Down)
But I need only Page top and Page down for this Table UI .
I think my question is clear enough.
Please let me know this also.
Thanks & Regards,
Kishore K
Maybe you are looking for
-
(Using an "iPad 3", i dont care what apple calls it) There should be a built in one button access to this from EVERY keyboard since this function is used to replace typing. An inherent Apple shortcut like copy and paste. I set my iPad up on a framed
-
User authentication in a transparent deployment
Hi all, Just wondering, if I don't want to have to change anything on my browser in terms of proxy settings, is there any way for me to set up IronPort so that I can build policies per user (with Active Directory)? Basically I want policies as granul
-
Hi all Im currently making a website ..and for it i need to use drop down menu's on the buttons (which i have created as photoshop images), I created a basic template page and created the drop down menu using behaviours. But when i create a new page
-
Installing Project Server 2013 as a private cloud
hi, as far as I know ,SharePoint 2013 is designed to support cloud computing.Moreover, I saw several Microsoft partners that provide project server as a SAAS. now I was wondering if is there any instruction for lunching a project server as a private
-
HP Envy Integrated Camera - Can't get the camera to start
When I open mediasmart webcam this message is displayed: No webcam detected. Try plugging in a webcam into your computer now. If you are using an intergrated camera, make sure that it is turned on. Can someone tell me how to turn the camera on or how