2009 Mar 31 7:46 AM
Hi experts ,
i have to navigate through transaction screens and upload the data in transaction thru BDC.
for example i have taken se11 as my transaction and i have been to the first screen SAPMSRD0' '0102' and but whn i want to display a table(zbdc_cust) using the text file in which i have given the screen values i m unable to navigate
SAPMSRD00102X
RSRD1-TBMA_VAL ZBC_CUST
BDC_OKCODE =SHOW
i have debugged it and i have found an error like this
RSRD1-TBMA_VAL###ZBC_CUST
BDC_OKCODE####=SHOW wat to do to not get this hashes
so how shuld i enter these values in the text file to navigate to diff screens
thnx and regards
harish
Edited by: Harish Kasyap on Mar 31, 2009 8:50 AM
Hi experts ,
i have to navigate through transaction screens and upload the data in transaction thru BDC.
for example i have taken se11 as my transaction and i have been to the first screen SAPMSRD0' '0102' and but whn i want to display a table(zbdc_cust) using the text file in which i have given the screen values i m unable to navigate
SAPMSRD00102X
RSRD1-TBMA_VAL ZBC_CUST
BDC_OKCODE =SHOW
i have debugged it and i have found an error like this
RSRD1-TBMA_VAL###ZBC_CUST
BDC_OKCODE####=SHOW wat to do to not get this hashes
so how shuld i enter these values in the text file to navigate to diff screens
thnx and regards
harish
Edited by: Harish Kasyap on Mar 31, 2009 8:50 AM
2009 Mar 31 7:54 AM
Hi,
You will have to first use GUI_UPLOAD to upload the values in the notepad into an internal table. and then use BDC ith this internal table to update the actual table .
In the notepad, enter these values with tab-limited so that accordingly they will be picked up during BDC
Regards,
Mansi,
2009 Mar 31 7:55 AM
Hi,
Try this
TABLES : KNA1.
DATA : BEGIN OF ITAB OCCURS 0,
CUSTNO LIKE KNA1-KUNNR,
CTRY LIKE KNA1-LAND1,
CUSTNAME LIKE KNA1-NAME1,
CITY LIKE KNA1-ORT01,
PCODE LIKE KNA1-PSTLZ,
END OF ITAB.
DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = 'C:\BDC_SES.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB
.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
GROUP = 'VENKAT'
KEEP = 'X'
USER = SY-UNAME
.
LOOP AT ITAB.
REFRESH BDCDATA.
PERFORM MAP_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'ZVENK_3'
TABLES
DYNPROTAB = BDCDATA
.
ENDLOOP.
FORM MAP_DATA.
perform bdc_dynpro using 'ZMY_FDB_SCR' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-PSTLZ'.
perform bdc_field using 'KNA1-KUNNR'
ITAB-CUSTNO.
perform bdc_field using 'KNA1-LAND1'
ITAB-CTRY.
perform bdc_field using 'KNA1-NAME1'
ITAB-CUSTNAME.
perform bdc_field using 'KNA1-ORT01'
ITAB-CITY.
perform bdc_field using 'KNA1-PSTLZ'
ITAB-PCODE.
perform bdc_dynpro using 'ZMY_FDB_SCR' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=EXI'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-KUNNR'.
ENDFORM.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
Edited by: ShaliniSinha on Mar 31, 2009 8:59 AM
Edited by: ShaliniSinha on Mar 31, 2009 9:02 AM
2009 Mar 31 7:56 AM
Hi Harish,
Its problem of field separator mismatch. To overcome this problem:
Fill the desired data in Excel sheet in separate columns and then SAVE AS tab delimited (text file).
This will provide the desired separator as tabs.
Hope this solves your problem.
Regards,
Brajvir
2009 Mar 31 8:02 AM
hiii brajvir,
i have to navigate through screens in this way can you please tell how to put this data in excel sheet
SAPMSRD00102X
RSRD1-TBMA_VAL ZBC_CUST
BDC_OKCODE =SHOW
SAPMSSY00120X
BDC_CURSOR 04/03
BDC_OKCODE =SAVE
SAPMSSY00120X
BDC_OKCODE =BACK
SAPMSSY00120X
BDC_OKCODE =&F03
SAPLSPO10100X
BDC_OKCODE =YES
RVKRED041000X
BDC_OKCODE /EE
TCDESE11
thnx
harish
2009 Mar 31 8:05 AM
Hi Harish,
You can directly use the Excel file for GUI_UPLOAD.
just fill you excel from first row and first column..
Hope now the error will not repeat.
Thanks & Regards,
Dileep. C
2009 Mar 31 8:10 AM
hiii dileep,this is the data i have to put up in a text file and i shuld navigate thru the screens
SAPMSRD00102X
RSRD1-TBMA_VAL ZBC_CUST
BDC_OKCODE =SHOW
SAPMSSY00120X
BDC_CURSOR 04/03
BDC_OKCODE =SAVE
SAPMSSY00120X
BDC_OKCODE =BACK
SAPMSSY00120X
BDC_OKCODE =&F03
SAPLSPO10100X
BDC_OKCODE =YES
RVKRED041000X
BDC_OKCODE /EE
TCDESE11
can you please tell how to put up this type of data in an excel sheet
thnx
harish
2009 Mar 31 8:51 AM
Hi Harish,
Declare internal table accordingly to your flatfile structure, and
After getting data into the internal table, Loop the table and in loop call transaction Se11.
Are you doing call transaction or session
Are you using a manual or recording methods.
If manual try to get the OK codes also into the internal table and pass accordingly,
Thanks & regards,
Dileep .C
2009 Mar 31 9:46 AM
hiii dilip,
i m doing in call transaction method and i have done the recording and from that i m taking the inputs and can you specify hw to put this type of data which i have mentioned above into an text file
thnx
harish
2009 Apr 01 3:14 AM
Hi Harish,
I am now bit confused,
I tried to do recording SE11.
when i did, the first screen was fine.
SAPMSRD0 0102 X
RSRD1-TBMA_VAL ZBC_CUST
BDC_OKCODE =SHOW
Now after this I am getting
SAPLSD41 2200 X
Even if i go Change or Create I get this screen only...
I dont know about your SAPMSSY0 screen 0120 X..
=SHOW (Display, For Display we dont have SAVE Option in the next screen)
So please can you clearly mention your requirement with screen names so that we can solve in the next post.
And I see that You have a requirement for program and Screen No in the text file...
For this you do one thing, after getting your text fiel into internal table.
Loop internal table and pass values to BDCDATA.
this is Original code
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_OKCODE' '=SHOW'.
Now you write like this
make your text file in the single line format for each loop. if not move to a new internal table as required.
*After uploading to Internal table
Loop at itab.
perform bdc_dynpro using itab-f1 itab-f2.
perform bdc_field using itab-f3 itab-f4.
endloop.
perform bdc_transaction using 'SE11'.
Hope it works.
Thanks & regards,
Dileep .C
2009 Apr 01 5:33 AM
hii dileep thnx for ur concern ,i m tryng to put this BDC recording data into the text file but i m stucking up at perform bdc_dynpro using 'SAPLZBDC_CUST' '0001'. i m tryng to enter few record into the table
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR' 'RSRD1-TBMA_VAL'.
perform bdc_field using 'BDC_OKCODE' '=SHOW'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'=TDED'.
perform bdc_field using 'BDC_CURSOR'
'DD03P-FIELDNAME(01)'.
perform bdc_dynpro using 'SAPLZBDC_CUST' '0001'.
perform bdc_field using 'BDC_CURSOR'
'VIM_POSITION_INFO'.
perform bdc_field using 'BDC_OKCODE'
'=NEWL'.
loop at it_record into wa_record.
perform bdc_dynpro using 'SAPLZBDC_CUST' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZBDC_CUST-ZNUMBER'.
perform bdc_field using 'ZBDC_CUST-ZNAME(01)'
wa_record-ZNAME.
perform bdc_field using 'ZBDC_CUST-ZNUMBER(01)'
wa_record-ZNUMBER.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
2009 Apr 01 7:19 AM
Hi Harish,
but i m stucking up at perform bdc_dynpro using 'SAPLZBDC_CUST' '0001'. i m tryng to enter few record into the table
I dont know where you getting this 'SAPLZBDC_CUST' '0001' from.
But looking to your code i came to know that you have a custom table with name
ZBDC_CUST with fields ZNAME & ZNUMBER
Now let us modify your code
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR' 'RSRD1-TBMA_VAL'. not necessary to have cursor's in code.
perform bdc_field using 'BDC_OKCODE' '=SHOW'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE' '=TDED'. " Is Nothing but Create Entries.
perform bdc_field using 'BDC_CURSOR'* " Also remove this
'DD03P-FIELDNAME(01)'.*" Also remove this
"From the above step you will directly reach to the create entries screen.
" Now enter the values. & Save & Enter & Save
"Means the code should follow this.
loop at it_record into wa_record.
perform bdc_dynpro using 'SAPLZBDC_CUST' '0001'.
perform bdc_field using 'ZBDC_CUST-ZNAME(01)' wa_record-ZNAME.
perform bdc_field using 'ZBDC_CUST-ZNUMBER(01)' wa_record-ZNUMBER.
perform bdc_field using 'BDC_OKCODE' '=SAVE'.
endloop.
perform bdc_field using 'BDC_OKCODE' '=BACK'.
And Also I dont know what is 'VIM_POSITION_INFO' & 'BDC_OKCODE' '=NEWL'.
As per my understanding I updated the code,
And dont worriy about your problem, coz its easy to do. Only thing is you need to improve your presentation about the problem clear & well.
If this is not requirement, lets try one more time, Your are welcome.
Thanks & Regards,
Dileep .C
2009 Mar 31 8:02 AM
Hi Harish,
In the function module GUI_UPLOAD.try to pass the hash_key_field seperator = 'X'.try this hope this will solve ur problem.
2009 Mar 31 9:08 AM
Hi ,
You can use function module: GUI_UPLOAD
There you can declare FILETYPE as DAT.
Hope it helps
Regards
Mansi
2009 Mar 31 11:11 AM
hi,
SAPMSRD00102X
RSRD1-TBMA_VAL ZBC_CUST
BDC_OKCODE =SHOW
SAPMSSY00120X
BDC_CURSOR 04/03
BDC_OKCODE =SAVE
SAPMSSY00120X
BDC_OKCODE =BACK
SAPMSSY00120X
BDC_OKCODE =&F03
SAPLSPO10100X
BDC_OKCODE =YES
RVKRED041000X
BDC_OKCODE /EE
As far as i understood is that u have to upload the above data from notepad and construct 'bdcdata' based on the data from your notepad and use call transaction method.
if that is the case use this logic.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
data:l_file TYPE string.
data: begin of record,
line type string,
end of record.
data:itab like standard table of record,
wa like record.
data: len type i,
pos type i.
data: program like bdcdata-program,
dynpro like bdcdata-dynpro,
dynbegin like bdcdata-dynbegin,
fnam like bdcdata-fnam,
fval like bdcdata-fval.
*To Upload data from file to internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
has_field_separator = 'X'
TABLES
data_tab = itab.
loop at itab into wa.
len = strlen( wa-line ).
len = len - 1 .
dynbegin = wa-line+len(1).
if dynbegin = 'X'.
pos = len - 4.
program = wa-line+0(pos).
dynpro = wa-line+pos(4).
perform bdc_dynpro using program dynpro.
else.
split wa-line at ' ' into fnam fval.
perform bdc_field using fnam fval.
endif.
endloop.
call transaction 'SE11' using BDCDATA.
----
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.
Thanks Sruthi
2009 Apr 01 5:52 AM
Perfrom a recording using transaction SHDB and the proceed for report creation for BDC.
2009 Apr 01 6:01 AM
Hi,
Steps
a) We can upload the file using gui_upload.
b) With the shdb recording, record the particular transaction.
c) Define a table with the fields.
Here is a sample code for transaction FI01.
call function 'GUI_UPLOAD'
exporting
filename = 'C:\File.txt' "File path to upload the data
has_field_separator = 'X' "Field separator
tables
data_tab = t_master "Table with the fields which are required to call the transaction
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. " IF SY_SUBRC = 0
refresh t_bdcdata. " This is a tbale which holds the screen number, program nam, field name, field value
loop at t_master into fs_master.
perform bdc_dynpro using 'SAPMF02B' '0100'.
perform bdc_field using 'BNKA-BANKS' fs_master-banks.
perform bdc_field using 'BNKA-BANKL' fs_master-bankl.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_dynpro using 'SAPMF02B' '0110'.
perform bdc_field using 'BDC_OKCODE' '=UPDA'.
perform bdc_field using 'BNKA-BANKA' fs_master-banka.
perform bdc_field using 'BNKA-PROVZ' fs_master-provz.
perform bdc_field using 'BNKA-STRAS' fs_master-stras.
perform bdc_field using 'BNKA-ORT01' fs_master-ort01.
perform bdc_field using 'BNKA-BRNCH' fs_master-brnch.
call transaction FI01 using t_bdcdata mode A.
clear t_bdcdata.
endloop.
form bdc_dynpro using value(p_program_name) type bdcdata-program
value(p_screen_number) type bdcdata-dynpro.
clear fs_bdcdata.
fs_bdcdata-program = p_program_name.
fs_bdcdata-dynpro = p_screen_number.
fs_bdcdata-dynbegin = 'X'.
append fs_bdcdata to t_bdcdata.
endform. " FORM BDC_DYNPRO
form bdc_field using value(p_fname) type c
value(p_fval) type c.
clear fs_bdcdata.
fs_bdcdata-fnam = p_fname.
fs_bdcdata-fval = p_fval.
append fs_bdcdata to t_bdcdata.
endform. " FORM BDC_FIELDHope this helps you.
Regards,
Rajani.
2009 Apr 01 6:08 AM
hii rajani,
As i mentioned in my earlier post i have done recording using transaction se11 and bdc_ok code which i have got through the recording i have put up this recording in a text file and using the text file i am tryng to navigate through the screens of se11 transaction using CALL transaction method,
hope u got my message
regards
harish
Edited by: Harish Kasyap on Apr 1, 2009 7:08 AM
2009 Apr 01 8:05 AM
Hello Harish,
There is an example program in SAPTechnical website.
I think that will help you out on this. Plz check the same.
Thanks,
Babu Kilari
2009 Apr 01 7:37 AM
thnx a lot dilip for ur answers this helping me a lot in dealing with the problem but i will explain you more clearly abt this
'VIM_POSITION_INFO' & 'BDC_OKCODE' '=NEWL' -->this is used when their are already some values in the table and we need to enter a new values by clicking new entries
'SAPLZBDC_CUST' '0001'--> this is the screen name from where we can enter new entries.
so i have solved this problem upto a level now a new problem araised
when i am entering the values by the text table where i have put the recording the values are gettin over written suppose i have given two values first one is entering into the table but again it is getting over written by the second one
hope this is clear with you
harish
2009 Apr 01 7:47 AM
Hi Harish,
Put a break point before endloop. and when breakpoint triggers,
check you database table whether that particular record hasbeen updated or not,
after that again check internal table and dbtable.... do this you will clearly get an idea where to put your save OK_CODE, and check with your customised databse table with primary key's and you have data in text file accordingly to the database table.
Hope this solves..
Thanks & regards,
Dileep .C
2009 Apr 01 7:52 AM
But Harish,
If I am not mistaken, You are just updating or modifying or creating database table.
Directly a Database Table....
then I dont know why you are using a BDC....
If this is my case,,, I Just take GUI_UPLOAD to update my internal table,,,,
Case1
and Loop my internal table... and Update DBtable form workarea.
Case2
Or Update database table form Internal table directly.
Thanks & Regards,
Dileep .C
2009 Apr 01 8:07 AM
dear dilip
i want to update the database table by putting up the recording into a text table
regards
harish
2009 Apr 02 7:51 AM
Hi
Did u notice the code changes suggested by Dileep?
The statement " perform bdc_field using 'BDC_OKCODE' '=SAVE'. " should be inside the loop.
So repeat this entry in your text file (for every new line to be entered into the table).
This may slove your new issue (ie) overwriting the entries in the table.
Thanks Sruthi.
2009 Apr 02 7:56 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |