How to transfer data in table control in bdc
hi
how to transfer data in table control in bdc . I need the theory regarding this
bye
Hi,
just check in the forum , there is many threads available to ur questions.
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
You can even refer to these related threads
bdc table control
Re: table control in bdc
table control in BDC
Reward if helpful.
Thanks
Naveen khan
Similar Messages
-
How populate the data in table control in BDC?
pls urgent?
hi,
see the below code .
FORM create_bdc_session .
DATA : w_saved_tx.
DATA g_r_itab TYPE typ_itab_rec.
CLEAR g_t_itab.
CLEAR g_r_itab.
LOOP AT g_t_itab INTO g_r_itab.
skip error lines
IF g_r_itab-ebeln = 'ERROR'.
CONTINUE.
ENDIF.
open Bdc session
AT FIRST.
PERFORM bdc_open_group.
ENDAT.
g_t_itab = g_r_itab.
On change in agreement number
AT NEW ebeln.
PERFORM bdc_header.
CLEAR: w_dtl_cnt_i, w_line_i.
ENDAT.
save at full page
IF w_line_i > 11.
PERFORM bdc_save.
PERFORM bdc_header_change.
w_line_i = 1.
ENDIF.
detail material processing
PERFORM bdc_detail.
CLEAR w_saved_tx .
save at end of agreement
AT END OF ebeln.
IF w_saved_tx NE 'Y' AND w_dtl_cnt_i > 0.
PERFORM bdc_save.
ENDIF.
w_saved_tx = 'Y'.
ENDAT.
ENDLOOP.
PERFORM bdc_close_group.
ENDFORM. " CREATE_BDC_SESSION
*& Form BDC_OPEN_GROUP
text
--> p1 text
<-- p2 text
FORM bdc_open_group .
DATA w_user_tx LIKE apqi-userid.
w_user_tx = sy-uname.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = p_bdc
keep = 'X'
user = w_user_tx
EXCEPTIONS
client_invalid = 01
destination_invalid = 02
group_invalid = 03
holddate_invalid = 04
internal_error = 05
queue_error = 06
running = 07
user_invalid = 08.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
WRITE: / 'BDC OPEN ERROR', sy-subrc.
ENDCASE.
ENDFORM. " BDC_OPEN_GROUP
*& Form BDC_HEADER
text
--> p1 text
<-- p2 text
FORM bdc_header .
REFRESH bdcdata.
CLEAR bdcdata.
determine now if text exists
CLEAR w_text_lines_i.
Transaction ME31K.
PERFORM bdc_dynpro USING 'SAPMM06E' '0200'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'EKKO-LIFNR' g_t_itab-lifnr.
PERFORM bdc_field USING 'RM06E-EVART' 'MK'.
PERFORM bdc_field USING 'RM06E-EVRTN' g_t_itab-ebeln.
PERFORM bdc_field USING 'EKKO-EKORG' g_t_itab-ekorg.
PERFORM bdc_field USING 'EKKO-EKGRP' g_t_itab-ekgrp.
Item category is on a detail line, but is entered on the entry screen
IF g_t_itab-pstyp = '3'.
g_t_itab-pstyp = 'L'.
ELSE.
CLEAR g_t_itab-pstyp.
ENDIF.
PERFORM bdc_field USING 'RM06E-EPSTP' g_t_itab-pstyp.
PERFORM bdc_field USING 'RM06E-WERKS' p_nwerks.
PERFORM bdc_field USING 'RM06E-LGORT' g_t_itab-lgort.
PERFORM bdc_dynpro USING 'SAPMM06E' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'EKKO-WAERS' g_t_itab-waers.
WRITE sy-datum TO w_date_tx DD/MM/YYYY.
PERFORM bdc_field USING 'EKKO-KDATB' '01.06.2004'.
PERFORM bdc_field USING 'EKKO-KDATE' '31.12.2999'.
w_tcode = 'ME31K'.
ENDFORM. " BDC_HEADER
*& Form BDC_SAVE
text
--> p1 text
<-- p2 text
FORM bdc_save .
final save
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
needed for some boxes (save anyway message)
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE' '=YES'.
Insert the transaction into the BDC session.
PERFORM bdc_insert USING w_tcode.
REFRESH bdcdata.
CLEAR bdcdata.
ENDFORM. " BDC_SAVE
*& Form BDC_HEADER_change
text
--> p1 text
<-- p2 text
FORM bdc_header_change .
DATA: w_pos LIKE rm06e-ebelp.
REFRESH bdcdata.
CLEAR bdcdata.
determine now if text exists
CLEAR w_text_lines_i.
Transaction ME32K.
PERFORM bdc_dynpro USING 'SAPMM06E' '0205'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'RM06E-EVRTN' g_t_itab-ebeln.
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
w_pos = g_t_itab-ebelp - 10.
PERFORM bdc_field USING 'RM06E-EBELP' w_pos.
w_tcode = 'ME32K'.
ENDFORM. " BDC_HEADER_change
*& Form BDC_INSERT
text
-->P_W_TCODE text
FORM bdc_insert USING p_w_tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = w_tcode
TABLES
dynprotab = bdcdata
EXCEPTIONS
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
WRITE: / 'BDC INSERT ERROR', sy-subrc.
ENDCASE.
ENDFORM. " BDC_INSERT
*& Form BDC_CLOSE_GROUP
text
--> p1 text
<-- p2 text
FORM bdc_close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
WRITE: / 'BDC CLOSE ERROR', sy-subrc.
ENDCASE.
ENDFORM. " BDC_CLOSE_GROUP
*& Form bdc_dynpro
text
-->P_0658 text
-->P_0659 text
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0688 text
-->P_W_POS text
FORM bdc_field USING field value.
CLEAR bdcdata.
bdcdata-fnam = field.
bdcdata-fval = value.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
*& Form load_dataset
text
--> p1 text
<-- p2 text
FORM load_dataset .
load dataset
LOOP AT g_t_itab INTO g_r_itab.
Load dataset with records needed for direct input
MOVE-CORRESPONDING g_r_itab TO g_t_itab.
AT NEW ebeln.
PERFORM load_dataset_mbepoh USING w_phys_outfil1_tx.
ENDAT.
PERFORM load_dataset_mbepoi USING w_phys_outfil1_tx.
ENDLOOP.
ENDFORM. " load_dataset
*& Form load_dataset_mbepoh
text
-->P_W_PHYS_OUTFIL1_TX text
FORM load_dataset_mbepoh USING p_dataset.
CLEAR rec1.
MOVE-CORRESPONDING g_t_itab TO rec1.
rec1-stype = '1'.
rec1-ernam = sy-uname.
TRANSFER rec1 TO p_dataset.
ENDFORM. " load_dataset_mbepoh
*& Form load_dataset_mbepoi
text
-->P_W_PHYS_OUTFIL1_TX text
FORM load_dataset_mbepoi USING p_dataset.
CLEAR rec2.
fields for MBEPOH
ADD 1 TO w_good_i.
MOVE-CORRESPONDING g_t_itab TO rec2.
rec2-stype = '2'.
rec2-werks = p_nwerks.
rec2-ematn = g_t_itab-matnr.
TRANSFER rec2 TO p_dataset.
ENDFORM. " load_dataset_mbepoi
*& Form BDC_DETAIL
text
--> p1 text
<-- p2 text
FORM bdc_detail .
DATA: w_ktmng_tx(11),
w_peinh_tx(5) TYPE c,
w_price_p(13) TYPE p DECIMALS 6,
w_price2_p(13) TYPE p DECIMALS 2,
w_price3_p(13) TYPE p DECIMALS 3,
w_price0_p(13) TYPE p DECIMALS 0,
w_cent_p TYPE p DECIMALS 2,
w_peinh_n(5) TYPE n,
w_price_tx(14).
accumulate lines to determine if page_down required
ADD 1 TO w_addit_i.
ADD 1 TO w_dtl_cnt_i.
ADD 1 TO w_line_i.
IF w_line_i > 12.
w_line_i = 2.
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE' '=NP'.
ENDIF.
get material unit of measure
CLEAR mara-meins.
SELECT SINGLE * FROM mara WHERE matnr = g_t_itab-matnr.
w_price_tx = g_t_itab-netpr.
w_peinh_tx = g_t_itab-peinh.
IF g_t_itab-ktmng = 0.
g_t_itab-ktmng = 1.
ENDIF.
w_ktmng_tx = g_t_itab-ktmng.
get decimal places of currency
TCURX-CURRDEC = 2.
SELECT SINGLE * FROM TCURX WHERE CURRKEY = g_t_itab-waers.
multiply Price
W_PRICE_P = g_t_itab-netpr.
CASE TCURX-CURRDEC.
WHEN 0.
W_PRICE_P = g_t_itab-netpr * 100.
W_PRICE0_P = W_PRICE_P.
W_PRICE_TX = W_PRICE0_P.
WHEN 2.
W_PRICE2_P = W_PRICE_P.
W_PRICE_TX = W_PRICE2_P.
WHEN 3.
W_PRICE3_P = W_PRICE_P.
W_PRICE_TX = W_PRICE3_P.
ENDCASE.
material overview screen (with enter)
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE' '=DETA'.
PERFORM bdc_field_idx USING 'RM06E-TCSELFLAG' 'X' w_line_i.
PERFORM bdc_field_idx USING 'EKPO-EMATN' g_t_itab-matnr w_line_i.
PERFORM bdc_field_idx USING 'EKPO-KTMNG' w_ktmng_tx w_line_i.
PERFORM bdc_field_idx USING 'EKPO-NETPR' w_price_tx w_line_i.
PERFORM bdc_field_idx USING 'EKPO-PEINH' w_peinh_tx w_line_i.
PERFORM bdc_field_idx USING 'EKPO-BPRME' mara-meins w_line_i.
PERFORM bdc_field_idx USING 'EKPO-WERKS' p_nwerks w_line_i.
PERFORM bdc_field_idx USING 'EKPO-LGORT' g_t_itab-lgort w_line_i.
IF g_t_itab-pstyp = '3'.
g_t_itab-pstyp = 'L'.
ELSE.
CLEAR g_t_itab-pstyp.
ENDIF.
PERFORM bdc_field_idx USING 'RM06E-EPSTP' g_t_itab-pstyp w_line_i.
item details screen
PERFORM bdc_dynpro USING 'SAPMM06E' '0211'.
PERFORM bdc_field USING 'BDC_OKCODE' '=OR'.
PERFORM bdc_field USING 'EKPO-SPINF' 'B'.
PERFORM bdc_field USING 'EKPO-BSTAE' '0001'.
PERFORM bdc_field USING 'EKPO-MWSKZ' g_t_itab-mwskz.
PERFORM bdc_field USING 'EKPO-IDNLF' g_t_itab-idnlf.
PERFORM bdc_field USING 'EKPO-REPOS' 'X'.
PERFORM bdc_field USING 'EKPO-EVERS' g_t_itab-evers.
PERFORM bdc_field USING 'EKPO-KZABS' 'X'.
PERFORM bdc_field USING 'EKPO-NETPR' w_price_tx. "deliberate
PERFORM bdc_field USING 'EKPO-PEINH' w_peinh_tx . "Overwriting
Source list
PERFORM bdc_dynpro USING 'SAPLMEOR' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE' 'EN'.
PERFORM bdc_field USING 'BDC_CURSOR' 'EORD-AUTET(01)'.
PERFORM bdc_field USING 'EORD-VDATU(01)' '01062004'.
PERFORM bdc_field USING 'EORD-BDATU(01)' '31122999'.
PERFORM bdc_field USING 'EORD-FEBEL(01)' ' '.
PERFORM bdc_field USING 'EORD-AUTET(01)' '1'.
GOTO Conditions
PERFORM bdc_dynpro USING 'SAPMM06E' '0211'.
PERFORM bdc_field USING 'BDC_OKCODE' '=KO'.
PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
ENDFORM. " BDC_DETAIL
*& Form BDC_FIELD_IDX
text
-->P_1390 text
-->P_G_T_ITAB_PSTYP text
-->P_W_LINE_I text
FORM bdc_field_idx USING field LIKE bdcdata-fnam
value p_index TYPE i.
DATA: w_index_tx(2).
UNPACK p_index TO w_index_tx.
CLEAR bdcdata.
CONCATENATE field '(' w_index_tx ')' INTO field.
bdcdata-fnam = field.
bdcdata-fval = value.
APPEND bdcdata.
ENDFORM. " BDC_FIELD_IDX
regards, -
How to populate data in table control .
hi all,
i put matnr no. in screen no. 103
validation is done at that screen only.
now when i want to modify dat record
when i put matnr no. at screen 103
so how i will get all data of dat number to table control screen.Hi Darshan,
Here is a detailed description of how to update data in table controll.
Updating data in table control
The ABAP language provides two mechanisms for loading the table control with data from the internal table and then storing the altered rows of the table control back to the internal table.
Method 1: Read the internal table into the Table Control in the screenu2019s flow logic. Used when the names of the Table Control fields are based on fields of the internal table.
Method 2: Read the internal table into the Table Control in the module pool code. Used when the names of the Table Control fields are based on fields of the database table.
Method 1 (table control fields = itab fields)
In the flow logic we can read an internal table using the LOOP statement. Define the reference to the relevant able control by specifying WITH CONTROL <ctrl>
Determine which table entry is to be read by specifying CURSOR <ctrl>-CURRENT_LINE.
After the read operation the field contents are placed in the header line of the internal table. If the fields in the table control have the same name as the internal they will be filled automatically. Otherwise we need to write a module to transfer the internal table fields to the screen fields.
We must reflect any changes the user makes to the fields of the table control in the internal table otherwise they will not appear when the screen is redisplayed after PBO processing, (eg, after the user presses Enter or scrolls) However, this processing should be performed only if changes have actually been made to the screen fields of the table control (hence the use of the ON REQUEST)
PROCESS BEFORE OUTPUT.
LOOP AT ITAB_REG WITH CONTROL TCREG
CURSOR TCREG-CURRENT_LINE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
MODULE MODIFY_ITAB_REG.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2 (table control fields = dict. fields)
If using a LOOP statement without an internal table in the flow logic, we must read the data in a PBO module which is called each time the loop is processed.
Since, in this case, the system cannot determine the number of internal table entries itself, we must use the EXIT FROM STEP-LOOP statement to ensure that no blank lines are displayed in the table control if there are no more corresponding entries in the internal table.
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TCREG.
MODULE READ_ITAB_REG.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG
ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE READ_ITAB_REG OUTPUT.
READ TABLE ITAB_REG INDEX TCREG-CURRENT_LINE.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING ITAB_REREG TO TCREG.
ELSE.
EXIT FROM STEP-LOOP.
ENDIF.
ENDMODULE.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
MODIFY ITAB_REG INDEX
TCREG-CURRENT_LINE.
ENDMODULE.
Updating the internal table
Method 1
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: TCREG-REG,
TCREG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Updating the database
MODULE USER_COMMAND_100.
CASE OK_CODE.
WHEN u2018SAVEu2019.
LOOP AT ITAB-REG.
CHECK ITAB_REG-MARK = u2018Xu2019.
MOVE-CORRESPONDING ITAB_REG TO TCREG.
UPDATE TCREG.
ENDLOOP.
WHEN u2026
u2026
ENDCASE.
ENDMODULE.
Hope this will solve your problem.
Regards,
Pavan.
Edited by: PAVAN CHANDRASEKHAR GANTI on Aug 3, 2009 12:48 PM -
How to insert data into table control
hi experts,,
i have inserted data into data base table through table control .
now i want to insert data into table control through database table.
how to delete data from table control for selected rowHi
go through this link.
http://www.****************/Tutorials/ABAP/TableControl/Demo.htm -
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 -
How to modify data in table control
hi
i have created table control where i have displayed data into table control
logic used
screen 200
PROCESS BEFORE OUTPUT.
MODULE SELECT_RECORD.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TBC_200'
MODULE TBC_200_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_200_CHANGE_COL_ATTR.
LOOP AT IT_MARA
INTO WA_MARA
WITH CONTROL TBC_200
CURSOR TBC_200-CURRENT_LINE.
MODULE TBC_200_GET_LINES.
*&SPWIZARD: MODULE TBC_200_CHANGE_FIELD_ATTR
ENDLOOP.
MODULE STATUS_0200.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TBC_200'
LOOP AT IT_MARA.
CHAIN.
FIELD WA_MARA-MATNR.
FIELD WA_MARA-ERSDA.
FIELD WA_MARA-ERNAM.
MODULE TBC_200_MODIFY ON CHAIN-REQUEST.
ENDCHAIN.
FIELD WA_MARA-MARK
MODULE TBC_200_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_200_USER_COMMAND.
*&SPWIZARD: MODULE TBC_200_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_200_CHANGE_COL_ATTR.
module -
MODULE SELECT_RECORD.
MODULE SELECT_RECORD OUTPUT.
SELECT MATNR ERSDA ERNAM
FROM MARA
INTO CORRESPONDING FIELDS OF TABLE it_mara.
ENDMODULE. " SELECT_RECORD OUTPUT
and
another thing
i have made field MARA-ERSDA. and FIELD WA_MARA-ERNAM editable by
input possible using layout
so
now those 2 fields contents are editable
i want to know how to edit and save the data
some body guide.
and i want to put the lock so that i can update
can tell how to implement lock.
Thanks
Edited by: viju bangalore on Jan 27, 2011 10:40 AMHi Viju,
In PAI do something like this
LOOP AT itab.
MODULE mod_table_control.
ENDLOOP.
MODULE user_command_0100.
at module mod_table_control put this
MODULE mod_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
if sy-subrc ne 0.
insert itab.
endif.
ENDMODULE.
for saving you can create at custom gui status with a save button, and at MODULE user_command_0100 save the data. -
How to clear data in Table Control.
hi! all
How to clear the data in table control.
i have a Table control which displays column A data from the previous screen and allows to enter column B and column C and i have a button CLEAR, when i click CLEAR button the Data displaying in table control has to be cleared. how to do it.
Regards,
NagulanHi,
Loop over the internal table of table control & clear data from table control.
loop at tctab.
clear tctab.
modify tctab.
endloop.
Best regards,
Prashant -
How to show data through table control
Hi Experts,
I have created an table control through wizard using table EKKO.
I have to populate one internal table( type ekko ), and then show it in output through table control.
Please advise, how to do that and in where i have to write the codes.
I will reward points for every suggestion
Thanks in advance.
regardshi saubrab,
This is kiran kumar.G.I am sending some sample code to populate data into table control check it once.
i will give input in 100 screen. and display table control in 200 screen.check it once once ..ok....
SE38 :(CODE)
*& Module pool YMODULEPOOL_TABLECONTROL1 *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : TABLE CONTROL DEMO *
*& CREATION DT : 17/12/2007 *
*& T.CODE : YMODTABLECONTROL1 *
*& REQUEST : ERPK900035 *
PROGRAM ymodulepool_tablecontrol1.
Tables
TABLES: yvbap, "Sales Document: Item Data
vbak. "Sales Document: Header Data
Controls
CONTROLS: my_table TYPE TABLEVIEW USING SCREEN 200.
Global Variables
DATA: gv_lines TYPE i,
gv_lines1 type i,
gv_temp type i,
gv_flag(20) TYPE c VALUE 'DISP',
gv_mode1 TYPE c,
gv_mode TYPE c VALUE 'C'. " C: Change, D :Display
Internal Table
DATA: BEGIN OF gt_item OCCURS 0,
vbeln LIKE vbap-vbeln, "Sales Document Number
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Material Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
cflag, "Deletion Indicator
END OF gt_item.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZTABLECONTROL' OF PROGRAM 'YMODULEPOOL_TABLECONTROL'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'DISP'.
SELECT single vbeln
erdat
angdt
bnddt
FROM vbak
INTO (vbak-vbeln,vbak-erdat,
vbak-angdt,vbak-bnddt)
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*Fetch the table control data and place them in Internal Table
SELECT vbeln
posnr
matnr
matkl
arktx
FROM yvbap
INTO TABLE gt_item
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*NO OF line in the Internal Table
DESCRIBE TABLE gt_item LINES gv_lines.
my_table-lines = gv_lines + 20.
ENDIF.
ENDIF.
*Call Screen 200.
SET SCREEN 200.
WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
*Exit from the Program
CALL TRANSACTION 'SESSION_MANAGER'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
module STATUS_0200 output.
SET PF-STATUS 'ZTABLECONTROL1'.
endmodule. " STATUS_0200 OUTPU
*& Module copy_data OUTPUT
text
module copy_data output.
*Fetch the current line data from the Table control
read table gt_item index my_table-current_line.
if sy-subrc eq 0.
*Populating data into screen fields
gt_item-vbeln = gt_item-vbeln.
gt_item-posnr = gt_item-posnr.
gt_item-matnr = gt_item-matnr.
gt_item-matkl = gt_item-matkl.
gt_item-arktx = gt_item-arktx.
endif.
SE51:CODE (SCREEN 100)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
SE51 :CODE (SCREEN 200)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
loop at gt_item with control my_table cursor my_table-current_line.
module copy_data.
endloop.
PROCESS AFTER INPUT.
loop at gt_item.
MODULE USER_COMMAND_0200.
endloop.
HAVE A NICE DAY..
Award points if helpful,kiran kumar.G -
How to delete data in table control
Hi,
I am doing module pool programming. After the user enters the data in table control after saving the data. if the user wants to remove the line item the line item shd be removed from the screen and data base.
Please Give me vaulable Suggestions
RegardsHi,
Screen 8002 (with table control) --> select records --> press delete button --> delete selected records
Now you wan to delete those records selected by the user at runtime when DELETE button is clicked.
Take another internal table and work area same as the initial internal table and work area used in screen 8002 which is to be used to delete the selected data.
Take the names of the input/output fields as work_area-field_name and select column in table control as work_area-flag.
Also take a flag field of size 1 datatype character as the last field in the internal table and work area while declaration.
You must have passed a code in PBO of the screen for reading internal table into the table control.
So it reads the internal table into the table control whenever you perform any action on use command.
All you need to do is to write a code to modify the internal table form the table control while performing any user action.
Remember to change the LINE SEL option in attributes of table control as MULTIPLE.
At screen logic,
PROCESS BEFORE OUTPUT.
MODULE status_8002. "for pf-status
LOOP WITH CONTROL po_tab. "po_tab is table control
MODULE pass_data. "to pass data into table control from internal table
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_8002. "for user command(back and exit)
LOOP WITH CONTROL po_tab.
MODULE modify_data. "to modify data from table control into table control
ENDLOOP.
MODULE delete. "to delete the selected records
In PBO,
*& Module STATUS_8002 OUTPUT
MODULE status_8002 OUTPUT.
SET pf-status 'ZAB_PFSTA'. " pf-status
DATA : line_count TYPE i.
DESCIRBE TABLE it_ekpo
LINES line_count.
po_tab-lines = line_count + 10.
" to make table control scrollable
ENDMODULE. " STATUS_8002 OUTPUT
*& Module PASS_DATA OUTPUT
MODULE pass_data OUTPUT.
READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
ENDMODULE. " PASS_DATA OUTPUT
"it_ekpo is internal table and wa_ekpo is the work area
In PAI,
*& Module MODIFY_DATA INPUT
MODULE MODIFY_DATA INPUT.
MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
"modify records from table control into the internal table
ENDMODULE. " MODIFY_DATA INPUT
*& Module DELETE INPUT
MODULE DELETE INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'DELETE'. "when delete button is clicked
SORT IT_EKPO BY FLAG DESCENDING. "sort by flag(selection column value)
CLEAR WA_EKPO1.
CLEAR WA_EKPO.
REFRESH IT_EKPO1.
LOOP AT IT_EKPO INTO WA_EKPO WHERE FLAG = 'X'.
DATA : J TYPE I.
CLEAR J.
J = SY-TABIX. "assign index value if a record is selected
MOVE-CORRESPONDING WA_EKPO TO WA_EKPO1. "append selected records to another
"work area and append to another internal table to delete
APPEND WA_EKPO1 TO IT_EKPO1.
DELETE IT_EKPO. "delete the selected records from initial internal table
" to reflect the changes on the table control
ENDLOOP.
IF J = 0.
MESSAGE I006. "if no record selected
ELSE. "if some records are selected
DELETE ZEKPO FROM TABLE IT_EKPO1. "delete from database table
COMMIT WORK.
IF SY-SUBRC = 0.
MESSAGE S007. "success message (records deleted)
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE. " DELETE INPUT
Now at PAI, you have delete records and these changes are reflected back to the internal table.
Now when PBO is executed it will again read the initial internal table and will not show the deleted records.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
Modifying data in Table Control thr' BDC
Hi,
I have a following requirement.
I need to modify(update/delete) the data in the table control through BDC. The number of records of the table control, seen on the screen are only 4. If i need to modify 11th record, how do i go forward?
Your help is highly appreciated.
Regards
ShankarDue to rudeness, your thread is denied.
Note. If you want help from people it's best to a) follow the rules, and b) not antagonise those who could help you.
locked. -
How to display data in Table control?
Hi Experts,
Can anyone please explain me how to display the data from two different tables(those two table is related with 1 field) into a single table control?
For Example: T1 has fields (F1,F2) and
T2 has fields (F3,F4) --> here F3 is foreign key for F1
I need to display the data F1,F2,F3,F4 into the table control.
Can anyone explain me?
Thanks in Advance,
Regards,
RaghuHi,
If F3 is foreign key for F1, then both fields will have same values. Then why do you need to display both F1 and F3? Either one of them is enough. Try the following code.
types: begin of t_table,
F1 type T1-F1,
F2 type T1-F2,
F4 type T2-F4,
end of t_table.
data: i_table type standard table of t_table with header line.
select F1 F2 F4 into table i_table from T1 inner join T2 on T1F1 = T2F3.
You should create three columns in the table control with names i_table-F1, i_table-F2, i_table-F3.
After populating the internal table, refresh the control with the following statement.
REFRESH CONTROL <NAME> FROM SCREEN <SCREEN_NO>.
All the above statements should be in your PBO Module.
Regards,
Hema
Message was edited by:
Sorry, Declarations can be in the common include. Select statement and refresh statement should be in PBO.
Hema Nagarajan -
How to maintain data in table control
plz send a detail description of how to create table control and maintain data in that table control.
Hello Narendar,
Check the following link:
http://help.sap.com/saphelp_erp2005/helpdata/en/45/adee2396f711d1b46b0000e8a52bed/frameset.htm
Also, a table control wizard in Screen Painter(SE51) exists, which takes you step by step through the Table Control generation and also creates code, so you can start using the Table Control right away.
You can either specify a database table, or use an internal table from program.
If you want to use internal table, it needs to be predefined in your program, before you start creating the table control.
Reward if helpful. -
How to clear data from Table-Control
Hi all,
I am working on table control. I have some data on the table control.
When I press the 'Cancel' button, I require that the table-control should be cleared.
I tried using REFRESH CONTROL TC01 USING SCREEN 1001. But, the data doesn't get cleared.
Please advise.
Regards,
Saurabh Buksh.hi
good
try this example
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols
WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.
thanks
mrutyun^ -
How to retrieve data from Table Control
Hi,
I am a Beginner to ABAP. I want to know how to fetch the selected rows from Screen table control.
Here is my scenario:
I am having one table control with selection field. Once i select some rows means the selected rows are going to be stored in one Internal Table.
If any body knows the thing means please reply me the logic as well as giving me some code sample.
Thankyou.Hi Mithun,
Try to implement this code in your requirement.
There will be some button on your screen and after selecting some or all the records from the table control you must be pressing some button for collecting the selected rows from the table control too your internal table.
Put Fcode of that button in WHEN condition in this CASE.
CONSTANTS: kc_sel_flag TYPE char01 VALUE 'X'.
CASE sy-ucomm.
WHEN kc_sel.
PERFORM f_sel_desel USING kc_sel_flag.
ENDCASE.
FORM f_sel_desel
USING p_sel_desel TYPE c.
Set the value
wa_cond_type-z_sel = p_sel_desel.
Update the Itab.
MODIFY it_cond_type
FROM wa_cond_type
TRANSPORTING z_sel
WHERE mandt EQ sy-mandt. "Where cond is only to specify all
ENDFORM. " f_sel_desel
After that all the selected records will be having 'X' in the internal table.
Regards,
Mueksh Kumar -
BDC: How to enter data in Table control (With wizard) using scrolling?
Using BDC, I am trying to enter the data in the table control (with wizard).
I want to know what is the specific command to scroll down in table control (With Wizard).
While recording I am getting these steps:
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MATNR
BDC_OKCODE /00
When I use above command and run BDC, it does not scroll.
Kindly let me know where am I going wrong.
Thanks in advance for your kind help.
AshishThe transaction is CK94
and the BDC recording is :
T CK94
SAPLCKBASCR1 0200 X
BDC_CURSOR CKI94A-BDATJ
BDC_OKCODE =ENTR
CKI94A-MATNR 10000789
CKI94A-WERKS VA79
CKI94A-BDATJ 2005
CKI94A-MGTYP ZDU01
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MISCH_VERH(02)
BDC_OKCODE /00
CKI94B-MIXCOST_PC(01)
CKI94B-MIXCOST_PC(02) X
CKI94B-MISCH_VERH(01)
CKI94B-MISCH_VERH(02) 40
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MATNR
BDC_OKCODE /00
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MATNR
BDC_OKCODE /00
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MISCH_VERH(07)
BDC_OKCODE /00
CKI94B-MIXCOST_PC(07)
CKI94B-MISCH_VERH(07) 60
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MATNR
BDC_OKCODE /00
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MATNR
BDC_OKCODE /00
SAPLCKBASCR1 0202 X
BDC_CURSOR CKI94B-MATNR
BDC_OKCODE =STOR
BDC_OKCODE '/00' is recorded when I scroll down in the table control.
Thanks for your kind concern.
Ashish
Maybe you are looking for
-
Phone numbers are no longer showing up on my email and text as links to call
Phone numbers are no longer showing up in my messages and on my emails as links so that I can call the number directly.
-
SSL/TLS - secure connection could not be established but passes diagnostics
Any other ideas for the ever popular inability to create a secure connection issue? I've tried just about everything I could find in all the posts on this issue and continue to get the inability to create a secure connection messag4e when logging in.
-
ITunes store keeps saying that my session has timed out when trying to buy a product from the store
I Tunes is telling me that my session has timed out when trying to buy a gift voucher, which i have done many times before. The most recent change i'v made to my computer before this happened was to download an update (MacOSX updatecombo 10.7.3dmg) a
-
Everything was working fine and when I switched from email back to Firefox the problem started. Nothing new had been added before it experienced this problem. I also have IE on the computer, so I can get to this site.
-
Image loading speed: DB vs File?
Hi, everyone: i have made a program which need to load several images into memory in the same time. i want to know which will be faster: 1. use a loop to read them directly from files according to the filepaths (use the ImageIO.read meathod) 2. pre-s