Error in BDC upload
Hi,
I am facing a problem in BDC upload for hr master data tcode pa40.
I want to stop bdc after 3 screens and i dont want to processforthe remaining screens.
Can anyone help me onthis?
Thanks in advance.
Hi Anil,
I am regret to you becz i could nt tell thanks because i am full busy of my work.
Thanks a lot.
I have checked with your valuable logic. Now I am processing BDC upto two screens.
Regards,
Sreekanth
Similar Messages
-
Error in bdc uploading for transaction F-02
Hi all,
Iam uploading transactional data for the transaction F-02 using BDC call transaction.
I have recorded all the screens of F-02 and internal table with fields also declared.
While running the program, it is showing the error saying -- " Input value is longer than screen field "
In debugging, Iam getting all the data from flat file into the internal table.
Iam unable to identify where it has gone wrong.
Can anybody look into it.
Thanks and Regards,
Murali Krishna .TModerator message - Please search before asking - post locked
Rob -
hie gurus , can anyone help me , i have created a bdc upload for transaction MFBF repetitive manufacturing backflush
, when i upload a material with multiple production version i get an error , production version for material could not be
determined. initially its supposed to give a pop up window that allows me to select the production version, in the bdc recording so the pop window is not being called in the program for some reason i have not modified the recording
in anyway this is straight from sm35 recording to my z program :
perform bdc_dynpro using 'SAPLBARM' '0800'.
perform bdc_field using 'BDC_OKCODE'
'=GOON'.
perform bdc_field using 'RM61B-RB_BAUGR'
'X'.
perform bdc_field using 'RM61B-BUDAT'
'06.06.2011'.
perform bdc_field using 'RM61B-BLDAT'
'06.06.2011'.
perform bdc_field using 'BDC_CURSOR'
'RM61B-MATNR'.
perform bdc_field using 'RM61B-MATNR'
'900-03-000'.
perform bdc_field using 'RM61B-WERKS'
'1200'.
perform bdc_field using 'RM61B-ERFMG'
'1111'.
error screen not being called
perform bdc_dynpro using 'SAPLBARM' '0160'.
perform bdc_field using 'BDC_CURSOR'
'MKAL-VERID(02)'.
perform bdc_field using 'BDC_OKCODE'
'=GOON'.
perform bdc_field using 'RM61B-SELEK(02)'
'X'.Hi Daniel,
Please check the BAPIs available in Function group 2127 if you can use any. That way you do not have to manipulate the screens in BDC.
Regards,
Shyam -
hi experts.
I am using a BDC-UPLOAD program for MB11 but there is one error during an upload.
Here is a procedure which i am following:
I have created an upload file, which is tab-delimited format. In which such information exists:
01.12.2008 12.12.2008 561 d920 m920 536319000 1 PC 100
Now when i am uploading this file using movement type P61 or 561 a same error occurs:
Formatting error in the field MSEG-EXBWR ; see next message
Make an entry in all required fields and this is a required field, its a currency type field but i have even checked it by replacing it into char & num.
Is there any standard upload program for STOCK UPLOAD using MB11? If there is any one who can send me a solution.
thanks in advance.
Regards,
Yahya Shoaib.OK...I think you have declared the internal table field for that value same as the standard table right??
Now, create a variable with char and then move the value to that char variable and then pass it to the subroutines...
Ex:
loop at itab into wa.
var1 = wa-amount
perform bdc_field using mseg-exwbr var1.
endloop.
Now, I think it will pick up the value.
VIshwa. -
BDC Uploading - Organisation structure position error
Hi Gurus,
When we are uploading Master data through BDC its uploading in pa30 but its not updating positions in organization structure (PPOM_OLD - TCODE) . we cant find the holder under the position though we have upload the data and clear see the data in pa30 for that position.
when we are doing Action manually its updating the position. ofcourse its common too.
My question is why its not updaing the holder to the position when we are doing BDC upload
Any thoughts and suggestions.
Regards,
Ravi
Edited by: ravi Kumar on Jun 17, 2010 12:02 PMFirst try this.
1. Execute RHINTE00 for one person
Selection screen
tick CREATE RELATIONSHIPS and CREATE HOLDER RELATIONSHIPS ONLY.
Remove the TEST tick and run.
First try for one person only then you can run it for others.
cheers
Ajay -
Handle error and skip error in BDC
HI experts,
I have done a BDC call transaction method for t.code XK02.
During the uploading i am getting a lot hidden errors which my uploading getting stop.
I have done a lot checking but still some new problems coming during uploading.
Example :
Sometimes the user did not maintain payment terms and ETC.
Is it possible for me to skip if the there is any error hit during the uploading and it should skip to the
next data to upload.
I hope it is clear.
Thank you in advanced.
regards.
saravannan.sHi,
If you are trying to create the multiple vendors using call transaction you'll be using a loop for the CALL TRANSACTION.
So, you can do this, when you are uploading data into the BDCDATA structure after you upload the data you'll be calling the CALL TRANSACTION statement. So, call this statement using mode 'N' and store the errors in an internal table type BDCMSGCOLL.if any error comes then you'll get the error stored into this table and loop continues for the next vendor creation data.
finally you'll get the error and success of the vendors into the internal table type BDCMSGCOLL.
P.S. use the call transaction statement like this
CALL TRANSACTION 'XK02' USING T_BDCDATA MODE 'N' MESSAGES INTO T_BDCMSGCOLL.
Thanks&Regards
Sarves -
BDC upload program for inoftypes 14 and 168
Hi All,
I am uploading IT 14 and 168 through a single BDC program. i am opening the bdc session using
BDC_OPEN_GROUP before bdc recording. my requirement is to upload IT 168 only when uploading
of IT 14 is successful. For this i am using the message table of the first upload(for IT14). if the message
type is 'S'(success) then i am uploading IT168 else i am moving it to an error internal table. Please suugest
wthr this logic is fine. Also where should i call BDC_CLOSE_GROUP. currently i am calling it after the
PERFORM for upload of infotype 168 but it is giving error "unable to open BDC_CLOSE_GROUP".
Can anyone suggest me the solution through some sample code.
i am attaching here my code for your reference.
REPORT ZUSAHR_IN_BN_E_014_168 NO STANDARD PAGE HEADING
LINE-COUNT 65 LINE-SIZE 132.
*=======================================================================
TYPE-POOLS
*=======================================================================
TYPE-POOLS: slis,
truxs.
*=======================================================================
TABLES
*=======================================================================
TABLES: pernr.
*=======================================================================
INFOTYPES
*=======================================================================
INFOTYPES: 0000, "Action
0014, "Recurring payement/deductions
0168. "Insurance plan
*=======================================================================
TYPES
*=======================================================================
TYPES : BEGIN OF t_0014_0168,
num(20) type c, "Number
actcode(1) type c, "action code
lgart LIKE p0014-lgart, "Wage Type
betrg LIKE q0014-betrg, "Amount
betrg(14) type c, "Amount
bplan LIKE p0168-bplan, "Benefit plan
bcovr like p0168-bcovr, "Insurance Option
END OF t_0014_0168,
BEGIN OF t_pernr,
pernr LIKE p0002-pernr, "personnel number
perid like p0002-perid, "SSN
END OF t_pernr,
BEGIN OF errmsg,
pernr LIKE p0014-pernr, "personnel number
messg(85), " message text
END OF errmsg,
BEGIN OF succmsg,
pernr LIKE p0014-pernr, "personnel number
messg(85), " message text
END OF succmsg.
*=======================================================================
INTERNAL TABLES
*=======================================================================
DATA : i_itab TYPE STANDARD TABLE OF t_0014_0168,
i_pernr TYPE STANDARD TABLE OF t_pernr,
i_bdcitab TYPE STANDARD TABLE OF bdcdata ,
i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll,
i_errmsg TYPE STANDARD TABLE OF errmsg,
i_succmsg TYPE STANDARD TABLE OF succmsg.
*=======================================================================
RANGES
*=======================================================================
*=======================================================================
DATA DECLARATION
*=======================================================================
DATA : messg(85).
*=======================================================================
GLOBAL WORKAREAS
*=======================================================================
DATA : wa_itab TYPE t_0014_0168,
wa_pernr TYPE t_pernr,
wa_bdcitab TYPE bdcdata ,
wa_bdcmsgcoll TYPE bdcmsgcoll,
wa_errmsg TYPE errmsg,
wa_succmsg TYPE succmsg.
*=======================================================================
GLOBAL VARIABLES
*=======================================================================
DATA : g_n1 TYPE sy-dbcnt.
*=======================================================================
GLOBAL CONSTANTS
*=======================================================================
DATA : g_x TYPE c VALUE 'X',
g_asc TYPE char10 VALUE 'ASC',
g_xls(3) TYPE c VALUE 'XLS',
g_f TYPE c VALUE 'F',
g_1 TYPE c VALUE '1',
g_0 TYPE c VALUE '0',
g_u TYPE c VALUE 'U',
g_int(3) TYPE c VALUE 'INT',
g_raw(3) TYPE c VALUE 'RAW',
G_A(1) TYPE C VALUE 'A',
G_C(1) TYPE C VALUE 'C',
G_D(1) TYPE C VALUE 'D'.
*=======================================================================
SELECTION-SCREEN
*=======================================================================
*Block for Additional selection
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_check TYPE char1 DEFAULT 'X', "check box for test run
p_file1 TYPE rlgrap-filename OBLIGATORY, " upload file
p_file2 TYPE rlgrap-filename OBLIGATORY, " succ emp
p_file3 TYPE rlgrap-filename OBLIGATORY. " err emp
SELECTION-SCREEN END OF BLOCK b1.
*=======================================================================
AT SELECTION-SCREEN
*=======================================================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
PERFORM sub_file_intake.
*=======================================================================
START-OF-SELECTION
*=======================================================================
START-OF-SELECTION.
PERFORM sub_data_upload.
PERFORM GET_PERNR_SSN.
*=======================================================================
END-OF-SELECTION
*=======================================================================
END-OF-SELECTION.
*> upload the data using BDC
PERFORM sub_bdc_upload.
*> To display the contents of the input file for test run
IF p_check = space.
PERFORM sub_output.
ELSE.
*> To display in the messages after uploading the input file
PERFORM sub_output_messages.
ENDIF.
*& Form sub_file_intake
F4 on filename to accept file
--> p1 text
<-- p2 text
FORM sub_file_intake .
To provide F4 Functionality for file path
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
CHANGING
file_name = p_file1
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.
ENDFORM. " sub_file_intake
*& Form SUB_DATA_UPLOAD
Upload the input file and perform the checkings.
--> p1 text
<-- p2 text
FORM SUB_DATA_UPLOAD .
*> local variable for filename
DATA : l_file1 TYPE string.
*> assign value for file1.
l_file1 = p_file1.
*> function to upload the input file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file1
filetype = g_asc
has_field_separator = g_x
TABLES
data_tab = i_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.
ENDIF.
ENDFORM. " SUB_DATA_UPLOAD
*& Form sub_output
if program is on test run mode then display records
FORM sub_output .
*> Count the number of employee to be processed
CLEAR g_n1.
DESCRIBE TABLE i_itab LINES g_n1.
IF g_n1 NE 0.
*> if program is in test run mode then display
LOOP AT i_itab INTO wa_itab.
WRITE: / wa_itab-num,
wa_itab-lgart,
wa_itab-betrg,
wa_itab-bplan,
wa_itab-bcovr.
ENDLOOP.
ENDIF.
ENDFORM. " sub_output
*& Form sub_bdc_upload
bdc upload
FORM sub_bdc_upload .
*> Count the number of employee to be processed
CLEAR g_n1.
DESCRIBE TABLE i_itab LINES g_n1.
IF g_n1 NE 0.
PERFORM sub_open_group.
PERFORM sub_bdc_sessions.
PERFORM sub_close_group.
ELSE.
MESSAGE e003(zmsg) WITH text-021.
ENDIF.
ENDFORM. " sub_bdc_upload
*& Form sub_open_group
bdc_open_group
FORM sub_open_group .
*> group name
DATA : c_group LIKE apqi-groupid .
c_group = text-001.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = c_group
holddate = sy-datum
keep = g_x
user = sy-uname
prog = sy-cprog
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 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. " sub_open_group
*& Form sub_close_group
Close the BDC Session
FORM sub_close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 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.
ENDFORM. " sub_close_group
*& Form sub_bdc_sessions
BDC Sessions
FORM sub_bdc_sessions .
*> Local Constants
DATA: l_ctumode LIKE ctu_params-dismode VALUE 'A',
l_cupdate LIKE ctu_params-updmode VALUE 'S',
l_startdate(10) type c,
l_enddate(10) type c,
l_tcode(4) TYPE c VALUE 'PA30',
l_info(2) TYPE c VALUE '14'.
LOOP AT i_itab INTO wa_itab.
perform bdc_dynpro using 'SAPMP50A' '1000'.
IF wa_itab-actcode = G_A.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
ELSEIF wa_itab-actcode = G_D.
perform bdc_field using 'BDC_OKCODE'
'=DEL'.
ELSEIF wa_itab-actcode = G_C.
perform bdc_field using 'BDC_OKCODE'
'=MOD'.
ENDIF.
perform bdc_field using 'RP50G-PERNR' wa_itab-num.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC' l_info.
perform bdc_dynpro using 'MP001400' '2010'.
perform bdc_field using 'BDC_CURSOR'
'Q0014-BETRG'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'P0014-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0014-ENDDA'
'12/31/9999'.
perform bdc_field using 'P0014-LGART' wa_itab-lgart.
perform bdc_field using 'Q0014-BETRG' wa_itab-betrg.
perform bdc_field using 'Q0014-BETRG'
wa_itab-betrg.
' 248'.
perform bdc_field using 'P0014-BETRG' wa_itab-betrg.
perform bdc_field using 'P0014-WAERS'
'USD'.
perform bdc_dynpro using 'MP001400' '2010'.
perform bdc_field using 'BDC_CURSOR'
'P0014-BEGDA'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0014-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0014-ENDDA'
'12/31/9999'.
perform bdc_field using 'P0014-LGART' wa_itab-lgart.
perform bdc_field using 'Q0014-BETRG' wa_itab-betrg.
perform bdc_field using 'P0014-BETRG' wa_itab-betrg.
perform bdc_field using 'P0014-WAERS'
'USD'.
*> refresh the message tab
REFRESH i_bdcmsgcoll.
CALL TRANSACTION l_tcode USING i_bdcitab
MODE l_ctumode
UPDATE l_cupdate
MESSAGES INTO i_bdcmsgcoll.
*> refresh the bdc data tab
REFRESH i_bdcitab.
*> store the message for this pernr
PERFORM sub_build_messages.
ENDLOOP.
ENDFORM. " sub_bdc_sessions
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcitab.
wa_bdcitab-program = program.
wa_bdcitab-dynpro = dynpro.
wa_bdcitab-dynbegin = g_x.
APPEND wa_bdcitab TO i_bdcitab.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR wa_bdcitab.
wa_bdcitab-fnam = fnam.
wa_bdcitab-fval = fval.
APPEND wa_bdcitab TO i_bdcitab.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form sub_build_messages
Generate the messages
FORM sub_build_messages .
*> Local Constants
DATA : l_s TYPE c VALUE 'S'.
LOOP AT i_bdcmsgcoll INTO wa_bdcmsgcoll.
*> generate the message
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_bdcmsgcoll-msgid
msgnr = wa_bdcmsgcoll-msgnr
msgv1 = wa_bdcmsgcoll-msgv1
msgv2 = wa_bdcmsgcoll-msgv2
msgv3 = wa_bdcmsgcoll-msgv3
msgv4 = wa_bdcmsgcoll-msgv4
IMPORTING
message_text_output = messg
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
*> if message type is 'S' then store in successful table
IF wa_bdcmsgcoll-msgtyp = l_s.
MOVE wa_itab-num TO wa_succmsg-pernr.
MOVE messg TO wa_succmsg-messg.
APPEND wa_succmsg TO i_succmsg.
CLEAR wa_succmsg.
PERFORM BDC_UPLOAD_168.
ELSE.
*> if message type is 'E' then store in error table
MOVE wa_itab-num TO wa_errmsg-pernr.
MOVE messg TO wa_errmsg-messg.
APPEND wa_errmsg TO i_errmsg.
CLEAR wa_errmsg.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " sub_build_messages
*& Form sub_output_messages
text
--> p1 text
<-- p2 text
FORM sub_output_messages .
IF p_check = g_x.
*> clear the count
CLEAR g_n1.
*> count the number of successful employees
DESCRIBE TABLE i_succmsg LINES g_n1.
IF g_n1 <> 0 .
*> download success file
PERFORM sub_succ_file.
*> display the successful employees
WRITE :/ text-002.
LOOP AT i_succmsg INTO wa_succmsg.
WRITE:/ wa_succmsg-pernr, wa_succmsg-messg.
ENDLOOP.
ENDIF.
*> clear the count
CLEAR g_n1.
*> count the number of error employees
DESCRIBE TABLE i_errmsg LINES g_n1.
IF g_n1 <> 0 .
*> download error file
PERFORM sub_err_file.
*> display the error employees
WRITE :/ text-003.
LOOP AT i_errmsg INTO wa_errmsg.
WRITE:/ wa_errmsg-pernr,wa_errmsg-messg.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " sub_output_messages
*& Form SUB_SUCC_FILE
text
--> p1 text
<-- p2 text
FORM sub_succ_file .
*> local variable for filename
DATA : l_file1 TYPE string.
*> assign value for file1.
l_file1 = p_file2.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file1
filetype = g_asc
TABLES
data_tab = i_succmsg
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.
IF sy-subrc EQ 0.
MESSAGE s003(zmsg) WITH text-006.
ENDIF.
ENDFORM. " SUB_SUCC_FILE
*& Form SUB_ERR_FILE
text
--> p1 text
<-- p2 text
FORM sub_err_file .
*> local variable for filename
DATA : l_file1 TYPE string.
*> assign value for file1.
l_file1 = p_file3.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file1
filetype = g_asc
TABLES
data_tab = i_errmsg
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.
IF sy-subrc EQ 0.
MESSAGE s003(zmsg) WITH text-007.
ENDIF.
ENDFORM. " SUB_ERR_FILE
*& Form GET_PERNR_SSN
text
--> p1 text
<-- p2 text
FORM GET_PERNR_SSN .
data : l_cnt type i.
describe table i_itab lines l_cnt.
if l_cnt ge 0.
SELECT PERNR PERID FROM PA0002 INTO table i_pernr
FOR ALL ENTRIES IN i_itab
WHERE PERID EQ i_itab-num.
IF SY-SUBRC EQ 0.
PERFORM MODIFY_TABLE.
ENDIF.
endif.
ENDFORM. " GET_PERNR_SSN
*& Form MODIFY_TABLE
text
--> p1 text
<-- p2 text
FORM MODIFY_TABLE .
LOOP AT i_itab INTO wa_itab.
READ TABLE i_pernr INTO wa_pernr WITH KEY perid = wa_itab-num.
IF SY-SUBRC EQ 0.
MOVE WA_PERNR-PERNR TO WA_ITAB-NUM.
MODIFY i_itab FROM wa_itab.
ENDIF.
ENDLOOP.
ENDFORM. " MODIFY_TABLE
*& Form BDC_UPLOAD_168
text
--> p1 text
<-- p2 text
FORM BDC_UPLOAD_168 .
PERFORM sub_open_group.
PERFORM sub_bdc_sessions_168.
PERFORM sub_close_group.
ENDFORM. " BDC_UPLOAD_168
*& Form SUB_BDC_SESSIONS_168
text
--> p1 text
<-- p2 text
FORM SUB_BDC_SESSIONS_168 .
DATA: l_ctumode LIKE ctu_params-dismode VALUE 'A',
l_cupdate LIKE ctu_params-updmode VALUE 'S',
l_sdate(10) type c,
l_edate(10) type c,
l_tcode(4) TYPE c VALUE 'PA30',
l_info(3) TYPE c VALUE '168'.
LOOP AT i_itab INTO wa_itab.
perform bdc_dynpro using 'SAPMP50A' '1000'.
IF wa_itab-actcode = G_A.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
ELSEIF wa_itab-actcode = G_D.
perform bdc_field using 'BDC_OKCODE'
'=DEL'.
ELSEIF wa_itab-actcode = G_C.
perform bdc_field using 'BDC_OKCODE'
'=MOD'.
ENDIF.
perform bdc_field using 'RP50G-PERNR' wa_itab-num.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC' l_info.
perform bdc_dynpro using 'MP016800' '2000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'P0168-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0168-ENDDA'
'12/31/9999'.
perform bdc_field using 'BDC_CURSOR'
'P0168-BCOVR'.
perform bdc_field using 'P0168-BPLAN' wa_itab-bplan.
perform bdc_field using 'P0168-BCOVR' wa_itab-bcovr.
perform bdc_field using 'Q0168-CSTDT'
'03/18/2008'.
perform bdc_field using 'Q0168-EEPER'
'2'.
perform bdc_field using 'P0168-PERIO'
'2'.
perform bdc_dynpro using 'MP016800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0168-BEGDA'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0168-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0168-ENDDA'
'12/31/9999'.
perform bdc_field using 'P0168-BPLAN' wa_itab-bplan.
perform bdc_field using 'P0168-BCOVR' wa_itab-bcovr.
perform bdc_field using 'Q0168-CSTDT'
'03/18/2008'.
perform bdc_field using 'Q0168-EEPER'
'2'.
*> refresh the message tab
REFRESH i_bdcmsgcoll.
CALL TRANSACTION l_tcode USING i_bdcitab
MODE l_ctumode
UPDATE l_cupdate
MESSAGES INTO i_bdcmsgcoll.
*> refresh the bdc data tab
REFRESH i_bdcitab.
*> store the message for this pernr
PERFORM sub_build_messages_168.
ENDLOOP.
ENDFORM. " SUB_BDC_SESSIONS_168
*& Form SUB_BUILD_MESSAGES_168
text
--> p1 text
<-- p2 text
FORM SUB_BUILD_MESSAGES_168 .
*> Local Constants
DATA : l_s TYPE c VALUE 'S'.
LOOP AT i_bdcmsgcoll INTO wa_bdcmsgcoll.
*> generate the message
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_bdcmsgcoll-msgid
msgnr = wa_bdcmsgcoll-msgnr
msgv1 = wa_bdcmsgcoll-msgv1
msgv2 = wa_bdcmsgcoll-msgv2
msgv3 = wa_bdcmsgcoll-msgv3
msgv4 = wa_bdcmsgcoll-msgv4
IMPORTING
message_text_output = messg
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
*> if message type is 'S' then store in successful table
IF wa_bdcmsgcoll-msgtyp = l_s.
MOVE wa_itab-num TO wa_succmsg-pernr.
MOVE messg TO wa_succmsg-messg.
APPEND wa_succmsg TO i_succmsg.
CLEAR wa_succmsg.
ELSE.
*> if message type is 'E' then store in error table
MOVE wa_itab-num TO wa_errmsg-pernr.
MOVE messg TO wa_errmsg-messg.
APPEND wa_errmsg TO i_errmsg.
CLEAR wa_errmsg.
ENDIF.
ENDIF.
ENDLOOP.
Many thanks in advance!!!!
RupeshFor the IDOC perspective, you can uses CREMAS.
For the mass maintenance you still have XK99 (which also uses CREMAS internally)
True there is NO BAPI
For the BDC and the table control. Well this is not really true.
In batchinput, instead of maintaining the rows by there Number, you should select it at the first position.
OK-CODE /06 will open a selection screen SAPMF02K 2324. The result of the selection screen goes to the first line of the table control.
Of course this works only in BDC
reward points if helpful
Edited by: Alain Bacchi on Jun 18, 2008 8:48 AM -
hi experts.
I am using a BDC-UPLOAD program for MB11 but there is one error during an upload.
Here is a procedure which i am following:
I have created an upload file, which is tab-delimited format. In which such information exists:
01.12.2008 12.12.2008 561 d920 m920 536319000 1 PC 100
Now when i am uploading this file using movement type P61 or 561 a same error occurs:
Formatting error in the field MSEG-EXBWR ; see next message
Make an entry in all required fields and this is a required field, its a currency type field but i have even checked it by replacing it into char & num.
Is there any standard upload program for STOCK UPLOAD using MB11? If there is any one who can send me a solution.
thanks in advance.
Regards,
Yahya Shoaib.Hi,
For Stock upload I prefer creation of a program by calling Function Module BAPI_GOODSMVT_CREATE. When you use BAPI, as it is being function module you need not do the recording as well. You can test the BAPI also manually in SE37. This simulation helps in passing the data in the feed file. You may contact your ABAPer for creating a program using this BAPI. You can input the feed file in similar fashion that of BDC -
Hi experts,
I have a problem in my BDC Call transaction method, am getting the below error when i upload the price. My internal table having the value, but when i pass into fval that time there is no value comming, while uploading its giving this error.
field konp-kbetr(1) input value is longer than screen field
anyone having soln, please help me out.
MohanaHi,
Try Condense that Field Fval.
FORM populate_data USING value(p_fieldname)
value(p_fieldval).
CLEAR fs_bdcdata.
fs_bdcdata-fnam = p_fieldname.
fs_bdcdata-fval = p_fieldval.
CONDENSE fs_bdcdata-fval.
APPEND fs_bdcdata TO t_bdcdata.
ENDFORM.
Hope this is helpful.
Thanks
Kalyan -
Capturing the details of data in which error occured during uploading
Hi, anyone tell me how to Capturing the details of data in which error occured during uploading the file using BDC in backgroung mode. Please do the needful
Thanks & Regards.
Aniruddhahi,
This declaration is used to capture the error msg. V is the std table that captures that.i have given a sample code with this..pls chk it out..
data: err type standard table of bdcmsgcoll with header line.
SAmple code:
report z_aru_bdc_new4
no standard page heading line-size 255.
include bdcrecx1.
Generated data section with specific formatting - DO NOT CHANGE ***
parameters: p_file like rlgrap-filename obligatory.
data: err type standard table of bdcmsgcoll with header line.
data: mess(200) type c.
data: begin of it_err occurs 0,
msg(200) type c,
end of it_err.
data: begin of record occurs 0,
data element:
viewname_001(030),
data element: VIM_LTD_NO
ltd_dta_no_002(001),
data element: ZEMPID3
zempid3_003(004),
data element: ZENAME3
zename3_008(040),
data element: ZEDEPID
zedepid_009(004),
data element:
zsalkey_010(005),
data element:
salary_011(013),
data element: ZENAME3
ZENAME3_008(040),
data element: ZEDEPID
ZEDEPID_009(004),
data element:
ZSALKEY_010(005),
data element:
SALARY_011(013),
end of record.
End generated data section ***
start-of-selection.
at selection-screen on value-request for p_file.
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
DEF_PATH = ' '
mask = '.,..'
mode = 'O' " O -- open, S -- Save.
title = 'OPEN'
importing
filename = p_file
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
start-of-selection.
call function 'UPLOAD'
exporting
CODEPAGE = ' '
filename = p_file
filetype = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
tables
data_tab = record
exceptions
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7
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_dataset using dataset.
*perform open_group.
delete record index 1.
loop at record.
*read dataset dataset into record.
*if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMSVMA' '0100'.
perform bdc_field using 'BDC_CURSOR'
'VIEWNAME'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'VIEWNAME'
record-viewname_001.
perform bdc_field using 'VIMDYNFLDS-LTD_DTA_NO'
record-ltd_dta_no_002.
perform bdc_dynpro using 'SAPLZSHAP' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZEMPID3(01)'.
perform bdc_field using 'BDC_OKCODE'
'=NEWL'.
perform bdc_dynpro using 'SAPLZSHAP' '0002'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-SALARY'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'ZEMPTAB1-ZEMPID3'
record-zempid3_003.
perform bdc_field using 'ZEMPTAB1-ZENAME3'
record-zename3_008.
perform bdc_field using 'ZEMPTAB1-ZEDEPID'
record-zedepid_009.
perform bdc_field using 'ZEMPTAB1-ZSALKEY'
record-zsalkey_010.
perform bdc_field using 'ZEMPTAB1-SALARY'
record-salary_011.
perform bdc_dynpro using 'SAPLZSHAP' '0002'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZENAME3'.
perform bdc_field using 'BDC_OKCODE'
'=UEBE'.
perform bdc_field using 'ZEMPTAB1-ZENAME3'
record-zename3_008.
perform bdc_field using 'ZEMPTAB1-ZEDEPID'
record-zedepid_009.
perform bdc_field using 'ZEMPTAB1-ZSALKEY'
record-zsalkey_010.
perform bdc_field using 'ZEMPTAB1-SALARY'
record-salary_011.
perform bdc_dynpro using 'SAPLZSHAP' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZEMPID3(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_dynpro using 'SAPLZSHAP' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZEMPID3(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_dynpro using 'SAPMSVMA' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'VIEWNAME'.
perform bdc_transaction using 'SM30'.
*enddo.
*perform close_group.
*perform close_dataset using dataset.
endloop.
loop at it_err.
write : / it_err-msg.
endloop.
form error.
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = mess
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.
it_err-msg = mess.
append it_err.
clear it_err.
endform.
If it is session method u can find the session in SM35 from where u can get the error log.
Hope this helps u,
Regards,
Arunsri -
Hi,
How to handle errors in bdc call transaction method.
what is the steps to download errors from bdcmsgcoll into flat file in call transaction method
udayHi friend,
Here is a beautiful example which explains how to trap erroreneous records ..if help full then please give me max reward point.
REPORT zgopi_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_FFCUST
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.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
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 = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop -
I Need Navigation about BDC Upload
Need Navigation about BDC Upload
Hi
<b>the BDC program should be in this format</b>
Transaction Recorder (SHDB)
How to Upload Presentation Server Flat file to SAP R/3 system???
How to upload application server file to R/3 system?
Definition
<b>Example - Call Transaction Method</b>
<b>Transaction Recorder (SHDB)</b>
Before you work with the Batch Input methods, you should know the purpose of the tool
Transaction Recorder.
<b>Use:</b>
You can use the transaction recorder to record a series of transactions and their screens.
<b>Features:</b>
You can use the recording to create
Data transfer programs that use batch input or CALL TRANSACTION
Batch input sessions
Test data
Function modules.
Note: It doesnt record F1, F4 and Scrollbar movements
<b>Upload Flat file from Presentation Server to SAP R/3</b>
CALL FUNCTION GUI_UPLOAD'
EXPORTING
CODEPAGE = IBM'
FILENAME = P_UFILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = INT_TAB
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
OTHERS = 10 .
IF SY-SUBRC NE 0.
MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
ENDIF.
<b>Upload file from application server to SAP R/3</b>
Open the the application server file
OPEN DATASET <dsn> FOR INPUT <mode>
Read the data from application server file
READ DATASET <dsn> INTO <wa>
And then close the application server file
CLOSE DATASET <dsn>
Definition- Declaring BDC Table
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6
WITH HEADER LINE .
The internal table used to collect the transactions information must be declared LIKE BDCDATA.
<b>Filling BDC Table Method #1</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 01016.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-LIFNR.
BDC_TAB-FVAL = TEST1.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-D0010.
BDC_TAB-FVAL = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 0110.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = LFA1-STRAS.
BDC_TAB-FVAL = 123 Main St..
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = BDC_OKCODE.
BDC_TAB-FVAL = /11.
APPEND BDC_TAB.
ENDFORM.
<b>Filling BDC Table Method #2</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1 SAPMF02K 0106,
RF02K-LIFNR TEST1,
RF02K-D0010 X,
1 SAPMF02K 0110,
LFA1-STRAS, 123 Main St.,
BDC_OKCODE, /11.
ENDFORM.
FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
CLEAR BDC_TAB.
IF FLAG = 1.
BDC_TAB-PROGRAM = VAR1.
BDC_TAB-DYNPRO = VAR2..
BDC_TAB-DYNBEGIN = X.
ELSE.
BDC_TAB-FNAM = VAR1.
BDC_TAB-FVAL = VAR2.
ENDIF.
APPEND BDC_TAB.
ENDFORM.
This two subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.
Example #1 - Change Vendor (Call Transaction Method)
<b>Example #1- Declaration Section</b>
REPORT Y180DM10.
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
INFILE(20) VALUE /tmp/bc180_file4.
DATA: BEGIN OF INREC.
VENDNUM LIKE LFA1-LIFNR.
STREET LIKE LFA1-STRAS.
END OF INREC.
PARAMETERS: DISPMODE DEFAULT A,
UPDAMODE DEFAULT S.
START-OF-SELECTION.
OPEN DATASET INFILE
FOR INPUT IN TEXT MODE.
DO.
READ DATASET INFILE INTO INREC.
IF SY-SUBRC < > 0. EXIT. ENDIF.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE DISPMODE
UPDATE UPDAMODE.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
CLOSE DATASET INFILE.
<b>synchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE S.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
<b>asynchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE A.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
<b>Error Handling</b>
Write an error report.
Send the record(s) in error to an error file.
Create a batch input session with the record(s) in error.
To store error messages ( CALL TRANSACTION )
data: begin of Tab_Mess occurs 0.
include structure bdcmsgcoll.
data : end of Tab_Mess,
CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S
MESSAGES INTO TAB_MESS.
IF SY-SUBRC NE 0.
WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
Tab_MESS-MSGID.
ENDIF.
<b>i am giving you example for Change Vendor you practice for ur tcode</b>
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
<b>Step #1</b>
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
<b>Step #2</b>
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
<b>Step #3</b>
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
<b>BDC Table Contents</b>
After researching the transaction we can determine the contents of the BDC table.
PROGRAM DYNPRO DYNBEGIN FNAM FVAL
SAMPF02K 0106 X
RF02K-LIFNR TEST1
RF02K-D0110 X
SAMPF02K 0110 X
LFA1-STRAS 123 Main St.
BDC_OKCODE /11
<b>Batch Input Methods</b>
CALL TRANSACTION USING
STATEMENT
<b>Call transaction - for data transfer</b>Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
A Display all
E Display errors only
N No display
S Synchronous
A Asynchronous
L Local update
<b>The process flow of CALL TRANSACTION</b>
A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
<b>Overview of Batch Input Session</b>
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
<b>Reward if usefull</b> -
I am getting this error while file uploading
Hi!
I am getting this error while file uploading,I can't find any solution.
SRVE0026E: [Servlet Error]-[org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found]: javax.servlet.ServletException: org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found
at com.honeywell.sdm.base.controller.SDMActionServlet.service(SDMActionServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
Please help me.I have attached the bean,action ,jsp pages
uploadInfo.jsp
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html>
<HEAD>
<script>
function submitting(){
document.uploadForm.operation.value = "uploadOrgAdj";
document.uploadForm.action = "/uploadRecAction.do";
document.uploadForm.submit();
</script>
</HEAD>
<body>
<html:form action="/uploadRecAction" method="post" enctype="multipart/form-data">
Select the .xls File to upload data
<html:file property="fileName"></html:file>
<html:hidden property="operation" value=""/>
<html:button property="btn" value="Submit" onclick="submitting()"></html:button>
</html:form>
</body>
</html:html>
uploadAdjForm :
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
public class uploadAdjForm extends ActionForm{
private FormFile fileName;
* @return
public FormFile getFileName() {
System.out.println("getFileName"+fileName);
return fileName;
* @param string
public void setFileName(FormFile string) {
System.out.println("setileNmame"+string);
fileName = string;
Action:
public class uploadFinancialAdjAction extends DispatchAction{
public org.apache.struts.action.ActionForward uploadOrgAdj(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception {
String sForward = "UploadInfo";
HttpSession session = request.getSession();
String sStartIndex = null;
String sEndIndex = null;
try
uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
System.out.println(UploadForm.getFileName().getContentType().toString());
String file=UploadForm.getFileName().toString();
uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
ArrayList fileName = new ArrayList(); fileName = businessManager.getOrgAdjDetails(file);
boolean isMultipart = FileUpload.isMultipartContent(request);
if(isMultipart){
// Create a new file upload handler
DiskFileUpload upload = new DiskFileUpload();
// Parse the request
List items = upload.parseRequest(request);
//Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
//processFormField(item);
if(item.getFieldName().equalsIgnoreCase("txtStartIndex")){
sStartIndex = item.getString();
else if(item.getFieldName().equalsIgnoreCase("txtEndIndex")){
sEndIndex = item.getString();
uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
String file=UploadForm.getFileName().toString();
uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
ArrayList fileName = new ArrayList();
fileName = businessManager.getOrgAdjDetails(file);
}else{
if(item.getName()!=null && !item.getName().toUpperCase().endsWith(".XLS")){
throw new Exception("Please browse an excel file and Upload");
session.setAttribute("fileItem",item);
}//end of while
session.setAttribute("startIndex",sStartIndex);
session.setAttribute("endIndex",sEndIndex);
request.setAttribute("FileUploadStatus","true");
else{
throw new Exception("Error:Form is not multipart");
catch(Exception e)
System.out.println(e);
return mapping.findForward(sForward);
}Plz answer for my question
-
Error 2009 while uploading XAP to Store
I am getting error 2009 while uploading the XAP file to the store:
>"The Xap Processing for the package failed. Please refer to this page
>for troubleshooting information Validation errors
>2009: The embedded file MDILFileList.xml isn¹t allowed."The problem was that I was trying to upload a signed version of the xap, so this error code is not really helpful.
-
Error message while uploading the flat file
Hi Experts,
I am getting the error message while uploading the flat file.
Message class: MG
Number: 147
The message is: Several descriptions exist for the language JA.
Please guide me why this error is occuring.
Regards
Akshayhi,
how are you uploading the file and where ?
u can use open dataset , read dataset or gui_upload
check this link
http://help.sap.com/saphelp_nw04/helpdata/en/c8/e92637c2cbf357e10000009b38f936/frameset.htm
Maybe you are looking for
-
Which WSDL file to get the list of Groups present in OAM.
Hi All, Can any one tell me which WSDL file is to be used to get the list of groups present in OAM from an IDXML call. Please provide sample IDXML call if possible. Thanks in advance. Thanks & Regards, Siva Pokuri.
-
Help me! My keyboard just stopped working!
I just bought my MacBook at an Apple Store today. For several hours, I was enjoying it, no problem whatsoever. Later in the night, I was talking with friends and my keyboard just suddenly died on me. The trackpad, too. Thankfully I had the leftover k
-
Hello, when i use the :SYSTEM.MOUSE_BUTTON_PRESSED variable, it returns allways 1 for 1st and 2nd button and nothing for the 3rd (right) button. is anybody could tell me the reason why ?
-
Hello! We are ORACLE dba's who are new to TimesTen... We are running v7. TimesTen checkpoint and log files are in the /opt/TimesTen/TimesTenData directory, and /opt is running out of space. How do we relocate the logs and checkpoint files to a differ
-
Video Menu in Encore 2.0
Hey all, I'm trying to put video as the background of my menu for a dvd using Encore 2.0. I've split my video into two parts, the first playing as a 'first play' timeline and then going into a looped menu that I created in AE. I've linked and a