BDC XL sheet
If we want to upload the data from XL-sheet and DOwnload to XL-sheet ,what are the function modules we can use?
For upload data from xl use the refer the following code.
data: begin of excel_tab occurs 0.
include structure alsmex_tabline.
data: end of excel_tab .
data: begin of itab occurs 0,
bldat like bkpf-bldat,
blart like bkpf-blart,
bukrs like bkpf-bukrs,
budat like bkpf-budat,
waers like bkpf-waers,
bschl like bseg-bschl,
hkont like bseg-hkont,
sgtxt like bseg-sgtxt,
end of itab.
data: process_tab_struct_tmp like itab.
field-symbols: <fs1>.
selection-screen: begin of block blk.
parameters: fname type rlgrap-filename.
selection-screen: end of block blk.
at selection-screen on value-request for fname.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = 'ZFI_EXCEL'
DYNPRO_NUMBER = '1000'
FIELD_NAME = 'FNAME'
IMPORTING
FILE_NAME = FNAME.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = FNAME
i_begin_col = 1
i_begin_row = 1
i_end_col = 24
i_end_row = 60000
tables
intern = EXCEL_TAB
LOOP AT EXCEL_TAB.
assign component excel_tab-col of structure
process_tab_struct_tmp to <fs1>.
<fs1> = excel_tab-value.
at end of row.
move-corresponding: process_tab_struct_tmp to itab. Move values to itab
append itab.
endat.
ENDLOOP.
LOOP AT ITAB.
WRITE:/2 ITAB-BLDAT,14(8) ITAB-BLART,20(10) ITAB-BUDAT.
ENDLOOP.
For download Use GUI_DOWNLOAD
Similar Messages
-
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 AMafter 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. -
Uploading data from excel sheets through BDC's into sap system
hi guys,
can you please help me with this. As we use gui_upload to upload data from flat file to sap system, which function module you use to upload data from Excel sheet to sap system through bdc'shello pavan,
welcome to SDN
check the below program
REPORT ZEXCEL_TO_INTERNAL .
data: begin of itab occurs 0,
name(20) type c,
addre(20) type c,
end of itab.
DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA : B1 TYPE I VALUE 1,
C1 TYPE I VALUE 1,
B2 TYPE I VALUE 100,
C2 TYPE I VALUE 9999.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME =
'C:\Documents and Settings\administrator\Desktop\ppcon001bd_24.xls'
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = itab1
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at itab1.
write:/ itab1.
Endlop.
Regards,
Naveen -
How to upload datas in excel sheet through BDC
Hi,
I know how to upload datas in Text format through BDC...Suppose even when datas are in .xls format,I saved that file as Text(tab delimited) format...then file become text format and it can be easily uploaded....
So, I want to know How to upload datas in excel sheet through BDChi,
try this Example, hope useful to u, assign me point.
report ZMSV1_BDC_CALL
no standard page heading line-size 255.
*include bdcrecx1.
*parameters: dataset(132) lower case.
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 ***
data: begin of record,
data element: BUKRS
BUKRS_001(004),
data element: KTOKK
KTOKK_002(004),
data element: NAME1_GP
NAME1_003(035),
data element: SORTL
SORTL_004(010),
data element: ORT01_GP
ORT01_005(035),
data element: LAND1_GP
LAND1_006(003),
data element: SPRAS
SPRAS_007(002),
data element: BANKS
BANKS_01_008(003),
data element: BANKK
BANKL_01_009(015),
data element: BANKN
BANKN_01_010(018),
end of record.
End generated data section ***
data: itab like record occurs 0 .
data: it_bdc type bdcdata occurs 0 with header line.
data: it_msg type bdcmsgcoll occurs 0 with header line.
parameter p_file type rlgrap-filename default 'c:\vendor.txt' obligatory
start-of-selection.
perform open_dataset using p_file.
perform open_group.
*perform close_group.
*perform close_dataset using dataset.
*& Form open_dataset
text
-->P_P_FILE text
form open_dataset using p_p_file.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = p_file
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " open_dataset
*& Form open_group
text
--> p1 text
<-- p2 text
form open_group .
loop at itab into record.
perform bdc_dynpro using 'SAPMF02K' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-BUKRS'
record-BUKRS_001.
perform bdc_field using 'RF02K-KTOKK'
record-KTOKK_002.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-ORT01'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
record-NAME1_003.
perform bdc_field using 'LFA1-SORTL'
record-SORTL_004.
perform bdc_field using 'LFA1-ORT01'
record-ORT01_005.
perform bdc_field using 'LFA1-LAND1'
record-LAND1_006.
perform bdc_field using 'LFA1-SPRAS'
record-SPRAS_007.
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(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'LFBK-BANKS(01)'
record-BANKS_01_008.
perform bdc_field using 'LFBK-BANKL(01)'
record-BANKL_01_009.
perform bdc_field using 'LFBK-BANKN(01)'
record-BANKN_01_010.
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-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
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 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
call transaction 'FK01' using it_bdc mode 'A' update 'S'
messages into it_msg.
write:/ sy-subrc.
perform message_formatwrite.
refresh it_bdc.
clear it_bdc.
endloop.
endform. " open_group
*& Form message_formatwrite
text
--> p1 text
<-- p2 text
form message_formatwrite .
data:l_msg(10).
loop at it_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = sy-langu
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = l_msg
EXCEPTIONS
NOT_FOUND = 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.
endloop.
endform. " message_formatwrite
*& Form bdc_dynpro
text
-->P_0112 text
-->P_0113 text
form bdc_dynpro using value(p_0112)
value(p_0113).
it_bdc-program = p_0112.
it_bdc-dynpro = p_0113.
it_bdc-dynbegin = 'X'.
append it_bdc.
clear it_bdc.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0117 text
-->P_0118 text
form bdc_field using value(p_0117)
value(p_0118).
it_bdc-fnam = p_0117.
it_bdc-fval = p_0118.
append it_bdc.
clear it_bdc.
endform. " bdc_field
Regards
fareedas -
Upload data in excel sheet through BDC
Dear all,
How do we upload data in excel sheet through BDC?
Thanks in advance.
Regards,
Sandra.Hi,
The sample code is as given below:
REPORT upload_supply_area.
*include for dispaying icons in error log
INCLUDE <icon>.
*Declaration of structure.
TYPES:BEGIN OF x_struct,
werks TYPE v_pvbe-werks, "Plant
prvbe TYPE v_pvbe-prvbe, "Supply Area
pvbtx TYPE v_pvbe-pvbtx, "Production supply area description
lgort TYPE v_pvbe-lgort, "Storage Location
rgver TYPE v_pvbe-rgver, "Person responsible for one or more supply areas
END OF x_struct.
TYPES:BEGIN OF x_messages,
msgtyp(1) type c,
werks TYPE v_pvbe-werks, "Plant
prvbe TYPE v_pvbe-prvbe, "Supply Area
message(120) type c,
END OF x_messages.
DATA: it_messages TYPE STANDARD TABLE OF x_messages .
DATA: wa_messages TYPE x_messages.
DATA:it_msgtab TYPE STANDARD TABLE OF bdcmsgcoll,
wa_msgtab TYPE bdcmsgcoll.
*internal table for BDC
DATA: it_bdcdata TYPE STANDARD TABLE OF bdcdata.
DATA: wa_bdcdata TYPE bdcdata.
DATA:it_file TYPE STANDARD TABLE OF x_struct. "internal table which has same structure as file
DATA:wa_file TYPE x_struct. "work area which has same structure as file
DATA: it_excel TYPE STANDARD TABLE OF alsmex_tabline,
wa_excel TYPE alsmex_tabline.
DATA: x_ctuprms TYPE ctu_params.
DATA:nodata TYPE c VALUE '/'.
data:con(50) type c.
data:con1(50) type c.
*selection screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*Enter file name on presentation server
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*Function which enables the user to browse the files on hard disk
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
static = 'X'
CHANGING
file_name = p_file
EXCEPTIONS
mask_too_long = 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.
START-OF-SELECTION.
*Subroutine to upload excel file and read it
PERFORM upload.
*Subroutine to upload supply area data
PERFORM fill.
*& Form bdc_dynpro
Fill the BDC table
FORM bdc_dynpro USING program dynpro. "#EC *
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form bdc_field
Fill the BDC table
FORM bdc_field USING fnam fval. "#EC *
IF fval <> nodata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO it_bdcdata. "#EC
ENDIF.
ENDFORM. "BDC_FIELD
*& Form collect_messages
Collect the messages from transaction
FORM collect_messages . "#EC *
DATA: w_msg(100).
LOOP AT it_msgtab INTO wa_msgtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_msgtab-msgid
lang = wa_msgtab-msgspra
no = wa_msgtab-msgnr
v1 = wa_msgtab-msgv1
v2 = wa_msgtab-msgv2
IMPORTING
msg = w_msg
EXCEPTIONS
not_found = 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.
CONDENSE w_msg.
CLEAR wa_messages.
wa_messages-msgtyp = wa_msgtab-msgtyp.
wa_messages-message = w_msg.
wa_messages-werks = wa_file-werks.
wa_messages-prvbe = wa_file-prvbe.
if wa_messages-message eq 'Formatting error in the field V_PVBE-RGVER; see next message'.
wa_messages-message = 'Invalid name of the person responsible'.
endif.
if wa_messages-message eq 'Formatting error in the field V_PVBE-LGORT; see next message'.
wa_messages-message = 'Enter the storage location'.
endif.
APPEND wa_messages TO it_messages .
ENDLOOP.
REFRESH it_msgtab.
ENDFORM. "collect_messages
*& Form write_messages
Display the messages
FORM write_messages .
DELETE ADJACENT DUPLICATES FROM it_messages COMPARING werks prvbe.
LOOP AT it_messages INTO wa_messages .
WRITE:/1 sy-vline.
IF wa_messages-msgtyp = 'S'.
WRITE: 10 icon_green_light.
ELSEIF wa_messages-msgtyp = 'E'.
WRITE: 10 icon_red_light.
ELSEIF wa_messages-msgtyp = 'W'.
WRITE: 10 icon_yellow_light.
ENDIF.
WRITE: 20 sy-vline.
WRITE : 30 'Plant-', wa_messages-werks . "#EC NOTEXT
WRITE: 48 sy-vline.
WRITE : 49 'Supply Area-', wa_messages-prvbe . "#EC NOTEXT
WRITE: 79 sy-vline.
WRITE : 80 wa_messages-message .
WRITE: 180 sy-vline.
WRITE:/1 sy-vline.
ULINE 1(180).
ENDLOOP.
ENDFORM. " write_m
*& Form fill_params
Processing mode for the transaction
FORM fill_params .
x_ctuprms-dismode = 'N'.
x_ctuprms-updmode = 'A'.
x_ctuprms-defsize = 'X'.
ENDFORM. "fill_params
*& Form upload
Upload the excel file and read the data
FORM upload .
*Function to upload excel file
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 5
i_end_row = 9999
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR wa_file.
*Read the file row-wise
LOOP AT it_excel INTO wa_excel.
CASE wa_excel-col .
*Read plant
WHEN '1'.
wa_file-werks = wa_excel-value.
*Read supply area
WHEN '2'.
wa_file-prvbe = wa_excel-value.
*Read decription
WHEN '3'.
wa_file-pvbtx = wa_excel-value.
*Read storage location
WHEN '4'.
wa_file-lgort = wa_excel-value.
*Read Person responsible
WHEN '5'.
IF STRLEN( wa_excel-value ) = 1.
CONCATENATE '00' wa_excel-value INTO con.
wa_file-rgver = con.
ELSEIF STRLEN( wa_excel-value ) = 2.
CONCATENATE '0' wa_excel-value INTO con1.
wa_file-rgver = con1.
ELSE.
wa_file-rgver = wa_excel-value.
ENDIF.
ENDCASE.
AT END OF row.
CONDENSE:wa_file-werks,wa_file-prvbe,wa_file-pvbtx,wa_file-lgort,wa_file-rgver.
APPEND wa_file TO it_file.
CLEAR wa_file.
ENDAT .
ENDLOOP.
ENDFORM. " upload
*& Form fill
Call the transaction 'PK05'
FORM fill .
*Upload the data through transaction 'PK05'
PERFORM fill_params.
LOOP AT it_file INTO wa_file.
PERFORM bdc_dynpro USING 'SAPLSVIX' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'D0100_FIELD_TAB-LOWER_LIMIT(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=OKAY'.
PERFORM bdc_dynpro USING 'SAPL0PK1' '0020'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_PVBE-PVBTX(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEWL'.
PERFORM bdc_dynpro USING 'SAPL0PK1' '0021'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_PVBE-RGVER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'V_PVBE-WERKS'
wa_file-werks.
PERFORM bdc_field USING 'V_PVBE-PRVBE'
wa_file-prvbe.
PERFORM bdc_field USING 'V_PVBE-PVBTX'
wa_file-pvbtx.
PERFORM bdc_field USING 'V_PVBE-LGORT'
wa_file-lgort.
PERFORM bdc_field USING 'V_PVBE-RGVER'
wa_file-rgver.
PERFORM bdc_dynpro USING 'SAPL0PK1' '0021'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_PVBE-WERKS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'V_PVBE-WERKS'
wa_file-werks.
PERFORM bdc_field USING 'V_PVBE-PRVBE'
wa_file-prvbe.
PERFORM bdc_field USING 'V_PVBE-PVBTX'
wa_file-pvbtx.
PERFORM bdc_field USING 'V_PVBE-LGORT'
wa_file-lgort.
PERFORM bdc_field USING 'V_PVBE-RGVER'
wa_file-rgver.
CALL TRANSACTION 'PK05'
USING it_bdcdata
OPTIONS FROM x_ctuprms
MESSAGES INTO it_msgtab.
REFRESH it_bdcdata.
PERFORM collect_messages.
CLEAR wa_file.
ENDLOOP.
PERFORM write_messages.
ENDFORM. " fill -
BDC for Uploading data from XL sheet with unknown order of fields
Hi SAP Gurus,
My requirement is as follows,
A BDC is to be developed for uploading data from an XL sheet, but the problem here is , the order of fileds in the sheet can be changed .
ie, for example the fields in the XL sheet are :-
matnr maktx menge amount
but the user can give as
matnr amount menge maktx
or
maktx matnr amount menge
how i can solve this problem.
Thanks and Regards,
pavan.Hi Pavan,
You need to handle it by your self, you can create a dynamic table based on the file value.
The field name pass from file with the record as a header, and based on the header name create your dynamic table.
afterward you can pass your value to BDC.
for creating dynamic table you can use this method
call method cl_alv_table_create=>create_dynamic_table
exporting
i_style_table =
it_fieldcatalog = it_field[]
i_length_in_byte =
importing
ep_table = dyn_tab
e_style_fname =
exceptions
generate_subpool_dir_full = 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.
-Dhirendra -
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. -
Hi Abapers,
I had doubt regarding uploading excel sheet using BDC.
I dont know how to upload excel sheet,after executing the BDC program in a go, i.e.. after executing the program i have to press ENTER for each & every record to upload(this s the way i know).
I dont know how to upload directly, without pressing ENTER for every record.
I m getting error while saving in xls format.Give me an idea, in which format i want to save the flatfile for uploading in BDC.
So, clarify me about this doubt....Hi BDK,
Try this Function Module to get from excel to internal table,
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = ','
i_line_header = p_head
i_tab_raw_data = it_raw
i_filename = p_upl
TABLES
i_tab_converted_data = t_indata
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
if you are using call transaction then select the Processing Mode as N.it will upload in one go. -
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. -
Upload data from excel sheet into md61
Hi Gurus,
Can anybody please tell me the solution like how to upload the data from excel sheet into the MD61
if u suggest me to write an ABAP code then its fine or any other way would be great
and can u also send me the abap code i would be thankful to allHi,
I can be done in 2 ways.
1. Using LSMW you can upload your MD61 demand thru Excel sheet.
2. You can use BDC to upload the demand from Excel. For this you need to take help from the ABAP. You need to record the macro usinf SHDB and the table maintenance will be taken care by the developer.
For LSMW you need not depend on your developer, as a functional consultant you can do it yourself.
Regards,
V. Suresh -
BDC Call Transaction : FS00(Create G/L Account)
Hi,
BDC of FS00 is running properly in Forground (A) Mode, with success messages and G/L account being created in SKB1 table.
But when I run it in Background (N) Mode, it is not creating the G/L account. Although I am getting the success messages in the end of the execution but in the table, there is no G/L account.
FORM fill_bdcdata .
loop at i_output.
clear i_bdcdata.
refresh i_bdcdata.
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'=ACC_CRE'.
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_KEY-BUKRS'.
perform bdc_field using 'GLACCOUNT_SCREEN_KEY-SAKNR'
i_output-SAKNR. "gl ac number
perform bdc_field using 'GLACCOUNT_SCREEN_KEY-BUKRS'
i_output-BUKRS. "company code
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'=2102_GROUP'.
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_COA-KTOKS'. "ac grp
*perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'
i_output-cc.
perform bdc_field using 'GLACCOUNT_SCREEN_COA-XPLACCT'
i_output-xplacct. "pl account
perform bdc_field using 'GLACCOUNT_SCREEN_COA-XBILK'
i_output-xbilk. "balance sheet
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'=TAB02'.
perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'
i_output-ktoks. "ac grp
perform bdc_field using 'GLACCOUNT_SCREEN_COA-XPLACCT'
i_output-xplacct. "pl account
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_COA-TXT50_ML'.
perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT20_ML'
i_output-txt20_ml. "short text
perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT50_ML'
i_output-txt50_ml. "long text
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'=TAB03'.
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_CCODE-MITKZ'.
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XSALH'
i_output-xsalh. "Only Balance in Local Currency
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MWSKZ'
i_output-mwskz. "Tax Category
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XMWNO'
i_output-xmwno. "Posting without tax
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MITKZ'
i_output-mitkz. "Reccon A/C
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_CCODE-ZUAWA'.
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XOPVW'
i_output-xopvw. "Open Item Management
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XKRES'
i_output-xkres. "Line Item Display
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'
i_output-zuawa. "Sort Key
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'=ENTER'.
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-FSTAG'
i_output-fstag. "Field Stauts
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XINTB'
i_output-xintb. "post automatically
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_CCODE-XGKON'.
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XGKON'
i_output-xgkon. "relevent to cash A/c
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_CCODE-ZUAWA'.
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_CCODE-FSTAG'.
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-FSTAG'
i_output-fstag. "Field Stauts
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XINTB'
i_output-xintb. "post automatically
perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XGKON'
i_output-xgkon. "relevent to cash A/c
perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field using 'BDC_OKCODE'
'/EEXIT'.
perform bdc_field using 'BDC_CURSOR'
'GLACCOUNT_SCREEN_CCODE-XGKON'.
perform bdc_dynpro using 'SAPLSPO1' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform f_elog.
endloop.
FORM f_elog .
data len type i.
clear i_msgtab.
call transaction 'FS00'
using i_bdcdata
mode g_v_mode "N
messages into i_msgtab
update g_v_update . "S
write: i_output-saknr.
I am not getting where I am going wrong in the code.
Regards,
Priyanka.Hi,
Make the mode 'E' and see excatly, where the warning or errors or coming.
If you are having an currency or UOM ,related fields, see that the values should not be empty. If they are enpty. Put an if condition there and Quit filling such fields.
First keep in mode 'e' and debug. 100% you will see the warnings or errors, then tell me what is the error.
<b>call transaction 'FS00'
using i_bdcdata
mode g_v_mode "E
messages into i_msgtab</b>
Thansk'
Manju. -
Dear Friends,
We are suppose to go likve soon, but we have @ 500 open Purchase orders and we would like to ipload same in sap as retail can any 1 guide me how to do it?
Regrads,
Vishal
[email protected]Hi Vishal,
Please make a note that,
LSMW is used to transfer Master Data.
BDC is used for transactional Data.
LSMW can import data from legacy systems (e.g. in the form of Excel sheets or CSV files). For this, I guess, LSMW converts your data into batch input files automatically. If you use BDC, on the other hand, you have to write your batch input file yourself, line per line.
So, Open Purchase Order are the Transactional Data for you can use BDC for this Purpose
Please take your ABAPER's help to will write a Code to Migrate the Data.
Hope this Solve your Purpose and Please Reward If Really Helpful,
Thanks and Regards,
Sateesh.Kandula -
Handling a warning message in BDC through RFC
Hi all,
I have a requirement where I have to do a CALL TRANSACTION using a RFC Fn. Module.
This is for sending time sheet data to CATSDB thru CAT2 (T-code). In the process of time entry I have to go through a warning message (time entry for saturday & sunday ) and save the time sheet. I have recorded all this thru SHDB and created the BDC. The FM works fine in the back end. It is also fine when this RFC is called in the front end from a portal, except for the warning message part. The FM errors out when called thru portal for uploading data for saturday or sunday.
There seems to be no problem when I call this function module in the backend using a custom program and try to save time for saturday and sunday. I have tried various options and founnd that the RFC is failing only when called for saturday and sunday. Somehow the BDC part where the warning message is handled is causing the error.
One of my colleague said, the backend is trying to return a dialog box/screen (warning message pop up) to the fucntion module which is not being accomodated or something of that sort????
Is this true??? So does this mean I cannot do it the way I am trying to.
Any suggestions and thoughts on why this is happening. Am I missing something here???
Any kind of input is highly appreciated.
Thanks
M
Edited by: Mark Mark on Aug 26, 2008 5:45 AM
Edited by: Mark Mark on Aug 26, 2008 6:07 AMHi Anees, Thanks for your suggestion.
I was probably not very clear in stating my problem. I do not have to display the error or warning message.
During time entry,when I click SAVE button, I get a warning message, to get through this message I have to hit ENTER again (now the time sheet is saved). All this I have recorded in SHDB and used in the BDC.
Now my problem is this BDC for saturday & sunday (the warning message comes up for these days) does not work when the RFC is called from the portal, whereas the time sheet is saved without any errors when I try to call this from the back end.
Also the RFC works fine for the rest of the days both in the back end and also when called from the portal.
I hope I am clear.....
Any suggestions
Thanks
M -
How can i take an excel sheet record as input into my report
Hi
I am having one object.I need to develop code for this.I can take excel sheet record as input.I thought it is some kind of BDC.But my TL told me that it is an enhancement.How can I start this object.
1.If it is a BDC : I am very new to BDC.I need total description how to start and populate.
2.If it is an enhancement : How can I take excel sheet record to input in to my object.
Thanks & Regards,
Aruna.It seems neither BDC nor Enhancement.
See it could be some awkward process but definately would be Handy.
First create one dummy program in that code you just Take Excel data by simple Upload FM for Excel,Than from this program Use Submit <report> via selection screen.
Here <report> is your actual program.so you may need simultaneously control two program.
But my TL told me
...But what is TL stands for?
TL True Love
TL Total Loss
TL Turn Left
TL Team Liquid ??
Cheers,
Amit. -
How can we know the return code of BDC Program ?
Hi All,
Please tell me : How can we know the return code of BDC Program when being exceuted in Session or in Transaction mode.
In my program, we are uploading data from Excel sheet to SAP via BDC
The records that are not updated we want to create a log file.
Now to know whether a record is updated ot not, wat syst field shloud be used?
Its urgent....
<b>Reward Point will be there ....</b>
Thanks,
HarishHi harish,
try the logic in this code ...
i had attached input file in the end.
TYPES: begin of errmess,
msgnr type t100-msgnr,
text type t100-text,
end of errmess.
TABLES : t100.
DATA: BEGIN OF DD_VA01,
AUART TYPE VBAK-AUART,
KUNNR TYPE RV45A-KUNNR,
BSTKD TYPE VBKD-BSTKD,
MABNR TYPE RV45A-MABNR,
KWMENG(2) type C,
KBETR(2) type C,
END OF DD_VA01.
DATA:IT_VA01 Like TABLE OF DD_VA01,
WA_VA01 Like LINE OF IT_VA01,
WA_VA01_F Like LINE OF IT_VA01,
IT_BDCDATA TYPE TABLE OF BDCDATA,
WA_BDCDATA Like Line OF IT_BDCDATA,
W_FNAME TYPE STRING,
messtab like bdcmsgcoll occurs 0 with header line,
it_errmess type table of errmess,
wa_errmess like line of it_errmess,
err_message type string.
data: zf1 type i,
zc1 type c value '2',
fn(20) type c.
Main Code ************************************************************
PERFORM get_input using 'C:\Documents and Settings\ic881592\Desktop\Daran_bdc_VA01-e.txt'.
SORT IT_VA01 BY AUART KUNNR BSTKD.
LOOP AT IT_VA01 INTO WA_VA01.
if WA_VA01_F-AUART <> WA_VA01-AUART OR
WA_VA01_F-KUNNR <> WA_VA01-KUNNR OR
WA_VA01_F-BSTKD <> WA_VA01-BSTKD.
PERFORM set_header_flag.
PERFORM create_bdc_header_data.
endif.
PERFORM create_bdc_item_data.
ENDLOOP.
PERFORM call_transaction.
PERFORM errorlog.
Procedures ***********************************************************
form get_input using w_fname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = W_FNAME
HAS_FIELD_SEPARATOR = '#'
TABLES
DATA_TAB = IT_VA01.
endform.
form call_transaction.
PERFORM bdc_field using 'BDC_OKCODE' '/11'.
CALL TRANSACTION 'VA01' USING IT_BDCDATA MODE 'A' messages into messtab.
refresh it_bdcdata.
endform.
FORM set_header_flag.
WA_VA01_F-AUART = WA_VA01-AUART.
WA_VA01_F-KUNNR = WA_VA01-KUNNR.
WA_VA01_F-BSTKD = WA_VA01-BSTKD.
if zf1 = 1.
PERFORM call_transaction.
endif.
zf1 = 1.
endform. "set_header_flag.
form create_bdc_header_data.
perform bdc_dynpro using 'SAPMV45A' '0101'.
perform bdc_field using 'VBAK-AUART' WA_VA01-AUART.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'KUAGV-KUNNR' WA_VA01-KUNNR.
perform bdc_field using 'VBKD-BSTKD' WA_VA01-BSTKD.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_CURSOR' '04/06'.
perform bdc_field using 'BDC_OKCODE' '=CHOO'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.
endform. "create_bdcdata
FORM create_bdc_item_data.
CONCATENATE 'RV45A-KWMENG(' zc1 ')' INTO FN.
perform bdc_field using 'BDC_CURSOR' FN.
perform bdc_field using FN WA_VA01-KWMENG.
CONCATENATE 'KOMV-KBETR(' zc1 ')' INTO FN.
perform bdc_field using FN WA_VA01-KBETR.
CONCATENATE 'RV45A-MABNR(' zc1 ')' INTO FN.
perform bdc_field using FN WA_VA01-MABNR.
perform bdc_dynpro using 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.
ENDFORM.
form errorlog.
LOOP AT MESSTAB .
if MESSTAB-MSGNR = '311' or MESSTAB-MSGTYP = 'E'.
SELECT SINGLE msgnr text FROM T100
into wa_errmess
WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
err_message = wa_errmess-TEXT.
IF err_message CS '&1'.
REPLACE '&1' WITH MESSTAB-MSGV1 INTO err_message.
REPLACE '&2' WITH MESSTAB-MSGV2 INTO err_message.
REPLACE '&3' WITH MESSTAB-MSGV3 INTO err_message.
REPLACE '&4' WITH MESSTAB-MSGV4 INTO err_message.
ELSE.
REPLACE '&' WITH MESSTAB-MSGV1 INTO err_message.
REPLACE '&' WITH MESSTAB-MSGV2 INTO err_message.
REPLACE '&' WITH MESSTAB-MSGV3 INTO err_message.
REPLACE '&' WITH MESSTAB-MSGV4 INTO err_message.
ENDIF.
CONDENSE err_message.
WRITE: / MESSTAB-MSGTYP, err_message .
ELSE.
WRITE: / MESSTAB.
ENDIF.
endif.
ENDLOOP.
endform. "errorlog
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
ENDFORM.
input file :
OR 2148 0001235 R-1162 8 17
OR 2148 0001235 R-1161 2 30
OR 2148 0001235 100-400 6 25
OR 2148 0001235 R-1162 4 12
OR 2148 0001236 R-1162 3 12
OR 2148 0001236 R-1161 2 30
OR 2148 0001236 100-400 1 25
OR 2148 0001236 R-1162 7 12
OR 2148 0001236 R-1161 8 30
OR 2148 0001236 100-400 10 25
OR 2148 0001235 R-1161 5 30
OR 2148 0001235 100-400 2 25
OR 2148 0001235 R-11621 3 12
OR 2148 0001235 R-1161 2 30
OR 2148 0001235 100-400 1 25
OR 2148 0001235 R-1162 7 12
OR 2148 0001235 R-1161 8 30
OR 2148 0001235 100-400 10 25
OR 2148 0001236 R-1162 8 17
OR 2148 0001236 R-1161 2 30
OR 2148 0001236 100-400 6 25
OR 2148 0001236 R-1162 4 12
OR 2148 0001236 R-1161 5 30
OR 2148 0001236 100-400 2 25
Maybe you are looking for
-
Setting up my msn account with mail
i'm a new mac user and i read posts to set up my msn account on mail. but it keps asking for my password and will not sign me on for mail. i don't know what i'm doing wrong can someone help me? my searches are bringing me in circles
-
Behavior of ENTER arbitrarily changes in my JTable
The setup: basic, non-exotic JTable in a 1.6.0_02 application running on Red Hat Enterprise 3. Normal behavior: hitting enter causes the table to select the next cell row. My behavior: randomly, I've been noticing that hitting enter causes the cell t
-
In file to idoc scenario we define metadata in IDX2,but in idoc to file scenario is it require to import metadata into xi, if yes where in xi we import it?
-
SCSI Tape Drive 599-2081-01: What tapes?
I can find no documentation whatsoever on sun.com for the SCSI Tape Drive 599-2081-01. I'm thinking of buying this tape drive from a friend, but he doesn't know what tapes will work on it. Will Exabyte 8mm 112metre tapes work, for instance? I already
-
How to make sound optional in flash?
I need to edit this flash design. I have not done flash in a very long time and have no clue what to do so I need a simple and step by step explanation. Currently, the flash design starts off with sound and there is an option on the bottom right corn