‎2007 Jul 18 10:25 AM
Hi gurus.
Im running a batch input but what it happens is that if i run it in mode E the subrc given is 0 but if i run it with mode N it returns a subrc of 1.001!!!
Does someone allready had this??
Thk,
Regards
‎2007 Jul 18 10:30 AM
check the sample code below.
messtab is of type BDCMSGCOLL.
Call the transaction and then use T100 to get the message.
DATA: l_mstring(480).
call transaction using
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE ctumode
UPDATE cupdate
MESSAGES INTO messtab.
l_subrc = sy-subrc.
SKIP.
LOOP AT messtab.
SELECT SINGLE * FROM t100 WHERE sprsl = messtab-msgspra
AND arbgb = messtab-msgid
AND msgnr = messtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH messtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
WRITE: /4 messtab-msgtyp, l_mstring(250).
ELSE.
WRITE: /4 messtab.
ENDIF.
ENDLOOP.
<b>rewards point for useful answer....</b>
regards....
Abhay Singh.
‎2007 Jul 18 10:29 AM
Hi,
SY-SUBRC = 1001 - Error in batch input processing.
This occurs when there is some error in the BDC execution like wrong data, wrong field or format anything it can be.
Please try to debug with mode 'E' and see where the error happened.
Or
Please check if your recording is fine.
As it may be the case that you have done the recording well,but still there is something missing in the recording.
Is the recording fine when you are running it in foreground,or some ok-code is missing?,for eg you may have to press back button while in foreground,which should be in recording.
This can only be corrected if your recording is fine.
<b>Reward points</b>
Regards
‎2007 Jul 18 10:29 AM
When you have the message id and number, you can use
FM: FORMAT_MESSAGE to retreive the actial message.
Eg:
DATA: L_TEXT(50) TYPE C.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = L_TEXT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
WRITE:/ L_TEXT.
ENDIF.
Kind Regards
<b>
reawrds point for useful; answer....</b>
‎2007 Jul 18 10:29 AM
Batch Input has a different response depending on the mode you are calling it. Mode 'N' means non-visible, and it rips off all non-error messages from the queue (more or less).
Mode 'E' is like to calling it visible, but only shows the screens if an error occurs.
Use MESSAGES into your CALL TRANSACTION sentence, and read the messages' table returned, you will have a lot more information about the batch than just by checking sy-subrc.
Take a look at this piece of crap code I use with my Batch Inputs to keep a more accurate control of them:
DATA: it_err TYPE TABLE OF bdcmsgcoll.
CALL TRANSACTION 'your_tcode_here' USING it_bdc
OPTIONS FROM wa_params
MESSAGES INTO it_err.
CHECK LINES( it_err ) > 0.
CALL FUNCTION 'CONVERT_BDCMSGCOLL_TO_BAPIRET2'
TABLES
imt_bdcmsgcoll = it_err
ext_return = it_re2.
APPEND LINES OF it_re2 TO it_ret.I do the last call because I like to read all my messages like BAPI's returns, but if you check the structure used
‎2007 Jul 18 10:30 AM
messages are stored in table T100.
use following logic
call transaction 'VA01' using bdcdata mode 'A' update 'S' messages into messtab.
messages raen stoted in variable sy-msgv1,sy-
msgv2...
if sy-subrc = 0.
loop at messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = MESSTAB-MSGID
LANG = MESSTAB-MSGSPRA
NO = MESSTAB-MSGNR
V1 = MESSTAB-MSGV1
V2 = MESSTAB-MSGV2
V3 = MESSTAB-MSGV3
V4 = MESSTAB-MSGV4
IMPORTING
MSG = ZMSG_TEXT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
ENDIF.
endif.
endloop.
Regards
<b>rewards point for useful answer....</b>
‎2007 Jul 18 10:30 AM
check the sample code below.
messtab is of type BDCMSGCOLL.
Call the transaction and then use T100 to get the message.
DATA: l_mstring(480).
call transaction using
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE ctumode
UPDATE cupdate
MESSAGES INTO messtab.
l_subrc = sy-subrc.
SKIP.
LOOP AT messtab.
SELECT SINGLE * FROM t100 WHERE sprsl = messtab-msgspra
AND arbgb = messtab-msgid
AND msgnr = messtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH messtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
WRITE: /4 messtab-msgtyp, l_mstring(250).
ELSE.
WRITE: /4 messtab.
ENDIF.
ENDLOOP.
<b>rewards point for useful answer....</b>
regards....
Abhay Singh.
‎2007 Jul 18 10:33 AM
hi
pl make sure the screen that you have recorded looks alike in recorded/executing servers..i had this probl once, happened to later see that the configuration of fields in both the servers were different...this is just a suggestion if you have recorded the txn. in one server and trying to execute the bdc in another server
if helpful, reward
Sathish. R