Display error messages in Call transaction
Hi Gurus,
I have donme BDC using call transaction..can anybody help me in displaying the error messages in call transaction..
A detailed code wud be very much helpful..
full marks wud given
regards
Sahil
hi check this,
PERFORM Z11_BDC_VA02.
ELSE.
MESSAGE I013 WITH TEXT-013.
ENDIF.
ELSE.
CLEAR V_FLAG.
MESSAGE E012 WITH TEXT-012.
ENDIF.
FORM z11_bdc_va02 .
*COVER 1
perform bdc_dynpro using 'SAPMV45A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-VBELN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-VBELN'
wa_head_detail-vbeln.
*COVER 2
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=T\03'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(01)'.
*COVER 3
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=ITNE'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(01)'.
*COVER 4
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG'.
perform bdc_field using 'VBAP-MATNR'
wa_head_detail-matnr.
perform bdc_field using 'RV45A-KWMENG'
v_kwmeng.
perform bdc_field using 'VBAP-VRKME'
wa_head_detail-meins.
*COVER 5
perform bdc_dynpro using 'SAPLSPO2' '0101'.
perform bdc_field using 'BDC_OKCODE'
'=OPT1'.
call transaction 'VA02' using it_tab1 mode 'A' UPDATE 'S' MESSAGES INTO
IT_TAB_ERROR.
"CAlling transaction with all screen
Loop at it_tab_error.
if it_tab_ERROR-MSGTYP = 'E' .
clear v_flag.
message I014 with TEXT-014.
else.
clear v_flag.
message I019 with TEXT-019.
endif.
endloop.
refresh it_tab1.
clear V_KWMENG.
ENDFORM. " z11_bdc_va02
Reward if helpful,
Gaurav J.
Edited by: GAURAV on Feb 4, 2008 9:10 AM
Similar Messages
-
Display Error Message in Co11n Transaction
Hello Experts,
I am using co11n transaction, While saving the transaction i need to display a
error message based on some conditions. I can display a error message but the screen got struck
and it is not returning to the PBO again. Can any one tell me the any Exits is available there in the transaction to display the error messages.
ThanksHai,
krupa, what u have to do is, u r using a screen exit right? Dont display the error message inside
the Function Exit. Instead, in the PAi module inside chain endchain of ur screen double click on your module and include the module in the TOPINCLUDE of the Main program( How to find this top include is goto se80-->
select function group XCOF--> EXPAND INCLUDE->LXCOFTOP -
>ZXCOFTOP----->DOUBLE CLICK and open it and put your module here and display ur error message. )
set the breakpoint here it will stop here
Regards,
Viverk
Edited by: vivek selvam on May 12, 2009 8:36 PM -
How to track error message when calling Transaction: va02
Hi all,
As we all know, when we change an order through T-Code: VA02, system will update modified data to corresponding database. Meanwhile, if our operate is not legal or incorrect on T-code: VA02, system will call corresponding error messages to us.
Now I want to know:
1. how to track the error messages
2. Is there any Tcode such as: SM21 that we can see the message logs after our operation?
Thanks.Hi ,
message table for call transaction
DATA: BEGIN OF G_T_MSG OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF G_T_MSG.
Exucute transaction via Call Transaction
CALL TRANSACTION 'FB01'
USING g_t_bdcdata
MODE g_l_mode
UPDATE 'S'
MESSAGES INTO g_t_msg .
errors will be stpored in the table g_t_msg ..
Thanks . -
Bdc error message in call transaction
Hi all,
Can anyone send me a program where they have used the ' BDCMSGCOLL ' structure and format_message FM. I need only complete program, please don't send sample codings or just a part of coding.
Points are assured.
Thanks and regards,
subbu.Hi,
Here is the BDC recording program for updating a custom field (out of 3 custom fields) in CALL TRANSACTION method depends upon which value is given in text file, based on that the corresponding radio button will be selected for that PERNR in PA30.(For 3 custom fields in PA0007) created.
Flat file contains 1) PENR 2) Custom field1 3) CF2 4) CF3.
The values are like [ '636363', ' ', 'X', ' ' ] .
Here is the complete program using BDCMSGCOLL structure.
report Y0007_BDC NO STANDARD PAGE HEADING MESSAGE-ID RP LINE-SIZE 180." LINE-COUNT 28.
DATA DECLARATION *
TYPES : BEGIN OF TY_0007,
PERNR TYPE PERNR, " PERNR
SCHKZ TYPE SCHKN, " Work Schudule
ZTERF TYPE PT_ZTERF, " Time Magmt Status
R1 TYPE C,
R2 TYPE C,
R3 TYPE C,
END OF TY_0007.
DATA : INT_0007 TYPE STANDARD TABLE OF TY_0007 WITH HEADER LINE,
WA_0007 TYPE TY_0007.
DATA: P_FNAME TYPE IBIPPARMS-PATH.
DATA : begin of int_out occurs 0,
pernr type persno,
mesg(300),
end of int_out.
DATA : BEGIN OF int_err occurs 0,
pernr type persno,
mesg(300),
end of int_err.
include bdcrecx1.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS : P_PATH TYPE string.
SELECTION-SCREEN END OF BLOCK B.
SELECTION-SCREEN END OF BLOCK A.
CALL FUNCTION FOR INPUT FILE NAME *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FNAME.
p_path = p_fname.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_PATH
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = INT_0007
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.
perform open_group.
*Looping pernr values*
LOOP AT INT_0007 INTO WA_0007.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*INSERTING THE PERNR VALUE*
perform bdc_field using 'RP50G-PERNR'
WA_0007-PERNR. "'00001011'.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC'
'0007'.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-PERNR'.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
perform bdc_field using 'RP50G-PERNR'
WA_0007-PERNR. "'1011'.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'RP50G-CHOIC'
'Planned Working Time - 0007'.
perform bdc_dynpro using 'MP000700' '2000'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0007-BEGDA'
'12/01/2007'.
perform bdc_field using 'P0007-ENDDA'
'12/31/9999'.
*INSERTING THE WORK SCHEDULE*
perform bdc_field using 'P0007-SCHKZ'
WA_0007-SCHKZ. "'N12'.
perform bdc_field using 'P0007-ZTERF'
WA_0007-ZTERF. "'1'.
*INSERTING THE OVERTIME CLASS*
IF WA_0007-R1 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_ELGBLE'
'X'.
ELSEIF WA_0007-R2 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_NOTELG'
'X'.
ELSEIF WA_0007-R3 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_TMPELG'
'X'.
ENDIF.
*BDC output for transaction code*
perform bdc_transaction using 'pa30'. (STD)
perform f_bdc_output using 'pa30'. (write on our own)
ENDLOOP.
**Writing the output**
PERFORM f_write_output.
perform close_group.
*& Form f_write_output
text
--> p1 text
<-- p2 text
FORM f_write_output .
*For Successfull Records*
if int_OUT[] IS NOT INITIAL.
WRITE : /50 TEXT-004 color 4.
write : / sy-uline.
LOOP AT INT_OUT.
WRITE : /40 int_out-pernr,50 '-->',54 int_out-mesg.
ENDLOOP.
ENDIF.
write / sy-uline.
SKIP 2.
*For Error records*
if int_err[] IS NOT INITIAL.
WRITE /53 text-005 color 6.
write / sy-uline.
LOOP AT int_err.
write :/40 int_err-pernr,50 '-->',54 int_err-mesg.
ENDLOOP.
endif.
write / sy-uline.
ENDFORM. " f_write_output
*& Form f_bdc_output
text
-->P_0369 text
FORM f_bdc_output USING VALUE(P_0369).
DATA: L_MSTRING(480).
DATA: L_SUBRC LIKE SY-SUBRC.
REFRESH MESSTAB.
*Capturing the output message*
CALL TRANSACTION 'PA30' USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
IF SMALLLOG <> 'X'.
LOOP AT MESSTAB.
*Selection for capturing the text for records*
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
*Moving the text from T100 to local variable*
L_MSTRING = T100-TEXT.
IF ( MESSTAB-MSGTYP = 'W' or
MESSTAB-MSGTYP = 'S' OR
MESSTAB-MSGTYP = 'E' ).
*Moving the success records pernr and text to internal table*
IF MESSTAB-MSGTYP = 'S'.
INT_OUT-PERNR = WA_0007-PERNR.
INT_OUT-MESG = L_MSTRING.
APPEND INT_OUT.
CLEAR INT_OUT.
*Moving the success records pernr and text to internal table*
ELSEIF MESSTAB-MSGTYP = 'E'.
*For getting the error text exactly*
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.
INT_ERR-PERNR = WA_0007-PERNR.
INT_ERR-MESG = L_MSTRING.
APPEND INT_ERR.
CLEAR INT_ERR.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
*& CALL FUNCTION 'BDC_OPEN_GROUP'
IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = E_GROUP
USER = E_USER
KEEP = E_KEEP
HOLDDATE = E_HDATE.
E_GROUP_OPENED = 'X'.
ENDIF.
*& CALL FUNCTION 'BDC_INSERT'
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'PA30'
TABLES
DYNPROTAB = BDCDATA.
*& CALL FUNCTION 'BDC_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.
ENDIF.
REFRESH BDCDATA.
ENDFORM. " f_bdc_output
Hope it helps u..
Kindly reward points if helpful
Regards,
Shanthi -
Error message during call transaction
Hi all,
I want to get the message type after calling the transaction method. I've simulated an input for error, and I expect that the returned message type should be 'E' or 'W'. But it (SY-MSGTY and msgtab-MSGTYP) still returns 'S' even there is error. What's wrong ?
Call transaction 'VL02N' USING BTAB MODE 'N' UPDATE 'S'.
messages into msgtab.CALL TRANSACTION tcode USING bdcdata
MODE ctumode
UPDATE cupdate
MESSAGES INTO messtab.
LOOP AT messtab.
msgtype = messtab-msgtyp.
Check what the actual tranaction is giving as message for eg. mm01 does give u a sucess message saying data for the matnr is already maintained. -
How to display error message ??
Hi,
I have a BDC program to upload data from an excel sheet. I could see that some records of data fail to pass and hence after my bdc run i would like to display error message for the failed records as follows:
costcenter:
cost element:
fiscal year:
etc etc
is it possible ?? how to do that ? please explain in detail.
for ur reference my program is pasted below.
thanks
*& Report ZBDC_BUDGET_UPLOAD
REPORT ZBDC_BUDGET_UPLOAD.
types: begin of tdata,
rec(150) type c,
end of tdata,
begin of tmtgp,
costcent LIKE CCSS-KOSTL,
costelem LIKE CCSS-KSTAR,
fisyear LIKE CCSS-GJAHR,
jan(10),
feb(10),
mar(10),
apr(10),
may(10),
jun(10),
jul(10),
aug(10),
sep(10),
oct(10),
nov(10),
dec(10),
end of tmtgp.
data: idata type table of tdata with header line.
data: imtgp type table of tmtgp with header line.
Data : fieldval(10) type c.
selection-screen begin of block b1 with frame title text-001.
parameters: p_file type localfile default 'C:\budget_data_csv.csv'.
selection-screen end of block b1.
include zbdcrecx1.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting static = 'X'
changing file_name = p_file.
start-of-selection.
perform upload_data.
loop at imtgp.
Write imtgp-fisyear to fieldval.
perform open_group.
perform bdc_dynpro using 'SAPLKPP0' '1000'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(04)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KPP0B-VALUE(04)'
fieldval.
Write imtgp-costcent to fieldval.
perform bdc_dynpro using 'SAPLKPP0' '1000'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(06)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KPP0B-VALUE(06)'
fieldval.
perform bdc_dynpro using 'SAPLKPP0' '1000'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(09)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-costelem to fieldval.
perform bdc_field using 'KPP0B-VALUE(09)'
fieldval.
perform bdc_dynpro using 'SAPLKPP0' '1000'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(04)'.
perform bdc_field using 'BDC_OKCODE'
'=CSPB'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-jan to fieldval.
perform bdc_field using 'Z-BDC03(01)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-feb to fieldval.
perform bdc_field using 'Z-BDC03(02)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(03)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-mar to fieldval.
perform bdc_field using 'Z-BDC03(03)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(04)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-apr to fieldval.
perform bdc_field using 'Z-BDC03(04)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(05)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-may to fieldval.
perform bdc_field using 'Z-BDC03(05)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(06)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-jun to fieldval.
perform bdc_field using 'Z-BDC03(06)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(07)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-jul to fieldval.
perform bdc_field using 'Z-BDC03(07)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(08)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-aug to fieldval.
perform bdc_field using 'Z-BDC03(08)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(09)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-sep to fieldval.
perform bdc_field using 'Z-BDC03(09)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(10)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-oct to fieldval.
perform bdc_field using 'Z-BDC03(10)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(11)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-nov to fieldval.
perform bdc_field using 'Z-BDC03(11)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(12)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
Write imtgp-dec to fieldval.
perform bdc_field using 'Z-BDC03(12)'
fieldval.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(12)'.
perform bdc_field using 'BDC_OKCODE'
'=CBUC'.
perform bdc_transaction using 'KP06'.
perform close_group.
endloop.
form upload_data.
data: filename type string.
clear idata.
refresh idata.
filename = p_file.
call function 'GUI_UPLOAD'
exporting filename = filename
filetype = 'ASC'
tables data_tab = idata
exceptions file_open_error = 1
file_read_error = 2
no_authority = 6
others = 17.
check sy-subrc = 0.
loop at idata.
clear imtgp.
split idata at ',' into imtgp-costcent imtgp-costelem imtgp-fisyear
imtgp-jan imtgp-feb imtgp-mar imtgp-apr imtgp-may imtgp-jun imtgp-jul
imtgp-aug imtgp-sep imtgp-oct imtgp-nov imtgp-dec.
append imtgp.
endloop.
endform.check the below code,.,
DATA : t_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
CALL TRANSACTION '<DELIVERYTRANSACTION>' USING t_bdctab
mode 'N'
MESSAGES INTO t_bdcmsgcoll.
DESCRIBE TABLE t_bdcmsgcoll LINES g_lines.
READ TABLE t_bdcmsgcoll INDEX g_lines.
IF t_bdcmsgcoll-msgtyp = 'S' AND
t_bdcmsgcoll-msgid = <Msg id> AND
t_bdcmsgcoll-msgnr = <Msg number>.
* Trap your Call Transaction messages
t_success-deliverynumber = t_bdcmsgcoll-msgv1.
* You can format the message returned by call transaction using function 'FORMAT_MESSAGE' which will return g_mesg
t_success-message = g_mesg.
APPEND t_success.
CLEAR t_success.
ELSE.
* If there an Error-Do this..
READ TABLE t_bdcmsgcoll WITH KEY msgtyp = 'E'.
IF sy-subrc = 0.
* Format your message using FORMAT_MESSAGE "FM
CLEAR g_mesg.
t_error-msg = g_mesg_incl.
APPEND t_error.
CLEAR t_error.
ENDIF.
ENDIF.
* Clear for next run
CLEAR: t_bdcmsgcoll,
t_bdctab.
REFRESH: t_bdcmsgcoll[],
t_bdctab[]. -
Regarding error message from a transaction
Hello all,
I have a scenario where i need to collect all the error message from a trasaction and display it in a pop up.
i am calling a function module and inturn calling transaction 'FB08' using bdc. i may get one or more error message. if there are more than one messages from my function module then i need to display this messages in a popup.
Currently i am displaying one message using 'message ID' syntax at the bottom. what should i do to display error messages in a popup if there are more message
Thanks,
Raju N.use following fm.
CALL FUNCTION 'COPO_POPUP_TO_DISPLAY_TEXTLIST'
EXPORTING
TASK = 'DISPLAY'
titel = 'Creation Log'
IMPORTING
FUNCTION =
TABLES
text_table = i_documents_log. -
Error message in ME22n transaction
Hi All,
We want to display error message at status bar of me22n transaction for some certain conditon.I am using a user exit where actually i am writing a code.I tried to write like this 'Message E101(ZE) ' but message is not displaying at status bar.
Thanks
MohitHi ,
1 >If message is not getting shown at status bar then is it getting shown as popo up. ?
2 > If message is not at all getting shown then that means your exit is not getting called. Please put a break point inside your exit and exeute me22n and see if your debugger gets triggered.
If Debugger does not get triggered then that mean , either you have not created Project for yoour Exit OR you are using incorrect Exit.
Please revert with your observatins so that can help you further.
Hope this is helpful.
Regards,
Uma Dave -
Display error message as as status message on the screen
Hi all,
How to display error message as as status message on the screen
The requirement is if I call the screen, it should get with the error message in the status bar. If I write with error message 'E' error mesage information displays and when I click on exit, it leave the current transaction.
if i display success message and use display like 'E' it display the error message but if i save it save the transaction.
i cannot use leave to screen also because of subscreen. if i use leave to screen system display set screen not allowed in subscreen.
so i want to stop the processing or do not allow the transaction to complete on the message.Hi
displaying error message like status message will help u?
try the below code
MESSAGE 'Error' TYPE 'E' DISPLAY LIKE 'S'.
cheers
shibu -
Pls tell me how to check the errors in BDC CALL TRANSACTION
lemme know
HI ,
check for the bold part..
REPORT ZCONCUR_UPLOAD_TO_SAP NO STANDARD PAGE HEADING
LINE-SIZE 170
LINE-COUNT 58
MESSAGE-ID ZM.
Internal Table *
*-Internal table for the Header input data from the Comma Delimited file
DATA: BEGIN OF IT_DATA_HEADER OCCURS 0,
ID TYPE C, "Identifier
BUKRS(6), "Company Code
WAERS(7), "Currency
NEWKO(12), "Vendor
XBLNR(16), "First Name
XBLNR1(16), "Last Name
BLDAT(12), "Document/Posting date
PK(15), "Reference
WRBTR(15), "Amount
BKTXT(27), "Doc.header text
BKTXT1(27), "Item text
SELNO(8), "Serial No
END OF IT_DATA_HEADER.
*-Internal table for the item input data from the Comma Delimited file
DATA: BEGIN OF IT_DATA_ITEM OCCURS 0,
ID TYPE C, "Identifier
NEWKO(19), "Vendor
BUKRS(6), "Company Code
KOSTL(12), "Cost center
WRBTR(15), "Amount
SGTXT(50), "Text
SELNO(8), "Serial No Header
SELNO1(8), "Serial No item
END OF IT_DATA_ITEM .
*-Internal table for the Header input data from the Comma Delimited file
*-Removing " " From Comma Delimited file
DATA: BEGIN OF IT_FINAL_HEADER OCCURS 0,
ID TYPE C, "Identifier
BUKRS LIKE BKPF-BUKRS, "Company Code
WAERS LIKE BKPF-WAERS, "Currency
NEWKO TYPE RF05A-NEWKO, "Vendor
XBLNR LIKE BKPF-XBLNR,
XBLNR1 LIKE BKPF-XBLNR,
BLDAT(10), " LIKE BKPF-BLDAT, "Date
PK(15), "Reference
WRBTR(15), "Amount
BKTXT LIKE BKPF-BKTXT, "Doc.header text
BKTXT1 LIKE BKPF-BKTXT, "Item text
SELNO TYPE I, "Serial No
FLAG TYPE C,
END OF IT_FINAL_HEADER.
*-Internal table for the Item input data from the Comma Delimited file
*-Removing " " From Comma Delimited file
DATA: BEGIN OF IT_FINAL_ITEM OCCURS 0,
ID TYPE C, "Identifier
NEWKO TYPE RF05A-NEWKO, "Account
BUKRS LIKE BKPF-BUKRS, "Company Code
KOSTL LIKE BSEG-KOSTL, "Cost Center
WRBTR(15), "Amount
SGTXT LIKE BSEG-SGTXT, "Text
SELNO TYPE I, "Serial No
SELNO1 TYPE I, "Serial No
END OF IT_FINAL_ITEM.
**-Internal table for the input data from the file
DATA : BEGIN OF P_DOWNLOAD OCCURS 0,
V_FILEREC(1000) TYPE C,
END OF P_DOWNLOAD.
*--- Internal Table for Success messages
DATA : BEGIN OF I_SUCC OCCURS 0,
HEADER(50),
MSG(100), "SUCCESS message
END OF I_SUCC.
*--- Internal Table for error messages
DATA : BEGIN OF I_ERROR_LOG OCCURS 0,
HEADER(50),
MSG(100), "Error message
END OF I_ERROR_LOG.
*--- Internal table for getting the BDC data
DATA : BEGIN OF IT_BDCDATA OCCURS 0.
INCLUDE STRUCTURE BDCDATA. " Table to hold BDC data
DATA : END OF IT_BDCDATA.
*--- Internal table for reading the messages of call transaction
DATA : BEGIN OF IT_MESSAGE_TAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL. "Table to hold messages
DATA : END OF IT_MESSAGE_TAB.
DATA DECLARATIONS *
DATA:
V_ERROR_COUNTER TYPE I, " error records counter
V_MSG(100), " used for Error message
V_LINES TYPE I, " used for format message
V_HEAD LIKE SY-CPROG, " Heading for report
XMODE VALUE 'N', " EXECUTION MODE
V_SUCCESS_COUNTER TYPE I, " Success records counter
V_UNAME LIKE APQI-USERID, " User Name
V_TOTAL TYPE I. " Total records uploaded
DATA : V_SELNO TYPE I.
DATA : V_CHECK TYPE I.
DATA : V_HEADER(50) TYPE C. "Header Information
DATA : V_SUCC_MSG LIKE BDCMSGCOLL-MSGV1."Success Message
DATA : V_ZERO(4) VALUE '0.00'. "Checking Zero
DATA : V_CHECK_ZERO LIKE BSEG-WRBTR. "Checking Zero
DATA : V_CHECK_ZERO1 LIKE BSEG-WRBTR. "Checking Zero
DATA : V_SYSTEMDATE LIKE BKPF-BUDAT.
DATA : V_VALUE TYPE I.
DATA : V_VALUE1 TYPE I.
DATA : V_VALUE2 TYPE I.
Flags
DATA:
F_BDC_OPEN, " BDC session open check.
F_CONTINUE_PROCESSING. " To continue further processing
CONSTANTS *
CONSTANTS:
C_SESSION_NAME LIKE APQI-GROUPID VALUE 'F-43', "Session
C_X VALUE 'X'. " Used for falgs
SELECTION SCREEN *
*--- Selection Screen with Block and title
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-038.
PARAMETER: P_FNAME LIKE RLGRAP-FILENAME DEFAULT
'C:\Concur.txt'.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION SCREEN ON VALUE-REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = P_FNAME
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Error in opening a file'(009).
ENDIF.
Top-of-page *
TOP-OF-PAGE .
*---perform to display the standard header
PERFORM STANDARD_HEADER.
--START OF SELECTION--
START-OF-SELECTION.
Upload data
PERFORM UPLOAD_DATA.
move data to bdcdata internal table
PERFORM MOVE_DATA_F43.
*--- Posting the valid data to F-43
IF F_BDC_OPEN = C_X.
*---perform to close bdc group
PERFORM CLOSE_GROUP.
ENDIF.
END OF SELECTION *
END-OF-SELECTION.
CHECK F_CONTINUE_PROCESSING IS INITIAL.
PERFORM DISPLAY_REPORT.
*& Form MESSAGE_FORMAT
MESSAGE FORMAT
FORM MESSAGE_FORMAT.
CLEAR V_MSG.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MESSAGE_TAB-MSGID
LANG = 'EN'
NO = IT_MESSAGE_TAB-MSGNR
V1 = IT_MESSAGE_TAB-MSGV1
V2 = IT_MESSAGE_TAB-MSGV2
V3 = IT_MESSAGE_TAB-MSGV3
V4 = IT_MESSAGE_TAB-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
V_MSG = SPACE.
ENDIF.
ENDFORM. " MESSAGE_FORMAT
*& Form F4_HELP
FORM F4_HELP.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = 'C:\'
MODE = 'O'
TITLE = TEXT-025 "'Upload File'
IMPORTING
FILENAME = P_FNAME
EXCEPTIONS
SELECTION_CANCEL = 3
SELECTION_ERROR = 4.
CASE SY-SUBRC.
WHEN 3.
MESSAGE I000 WITH TEXT-007. " Selection Cancel.
WHEN 4.
MESSAGE I000 WITH TEXT-008. " Selection Error.
ENDCASE.
ENDFORM. " F4_HELP
*& Form STANDARD_HEADER
STANDARD_HEADER
FORM STANDARD_HEADER.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
CASE V_HEAD.
WHEN 'Summary Report'(001).
WHEN 'SUCC_REPORT'.
**---To display the field headings for Success report.
ULINE (154).
WRITE : /001 SY-VLINE,
002 'Header Details '(011),
052 SY-VLINE,
053 'Document Number'(036),
154 SY-VLINE.
ULINE (154).
WHEN 'Error Report'.
**---To display the field headings for error report.
ULINE (154).
WRITE : /001 SY-VLINE,
002 'Header Details '(011),
052 SY-VLINE,
053 'Error Message/Text'(035),
154 SY-VLINE.
ULINE (154).
ENDCASE.
ENDFORM. " STANDARD_HEADER
*& Form DISPLAY_REPORT
Display Report Details
FORM DISPLAY_REPORT.
PERFORM SUMMARY_REPORT.
PERFORM SUCC_REPORT.
PERFORM ERROR_REPORT.
ENDFORM. " DISPLAY_REPORT
*& Form SUMMARY_REPORT
Success & Error Count Number
FORM SUMMARY_REPORT.
WRITE : /030 SY-TITLE.
SKIP 1.
WRITE : /005 'Program Name : '(032),
024 SY-REPID,
080 'Date :'(033),
088 SY-DATUM.
SKIP 1.
V_HEAD = 'Summary Report'(001).
ULINE (132).
WRITE : /1 SY-VLINE,
5 'No. of Records read from the Data file'(014),
45 ':', V_TOTAL LEFT-JUSTIFIED,
132 SY-VLINE,
/1 SY-VLINE,
5 'No. of Records successfully posted'(015),
45 ':', V_SUCCESS_COUNTER LEFT-JUSTIFIED,
132 SY-VLINE,
/1 SY-VLINE,
5 'No. of Records Failed'(023),
45 ':'(031), V_ERROR_COUNTER LEFT-JUSTIFIED,
132 SY-VLINE.
IF NOT F_BDC_OPEN IS INITIAL.
WRITE: /1 SY-VLINE,
5 'Session Name'(022),
45 ':'(031), C_SESSION_NAME LEFT-JUSTIFIED,
132 SY-VLINE.
ENDIF.
ULINE (132).
IF NOT F_BDC_OPEN IS INITIAL.
WRITE: /1 SY-VLINE,
5 'Session Name'(022),
45 ':'(031), C_SESSION_NAME LEFT-JUSTIFIED,
132 SY-VLINE.
ENDIF.
ULINE (132).
ENDFORM. " SUMMARY_REPORT
*& Form ERROR_REPORT
Error Report
FORM ERROR_REPORT.
IF NOT I_ERROR_LOG[] IS INITIAL.
SORT I_ERROR_LOG. " by tcode.
V_HEAD = 'Error Report'(013).
NEW-PAGE.
LOOP AT I_ERROR_LOG.
WRITE: /001 SY-VLINE,
002 I_ERROR_LOG-HEADER,
052 SY-VLINE,
053 I_ERROR_LOG-MSG,
154 SY-VLINE.
ULINE (154).
ENDLOOP.
ENDIF.
ENDFORM. " ERROR_REPORT
*& Form ERROR_REPORT
Success Report
FORM SUCC_REPORT.
IF NOT I_SUCC[] IS INITIAL.
SORT I_SUCC. " by tcode.
V_HEAD = 'SUCC_REPORT'(034).
NEW-PAGE.
LOOP AT I_SUCC.
WRITE: /001 SY-VLINE,
002 I_SUCC-HEADER,
052 SY-VLINE,
053 I_SUCC-MSG,
154 SY-VLINE.
ULINE (154).
ENDLOOP.
ENDIF.
ENDFORM. " SUCC_REPORT
*& Form OPEN_SESSION
FORM OPEN_SESSION.
DATA : V_DATE LIKE SY-DATUM. " For Hold Date.
V_DATE = SY-DATUM - 1. " Hold date
V_UNAME = SY-UNAME. " User name
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = C_SESSION_NAME
HOLDDATE = V_DATE
KEEP = 'X'
USER = V_UNAME
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 I000 WITH 'Session can not be opened'(019).
STOP.
ENDIF.
F_BDC_OPEN = 'X'.
ENDFORM. " OPEN_SESSION
*& Form BDC_INSERT
FORM BDC_INSERT USING P_TCODE TYPE ANY.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = P_TCODE
TABLES
DYNPROTAB = IT_BDCDATA
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.
MESSAGE I000 WITH 'Unable to insert, Error record'(037).
STOP.
ENDIF.
ENDFORM. " BDC_INSERT
*& Form CLOSE_GROUP
FORM CLOSE_GROUP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'Session can not be closed'(021).
STOP.
ENDIF.
ENDFORM. " CLOSE_GROUP
*& Form UPLOAD_DATA
Upload Data From the text file
FORM UPLOAD_DATA.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FNAME
FILETYPE = 'DAT'
TABLES
DATA_TAB = P_DOWNLOAD
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
OTHERS = 10.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'File does not Exist'(003).
ELSEIF P_DOWNLOAD[] IS INITIAL.
MESSAGE E000 WITH 'Input file is empty'(004).
ENDIF.
DATA: V_INDEX LIKE SY-TABIX.
IF NOT P_DOWNLOAD[] IS INITIAL.
LOOP AT P_DOWNLOAD.
V_INDEX = SY-TABIX.
*Removing double quotes
DO.
REPLACE '"' WITH '' INTO P_DOWNLOAD.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDDO.
MODIFY P_DOWNLOAD INDEX V_INDEX.
CONDENSE P_DOWNLOAD.
IF P_DOWNLOAD(1) = '1'.
*Finding the header information, creating key field
V_SELNO = SY-TABIX.
ENDIF.
WE ARE NOT HAVING KEY FIELD IN HEADER/ITEM IN THE FILE.
SO WE ARE CREATING MANUAL KEY FIELD IN INTERNAL TABLE (SELNO).
IF P_DOWNLOAD(1) = '1'.
Moving header information into IT_DATA_HEADER Internal Table
SPLIT P_DOWNLOAD AT ',' INTO
IT_DATA_HEADER-ID
IT_DATA_HEADER-BUKRS
IT_DATA_HEADER-WAERS
IT_DATA_HEADER-NEWKO
IT_DATA_HEADER-XBLNR
IT_DATA_HEADER-XBLNR1
IT_DATA_HEADER-BLDAT
IT_DATA_HEADER-PK
IT_DATA_HEADER-WRBTR
IT_DATA_HEADER-BKTXT
IT_DATA_HEADER-BKTXT1.
IT_DATA_HEADER-SELNO = V_SELNO.
CONDENSE : IT_DATA_HEADER-ID, IT_DATA_HEADER-BUKRS,
IT_DATA_HEADER-WAERS, IT_DATA_HEADER-NEWKO,
IT_DATA_HEADER-XBLNR, IT_DATA_HEADER-XBLNR1,
IT_DATA_HEADER-BLDAT, IT_DATA_HEADER-PK,
IT_DATA_HEADER-WRBTR, IT_DATA_HEADER-BKTXT,
IT_DATA_HEADER-BKTXT1, IT_DATA_HEADER-SELNO.
APPEND IT_DATA_HEADER.
CLEAR IT_DATA_HEADER.
ELSEIF P_DOWNLOAD(1) = '2'.
Moving header information into IT_DATA_ITEM Internal Table
SPLIT P_DOWNLOAD AT ',' INTO
IT_DATA_ITEM-ID
IT_DATA_ITEM-NEWKO
IT_DATA_ITEM-BUKRS
IT_DATA_ITEM-KOSTL
IT_DATA_ITEM-WRBTR
IT_DATA_ITEM-SGTXT.
IT_DATA_ITEM-SELNO = V_SELNO.
IT_DATA_ITEM-SELNO1 = SY-TABIX.
CONDENSE: IT_DATA_ITEM-ID,IT_DATA_ITEM-NEWKO,IT_DATA_ITEM-BUKRS,
IT_DATA_ITEM-KOSTL,IT_DATA_ITEM-WRBTR,
IT_DATA_ITEM-SGTXT,IT_DATA_ITEM-SELNO,
IT_DATA_ITEM-SELNO1.
APPEND IT_DATA_ITEM.
CLEAR IT_DATA_ITEM.
ENDIF.
ENDLOOP.
*SORT HEADER & ITEM INTERNAL Table
SORT IT_DATA_HEADER BY SELNO.
SORT IT_DATA_ITEM BY SELNO SELNO1.
*Header Information
LOOP AT IT_DATA_HEADER.
IT_FINAL_HEADER-ID = IT_DATA_HEADER-ID.
IT_FINAL_HEADER-BUKRS = IT_DATA_HEADER-BUKRS.
IT_FINAL_HEADER-WAERS = IT_DATA_HEADER-WAERS.
IT_FINAL_HEADER-NEWKO = IT_DATA_HEADER-NEWKO.
CONCATENATE IT_DATA_HEADER-XBLNR IT_DATA_HEADER-XBLNR1
INTO IT_FINAL_HEADER-XBLNR.
IT_FINAL_HEADER-BLDAT = IT_DATA_HEADER-BLDAT.
IT_FINAL_HEADER-PK = IT_DATA_HEADER-PK.
IT_FINAL_HEADER-WRBTR = IT_DATA_HEADER-WRBTR.
IT_FINAL_HEADER-BKTXT = IT_DATA_HEADER-BKTXT.
IT_FINAL_HEADER-BKTXT1 = IT_DATA_HEADER-BKTXT1.
IT_FINAL_HEADER-SELNO = IT_DATA_HEADER-SELNO.
APPEND IT_FINAL_HEADER.
CLEAR IT_FINAL_HEADER.
ENDLOOP.
*Item Information
LOOP AT IT_DATA_ITEM.
CHECKING ZERO IN THE IT_DATA_ITEM-WRBTR FIELD
It will not append the IT_FINAL_ITEM
V_CHECK_ZERO = IT_DATA_ITEM-WRBTR.
IF V_CHECK_ZERO NE V_CHECK_ZERO1. "V_ZERO.
IT_FINAL_ITEM-ID = IT_DATA_ITEM-ID.
IT_FINAL_ITEM-NEWKO = IT_DATA_ITEM-NEWKO.
IT_FINAL_ITEM-BUKRS = IT_DATA_ITEM-BUKRS.
IT_FINAL_ITEM-KOSTL = IT_DATA_ITEM-KOSTL.
IT_FINAL_ITEM-WRBTR = IT_DATA_ITEM-WRBTR.
IT_FINAL_ITEM-SGTXT = IT_DATA_ITEM-SGTXT.
IT_FINAL_ITEM-SELNO = IT_DATA_ITEM-SELNO.
IT_FINAL_ITEM-SELNO1 = IT_DATA_ITEM-SELNO1.
APPEND IT_FINAL_ITEM.
CLEAR IT_FINAL_ITEM.
CLEAR : V_CHECK_ZERO,V_CHECK_ZERO1.
ENDIF.
ENDLOOP.
SORT IT_FINAL_HEADER BY SELNO.
SORT IT_FINAL_ITEM BY SELNO.
ENDIF.
ENDFORM. " UPLOAD_DATA
*& Form MOVE_DATA_F43
Call Transaction F-43
FORM MOVE_DATA_F43.
*MOVE THE SYSTEM DATE TO
CLEAR V_SYSTEMDATE.
V_SYSTEMDATE = SY-DATUM.
LOOP AT IT_FINAL_HEADER.
CLEAR V_CHECK.
V_CHECK = IT_FINAL_HEADER-SELNO.
MOVE HEADER DATA TO BDCDATA INTERNAL TABLE
PERFORM BDC_BUILD_HEADER.
MOVE ITEM DATA TO BDCDATA INTERNAL TABLE
PERFORM BDC_BUILD_ITEM.
<b>* Call Transcation (F-43)
CALL TRANSACTION 'F-43' USING IT_BDCDATA
MODE XMODE
UPDATE 'S'
MESSAGES INTO IT_MESSAGE_TAB.</b>
IF error record found, it will move to batch Input session
IF SY-SUBRC <> 0.
V_ERROR_COUNTER = V_ERROR_COUNTER + 1. " Inc the counter
CLEAR V_LINES.
DESCRIBE TABLE IT_MESSAGE_TAB LINES V_LINES.
READ TABLE IT_MESSAGE_TAB INDEX V_LINES.
*--- <b>Perform to read the messages
PERFORM MESSAGE_FORMAT.</b>*--- Appending the error records into error table
CONDENSE IT_FINAL_HEADER-BUKRS.
CONDENSE IT_FINAL_HEADER-NEWKO.
CONDENSE IT_FINAL_HEADER-XBLNR.
CONDENSE IT_FINAL_HEADER-BLDAT.
CONCATENATE IT_FINAL_HEADER-BUKRS ','
IT_FINAL_HEADER-NEWKO ','
IT_FINAL_HEADER-XBLNR ','
IT_FINAL_HEADER-BLDAT
INTO V_HEADER.
I_ERROR_LOG-HEADER = V_HEADER.
I_ERROR_LOG-MSG = V_MSG.
APPEND I_ERROR_LOG.
CLEAR I_ERROR_LOG.
*-- Posting the error record to Session
IF F_BDC_OPEN IS INITIAL.
PERFORM OPEN_SESSION.
ENDIF.
PERFORM BDC_INSERT USING 'F-43'.
ELSE.
V_SUCCESS_COUNTER = V_SUCCESS_COUNTER + 1.
*-- READING ONLY SUCCESS MESSAGE(MSGNR 312)
LOOP AT IT_MESSAGE_TAB WHERE MSGNR = '312'.
V_SUCC_MSG = IT_MESSAGE_TAB-MSGV1.
ENDLOOP.
*--- Perform to read the messages
PERFORM MESSAGE_FORMAT.
*--- Appending the Success records into Success table
CONDENSE IT_FINAL_HEADER-BUKRS.
CONDENSE IT_FINAL_HEADER-NEWKO.
CONDENSE IT_FINAL_HEADER-PK.
CONDENSE IT_FINAL_HEADER-XBLNR.
CONDENSE IT_FINAL_HEADER-BLDAT.
CONCATENATE IT_FINAL_HEADER-BUKRS ','
IT_FINAL_HEADER-NEWKO ','
IT_FINAL_HEADER-PK ','
IT_FINAL_HEADER-XBLNR ','
IT_FINAL_HEADER-BLDAT
INTO V_HEADER.
I_SUCC-HEADER = V_HEADER.
I_SUCC-MSG = V_SUCC_MSG.
APPEND I_SUCC.
CLEAR I_SUCC.
ENDIF.
V_TOTAL = V_TOTAL + 1.
REFRESH: IT_BDCDATA,
IT_MESSAGE_TAB.
CLEAR: IT_BDCDATA,
IT_MESSAGE_TAB.
ENDLOOP.
ENDFORM. " MOVE_DATA_F43
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
*& Form BDC_BUILD_HEADER
Header Information
FORM BDC_BUILD_HEADER.
Header Details
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_FIELD USING 'BKPF-BLDAT'
IT_FINAL_HEADER-BLDAT.
PERFORM BDC_FIELD USING 'BKPF-BLART'
'KR'.
PERFORM BDC_FIELD USING 'BKPF-BUKRS'
IT_FINAL_HEADER-BUKRS.
Moveing System date to Posting date in the document
CLEAR IT_FINAL_HEADER-BLDAT.
CONCATENATE V_SYSTEMDATE4(4) V_SYSTEMDATE0(4)
INTO IT_FINAL_HEADER-BLDAT.
PERFORM BDC_FIELD USING 'BKPF-BUDAT'
IT_FINAL_HEADER-BLDAT.
PERFORM BDC_FIELD USING 'BKPF-WAERS'
IT_FINAL_HEADER-WAERS.
PERFORM BDC_FIELD USING 'BKPF-XBLNR'
IT_FINAL_HEADER-PK.
PERFORM BDC_FIELD USING 'BKPF-BKTXT'
IT_FINAL_HEADER-BKTXT.
PERFORM BDC_FIELD USING 'FS006-DOCID' '*'.
IF IT_FINAL_HEADER-WRBTR CA '-'.
REPLACE '-' WITH SPACE INTO IT_FINAL_HEADER-WRBTR.
CONDENSE IT_FINAL_HEADER-WRBTR.
PERFORM BDC_FIELD USING 'RF05A-NEWBS' '25'.
ELSE.
PERFORM BDC_FIELD USING 'RF05A-NEWBS' '31'.
ENDIF.
PERFORM BDC_FIELD USING 'RF05A-NEWKO'
IT_FINAL_HEADER-NEWKO.
*-- Item Vendor Details
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0302'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'BSEG-WRBTR'
IT_FINAL_HEADER-WRBTR.
PERFORM BDC_FIELD USING 'BSEG-SGTXT'
IT_FINAL_HEADER-BKTXT1.
ENDFORM. " BDC_BUILD_HEADER
*& Form BDC_BUILD_ITEM
Item Information
FORM BDC_BUILD_ITEM.
DATA L_FIRST TYPE C.
LOOP AT IT_FINAL_ITEM WHERE SELNO = V_CHECK.
IF L_FIRST IS INITIAL.
L_FIRST = C_X.
Line Item ( PstKy,Account & New Company Code)
CONDENSE IT_FINAL_HEADER-BLDAT.
IF IT_FINAL_ITEM-WRBTR CA '-'.
REPLACE '-' WITH SPACE INTO IT_FINAL_ITEM-WRBTR.
CONDENSE IT_FINAL_ITEM-WRBTR.
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0302'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' '/00',
'RF05A-NEWBS' '50',
'RF05A-NEWKO' IT_FINAL_ITEM-NEWKO,
'RF05A-NEWBK' IT_FINAL_ITEM-BUKRS.
ELSE.
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0302'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' '/00',
'RF05A-NEWBS' '40',
'RF05A-NEWKO' IT_FINAL_ITEM-NEWKO,
'RF05A-NEWBK' IT_FINAL_ITEM-BUKRS.
ENDIF.
Amount & Text
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0300'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' '/00',
'BSEG-WRBTR' IT_FINAL_ITEM-WRBTR,
'BSEG-SGTXT' IT_FINAL_ITEM-SGTXT,
'DKACB-FMORE' 'X'.
Cost Center
PERFORM BDC_DYNPRO USING 'SAPLKACB' '0002'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' 'ENTE',
'COBL-KOSTL' IT_FINAL_ITEM-KOSTL.
ELSE.
Line Item ( PstKy,Account & New Company Code)
IF IT_FINAL_ITEM-WRBTR CA '-'.
REPLACE '-' WITH SPACE INTO IT_FINAL_ITEM-WRBTR.
CONDENSE IT_FINAL_ITEM-WRBTR.
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0300'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' '/00',
'RF05A-NEWBS' '50',
'RF05A-NEWKO' IT_FINAL_ITEM-NEWKO,
'RF05A-NEWBK' IT_FINAL_ITEM-BUKRS.
ELSE.
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0300'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' '/00',
'RF05A-NEWBS' '40',
'RF05A-NEWKO' IT_FINAL_ITEM-NEWKO,
'RF05A-NEWBK' IT_FINAL_ITEM-BUKRS.
ENDIF.
PERFORM BDC_DYNPRO USING 'SAPLKACB' '0002'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' 'ENTE'.
Amount & Text
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0300'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' '/00',
'BSEG-WRBTR' IT_FINAL_ITEM-WRBTR,
'BSEG-SGTXT' IT_FINAL_ITEM-SGTXT,
'DKACB-FMORE' 'X'.
Cost Center
PERFORM BDC_DYNPRO USING 'SAPLKACB' '0002'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' 'ENTE',
'COBL-KOSTL' IT_FINAL_ITEM-KOSTL.
ENDIF.
ENDLOOP.
*Save Details
PERFORM BDC_DYNPRO USING 'SAPMF05A' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_DYNPRO USING 'SAPLKACB' '0002'.
PERFORM BDC_FIELD USING: 'BDC_OKCODE' 'ENTE'.
ENDFORM. " BDC_BUILD_ITEM
Thanks
Mahesh -
Displaying error messages from application log
Hi,
I am using the function module RV_DELIVERY_CREATE for creating delivery in my program. If the sy-subrc is not zero i.e if delivery is not created, i have to display error messages collected inside the application.How can i do this ?
The object nd subobject are existing in SLG0 but when i
tried to see the object and subobject in SLG1 transaction , no logs were found.
Do we need to activate the object and sunobject somewhere before logging can take place??
I am using the following code in my program to display the logs but it is displaying no logs found:
CALL FUNCTION 'APPL_LOG_SET_OBJECT'
EXPORTING
object = 'ZCH_SCL'
subobject = 'DL'
LOG_HANDLE = ' '
NO_LOG = ' '
EXCEPTIONS
OBJECT_NOT_FOUND = 1
SUBOBJECT_NOT_FOUND = 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.
CALL FUNCTION 'APPL_LOG_INIT'
EXPORTING
OBJECT = 'ZCH_SCL'
SUBOBJECT = 'DL'
LOG_HANDLE = ' '
EXCEPTIONS
OBJECT_NOT_FOUND = 1
SUBOBJECT_NOT_FOUND = 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.
PERFORM z_call_rv_delivery_create. " to call fm rv_delivery_create
IF sy-subrc ne 0.
CALL FUNCTION 'APPL_LOG_DISPLAY_INTERN'
EXPORTING
object = 'ZCH_SCL'
subobject = 'DL'
title_list_screen = 'Error Logs'
COLUMN_SELECTION = '11112221122 '
COLUMN_SELECTION_MSG_JUMP = '1'
EXTERNAL_NUMBER_DISPLAY_LENGTH = 20
I_S_DISPLAY_PROFILE =
IMPORTING
NUMBER_OF_PROTOCOLS =
EXCEPTIONS
OBJECT_NOT_FOUND = 1
SUBOBJECT_NOT_FOUND = 2
OTHERS = 3
thanks,
vartikaHi Vartika,
you need to save that log after creating and appending to it.
here is a code to save that log.
If log created, save to database
if e_bal_hndl is not initial.
refresh: bal_hndl.
append e_bal_hndl to bal_hndl.
call function 'BAL_DB_SAVE'
exporting
i_client = sy-mandt
i_in_update_task = 'X'
i_t_log_handle = bal_hndl
importing
e_new_lognumbers = log_no
exceptions
log_not_found = 1
save_not_allowed = 2
numbering_error = 3
others = 4.
u have to write this code after appending info to Log.
hope this will help.
regards,
vikas -
How do i get data when displaying error message in BDC
hi,
I have generated one internal table for displaying error message using BDCMSGCOLL, i want the the error to display according to the field name,
Hw can i get it...
ex: <Material name> Error message as name already created or unit doesnt exit...
Pls reply,
Regards,
Divi.Hi Divya,
Try the below
CALL TRANSACTION 'MM01'
USING bdcdata
MODE 'N'
MESSAGES INTO MSGTAB.
IF SY-SUBRC NE 0.
move itab-matnr to jtab-matnr.
append jtab.
PERFORM CHECK.
ENDIF.
FORM CHECK.
LOOP AT MSGTAB where msgtyp = 'E'.
read table jtab index sy-index.
write:/ jtab-matnr.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
LANGUAGE = sy-langu
MSG_ID = MSGTAB-MSGID
MSG_NO = MSGTAB-MSGNR
MSG_VAR1 = MSGTAB-MSGV1(50)
MSG_VAR2 = MSGTAB-MSGV2(50)
MSG_VAR3 = MSGTAB-MSGV3(50)
MSG_VAR4 = MSGTAB-MSGV4(50)
IMPORTING
MSG_TEXT = L_MSG
EXCEPTIONS
FUNCTION_NOT_COMPLETED = 1
MESSAGE_NOT_FOUND = 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.
WRITE: L_MSG.
ENDLOOP.
ENDFORM.
- Satish -
A way to display error messages from the program
Dear all,
I am looking forward to display a set of error messages(in a internal table) during the execution of the program to the user.
I wanted to know the better way of displaying error messages from my program with more options.
Well I tried out using displaying errors as ALV list/Grid or as simple list processing.
But I found some stanadard transactions (Like in MM and FI where errors are shown in a better way, but failed to find out how they are done.
Please guide me.
Thanks in advance
AryanTry to use application logging it has a very good way to display a set of messages.
[http://abap4.tripod.com/Using_Application_Logging.html|http://abap4.tripod.com/Using_Application_Logging.html]
Run this report in se38 an example sap report to understand logging way to show a set of messages
Report Name : SBAL_DEMO_01
Edited by: Vighneswaran CE on Dec 19, 2010 3:01 PM
Edited by: Vighneswaran CE on Dec 19, 2010 3:11 PM -
How to display error message in abap
How to dispaly error message in report?
i have to check the range bewteen two days and if it is not in range have to display error message only once.
next time if i press the execute button report will get executed without showing the warning message.
i am calculating the days between two dates, i am displaying the error message but if i press the execute button i will not allow me to execute the report.it again shows me the error message.i have to skip this in 2nd time.
can any one suggest what to do with this?hello suman,
i am using select-option in my report. And i have to check the difference between two dates in select option input box( low-value and high-value). if it is greater then suppose 10 then i have to display warning message at once and then if click on execute button , the report should get executed without showing any warning messages in report.
here i am attaching my source code.please take a close look and tell me where should i have to make change.
SELECT-OPTIONS :s_bedat FOR ekko-bedat.
AT SELECTION-SCREEN ON s_bedat.
IF NOT s_bedat IS INITIAL.
PERFORM bedat_validate. " Perform for Purchasing Document Date Validation
ENDIF.
FORM bedat_validate . " Form for Purchasing Document Date Validation
DATA : diffr TYPE i.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = s_bedat-high
i_datum_von = s_bedat-low
I_KZ_EXCL_VON = '0'
I_KZ_INCL_BIS = '0'
I_KZ_ULT_BIS = ' '
I_KZ_ULT_VON = ' '
I_STGMETH = '0'
I_SZBMETH = '1'
IMPORTING
e_tage = diffr
EXCEPTIONS
DAYS_METHOD_NOT_DEFINED = 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.
ELSE.
IF diffr GT 31.
MESSAGE s009(zerrormsg) WITH text-000 DISPLAY LIKE 'W'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " BEDAT_VALIDATE -
How to display error message in case of function module ?
In the report i was using " message-id " to display error message....
how to use in function module ?Hi,
Messages in Function Modules and Methods
Messages have two different functions in function modules and methods:
Normal Messages
If you use messages in function modules and methods without the RAISING addition in the MESSAGE statement, and the caller does not catch the message, the message is handled
normally according to the context in which it is called within the function module or method.
Triggering Exceptions with Messages
If you use messages in function modules and methods with the addition
... RAISING <exc>
the way in which the message is handled depends on whether the calling program handles the exception <exc> or not.
If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it
was called.
If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
Catching Message in the Calling Program
You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the
EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:
Type S, I, and W messages are ignored (but logged during background processing)
Type E and A messages trigger the exception ERROR_MESSAGE
Type X messages trigger the usual runtime error and short dump.
Catching messages is not currently supported for methods.
Regards,
Bhaskar
Maybe you are looking for
-
Problem with "Call Transaction" which calls a view cluster
Hi Colleagues , I have a rare issue with the call transaction , here is the use case for it : 1> I call a transaction(calls a screen X) in a report , 2> I have a button in the screen , which calls another transaction(calls a screen X2) . 3> On the sc
-
ABAP Proxy : Modification in Structure
Hi Experts, I have one query in ABAP Proxy. I had one customized table type as declared DATA: ITAB TYPE ZABCD. It is having line type as ZABCD_LINE. This is just line type. Now I wanted to add 2 fields in same line type. While using SE11 whenever I a
-
External content type with web service - new read item operation disable
Hi, i'm tring to create an external content type based on web service. I add for test the web service: http://www.webservicex.net/globalweather.asmx?WSDL when i try to set get reat item operation- it's disabled. what should i do in order to create th
-
Olympus e30 Raw support? Will there be a UPdate?
I am using LRf2.3 64-bit Vista, and a new Olympus e30 When I import and convert to DNG I notice on the e30 files that I am using Adobe Standard as the Camera Calibration. Does not even have a listing for the current ACR 5.3 to choose. Read on DP
-
VB Windows Forms Application Aero
Hi everyone, for quite some time I've avoided using aero forms whilst developing in VB. This is because I've been unable to find working code that allows me to utilize aero capabilities and standard Windows Forms controls at the same time. The issue