How to select perticular row in table control for BDC
Hi all
I want to select perticular row in table control for deletion through BDC. My transaction is CA02, My input is material no and plant , then it display table control with work center. Now i want to select W999 cost center and delete through BDC.
Please Suggest me. it urgent.
Thanks& Regards,
RP
Hi all
I want to select perticular row in table control for deletion through BDC. My transaction is CA02, My input is material no and plant , then it display table control with work center. Now i want to select W999 cost center and delete through BDC.
Please Suggest me. it urgent.
Thanks& Regards,
RP
Similar Messages
-
How can we select multiple rows in table control for module pool program?
hi guru's
i cannt able to select multiple table control rows for deletion of records please give any code to select rows?
regrards,
satheesh.On the Table Control attributes there is a "Selectability" option where you choose one of: None, Single, or Multiple. In your code you then need to pick up which rows have the selection column set to 'X'.
-
How to select all the rows of table control in BDC
Hi All,
While I am doing BDC for Transaction Code MC88, After the first screen I will get another screen with tabble control, Here I need to select all the rows of table control, I am assignng the 'X' to the first field of Table Control which is the indicator for selection.
Here I am getting message called Indicator field is not in program and screen.
While doing Recording I am not able to record the indicator, Please any one let me know how to record the Entire table control selection.
Thanks in advance..Sorry about that lakshmi. Here is my code.
PERFORM dynpro USING : 'X' 'SAPMMCP6' '0105',
' ' 'RMCP2-MATNR' t_matnr,
' ' 'RMCP2-WERKS' t_werks,
' ' 'BDC_OKCODE' '=AKTV'.
PERFORM dynpro USING : 'X' 'SAPLMCPA' '0707',
' ' 'BDC_OKCODE' '=MRKE'.
PERFORM dynpro USING : 'X' 'SAPLMCPA' '0707',
' ' 'BDC_OKCODE' '=GRAO -
How to delete the row in table control with respect to one field in module pool programming?
Hi,
Can I know the way to delete the row in table control with respect to one field in module pool programming
Regards
Darshan MSHI,
I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
I have written this code,
module USER_COMMAND_9000 input.
DATA OK_CODE TYPE SY-UCOMM.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'DELETE'.
LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
APPEND LS_SOURCE TO LT_RESTORE.
DELETE TABLE LT_SOURCE FROM LS_SOURCE.
SOURCE-LINES = SOURCE-LINES - 1.
ENDLOOP.
But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
So I thought of doing with respect to the field. -
BDC : to select different rows in table control
Hi,
I have to fill many rows in table control and want to select different row one by one in increasing order which rows are filled in BDC.
Can anybody suggest me with coding...
thanks
nareshHi ,
I am attaching sample code for BDC transaction code is : FV11 , This code is also contains poage down concepts . By using this page down concept you can add number of item fields
Program Name : ZFV11_NEW
Program Description : To Upload Condition Records-FV11
Author : Jagadish
Start Date : 11/06/2007
REPORT zfv11
NO STANDARD PAGE HEADING LINE-SIZE 255.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
TABLES : t100.
DATA: BEGIN OF record OCCURS 0,
data element: KSCHA
kschl(004), "Condition Type
data element: SELKZ_LIST
selkz(001),
data element: WERKS_D
werks(004), "Plant
data element: ELIFN
lifnr(010), "Vendor
data element: MATNR
matnr(018), "Material No.
data element: KBETR_KOND
kbetr(016), "Amount
data element: KODATAB
datab(010), "Condition Validity Date from
data element: KODATBI
datbi(010), "Condition Validity To
data element: MWSKZ
mwsk1(002),
END OF record.
DATA : BEGIN OF it_new OCCURS 0, " Internal Table for Header Data
kschl(004),
werks(004),
lifnr(010),
END OF it_new.
DATA : BEGIN OF it_item OCCURS 0, " Internal table for Item Data
werks(004),
lifnr(010),
matnr(018),
kbetr(016),
datab(010),
datbi(010),
mwsk1(002),
END OF it_item.
DATA : cnt(2) TYPE n,
fld(25) TYPE c.
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
DATA : n TYPE n.
DATA:
BEGIN OF t_data OCCURS 0,
data TYPE string,
END OF t_data.
DATA:BEGIN OF it_mess OCCURS 0,
msgtyp(5),
lms(200),
msgv1(50),
END OF it_mess.
DATA : p_mode TYPE c.
DATA:it_msgtab TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE,
it_msgtab1 TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
DATA : l_mstring(150).
DATA : BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
PARAMETERS : p_file1 LIKE rlgrap-filename.
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
PERFORM file_selection.
PERFORM data_upload.
PERFORM table_control.
LOOP AT it_new.
REFRESH bdcdata.
PERFORM bdc_dynpro USING 'SAPMV13A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV13A-KSCHL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RV13A-KSCHL'
it_new-kschl.
PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV130-SELKZ(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=WEIT'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1363'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KONP-KBETR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KOMG-WERKS'
it_new-werks.
PERFORM bdc_field USING 'KOMG-LIFNR'
it_new-lifnr.
DATA: "X(5) TYPE N,
N(5) TYPE N.
N = 0.
LOOP AT it_item.
N = N + 1.
ENDLOOP.
"X = 1.
CNT = 1.
DO N TIMES.
IF CNT > 19.
perform bdc_field using 'BDC_OKCODE' 'KOMG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1363'.
CNT = 1.
ENDIF.
cnt = 1.
LOOP AT it_item WHERE werks EQ it_new-werks AND lifnr EQ it_new-lifnr . "FROM x TO x.
CONCATENATE 'KOMG-MATNR(' cnt ')' INTO fld.
PERFORM bdc_field USING fld it_item-matnr.
CONCATENATE 'KONP-KBETR(' cnt')' INTO fld.
PERFORM bdc_field USING fld it_item-kbetr.
CONCATENATE 'RV13A-DATAB(' cnt ')' INTO fld.
PERFORM bdc_field USING fld it_item-datab.
CONCATENATE 'RV13A-DATBI(' cnt ')' INTO fld.
PERFORM bdc_field USING fld it_item-datbi.
CONCATENATE 'KONP-MWSK1(' cnt ')' INTO fld.
PERFORM bdc_field USING fld it_item-mwsk1.
cnt = cnt + 1.
if cnt = 20.
perform bdc_field using 'BDC_OKCODE' 'KOMG-MATNR(19)'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1363'.
CNT = 1.
endif.
CLEAR it_item.
ENDLOOP.
ENDDO.
PERFORM bdc_dynpro USING 'SAPMV13A' '1363'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KONP-MWSK1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
CALL TRANSACTION 'FV11' USING bdcdata MODE 'A'
UPDATE 'S'
MESSAGES INTO it_msgtab.
CLEAR bdcdata[].
PERFORM error.
ENDLOOP.
Start new screen -Subroutine for screen s *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field -Subroutine for field s *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
*& Form file_selection
FORM file_selection .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE1'
IMPORTING
file_name = p_file1.
ENDFORM. " file_selection
*& Form data_upload
FORM data_upload .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file1
TABLES
i_tab_converted_data = record
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " data_upload
*& Form error
FORM error .
LOOP AT it_msgtab.
IF it_msgtab-msgtyp = 'E'.
SELECT SINGLE * FROM t100 WHERE sprsl = it_msgtab-msgspra
AND arbgb = it_msgtab-msgid
AND msgnr = it_msgtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH it_msgtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH it_msgtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH it_msgtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH it_msgtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH it_msgtab-msgv1 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv2 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv3 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
it_mess-msgtyp = it_msgtab-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = it_msgtab-msgv1.
APPEND it_mess.
WRITE: / it_msgtab-msgtyp, l_mstring(150).
ELSE.
WRITE: / it_msgtab.
it_mess-msgtyp = it_msgtab-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = it_msgtab-msgv1.
APPEND it_mess.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " error
*& Form table_Control
FORM table_control .
SORT record BY lifnr matnr.
LOOP AT record.
ON CHANGE OF record-lifnr.
MOVE-CORRESPONDING record TO it_new.
APPEND it_new.
ENDON.
MOVE-CORRESPONDING record TO it_item.
APPEND it_item.
ENDLOOP.
ENDFORM. " table_Control
Reward if useful
Thanks
Jagadeesh.G -
How to add rows in table control for data recording BDC?
hello,
pl tell me the way to upload data through BDC in table control of screen .
how to add fields inrecording of table control?
Please give some code in this regard.
I am generous in giving points..pl help!Hi,
While doing code under recording first you need to do the recording with sample data under a particular transaction like T-code XK01 (Vendor creation).
Take an example of create vendor using T-code XK01:
Go to t-code 'SHDB' under make recording for XK01 with sample data and once if you complete the recording means after vendor creation check the source code bye by pressing the button 'Program', it shows the total coding for recording of what you entered the test data.
Then you will create one program and copy that source code of recording into your program, and now you have to remove the values at perform statement and give the internal table field name.
Like that you can develop your own code along with your validations.
my best suggestion is dont see the example code of recording method because any one for standard t-code should get the code from recording with sample data, so first tryout with your own recording method and you can understand the code step by step.
With these I hope you will get some idea of recoding method.
Let me know for further doubts.
Regards,
Vijay. -
How to handle scroll bar in table control in bdc
hi friends,
how to handle scroll bar coding in table control in bdc
Thanks & Regards,
Srinadh Dhi,
check the sites :
table control scrolling:
Scrolling in table control
Re: scrolling in table control
Table control - Vertical scrolling problem
table control scrolling problem -
How to determine fixed line of table control using BDC program ?
Dear All,
I create program using BDC that contains table control.
Unfortunately the table control line of BDC program will depend on the resolution of our PC setting.
Sometime I have 2 lines, sometime 3 lines (in different PC).
How to determine fixed line of table control?
So it will never be confusing me whether I have 2 or 3 lines.
Thnx - Regards,
(Taufik K.)Hi Taufik,
Check the table CTU_PARAMS and field DEFSIZE for setting fixed line of a table control.
CALL TRANSACTION 'VA01' USING it_bdcdata
OPTIONS FROM OPT
MESSAGES INTO it_mesg.
opt of type ctu_params.
WA_CTU_PARAMS-DISMODE = 'N'. "no screen mode
WA_CTU_PARAMS-UPDMODE = 'S'. "synchronus update
WA_CTU_PARAMS-NOBINPT = 'X'.
WA_CTU_PARAMS-NOBIEND = 'X'.
WA_CTU_PARAMS-DEFSIZE = 'X'. "Default size
Default size will play good role in terms of resoultion. in one system in table control you can see 10rows, but in others system it will show 20 records. it depends on resoultion. but when you set the default size then it will take same (default screen size) in all the systems when you run BDC.
Reward if helps.
Regards,
Senthil
Message was edited by: senthil kumar -
How to delete a row in table control?
Hi All,
I have a empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
In my code:
TOP Include
CONTROLS: tc_data TYPE TABLEVIEW USING SCREEN 9001.
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_DATA INTO WA_DATA INDEX TC_DATA-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_DATA TO WA_DATA.
ENDIF.
endmodule.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
ENDLOOP.
MODULE GET_USER_ACTION.
module GET_USER_ACTION input.
WHEN 'DEL'.
LOOP AT T_DATA INTO WA_DATA WHERE MARK EQ 'X'.
DELETE T_DATA.
ENDLOOP.
In my debug, the internal table T_DATA-MARK does not have any value(s) even if I selected a particular row in my table control.
Am I missing something here?
ThanksHi All,
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output: http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
ELSE.
"EXIT FROM STEP-LOOP.
CLEAR ZQID_CHECK.
ENDIF.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
CHAIN.
MODULE CHECK_ENTRIES ON CHAIN-INPUT.
MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
MODULE DELETE_ROW ON CHAIN-INPUT
ENDCHAIN.
ENDLOOP.
module CHECK_ENTRIES input.
CASE ok_code.
WHEN 'DEL'.
PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
ZQID_CHECK-LICHA
ZQID_CHECK-LIFNR.
ENDCASE.
endmodule.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
DELETE T_ID_CHECK.
ENDLOOP.
endmodule.
form F_FILL_ITABCREATE using us_zqid_check_matnr LIKE MARA-MATNR
us_zqid_check_licha LIKE MCHA-LICHA
us_zqid_check_lifnr LIKE LFA1-LIFNR.
MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
us_zqid_check_licha TO WA_ID_CHECK-LICHA,
us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
APPEND WA_ID_CHECK TO T_ID_CHECK.
CLEAR WA_ID_CHECK.
endform.
In my debug, I can now delete the internal table that has a 'X' mark on its respective row but on the SAP screen output, all of my entries are being deleted contrary to what the ABAP debugger is telling me.
Thanks -
How to delete a row from table control
I have created a push button on the screen for delete.
its getting stored in ok_code.
'FLAG' is the name of the mark on the table control.
I am getting probs in this line.
I am not getting anything in mark_field.
ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
The code is:
MODULE tablctrl2_user_command INPUT.
PERFORM user_ok_tc USING 'TABLCTRL2'
'I_ZSKILLEMP'
'FLAG'
CHANGING ok_code.
ENDMODULE.
FORM user_ok_tc USING p_tc_name TYPE dynfnam
p_table_name
p_mark_name
CHANGING p_ok LIKE sy-ucomm.
-BEGIN OF LOCAL DATA----
DATA: l_ok TYPE sy-ucomm,
l_offset TYPE i.
-END OF LOCAL DATA----
Table control specific operations *
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.
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.
FORM fcode_delete_row
USING p_tc_name TYPE dynfnam
p_table_name
p_mark_name .
-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>.
-END OF LOCAL DATA----
ASSIGN (p_tc_name) TO <tc>.
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
delete marked lines *
DESCRIBE TABLE <table> LINES <tc>-lines.
LOOP AT <table> ASSIGNING <wa>.
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.Hi...
i got the same prob...but got the solution too...
you have to take an internal table of same type of dbase table..and maintain a flag in it...which will be get filled automatically with 'X'.
here is the code..go throug it..
REPORT YH642_DIALOG_TABLECONTROL.
CALL SCREEN 999.
DATA:
W_INDEX TYPE I.
DATA:
W_UCOMM LIKE SY-UCOMM.
***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TAB'
*&SPWIZARD: DEFINITION OF DDIC-TABLE
TABLES: YH642_RAM.
DATA:
BEGIN OF DDTAB,
TAB_FLAG TYPE C,
MANDT LIKE YH642_RAM-MANDT,
EID LIKE YH642_RAM-EID,
ENAME LIKE YH642_RAM-ENAME,
MOBILE LIKE YH642_RAM-MOBILE,
END OF DDTAB.
*&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TAB'
TYPES: BEGIN OF T_TAB,
TAB_FLAG TYPE C,
MANDT LIKE YH642_RAM-MANDT,
EID LIKE YH642_RAM-EID,
ENAME LIKE YH642_RAM-ENAME,
MOBILE LIKE YH642_RAM-MOBILE,
END OF T_TAB.
*&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TAB'
DATA: G_TAB_ITAB TYPE T_TAB OCCURS 0,
H_TAB_ITAB TYPE T_TAB OCCURS 0,
G_TAB_WA TYPE T_TAB. "work area
DATA: G_TAB_COPIED. "copy flag
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB' ITSELF
CONTROLS: TAB TYPE TABLEVIEW USING SCREEN 0999.
*&SPWIZARD: LINES OF TABLECONTROL 'TAB'
DATA: G_TAB_LINES LIKE SY-LOOPC.
DATA: OK_CODE LIKE SY-UCOMM.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: COPY DDIC-TABLE TO ITAB
MODULE TAB_INIT OUTPUT.
IF G_TAB_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'YH642_RAM'
*&SPWIZARD: INTO INTERNAL TABLE 'g_TAB_itab'
SELECT * FROM YH642_RAM
INTO CORRESPONDING FIELDS
OF TABLE G_TAB_ITAB.
G_TAB_COPIED = 'X'.
H_TAB_ITAB[] = G_TAB_ITAB[].
REFRESH CONTROL 'TAB' FROM SCREEN '0999'.
ENDIF.
ENDMODULE. "TAB_INIT OUTPUT
*&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MOVE ITAB TO DYNPRO
MODULE TAB_MOVE OUTPUT.
MOVE-CORRESPONDING G_TAB_WA TO DDTAB.
ENDMODULE. "TAB_MOVE OUTPUT
*&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: GET LINES OF TABLECONTROL
MODULE TAB_GET_LINES OUTPUT.
G_TAB_LINES = SY-LOOPC.
ENDMODULE. "TAB_GET_LINES OUTPUT
*&SPWIZARD: INPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE TAB_MODIFY INPUT.
MOVE-CORRESPONDING DDTAB TO G_TAB_WA.
MODIFY G_TAB_ITAB
FROM G_TAB_WA
INDEX TAB-CURRENT_LINE.
ENDMODULE. "TAB_MODIFY INPUT
*&SPWIZARD: INPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: PROCESS USER COMMAND
MODULE TAB_USER_COMMAND INPUT.
OK_CODE = SY-UCOMM.
PERFORM USER_OK_TC USING 'TAB'
'G_TAB_ITAB'
'TAB_FLAG'
CHANGING OK_CODE.
SY-UCOMM = OK_CODE.
ENDMODULE. "TAB_USER_COMMAND INPUT
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.
L_OK = 'DELE'.
*&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
MESSAGE 'Are you really going to delete??' type 'I'.
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'.
W_INDEX = SYST-TABIX.
DELETE <TABLE> INDEX SYST-TABIX.
IF SY-SUBRC = 0.
<TC>-LINES = <TC>-LINES - 1.
ENDIF.
ENDIF.
ENDLOOP.
READ TABLE H_TAB_ITAB INDEX W_INDEX INTO G_TAB_WA.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.
DELETE YH642_RAM.
ENDIF.
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 STATUS_0999 OUTPUT
text
MODULE STATUS_0999 OUTPUT.
SET PF-STATUS 'SS_STD'.
SET TITLEBAR 'TITLE'.
ENDMODULE. " STATUS_0999 OUTPUT
*& Module USER_COMMAND_0999 INPUT
text
MODULE USER_COMMAND_0999 INPUT.
DATA:
H_TAB_WA LIKE G_TAB_WA.
CASE W_UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'TAB_MODI' OR 'SAVE'.
LOOP AT G_TAB_ITAB INTO G_TAB_WA.
FORMAT INPUT OFF.
MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.
READ TABLE H_TAB_ITAB WITH KEY EID = G_TAB_WA-EID INTO H_TAB_WA.
IF SY-SUBRC EQ 0.
IF G_TAB_WA NE H_TAB_WA.
MODIFY YH642_RAM.
ENDIF.
ELSE.
INSERT YH642_RAM.
ENDIF.
ENDLOOP.
SORT G_TAB_ITAB.
ENDCASE.
*CALL SCREEN 700.
ENDMODULE. " USER_COMMAND_0999 INPUT -
How to select multiple row of table using check box?
hi,
i am having table on view having first field as checkbox. what i want, when i click on checkboxes in multiple rows, and i click on any button i need to use those content to next view...
my problem is if i select only one row , i can use onlead select property of table..but when i select multiple rows through check box how should i read contents of table....?
Plz solve it.
Thanks,
Saurin ShahHello Saurin,
You are right using LeadSelection you can select only 1 row at a time. You will have to make use of Selection for achieving this. First you will have to change the selection mode of the table to multiple & also change the selection property for the related context to 0..n . Please find a code extract which might help you. (However this facility is only available from SP 14.) The main part is using the set_selected method of if_wd_context_node.
data: node_zcourse_details type ref to if_wd_context_node,
node_course_assign type ref to if_wd_context_node,
elem_course_assign type ref to if_wd_context_element,
stru_course_assign type if_v_details=>element_course_assign ,
item_popin_selected like stru_course_assign-popin_selected.
" navigate from <CONTEXT> to <ZCOURSE_DETAILS> via lead selection
node_zcourse_details = wd_context->get_child_node( name = if_v_details=>wdctx_zcourse_details ).
" navigate from <ZCOURSE_DETAILS> to <COURSE_ASSIGN> via lead selection
node_course_assign = node_zcourse_details->get_child_node( name = if_v_details=>wdctx_course_assign ).
" @TODO handle not set lead selection
if ( node_course_assign is initial ).
exit.
endif.
data elem_set type wdr_context_element_set.
field-symbols <wa_elem> like line of elem_set.
elem_set = node_course_assign->get_elements( ).
loop at elem_set assigning <wa_elem>.
<wa_elem>->set_selected( TRUE OR FALSE ). " Supply either TRUE/FALSE in here
endloop. -
How to select all rows in table automatically after refreshing?
Hi,All
After refreshing the table,I want to select all rows,like MultipleButton's function.
How can I do?
Thanks
Smile.Hi,-Grif-
* Set the selected state for the given row groups
* displayed in the table. This functionality requires
* the 'selectId' of the tableColumn to be set.
* @param rowGroupId HTML element id of the tableRowGroup component
* @param selected Flag indicating whether components should be selected
function selectGroupRows(rowGroupId, selected) {
var table = document.getElementById("form1:table1");
table.selectGroupRows(rowGroupId, selected);
}I don't know that the parameter selected is a boolean,or the checkbox(radio button) id?
Thanks
Smile -
How to delete a row in table control(accepts only input)?
Hi All,
I have an empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output:
http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
ELSE.
"EXIT FROM STEP-LOOP.
CLEAR ZQID_CHECK.
ENDIF.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
CHAIN.
MODULE CHECK_ENTRIES ON CHAIN-INPUT.
MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
MODULE DELETE_ROW ON CHAIN-INPUT
ENDCHAIN.
ENDLOOP.
module CHECK_ENTRIES input.
CASE ok_code.
WHEN 'DEL'.
PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
ZQID_CHECK-LICHA
ZQID_CHECK-LIFNR.
ENDCASE.
endmodule.
form F_FILL_ITABCREATE using us_zqid_check_matnr LIKE MARA-MATNR
us_zqid_check_licha LIKE MCHA-LICHA
us_zqid_check_lifnr LIKE LFA1-LIFNR.
MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
us_zqid_check_licha TO WA_ID_CHECK-LICHA,
us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
APPEND WA_ID_CHECK TO T_ID_CHECK.
CLEAR WA_ID_CHECK.
endform.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
DELETE T_ID_CHECK.
ENDLOOP.
endmodule.
Edited by: Jaime Cabanban on Jan 7, 2010 8:46 PMDebugging the PBO part after deletion will help you know why the rows are getting deleted
This is the sap doc answer for you question regarding LINE.
Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT <itab> the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.
Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT <itab>. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control. -
How to determine line number on Table control in BDC
Hi,
I am uploading changes for CG02 using BDC. I have to change data to specification type which are listed in a table control having some of the fields as IDCAT, IDTYPE, LANG, ORD, IDENT etc.
For a particular substance number, there can be variable number of idtypes. Since there were 8 Idtypes already created for the substance number I was working with while recording and I created 9th Idtyep(Z_SARADOT#) while recording (Using SHBD), I am getting the code like ...'ESTRI-IDTYPE(09)....ESTRI-IDCAT(09).....'RCGRIIOT-IDENT(09)' which indicate that while recording, the values were added on 9th line of table control.
Now this line number can vary for other substance number. How can I know
(1) The last line of table control
(2) Line number based on Value of field
Example - here I want to know line number corresponding to IDTYPE Z_SARADOT# if it was created so that I can change the value of field IDENT of the table control.
The piece of code I got after recording is:
perform bdc_field using 'ESTRI-IDTYPE(09)'
'NUM'.
perform bdc_field using 'ESTRI-IDCAT(09)'
'Z_SARADOT#'.
perform bdc_field using 'RCGRIIOT-IDENT(09)'
'1175'.
Please help friends.
Thanks & Regards,
SuryaThere are around 800 Substance numbers and for each substance number there are around 10 IDtype. So It would be a costly processing.
If there no other way doing it?
I think, I need to follow this way as We can not determine the line number untill BDC is running. -
Disable Vertical scroll but enable Page down in Table control for BDC
Hello All
In my 4.6C sysem , i had enabled Scroll bar in table control by populating TABC-lines = <No of records>...Then when i try to capture the BDC recording of this , then the scrolling event is not captured in BDC , as we all know.....
So i put few buttons on the application bar as NEXT PAGE, NEXT LINE , PREV PAGE n PREV LINE...and i did the scrolling by writing the code manually in PAI...and that is getting captured in BDC so my problem is partially solved...
Now as u see..i have default working Scroll bar on my T.C..also i have my buttons on the application bar....i want to get rid of the vertical scrolling....so now i am NOT populating the TABC-lines field...But as soon as i do this , my buttons stopped also working...Any idea how to get rid of this ?
In short when i don't write : TABC-lines = no_of_records .....to remove vertical scroling.......my manual scrolling mechanism also getting disabled..
Is it possible to remove only vertical scrolling ?
Thanks in advance .
NileshNo reply from any one ???
Maybe you are looking for
-
OS 10.6.2 to 10.6.3 upgrade
I'm doing a Software Update over my satellite connection. Twice, the upgrade to OS 10.6.3 (757MB) has failed because of a transmission error during the several-hour download. Whenever I exceed my daily HughesNet quota, I buy a token for more bandwidt
-
Hi, the problem with my iweb site is that when one is browsing through different pages it works just fine but if you try to return to the product page again (product photographs are placed here) it won't open up. You have to go to another page & then
-
Hi Experts, I am trying to insert 2 queries in a wrokbook but it overwrites and only 1 query is getting inserted. Please advise. Regards Shweta
-
Passing objects from two servlets residing in two servers
Suppose i need to pass an object from one servlet to another servlet ,that are residing in two servers(Tomcat).How can i achieve this. Plz help me in this regard. Thanks in Advance......
-
I successfully install Flash Player - I thought - but when i try to view a video clip, I'm told I need to install it. Any suggestions?