2007 Jul 25 12:49 PM
for the transaction me21n...
How will I do the recording and then get text data from notepad seperated by ; and send data into sap via bdc?
Thanks in advance.
Deniz.
2007 Jul 25 1:15 PM
Hi.
1.Just go to Transaction SHDB.
2.Give New Recording-> Give transaction name me21n
3. Do one recording properly, without error.
4. Keep in mind All your inputs gets recorded so record it properly.
5. Once one recording done save it.
6. Convert it to your PROGRAM from same transaction SHDB.
7. You can also make use of FM to convert.
8. Then Give Program name and then through SE38 access it.
9. Analyse code. Then use GUI_UPLOAD to upload data from text use ',' seperator as one of the parameter.
10. Collect data into internal table. These are uploding rrows.
11. Loop it on recording.
12. You have to see code proprly where to put loop.
13. Run Report and Choose method call transaction or Session.
14.Upload data.
Reward if useful!
for the transaction me21n...
How will I do the recording and then get text data from notepad seperated by ; and send data into sap via bdc?
Thanks in advance.
Deniz.
2007 Jul 25 12:57 PM
hi,
You can do recording in SM35 and after that code according to the recording in ur program.
Hope this program will help you.
REPORT Z_71754_BDC1 .
data : begin of itab occurs 0 ,
ebeln type ebeln ,
erdat type erdat ,
bprei type bprei ,
bukrs type bukrs ,
lifnr type lifnr,
waers_curc type waers_curc,
end of itab.
data : lt_bdcdata type standard table of bdcdata,
wa_bdcdata type bdcdata.
parameters : l_path type char50.
at selection-screen.
data : l_path_tmp type string .
l_path_tmp = l_path.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_path_tmp
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = itab
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.
else.
data : l_currency type char5,
l_date type char10,
l_netprice type char11.
loop at itab.
Building of bdc structure.
l_currency = itab-waers_curc.
l_date = itab-erdat.
l_netprice = itab-bprei.
perform build_bdcdata using : 'SAPMZ71754_PURCHASE' '0101' 'X' ' ' ' ',
' ' ' ' ' ' 'BDC_OKCODE' '=CREATE',
' ' ' ' ' ' 'WA_PURCHASE-VEBELN' itab-ebeln,
'SAPMZ71754_PURCHASE' '0100' 'X' ' ' ' ',
' ' ' ' ' ' 'BDC_OKCODE' '=CREATE',
' ' ' ' ' ' 'WA_PORDER-EBELN' itab-ebeln,
' ' ' ' ' ' 'WA_PORDER-ERDAT' l_date ,
' ' ' ' ' ' 'WA_PORDER-BPREI' l_netprice,
' ' ' ' ' ' 'WA_PORDER-BUKRS' itab-bukrs,
' ' ' ' ' ' 'WA_PORDER-LIFNR' itab-lifnr,
' ' ' ' ' ' 'WA_PORDER-WAERS_CURC' l_currency,
'SAPMZ71754_PURCHASE' '0100' 'X' ' ' ' ',
' ' ' ' ' ' 'BDC_OKCODE' '/EBACK'.
endloop.
call transaction 'Z71724_INITIAL'
using lt_bdcdata
mode 'A'
update 'S'.
ENDIF.
&----
*& Form build_bdcdata
&----
text
----
-->P_0105 text
-->P_0106 text
-->P_0107 text
-->P_0108 text
-->P_0109 text
----
form build_bdcdata using p1_prog
p1_dynnr
p1_start
p1_fnam
p1_fval.
clear wa_bdcdata.
wa_bdcdata-program = p1_prog.
wa_bdcdata-dynpro = p1_dynnr.
wa_bdcdata-dynbegin = p1_start.
wa_bdcdata-fnam = p1_fnam.
wa_bdcdata-fval = p1_fval.
append wa_bdcdata to lt_bdcdata.
clear wa_bdcdata.
endform. " build_bdcdata
Reward points if contents are useful..
Regards,
Mandeep.
2007 Jul 25 1:00 PM
Forgive me for potentially being stupid, but you cannot use BDC for enjoy transactions.
Use BAPI_PO_CREATE instead.
Message was edited by:
Martin Shinks
2007 Jul 25 1:06 PM
in fact I just wanted to learn bdc, I will not use this code...
But want to get the idea behind bdc, so it would be any transaction..
ok martins?????
thanks.
2007 Jul 25 1:15 PM
Hi.
1.Just go to Transaction SHDB.
2.Give New Recording-> Give transaction name me21n
3. Do one recording properly, without error.
4. Keep in mind All your inputs gets recorded so record it properly.
5. Once one recording done save it.
6. Convert it to your PROGRAM from same transaction SHDB.
7. You can also make use of FM to convert.
8. Then Give Program name and then through SE38 access it.
9. Analyse code. Then use GUI_UPLOAD to upload data from text use ',' seperator as one of the parameter.
10. Collect data into internal table. These are uploding rrows.
11. Loop it on recording.
12. You have to see code proprly where to put loop.
13. Run Report and Choose method call transaction or Session.
14.Upload data.
Reward if useful!
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |