Flat file to upload data using BDC for transaction MM01
Hi
I am trying to update data using bdc code has been attached below using a txt file.
It is updating the first set of data into the table mara ,but for the rest it is not
All the data from txt file has being loaded to internal table , but the problem is it does not gets updated from internal table to the database .
Only the first set of data has been loaded ,<u><b> rest of the data is not loaded</b></u>
<u><b>content of txt file</b></u>
zsc zsc kg
zsv zsv kg
zsb zsb kg
<u><b>Actual code</b></u>
report ZMAT_UPLOAD
no standard page heading line-size 255.
types declaration..........................................................................
types : begin of t_mat,
matnr(20),
desc(50),
uom(5),
end of t_mat.
internal table and workarea declaration.......................................
data : i_mat type table of t_mat.
data : wa_mat type t_mat.
include bdcrecx1.
start-of-selection.
moving the flat file content to internal table................................
CALL FUNCTION 'UPLOAD'
EXPORTING
FILETYPE = 'DAT'
TABLES
data_tab = i_mat.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform open_group.
loop at i_mat into wa_mat.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
wa_mat-matnr.
perform bdc_field using 'RMMG1-MBRSH'
'P'.
perform bdc_field using 'RMMG1-MTART'
'ZOH'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
wa_mat-desc.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
wa_mat-uom.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_transaction using 'MM01'.
endloop.
Perform close_group.
Hi Sumant,
just concentrate on bold one
report ZMAT_UPLOAD
no standard page heading line-size 255.
types declaration..........................................................................
<b>
data : begin of t_mat occurs 0,
matnr(20),
desc(50),
uom(5),
end of t_mat.</b>
internal table and workarea declaration.......................................
<b>*data : i_mat type table of t_mat.
*data : wa_mat type t_mat.</b>
include bdcrecx1.
start-of-selection.
moving the flat file content to internal table................................
CALL FUNCTION 'UPLOAD'
EXPORTING
FILETYPE = 'DAT'
TABLES
<b>data_tab = i_mat.---> t_mat.</b>
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform open_group.
<b>loop at i_mat into wa_mat.------>loop at t_mat.</b>
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
<b>wa_mat-matnr.---->t_mat-matnr(change in this for ur wa to t_mat.</b>
perform bdc_field using 'RMMG1-MBRSH'
'P'.
perform bdc_field using 'RMMG1-MTART'
'ZOH'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
wa_mat-desc.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
wa_mat-uom.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_transaction using 'MM01'.
endloop.
Perform close_group.
Reward points for helpful answers.
Thanks
Naveen khan
Message was edited by:
Pattan Naveen
Message was edited by:
Pattan Naveen
Similar Messages
-
UPload data useing BDC for cost element allocation
Hi ALL,
i have to upload data useing BDC , have to upload data for cost centre accloction table ,What is the T.code and how to do it, i have knows LSMW,
very useful for me
Advance Thanks
NarraUsing BDC means...use theTCODE: SHDB + ABAPer help, it requires program need to create for this....you can have options in BDC is...u can test the data validity before you upload the data
VVR -
Is it possible upload data using BDC for creation of Quotation
Dear All ,
Scenario is such that details in teh quotaion is entered in three steps by three departments, weh ave planned that all three departments would work on single excel sheet enter the details over there and when it is ready we will create quotaion by uploading it through BDC,
First of all is it possible to upload the data in quotaion through BDC , Kindly suggest
Regards
SunainaHi Sunaina,
Yes its possible to load the data through BDC.
But I would suggest to go for BAPI instead of BDC.
BAPI_QUOTATION_CREATEFROMDATA Or BAPI_SALESDOCU_CREATEFROMDATA can be used to create a quotation .
Regs.
Sai -
Can anyone list problems/errors when uploading data using BDC's and BAPI's?
Can anyone list the problems/errors when uploading data using BDC's and BAPI's?
Hi,
If you are actually creating a BDC to load data pls be more specific.
Data format incorrect. Tab delimited/ etc
Dates in wrong formats
Currency incorrect formats
Missing screens
Wrong transaction code
File not found,
Missing Mandatory fields,
Screen resoultion.
You should always use refresh for your Bdcdata table.
Loop at internal table.
refresh Bdcdata.
regards,
sowjanya. -
Hi Expert,
How to upload data using BDC. I have uploaded using LSMW....now want to know how to upload data using BDCHI
Ask your Abapper.
First you have to record in SHDB. then you have to generate the program and write the code in SE38
For more details please make a search
regards
Prashanth -
Export Table to flat file and upload to FTP server for external vendor
I have done some extensive searches on the forums and I think I have an idea but really need some help. Basically have a table that needs to be exported to a flat file and uploaded to a FTP server so that our vendor can get the data Monday-Saturday and automated by sysdate. This data is used to produce daily letters that go out to customers.
After doing some searching I came across the UTL_FILE package and reading more into this right now but I am not sure if it is what I should be using to create the file.
I am using TOAD right now and can see how to do it manually however really need the file to create itself and send automatically at 6 am Monday - Saturday with the date at the end of the file name making it a unique file for each day.
Thanks in advance for all of your help.As Justin and others have mentioned I wrote [XUTL_FTP|http://www.chrispoole.co.uk/apps/xutlftp.htm] so you wont find it in the Oracle documentation. It's pure PL/SQL and uses UTL_TCP and implements an integrated PL/SQL FTP client / API. One of it's many overloaded procedures FTP's the contents of a refcursor straight to a FTP server of your choice, meaning no intervening file is required. Since it is pure PL/SQL, it is trivial to schedule using DBMS_JOB/DBMS_SCHEDULER.
Any questions just ask.
HTH Chris -
hI SAP Guru's
here i have to upload non-sap data to sap , in the controling how to MAP the fileds and which T.code have use to please guide meDear Purna,
You would first need to identify the transaction for which you want to upload the data. For example KE51 to Create Profit Center. You could use BDC or BAPI methods. You can use LSMW tool as well.
you would need to map SAP fields with the corresponding legacy field. You would prepare a layout for the legacy file and accordingly design BDC.
Steps:
1. Fetch Data (Download/Read Dataset/Select from Tables)
3. Massage data as per SAP format.
3. Validation Check
4. Pass valid data to BDC (Call Transaction/Session) or BAPI
5. In case of session method - session log is generated. In case of Call transaction you can use an internal table with structure BDCMSGCOLL to get messages. In case of BAPI the messages will be returned in return table (strcutre BAPIRET2/BAPIRETTAB).
Hope this will help.
Regards,
Naveen. -
In RFC how to uploading data using bdc
Hi, Experts
In RFC how to use bdc program for uploading data
any example plz.
my requrement for tcode ME21.
thank you in advance.
with best regards
saiThank u reply
my requirement is in function moudle
( Program will be called from non-sap system with the data in the form of table as per the structure given above. Then the program will do the some validation for the data. If data validated correct, BDC will be run for creating DO
condition is )
ex:
if T_itab KNTTP = K,
Run BDC for transaction ME21.
( in that you should not use upload and ws_upload )
in put paramer is taking value for structure (non- sap ) run the bdc update in sap system.
plz any sample program
regards
sai -
Difference between uploading data using BDC,CATT
Dear experts,
what is the difference between uploading the data using BDC and CATT tool?
is it only the coding or something else.
and can you explain the situations where we prefer to upload the data using CATT tool.
thanks in advance.Check this thread -
Differences between BDC , LSMW, BAPI,CATT
Regards,
Amit -
How we can upload the data through BDC for transaction J1ID
Hi guru
How w can upload the data for Transaction J1ID.In this we want to upload the data for Customer Excise details. I want to upload the data on behalf of Customer (KUNNR) becasue customer is a primary KEY. Table name: J_1IMOCUST
Fields. 11 Fields.plz provide some code logic.
KUNNR J_1IEXCD J_1IEXRN J_1IEXRG J_1IEXDI J_1IEXCO J_1ICSTNO J_1ILSTNO J_1IPANNO J_1IEXCICU J_1ISERNHi,
I dont see any difficulties in doing BDC upload for J1ID, You have to record by giving the New Entries button and then enter all the details of customers using table control technique.
SEARCH SCN for Table Control in BDC
Regards
Karthik D -
Problem during uploading data Using BDC
While I'm trying to upload data for T.Code J1IS using BDC, Value for the field Net.***.value ( J_1IASSVAL-J_1IVALNDP) is not getting populated on the screen.
Pls help.Hi,
This is a Currency Field so you need to pass this to a Char field first and then pass to BDCTAB-FVAL.
" This is a common problem with BDC with other data types even with Date and Quantity and Numeric types
Please note while passing values to BDCTAB all the values should be passed in CHAR form only
Cheerz
Ram. -
How to revert the data that is loaded using BDC for transaction PA30
Hi All,
We had loaded the data in SAP using BDC-Session Unfortunately.
Now we want to delete all the data which is loaded usong these sessions.
Please can anyone know the procedure to do so.(May be using LSMW)
This is the test environment.
This is the HR Data.
Transaction we used is PA30.
Thank you,
Edited by: Kumar B on Sep 16, 2009 6:55 PMSorry All for the late response.
Thanks Swathi ..I thought in same manner.
But we used the LSMW,It deleted the records in the exact fashion we need.
It was a nice experience.
Use T-code SE38 run the report RPUDELPN and pass the pernr entire data will delete. as it is a test client then go to NUMKR Feature reset it and upload the correct data again.
I think that would not have worked for us as it deletes all the employee records.
Might be dangerous too
If it is has standard fast entry screen then use pa70 for mass deletion
Apart from deletion,Also we need to delimit the previous record.
Thank you All -
Light goes off or System crash During Upload data through BDC Call Transaction ..
Hi Experts ,
How do I know how many records had been updated in database while uploading the flat file through BDC call transaction ,the system suddenly crash or light goes off ..............
Thanks and Regards .
Om prakashHi Prakash,
i have already told toy to use bapi to get all the error and success messages, through which you don't need to do all the above stuffs, the first method you have shown is based on algorithm , which might not be correct each time, and the second method is handy.
You can add these code lines in your BDC which will give you all error and success messages
DATA : BEGIN OF options.
INCLUDE STRUCTURE ctu_params.
DATA : END OF options.
DATA: i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
l_message LIKE bapiret2-message.
DATA: p_mode TYPE c.
DATA BEGIN OF it_error OCCURS 1.
DATA : text(100) TYPE c.
DATA END OF it_error.
DATA BEGIN OF it_success OCCURS 1.
DATA: text(100) TYPE c.
DATA END OF it_success.
START-OF-SELECTION.
PERFORM upload_data.
* Report for success
PERFORM success_text.
* Report for Error
PERFORM error_text.
END-OF-SELECTION.
CALL TRANSACTION 'your transaction code' USING bdcdata
OPTIONS FROM options
MESSAGES INTO i_messtab.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
id = sy-msgid
number = sy-msgno
language = sy-langu
textformat = 'ASC'
message_v1 = sy-msgv1
message_v2 = sy-msgv2
message_v3 = sy-msgv3
message_v4 = sy-msgv4
IMPORTING
message = l_message.
CONCATENATE l_message '-' wa_input-newko wa_input-wrbtr wa_input-budat INTO it_error-text
SEPARATED BY ' '.
APPEND it_error.
ELSE.
CONCATENATE 'DATA UPLOADED SUCCESSFULLY :' wa_input-newko wa_input-wrbtr wa_input-budat
INTO it_success-text SEPARATED BY ' '.
APPEND it_success.
ENDIF.
REFRESH bdcdata.
CLEAR: wa_input,l_message.
ENDLOOP.
***ENDLOOP.
endform.
" UPLOAD_DATA
FORM success_text .
LOOP AT it_success.
AT FIRST.
WRITE :/10 'Following records successfully uploaded'.
ULINE.
ENDAT.
WRITE :/10 it_success-text.
ENDLOOP.
ENDFORM.
FORM error_text .
LOOP AT it_error.
AT FIRST.
WRITE :/10 'Following records are not uploaded'.
ULINE.
ENDAT.
WRITE :/10 it_error-text.
ENDLOOP.
ENDFORM. -
Different screens shown when using BDC for Transaction XK03
Hello Forum,
Please provide a soultion for the below problem .
When i open transaction XK03 (with 4 check boxes of general Data ticked )it is ok.
When i call transaction XK03 from my program (by sending the check box parameters ticked)- the scren shown is different .
(I used BDC to set the checkboxes)
Sample code for testing that i write to call XK03 is -
DATA: ls_bdc_comp TYPE bdcdata, "workarea for BDC recording of XK03
lt_bdc_comp TYPE STANDARD TABLE OF bdcdata. "table for BDC recording of MK03
CLEAR: ls_bdc_comp .
REFRESH lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-program = 'SAPMF02K'.
ls_bdc_comp-dynpro = '0101'.
ls_bdc_comp-dynbegin = wc_x.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'BDC_OKCODE'.
ls_bdc_comp-fval = '/00'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-LIFNR'.
ls_bdc_comp-fval = 'S000819001'. "Vendor
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-D0110'. "Address
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-D0120'. "Control
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-D0130'. "Payment transactions
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'WRF02K-D0380'. "contact person
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CALL TRANSACTION 'XK03'
USING lt_bdc_comp.
MODE 'E'.
Regards
Lovleen
Moderator Message: Please use proper subject lines while posting your questions.
Edited by: Suhas Saha on Jul 22, 2011 3:48 PMHi,
You can try with below code,
DATA: ls_bdc_comp TYPE bdcdata, "workarea for BDC recording of XK03
lt_bdc_comp TYPE STANDARD TABLE OF bdcdata. "table for BDC recording of MK03
CLEAR: ls_bdc_comp .
REFRESH lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-program = 'SAPMF02K'.
ls_bdc_comp-dynpro = '0101'.
ls_bdc_comp-dynbegin = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'BDC_OKCODE'.
ls_bdc_comp-fval = '/00'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-LIFNR'.
ls_bdc_comp-fval = 'S000819001'. "Vendor
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-D0110'. "Address
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-D0120'. "Control
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'RF02K-D0130'. "Payment transactions
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CLEAR ls_bdc_comp.
ls_bdc_comp-fnam = 'WRF02K-D0380'. "contact person
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
ls_bdc_comp-fnam = 'USE_ZAV'. "contact person
ls_bdc_comp-fval = 'X'.
APPEND ls_bdc_comp TO lt_bdc_comp.
CALL TRANSACTION 'XK03'
USING lt_bdc_comp
MODE 'E'.
It will also take you to some other screen but up to some extend you will able to see same kind of data. -
Problem when recording the data using BDC for Tcode CJ02.
Dear Experts,
When i am trying to record the data for TCODE : CJ02 i need to enter the project Definition and enter the WBS element it takes me to the screen then i should select the WBS element and attach a file for that selected WBS element . The option for me to attach the attachment of file will be available on the application area(Services for the Object).
Now the problem when i try to do recording in SHDB this option like create attachement is not visible in the recodring . Kindly suggest me what can i do such that i attach the file for the particular project def and WBS element.
Either suggest any function module or other procedure .......
Regards,
Sana.Hi,
in BDC each and every action is recording. If your press enter in same screen that also recorded once aging may be this is your case repeating field values will appear. we can solve the problem for repeat fields like below.
suppose in your excel having repeated field X1 X2 X3 the X2 contains repeated field X3 means delete the X3 field.
Now In your itab having X1 and X2 fields. While in the LOOP the ITAB pass the X2 field to repeated the fields.
LOOP at ITAB to WA.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_CURSOR'.
bdcdata_wa-fval = 'RM08M-EBELN'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'INVFO-BLDAT'.
bdcdata_wa-fval = wa-X2." 1st time pass the X2 fields
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'INVFO-BLDAT'.
bdcdata_wa-fval = wa-X2." pass the same value to repeated field
APPEND bdcdata_wa TO bdcdata_tab.
Endloop.
Hope you can understand.
Regards,
Dhina..
Maybe you are looking for
-
Office 2013 Std (local) in combination with Office 2013 Pro (App-V)
Hello, I have multiple RDS servers, that have Office 2013 Std installed locally. I did this on purpose, after reading some blogs pointing out Office 2013 is a complicated applicatie to stream well. And of course Office 2013 is highly critical to my
-
Help me in sending mails using Javamail
Hi guys this is my first Topic on thid Forum, expecting 'the best' response from any of u. I just want a class that takes a message and recipients address & sends a mail. I would really be obliged if some one can give me a very little class for it. T
-
Retain work item in user's inbox
HI , I have a DMS approval workflow in which we have a requirement for text dialog box/editor to enter the approver's comment. which is working fine but if i click on cancel or dont enter any values in the body of the dialog box/editor.in that case t
-
Error message when processing in the Business Warehouse
hi everybody!! this was the error i got.plz let me know the correction process.plz explain stepwise. thank u, jack. Error message when processing in the Business Warehouse Diagnosis An error occurred in the SAP BW when processing the data. The error
-
Table sdw_users doest not exist
Hi All, I have this error: "select USERNAME, to_char(USER_TYPE)||nvl(STATUS,'X')||nvl (SDD_OWNER,'N') from sdw_users order by USER_TYPE,SDD_OWNER,USERNAME" in the SCM. Is it the reason I cannot logon into the Designer with error "failed to connect to