BDC table control using Excel sheet upload
Hi All,
I am working BDC table control.I want to upload the From excel sheet.I am using the FM ALSM_EXCEL_TO_INTERNAL_TABLE to upload the the data into my internal table.The data is populating in the internal table.
Now i have problem tat how to populate this excel sheet data to the Bdc table control.
Can nybody help me out.\[removed by moderator\]
Thanks,
Swapna.
Edited by: Jan Stallkamp on Jul 25, 2008 10:57 AM
after fetching data from EXCEL sheet, each column data (in excel sheet) will be uploaded to individual record into your internal table along with row number and column number, loop through that internal table and collect all your excel data into record format.pls refer the below code.
data:
i_excel type alsmex_tabline occurs 0 with header line,
l_row type i value 1.
data:
begin of x_data occurs 0,
kunnr like RF02L-KUNNR,
klimk(17) type c,
CTLPC like knkk-CTLPC,
end of x_data,
begin of x_data1 occurs 0,
data(106),
end of x_data1.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_fname
i_begin_col = 1
i_begin_row = 1
i_end_col = no.of columns in your excel file
i_end_row = no.of rows in your file
tables
intern = i_excel.
if sy-subrc = 0.
loop at i_excel.
if l_row <> i_excel-row.
append x_data.
clear x_data.
endif.
case i_excel-col.
when 1.
x_data-kunnr = i_excel-value.
when 2.
x_data-klimk = i_excel-value.
when 3.
x_data-CTLPC = i_excel-value.
endcase.
l_row = i_excel-row.
clear i_excel.
at last.
append x_data.
endat.
endloop.
endif.
then loop through the internal table X_DATA, pass the data to your table control like.
tbl_control-field1(1) = x_data-field1.
tbl_control-field2(1) = x_data-field2.
tbl_control-fieldn(1) = x_data-fieldn.
Regards,
Sreeram.
Similar Messages
-
Uploading the Data into BDC using Excel sheet
HI Gurus,
Iam uploading the Data Using Excel sheet.TCode:qp01.
Upto 3 screens the data is passing in a very fine manner.
From the fourth screen I'v to enter the Lineitem for a single material.
Ex: Matnr is PJBRIX.
For this material upto 3 screens the data is same ,but from the line item data,the PJBRIX has 3 characterstics.
How can I upload that data.
Structure:
Matnr Group GroupCounter MicCode Method Lower Upper
Pjbrix 5 6 zsr001 zsr001 1 15
Pjbrix 5 6 zsr002 zsr003 4 20
Pjbrix 5 6 zsr006 zsr0018 2 18
This is the Structure.
Pls gv me the advise or Gv me the code asap.
thanks in advance.HI Gurus,
Iam uploading the Data Using Excel sheet.TCode:qp01.
Upto 3 screens the data is passing in a very fine manner.
From the fourth screen I'v to enter the Lineitem for a single material.
Ex: Matnr is PJBRIX.
For this material upto 3 screens the data is same ,but from the line item data,the PJBRIX has 3 characterstics.
How can I upload that data.
Structure:
Matnr Group GroupCounter MicCode Method Lower Upper
Pjbrix 5 6 zsr001 zsr001 1 15
Pjbrix 5 6 zsr002 zsr003 4 20
Pjbrix 5 6 zsr006 zsr0018 2 18
This is the Structure.
Pls gv me the advise or Gv me the code asap.
thanks in advance. -
MAY ANY ONE SUGGEST ME THE IDEA OF TABLE CONTROL USED IN BDC
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
check the below link also u may find answers for all your q's
http://help.sap.com/saphelp_webas630/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
<b>ex----</b>
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM. -
Uploading multiple lines in a table control using ECATT
Hi,
I want to upload muliple lines in a table control using ECATT. When I tried to upload only the first line is getting filled.What I have to do for that. Please reply at the earliest.
With warm regards,
Biju K.GeorgeHello ,
To insert multiple lines into the table you have to record the transaction for one entry and loop the same step multiple times to create multiple entries in the table.
Thanks,
Ajay -
How to create screen resolution in bdc table control
hi gurus
can anyone suggest me
how to create screen resolution in bdc table control
thanks®ards
mark.Hi ,
Using CTU_PARAMS table for screen resolution .
For this sample code.
This is for Transation FB60.
report ZZFB60
no standard page heading line-size 255.
tables t100.
PARAMETERS : p_file1 like rlgrap-filename,
p_doctyp like RF05A-BUSCS,
p_invdat like INVFO-BLDAT,
p_posdat like INVFO-BUDAT.
CONSTANTS : C_TRANS_FB60(4) VALUE 'FB60'.
*Parameter string for runtime of CALL TRANSACTION
data : l_option type ctu_params,
l_subrc type sysubrc.
DATA : l_mstring(150).
data accnt type char17.
data : day type char2,
month type char2,
year type char4,
date1 type char10,
date2 type char10.
data : cnt(2) TYPE n,
cnt1 type i,
fld(25) TYPE c.
data : begin of excel occurs 0,
fieldname(255) type c,
end of excel.
DATA:BEGIN OF it_mess OCCURS 0,
msgtyp(5),
lms(200),
msgv1(50),
END OF it_mess.
data: begin of t_record occurs 0,
BUKRS(004),
ACCNT(017),
XBLNR(016),
WRBTR1(016),
WAERS(005),
SECCO(004) ,
SGTXT(050),
HKONT(010),
WRBTR2(017),
MWSKZ(002),
GSBER(004),
KOSTL(010),
end of t_record.
*Internal Table for Header Data
DATA : BEGIN OF t_head OCCURS 0,
BUKRS(004), "Company Code
ACCNT(017), "Account or Vendor
XBLNR(016), "Reference
WRBTR1(017), "Amount in document currency
WAERS(005), "Currency
SECCO(004), "Section Code
SGTXT(050), "Text
END OF t_head.
*Internal table for Item Data
DATA : BEGIN OF t_item OCCURS 0,
ACCNT(017), "Account
HKONT(010), "GL Account
WRBTR2(017), "Line item Amount in document currency
MWSKZ(002), "Tax Code
GSBER(004), " Business Area
KOSTL(010), "Cost centre
END OF t_item.
DATA: IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDC_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
*include bdcrecx1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
PERFORM file_selection.
PERFORM data_upload.
PERFORM table_control.
start-of-selection.
l_option-defsize = 'X'.
l_option-dismode = 'A'.
l_option-updmode = 'S'.
day = p_invdat+6(2).
month = p_invdat+4(2).
year = p_invdat+0(4).
concatenate day month year into date1 SEPARATED BY '.'.
day = p_posdat+6(2).
month = p_posdat+4(2).
year = p_posdat+0(4).
concatenate day month year into date2 SEPARATED BY '.'.
*perform open_group.
loop at t_head.
CLEAR IT_BDCDATA.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPLACHD' '1000'.
perform bdc_field using 'BDC_OKCODE' '=ENTR'.
perform bdc_field using 'BKPF-BUKRS' t_head-bukrs.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'RF05A-BUSCS' p_doctyp.
perform bdc_field using 'INVFO-ACCNT' t_head-accnt.
perform bdc_field using 'INVFO-BLDAT' date1.
perform bdc_field using 'INVFO-BUDAT' date2.
perform bdc_field using 'INVFO-XBLNR' t_head-xblnr.
perform bdc_field using 'INVFO-WRBTR' t_head-wrbtr1.
perform bdc_field using 'INVFO-WAERS' t_head-waers.
perform bdc_field using 'INVFO-SECCO' t_head-secco.
perform bdc_field using 'INVFO-SGTXT' t_head-sgtxt.
cnt = 1.
cnt1 = 1.
loop at t_item where accnt = t_head-accnt.
*if cnt > 4.
*cnt = 4.
*endif.
if cnt1 gt 1.
CONCATENATE 'ACGL_ITEM-MARKSP(' cnt ')' INTO fld.
perform bdc_field using fld 'X'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE' '=0005'.
endif.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE' '/00'.
CONCATENATE 'ACGL_ITEM-HKONT(' cnt ')' INTO fld.
perform bdc_field using fld t_item-hkont.
CONCATENATE 'ACGL_ITEM-WRBTR(' cnt ')' INTO fld.
perform bdc_field using fld t_item-wrbtr2.
CONCATENATE 'ACGL_ITEM-MWSKZ(' cnt ')' INTO fld.
perform bdc_field using fld t_item-mwskz.
CONCATENATE 'ACGL_ITEM-GSBER(' cnt ')' INTO fld.
perform bdc_field using fld t_item-gsber.
CONCATENATE 'ACGL_ITEM-KOSTL(' cnt ')' INTO fld.
perform bdc_field using fld t_item-kostl.
perform bdc_field using 'BDC_CURSOR' fld.
*CONCATENATE 'ACGL_ITEM-MARKSP(' cnt ')' INTO fld.
*perform bdc_field using fld 'X'.
cnt1 = cnt1 + 1.
*cnt = cnt + 1.
*if cnt > 1.
*perform bdc_dynpro using 'SAPMF05A' '1100'.
*perform bdc_field using 'BDC_OKCODE' '=0005'.
**perform bdc_field using 'BDC_OKCODE' '=0006'.
*endif.
endloop.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=BS'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_transaction using 'FB60'.
CALL TRANSACTION C_TRANS_FB60 USING IT_BDCDATA options from l_option
MESSAGES INTO IT_BDC_MESSAGES.
perform error.
perform errordownload.
endloop.
*perform close_group.
*Form data_upload
FORM data_upload .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = p_file1
FILETYPE = 'DAT'
TABLES
DATA_TAB = t_record.
ENDFORM. " data_upload
*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 BDC_DYNPRO
FORM BDC_DYNPRO using program dynpro.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
endform.
*Form BDC_FIELD
FORM bdc_field using fnam fval.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
Table Control
FORM table_control .
LOOP AT t_record.
ON CHANGE OF t_record-accnt.
MOVE-CORRESPONDING t_record TO t_head.
APPEND t_head.
ENDON.
loop at t_head.
t_item-accnt = t_head-accnt.
t_item-hkont = t_record-hkont.
t_item-wrbtr2 = t_record-wrbtr2 .
t_item-mwskz = t_record-mwskz .
t_item-gsber = t_record-gsber .
t_item-kostl = t_record-kostl.
APPEND t_item.
endloop.
If t_record-level = 'H'.
t_head-bukrs = t_record-text1.
t_head-accnt = t_record-text2.
t_head-xblnr = t_record-text3.
t_head-wrbtr1 = t_record-text4.
t_head-waers = t_record-text5.
t_head-secco = t_record-text6.
t_head-sgtxt = t_record-text7.
APPEND t_head.
else.
t_item-accnt = t_head-accnt.
t_item-hkont = t_record-text1.
t_item-wrbtr2 = t_record-text2.
t_item-mwskz = t_record-text3.
t_item-gsber = t_record-text4.
t_item-kostl = t_record-text5.
APPEND t_item.
endif.
ENDLOOP.
ENDFORM.
FORM error .
LOOP AT IT_BDC_MESSAGES.
IF IT_BDC_MESSAGES-msgtyp = 'E'.
SELECT single * FROM t100 WHERE
sprsl = it_BDC_MESSAGES-msgspra
AND arbgb = IT_BDC_MESSAGES-msgid
AND msgnr = IT_BDC_MESSAGES-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
REPLACE '&2' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
REPLACE '&3' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
REPLACE '&4' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
APPEND it_mess.
ELSE.
it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
APPEND it_mess.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
form errordownload.
*down the internal table to excel file.
call function 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = 'c:/Error.xls'
TABLES
data_tab = it_mess
fieldnames = excel
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_filename = 6
invalid_pivot_fields = 7
download_problem = 8
others = 9.
endform.
Reward if useful
Regards,
Narasimha
Edited by: narasimha marella on May 13, 2008 12:12 PM -
How do we handle BDC table control
hi sap technical guru,
PLS suggest me how to handle BDC table control while uploading data to sap R/3
regards,Hi,
First take BDC recording for required transaction from SHDB then you will find screen field names, screen numbers sequence, According to that pass values to below BDC_DYNPRO and BDC_FIELD forms and append data to BDC table. In my requirement I have done this for VB03 transaction passed values to VB03 transaction from my selection screen.
*& Report ZS_VB03_TRANSACTION
REPORT ZS_VB03_TRANSACTION.
TABLES: KOMGG, "Dialogkommunikationstab
T685T, "Text zum Konditionsart
T185F, "Folgebildsteurung
T681, "Konditionstabelle
TMC1T, G000, TPARA. "Kurztext zur Konditionstabell
* Sales Organization *
SELECT-OPTIONS S_F001 FOR KOMGG-VKORG.
*MEMORY ID VKO.
* Distribution Channel *
SELECT-OPTIONS S_F002 FOR KOMGG-VTWEG
MEMORY ID VTW.
* Division *
SELECT-OPTIONS S_F003 FOR KOMGG-SPART
MEMORY ID SPA.
* CustomerHierarchy 01 *
SELECT-OPTIONS S_F004 FOR KOMGG-HIENR01.
* Material *
SELECT-OPTIONS S_F005 FOR KOMGG-MATNR
MEMORY ID MAT
MATCHCODE OBJECT MAT1.
* Customer *
SELECT-OPTIONS S_F006 FOR KOMGG-KUNNR
MEMORY ID KUN
MATCHCODE OBJECT DEBI.
* "Selektionsdatum *
SELECTION-SCREEN SKIP 1.
PARAMETERS SEL_DATE LIKE RV130-DATAM
DEFAULT SY-DATLO.
PARAMETERS: r_vb03 TYPE c RADIOBUTTON GROUP rb1 DEFAULT 'X',
r2 type c RADIOBUTTON GROUP rb1.
* * Batchinputdata of single transaction
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
* messages of call transaction
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
data: lv TYPE i.
data: s1 type KOMGG-VKORG,
s2 type KOMGG-VKORG.
START-OF-SELECTION.
if r_vb03 = 'X'.
data: num(2) TYPE n VALUE '01',
lv_string(40) type c,
lv_s_f001 like s_f001.
set PARAMETER ID: 'VGK' FIELD 'A001'. "Place ur default value here in A001 place.
If S_f001-high is INITIAL.
perform bdc_field using 'BDC_CURSOR'
'F001-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=%003'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
loop at S_f001 into lv_s_f001.
CONCATENATE 'RSCSEL-SLOW_I(' num ')' INTO lv_string.
perform bdc_field using 'BDC_CURSOR'
lv_string.
perform bdc_field using lv_string
lv_s_f001-low.
clear: lv_s_f001, lv_string.
num = num + 1.
ENDLOOP.
clear num.
perform bdc_dynpro using 'RV13GAAB' '1000'.
perform bdc_field using 'BDC_CURSOR'
'F002-LOW'.
ELSE.
perform bdc_dynpro using 'RV13GAAB' '1000'.
perform bdc_field using 'BDC_CURSOR'
'F001-LOW'.
perform bdc_field using 'F001-LOW' S_f001-low.
perform bdc_field using 'F001-HIGH' S_f001-high.
endif.
perform bdc_field using 'F002-LOW' S_F002-low.
perform bdc_field using 'F002-HIGH' S_F002-High.
perform bdc_field using 'F004-high' S_F004-high.
perform bdc_field using 'F005-LOW' S_F005-low.
perform bdc_field using 'F003-LOW' S_F003-low.
perform bdc_field using 'F003-High' S_F003-high.
perform bdc_field using 'F004-LOW' S_F004-low.
perform bdc_field using 'F005-high' S_F005-high.
perform bdc_field using 'F006-LOW' S_F006-low.
perform bdc_field using 'F006-high' S_F006-high.
call TRANSACTION 'VB03' USING BDCDATA MODE 'E' MESSAGES INTO MESSTAB.
ENDIF.
* Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
* Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM. -
How to download BDC transaction data to excel sheet directly.
Please don't have your subject in all CAPITALS. Now edited
Hello Experts,
i have been working on a BDC Tool,so the main job of this tool is
Generate BDCDATA from Excel Tool and pass as an input to a program to perform BDC (Session/Call Transaction).
so i want to the download data from BDC recording directly to excel sheet but i am unable to download it.
hope u all are clear with my question
with thanx and regards
harish
Edited by: Matt on Apr 24, 2009 10:44 AMHiii,
Plz refer the below code.
CALL TRANSACTION 'MEK1' USING it_bdcdata OPTIONS FROM x_ctuprms
MESSAGES INTO it_bdcmsg.
***collect the messages.
LOOP AT it_bdcmsg INTO wa_bdcmsg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_bdcmsg-msgid
lang = sy-langu
no = wa_bdcmsg-msgnr
v1 = wa_bdcmsg-msgv1
v2 = wa_bdcmsg-msgv2
v3 = wa_bdcmsg-msgv3
v4 = wa_bdcmsg-msgv4
IMPORTING
msg = message
EXCEPTIONS
not_found = 1
OTHERS = 2.
**collect the messages into an internal table.
endloop.
then use "gui_download" to download data.
Regards,
Anil N. -
Dear forums friends,
i have a problem in bdc table control.I send my report below,
please check it and tell me what is the problem,why this report not excute.
please tell me quickly.
regard
Rasmi.
REPORT ztable_control
NO STANDARD PAGE HEADING LINE-SIZE 255.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
DATA: it_exload LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA : str1 TYPE string,
var1(2) TYPE n.
var1 = 0.
DATA: BEGIN OF itab OCCURS 0,
cldte(8) TYPE n,
ocrsn(4) TYPE n,
END OF itab.
DATA: var3 TYPE dats,
var6 TYPE integer.
itab-cldte = var3.
itab2-cldte = var3.
itab-ocrsn = var6.
itab2-ocrsn = var6.
DATA: BEGIN OF itab1 OCCURS 0,
cldte(8) TYPE n,
ocrsn(4) TYPE n,
pernr(1) TYPE n,
taxcd LIKE pinct-taxcd,
betrg(1) TYPE n,
voudt(10) TYPE c,
vouam(2) TYPE n,
END OF itab1.
DATA var(1) TYPE c.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
PARAMETER: file_fi LIKE rlgrap-filename OBLIGATORY,
w_begin TYPE i OBLIGATORY,
w_end TYPE i OBLIGATORY,
rad1 RADIOBUTTON GROUP gp1,
rad2 RADIOBUTTON GROUP gp1 DEFAULT 'X',
rad3 RADIOBUTTON GROUP gp1 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_fi.
PERFORM sub_browse_file.
START-OF-SELECTION *
START-OF-SELECTION.
PERFORM mode_selection.
PERFORM sub_data_load.
PERFORM sub_data_transform.
PERFORM sub_post_data.
BROWS FILE *
FORM sub_browse_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = file_fi.
ENDFORM. "sub_browse_file
DATA LOAD *
FORM sub_data_load.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file_fi
i_begin_col = '0001'
i_begin_row = w_begin
i_end_col = '0007'
i_end_row = w_end
TABLES
intern = it_exload.
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. "sub_data_load
DATA TRANSFORM *
FORM sub_data_transform .
LOOP AT it_exload.
CASE it_exload-col.
WHEN '0001'.
itab-cldte = it_exload-value.
itab1-cldte = it_exload-value.
WHEN '0002'.
itab-ocrsn = it_exload-value.
itab1-ocrsn = it_exload-value.
WHEN '0003'.
itab1-pernr = it_exload-value.
WHEN '0004'.
itab1-taxcd = it_exload-value.
WHEN '0005'.
itab1-betrg = it_exload-value.
WHEN '0006'.
itab1-voudt = it_exload-value.
WHEN '0007'.
itab1-vouam = it_exload-value.
ENDCASE.
AT END OF row.
APPEND itab.
CLEAR itab.
APPEND itab1.
CLEAR itab1.
IF itab-cldte = ' '.
itab1-cldte = ' '.
itab-ocrsn = ' '.
itab1-ocrsn = ' '.
WRITE : / var3.
WRITE : / var6.
ENDIF.
ENDAT.
ENDLOOP.
*SORT itab by cldte.
*delete ADJACENT DUPLICATES FROM itab2.
ENDFORM. "sub_data_transform
Form sub_post_data *
FORM sub_post_data .
LOOP AT itab.
PERFORM bdc_dynpro USING 'HINCREMP' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'WA_CLAIMS-VOUAM(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PROC'.
PERFORM bdc_field USING 'RPCCLMIN-CLDTE'
itab-cldte . "'01.02.2009'.
PERFORM bdc_field USING 'RPCCLMIN-OCRSN'
itab-ocrsn. " '0002'.
LOOP AT itab1 WHERE cldte = itab1-cldte AND ocrsn = itab-ocrsn.
CONCATENATE 'wa_claims-pernr(' var1 ')' INTO str1.
PERFORM bdc_field USING str1
itab1-pernr. "'001'
CONCATENATE 'WA_CLAIMS-TAXCD (' var1')' INTO str1.
PERFORM bdc_field USING str1
itab1-taxcd. "'SCHA'.
CONCATENATE 'WA_CLAIMS-BETRG(' var1')' INTO str1.
PERFORM bdc_field USING str1
itab1-betrg. "'1'.
CONCATENATE 'WA_CLAIMS-VOUDT(' var1 ')' INTO str1.
PERFORM bdc_field USING str1
itab1-voudt. "'02.02.2009'.
CONCATENATE 'WA_CLAIMS-VOUAM(' var1')' INTO str1.
PERFORM bdc_field USING str1
itab1-vouam. "'50'.
var1 = var1 + 1.
Endif.
ENDLOOP. "'50'.
PERFORM bdc_dynpro USING 'HINCREMP' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'HINCREMP' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RPCCLMIN-CLDTE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RPCCLMIN-CLDTE'
'01.02.2009'.
PERFORM bdc_field USING 'RPCCLMIN-OCRSN'
'0002'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
*perform bdc_transaction using 'PC00_M40_REMP'.
CALL TRANSACTION 'PC00_M40_REMP' USING bdcdata MESSAGES INTO messtab MODE var.
"UPDATE 'S'
"MODE var.
Endloop.
Endform.
START NEW SCREEN *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
INSERT FILE *
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
MODE-SELECTION *
FORM mode_selection .
IF rad1 = 'X'.
var = 'P'.
ELSEIF rad2 = 'X'.
var = 'E'.
ELSEIF rad3 = 'X'.
var = 'A'.
ENDIF.
ENDFORM. " mode_selectiHi,
Check this ...
REPORT ztable_control
NO STANDARD PAGE HEADING LINE-SIZE 255.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
DATA: it_exload LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA : str1 TYPE string,
var1(2) TYPE n.
var1 = 1. " Change here and check
DATA: BEGIN OF itab OCCURS 0,
cldte(8) TYPE n,
ocrsn(4) TYPE n,
END OF itab.
DATA: var3 TYPE dats,
var6 TYPE integer.
itab-cldte = var3.
itab2-cldte = var3.
itab-ocrsn = var6.
itab2-ocrsn = var6.
DATA: BEGIN OF itab1 OCCURS 0,
cldte(8) TYPE n,
ocrsn(4) TYPE n,
pernr(1) TYPE n,
taxcd LIKE pinct-taxcd,
betrg(1) TYPE n,
voudt(10) TYPE c,
vouam(2) TYPE n,
END OF itab1.
DATA var(1) TYPE c.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
PARAMETER: file_fi LIKE rlgrap-filename OBLIGATORY,
w_begin TYPE i OBLIGATORY,
w_end TYPE i OBLIGATORY,
rad1 RADIOBUTTON GROUP gp1,
rad2 RADIOBUTTON GROUP gp1 DEFAULT 'X',
rad3 RADIOBUTTON GROUP gp1 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_fi.
PERFORM sub_browse_file.
START-OF-SELECTION *
START-OF-SELECTION.
PERFORM mode_selection.
PERFORM sub_data_load.
PERFORM sub_data_transform.
PERFORM sub_post_data.
BROWS FILE *
FORM sub_browse_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = file_fi.
ENDFORM. "sub_browse_file
DATA LOAD *
FORM sub_data_load.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file_fi
i_begin_col = '0001'
i_begin_row = w_begin
i_end_col = '0007'
i_end_row = w_end
TABLES
intern = it_exload.
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. "sub_data_load
DATA TRANSFORM *
FORM sub_data_transform .
LOOP AT it_exload.
CASE it_exload-col.
WHEN '0001'.
itab-cldte = it_exload-value.
itab1-cldte = it_exload-value.
WHEN '0002'.
itab-ocrsn = it_exload-value.
itab1-ocrsn = it_exload-value.
WHEN '0003'.
itab1-pernr = it_exload-value.
WHEN '0004'.
itab1-taxcd = it_exload-value.
WHEN '0005'.
itab1-betrg = it_exload-value.
WHEN '0006'.
itab1-voudt = it_exload-value.
WHEN '0007'.
itab1-vouam = it_exload-value.
ENDCASE.
AT END OF row.
APPEND itab.
CLEAR itab.
APPEND itab1.
CLEAR itab1.
IF itab-cldte = ' '.
itab1-cldte = ' '.
itab-ocrsn = ' '.
itab1-ocrsn = ' '.
WRITE : / var3.
WRITE : / var6.
ENDIF.
ENDAT.
ENDLOOP.
*SORT itab by cldte.
*delete ADJACENT DUPLICATES FROM itab2.
ENDFORM. "sub_data_transform
Form sub_post_data *
FORM sub_post_data .
LOOP AT itab.
PERFORM bdc_dynpro USING 'HINCREMP' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'WA_CLAIMS-VOUAM(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PROC'.
PERFORM bdc_field USING 'RPCCLMIN-CLDTE'
itab-cldte . "'01.02.2009'.
PERFORM bdc_field USING 'RPCCLMIN-OCRSN'
itab-ocrsn. " '0002'.
LOOP AT itab1 WHERE cldte = itab1-cldte AND ocrsn = itab-ocrsn.
CONCATENATE 'wa_claims-pernr(' var1 ')' INTO str1.
PERFORM bdc_field USING str1
itab1-pernr. "'001'
CONCATENATE 'WA_CLAIMS-TAXCD (' var1')' INTO str1.
PERFORM bdc_field USING str1
itab1-taxcd. "'SCHA'.
CONCATENATE 'WA_CLAIMS-BETRG(' var1')' INTO str1.
PERFORM bdc_field USING str1
itab1-betrg. "'1'.
CONCATENATE 'WA_CLAIMS-VOUDT(' var1 ')' INTO str1.
PERFORM bdc_field USING str1
itab1-voudt. "'02.02.2009'.
CONCATENATE 'WA_CLAIMS-VOUAM(' var1')' INTO str1.
PERFORM bdc_field USING str1
itab1-vouam. "'50'.
var1 = var1 + 1.
Endif.
ENDLOOP. "'50'.
PERFORM bdc_dynpro USING 'HINCREMP' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'HINCREMP' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RPCCLMIN-CLDTE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RPCCLMIN-CLDTE'
'01.02.2009'.
PERFORM bdc_field USING 'RPCCLMIN-OCRSN'
'0002'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
*perform bdc_transaction using 'PC00_M40_REMP'.
CALL TRANSACTION 'PC00_M40_REMP' USING bdcdata MESSAGES INTO messtab MODE var.
"UPDATE 'S'
"MODE var.
Endloop.
Endform. -
How can I work lsmw with table control using mm01 appl?
Hi
How can I work lsmw with table control using mm01 appl?
Is it difefrent the way we handle table control in BDC?
Thank YouHi
How can I work lsmw with table control using mm01 appl?
Is it difefrent the way we handle table control in BDC?
Thank You -
Code for va01 bdc table control
hi
i want to CODE FOR bdc table control VA01 (TCODE)
ASAPAwadhesh,
just refer:
Problem in the BDC Table Control for the T.Code VA01
BDC Uploading from flat file to VA01.
BDC For Line Items In Sales Order
dont forget reward.
Amit. -
hi friends,
Could u please tell me what BDC TABLE CONTROLER
in which cases we can use the bdc Table Contorler
Regards
srinu yHi srinu,
<b>Check this link</b>
http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
How to deal with table control / step loop in BDC
<b>Steploop</b> and <b>table contol</b> is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
Demo <b>ABAP code</b> has two purposes:
<b>1.</b> how to determine number of visible lines and how to calculte page number;
(the 'calpage' routine has been modify to meet general purpose usage)
<b>2.</b> using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.
Now I begin to describe the step to implement my method:
(I use transaction 'ME21', screen 121 for sample,
the method using is Call Transation Using..)
<b>Step1:</b> go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.
(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
Now we have : FixedLine = 9
LoopLine = 2(for table control, LoopLine is always equal to 1)
<b>Step2:</b> go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
Now we have: FirstLine = 0
or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
<b>Step3:</b> write a subroutine calcalculating number of pages
(here, the name of actual parameter is the same as formal parameter)
<b>global data:</b> FixedLine type i, " number of fixed line on a certain screen
LoopLine type i, " the number of lines occupied by one steploop item
FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1
Dataline type i, " number of items you will use in BDC, using DESCRIBE to get
pageno type i, " you need to scroll screen how many times.
line type i, " number of lines appears on the screen.
index(2) type N, " the screen index for certain item
begin type i, " from parameter of loop
end type i. " to parameter of loop
*in code sample, the DataTable-linindex stands for the table index number of this line
form calpage using FixedLine type i (see step 1)
LoopLine type i (see step 1)
FirstLine type i (see step 2)
DataLine type i ( this is the item number you will enter in transaction)
changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)
changing line type i.(visible lines one the screen)
data: midd type i,
vline type i, "visible lines
if DataLine eq 0.
Message eXXX.
endif.
vline = ( sy-srows - FixedLine ) div LoopLine.
*for table control, you should compare vline with maximum line of
*table control, then take the small one that is min(vline, maximum)
*here only illustrate step loop
if FirstLine eq 0.
pageno = DataLine div vline.
if pageno eq 0.
pageno = pageno + 1.
endif.
elseif FirstLine eq 1.
pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
midd = ( DataLine - 1 ) mod ( vline - 1).
if midd = 0 and DataLine gt 1.
pageno = pageno - 1.
endif.
endif.
line = vline.
endform.
<b>Step4</b> write a subroutine to calculate the line index for each item.
form calindex using Line type i (visible lines on the screen)
FirstLine type i(see step 2)
LineIndex type i(item index)
changing Index type n. (index on the screen)
if FirstLine = 0.
index = LineIndex mod Line.
if index = '00'.
index = Line.
endif.
elseif FirstLine = 1.
index = LineIndex mod ( Line - 1 ).
if ( index between 1 and 0 ) and LineIndex gt 1.
index = index + Line - 1.
endif.
if Line = 2.
index = index + Line - 1.
endif.
endif.
endform.
<b>Step5</b> write a subroutine to calculate the loop range.
form calrange using Line type i ( visible lines on the screen)
DataLine type i
FirstLine type i
loopindex like sy-index
changing begin type i
end type i.
If FirstLine = 0.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loopindex gt 1.
begin = Line * ( loopindex - 1 ) + 1.
end = Line * loopindex.
if end gt DataLine.
end = DataLine.
endif.
endif.
elseif FirstLine = 1.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loop index gt 1.
begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
end = ( Line - 1 ) * ( loopindex - 1 ) + Line.
if end gt DataLine.
end = DataLine.
endif.
endif.
endif.
endform.
<b>Step6</b> using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
form creat_bdc.
field-symbols: <material>, <quan>, <indicator>.
data: name1(14) value 'EKPO-EMATN(XX)',
name2(14) value 'EKPO-MENGE(XX)',
name3(15) value 'RM06E-SELKZ(XX)'.
assign: name1 to <material>,
name2 to <quan>,
name3 to <indicator>.
do pageno times.
if sy-index gt 1
*insert scroll page ok_code"
endif.
perform calrange using Line DataLine FirstLine sy-index
changing begin end.
loop at DataTable from begin to end.
perform calindex using Line FirstLine DataTable-LineIndex changing Index.
name1+11(2) = Index.
name2+11(2) = Index.
name3+12(2) = Index.
perform bdcfield using <material> DataTable-matnr.
perform bdcfield using <quan> DataTable-menge.
perform bdcfield using <indicator> DataTable-indicator.
endloop.
enddo.
Reward with points if it is helpful
Cheers
Alfred -
Export Data in Table Control to Excel
Hi Folks -
Here is what I thought would be a simple task. I want to use the run-time shortcut menu to export data to excel from a table control, which is an option in the default menu.
The two things I would like to be able to do are:
1) Either the whole table including the headers or
2) Perform a selection of rows during run-time to export to excel
From a prior discussion, it appear that there is a bug in this functionality. When I tried to create my own code to perform the selection programmatically, my table was resized to a thumbnail while running the VI, and the export still not work properly.
http://forums.ni.com/t5/LabVIEW/Export-table-to-excel/m-p/1089007#M481882
Any further thoughts on this are appreciated. I have some workarounds but would like to see this working.
Attachments:
test.vi 8 KBDonRothGE wrote:
Hi Folks -
Here is what I thought would be a simple task. I want to use the run-time shortcut menu to export data to excel from a table control, which is an option in the default menu.
The two things I would like to be able to do are:
1) Either the whole table including the headers or
2) Perform a selection of rows during run-time to export to excel
From a prior discussion, it appear that there is a bug in this functionality. When I tried to create my own code to perform the selection programmatically, my table was resized to a thumbnail while running the VI, and the export still not work properly.
http://forums.ni.com/t5/LabVIEW/Export-table-to-excel/m-p/1089007#M481882
Any further thoughts on this are appreciated. I have some workarounds but would like to see this working.
First, try to save to the oldest version of VI you can so that the most people are able to view your VI.
Not everybody has the latest LabVIEW installed. Strange but true.
Second, I opened your VI and I don't see anything except a While loop and a Stop button with a Table control. No other code.
I have no clue what you are doing with regards to "perform the selection programmatically".
Anyway, I select cells on the Table control using Property Node Selection Size and Property Node Selection Node and the Invoke Node to export the data to Excel, it works for me.
Excel opens up and I see one worksheet which is populated with the values from the Table control.
I have Excel 2010.
However, it looks like you will need to manually save the opened Excel file. -
Retrieving values from table control using DYNP_VALUES_READ
Hi all,
I am trying to retrieve the values from the table control using the FM DYNP_VALUES_READ. I have a situation where user enter values in table control in T.code FB60 in Withholding tab for validation purpose. There i'll have to check based on some entries maintained in SET.
I am unable to get the values when i scroll to the next page in the table control. FM raising an exception invalid_dynprofield.
Expecting reply...You have to populate the dynpfields internal table before calling the function,
data: repid like sy-repid.
dynpfields-fieldname = 'PNAME'.
append dynpfields.
repid = sy-repid.
call function 'DYNP_VALUES_READ'
exporting
dyname = repid
dynumb = sy-dynnr
tables
dynpfields = dynpfields
exceptions
others.
read table dynpfields index 1.
pname = dynpfields-fieldvalue.
Now you will have the field value in pname
Hope this helps
Vinodh Balakrishnan -
How to implement line selectability for a table control using table Wizard?
Hello SDN Community,
I have created a table control using the Table Wizard. I found my exact question in this forum, but unfortunately it had not been andsered. While I cannot paste a screen-print into this plane-text area, here are the steps I followed...
1) SE51
2) Create new screen 0100
3) Click Layout button
4) Clidk Table Control (with Wizard) and draw box on canvas.
5) Step is "Start" - click Continue
6) Step is "Name of Table Control" - provided name
7) Step is "Table Name" - provided name of dictionary table (AUFK)
8) Step is "Definition of Columns" - selected order numver and order text
9) Step is "Table Control Attributes" - Line Selectability is in display mode - cannot set it.
I would like to have a selectability column for my table. Would appreciate any insight into how to do this.
Thank you,
Dean Atteberry.This is a puzzling...
For the table control wizard, in the Table Control Attributes step, I was able to get line selectability to open up by declaring a char01 data element at the beginning of my type.
The puzzling is in regards to the "Selection col. fld" entry field.
If I leave it blank and try to go to the next step, I get message "Enter the name of the selection column if you are using a program table"
So it looked like it wanted to know the name of my selection column. So I type in "CHAR1". and got the message "The field "CHAR1" for the selection column is already contained in the table."
Hmmmmm.... don't understand............
Dean Atteberry. -
Download internal table data into excel sheet with column heading and data
Hi,
I am having one internal table with column headings and other table with data.
i want to download the data with these tables into an excel sheet.
It should ask the user for file name to save it on their own name. They should give the file name in runtime and it should be downloaded into an excel sheet.
Can anyone tell what is the right function module for downloading these two internal table data with column heading and data.
what we have to do for storing the file name in runtime.
Can anyone help me on this.
Thanks,
Rose.Hi Camila,
Try this
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = PATH2
FILETYPE = 'XLS'
TABLES
DATA_TAB = IT_DATA
FIELDNAMES = IT_HEADINGS
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
Maybe you are looking for
-
Importing fcpx project back into fcpx and having trouble
Please Help Me. So I shared a project from Final Cut Pro X to my desktop so that it was the "Title" - Mac and PC.mp4 file. Then I put the project and all the event files onto an external hard drive and deleted the project and the event files from my
-
JPopupMenu in one frame is not closing while clicking on the another frame
Hi friends, I have a web application which is manily applet oriented. I have two frames in the page on which i have loaded separate applets. One on the left side an the other on the right side. I have implemented a popup using JPopUpMenu in the left
-
Collection or Report query for IE versions
Hi I'm looking for a way to create a collection and also a report which consists of IE versions. Many of the queries available with forums are showing old versions as well the new versions and it's duplicating the system names. Client systems are run
-
I know that SSP5 is tightly integrated with Oracle Purchasing, but can it run as a stand alone product? If so, does it come with its own supplier catalog, or does it provide "hooks" to 3rd party catalog systems? Thank you, Russ Rubis
-
Hi, I've been having an issue with allocating and freeing memory in an application I'm developing. Read Thread 1. "GlobalAlloc" a block of memory. 2. Read data from a high speed optical card into the allocated memory. 3. Pass the pointer to the memor