Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Catch Message Type S after calling transaction in batch input ?

Former Member
0 Likes
2,211

Hallo,

I have writen an function module wich calls an Batch Input. I'm trying to catch all messages into the a local message- table:

CALL TRANSACTION ... MODE 'N'

MESSAGES INTO P_MESSTAB.

Although a message type 'S' is displayed. But I have to catch this message, because otherwise this message is displayed at the RF- Screen.

Can somebody tell me, how to catch messages type 'S' after calling Batch Input?

Regards, Eva

Hallo,

I have writen an function module wich calls an Batch Input. I'm trying to catch all messages into the a local message- table:

CALL TRANSACTION ... MODE 'N'

MESSAGES INTO P_MESSTAB.

Although a message type 'S' is displayed. But I have to catch this message, because otherwise this message is displayed at the RF- Screen.

Can somebody tell me, how to catch messages type 'S' after calling Batch Input?

Regards, Eva

9 REPLIES 9
Read only

Former Member
0 Likes
1,648

Hi

Use this FM FORMAT_MESSAGE to get the messages you have all the find which are populated in Message tab.

Regards,

Venkat

Read only

0 Likes
1,648

Hi,

I'm sorry. But I think you haven't understand me right.

Although I try to catch all Messages in the message tabel, the Message Type 'S' like "TO xy has been created" is displayed. I have to avoid, that this message is displayed!

So I don't know how I can additionally catch this message.

Thanks.

Read only

0 Likes
1,648

Not sure what is your question.

Is it that you run Batch Input Session and, a Message S is not letting the batch input continue?

or is it that everything works fine, but you don't want to display message type S in results after the batch input has ran?

I don't think there is a way to suppress any specific type of messages. You have to hit "Enter" to get past some of them.

Read only

Former Member
0 Likes
1,648

hi eva ,

check this example for getting messages into a message table in the uploading of bdc.

&----


*& Report Z_50835_BDCTEST

*&

&----


*&

*&

&----


*report name

REPORT z_50835_bdctest.

*delcaring tables

TABLES: mara, makt.

DATA: file TYPE ibipparms-path,

fname TYPE string.

*declaring internal tables of type bdcdata and bdcmsgcoll

DATA: git_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,

git_msg LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

*declaring internal table for data in local file(presentation server).

DATA: BEGIN OF git_upload1 OCCURS 0,

matnr TYPE mara-matnr,

maktx TYPE makt-maktx,

meins TYPE mara-meins,

matkl TYPE mara-matkl,

END OF git_upload1.

*declaring an internal table to hold the errors of the data in local file((presentation server).

DATA : git_error LIKE git_upload1 OCCURS 0 WITH HEADER LINE,

*a variable to hold the messges

msg(100) TYPE C.

*selection screen

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_file(128) TYPE c.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

*calling function to find the file in presentation server

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ''

IMPORTING

file_name = file

.

MOVE file TO p_file.

*start-of-selection

START-OF-SELECTION.

MOVE p_file TO fname.

*calling function upload to upload the file presentation server

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = fname

filetype = 'ASC'

has_field_separator = 'T'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH = FILELENGTH

  • HEADER = HEADER

TABLES

data_tab = git_upload1

  • 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.

*populating the bdc data table

LOOP AT git_upload1.

CLEAR git_bdcdata.

REFRESH git_bdcdata.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0060' 'X'.

PERFORM bdc_values USING 'BDC_CURSOR' 'RMMG1-MTART'.

PERFORM bdc_values USING 'BDC_OKCODE' '=AUSW'.

PERFORM bdc_values USING 'RMMG1-MATNR' git_upload1-matnr.

PERFORM bdc_values USING 'RMMG1-MBRSH' 'M'.

PERFORM bdc_values USING 'RMMG1-MTART' 'FERT'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070' 'X'.

PERFORM bdc_values USING 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(13)'.

PERFORM bdc_values USING 'BDC_OKCODE' '=ENTR'.

PERFORM bdc_values USING 'MSICHTAUSW-KZSEL(01)' 'X'.

PERFORM bdc_values USING 'MSICHTAUSW-KZSEL(12)' 'X'.

PERFORM bdc_values USING 'MSICHTAUSW-KZSEL(13)' 'X'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0080' 'X'.

PERFORM bdc_values USING 'BDC_CURSOR' 'RMMG1-LGORT'.

PERFORM bdc_values USING 'BDC_OKCODE' '=ENTR'.

PERFORM bdc_values USING 'RMMG1-WERKS' '1000'.

PERFORM bdc_values USING 'RMMG1-LGORT' '0001'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004' 'X'.

PERFORM bdc_values USING 'BDC_OKCODE' '/00'.

PERFORM bdc_values USING 'MAKT-MAKTX' git_upload1-maktx.

PERFORM bdc_values USING 'MARA-MEINS' git_upload1-meins.

PERFORM bdc_values USING 'MARA-MATKL' git_upload1-matkl.

PERFORM bdc_values USING 'MARA-MTPOS_MARA' 'NORM'.

PERFORM bdc_values USING 'BDC_CURSOR' 'MARA-VOLEH'.

PERFORM bdc_values USING 'MARA-BRGEW' '10 '.

PERFORM bdc_values USING 'MARA-GEWEI' 'KG'.

PERFORM bdc_values USING 'MARA-NTGEW' '10'.

PERFORM bdc_values USING 'MARA-VOLUM' '10'.

PERFORM bdc_values USING 'MARA-VOLEH' 'L'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '4000' 'X'.

PERFORM bdc_values USING 'BDC_OKCODE' '/00'.

PERFORM bdc_values USING 'MAKT-MAKTX' git_upload1-maktx.

PERFORM bdc_values USING 'MARA-MEINS' git_upload1-meins.

PERFORM bdc_values USING 'MARC-DISGR' '0031'.

PERFORM bdc_values USING 'MARC-DISMM' 'AP'.

PERFORM bdc_values USING 'MARC-DISPO' '000'.

PERFORM bdc_values USING 'BDC_CURSOR' 'MARC-DISLS'.

PERFORM bdc_values USING 'MARC-DISLS' 'LL'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '4000' 'X'.

PERFORM bdc_values USING 'BDC_OKCODE' '=BU'.

PERFORM bdc_values USING 'MAKT-MAKTX' git_upload1-maktx.

PERFORM bdc_values USING 'BDC_CURSOR' 'MARC-MRPPP'.

PERFORM bdc_values USING 'MARC-DZEIT' '1'.

PERFORM bdc_values USING 'MARC-WEBAZ' '0'.

PERFORM bdc_values USING 'MARC-FHORI' '000'.

CALL TRANSACTION 'MM01' USING git_bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO git_msg.

IF sy-subrc NE 0.

MOVE GIT_UPLOAD1 TO GIT_ERROR.

APPEND GIT_ERROR.

perform session.

PERFORM check.

ELSE.

ENDIF.

ENDLOOP.

*end of call transaction .

*begin of session method

form session.

*calling funntion to start a session

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

  • DEST = FILLER8

group = 'ses200'

  • holddate = sy-datum

keep = 'X'

user = sy-uname

  • RECORD = FILLER1

  • PROG = SY-CPROG

  • IMPORTING

  • QID = 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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*moving the error records in to git_error table

*calling the function to insert error data into another internal table .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = 'MM01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

dynprotab = git_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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*calling the function to close the session

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.

*end of session method

*form to populate three fileds of bdcdata

FORM bdc_dynpro USING value(p_0125)

value(p_0126)

value(p_0127).

CLEAR git_bdcdata.

git_bdcdata-program = p_0125.

git_bdcdata-dynpro = p_0126.

git_bdcdata-dynbegin = p_0127.

APPEND git_bdcdata.

ENDFORM. " bdc_dynpro

*form to populate the rest 2 fields in bdcdata

FORM bdc_values USING value(p_0131)

value(p_0132).

CLEAR git_bdcdata.

git_bdcdata-fnam = p_0131.

git_bdcdata-fval = p_0132.

APPEND git_bdcdata.

ENDFORM. " bdc_values

*form to check whether we have any error records in the given file and passing them to git_error if any.

FORM check .

LOOP AT git_msg.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = git_msg-msgid

LANG = SY-LANGU

no = sy-msgno

v1 = sy-msgv1

v2 = sy-msgv2

v3 = sy-msgv3

v4 = sy-msgv4

IMPORTING

msg = msg

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.

IF sy-subrc = 0.

WRITE:/ msg.

ENDIF.

ENDLOOP.

ENDFORM. " check

<REMOVED BY MODERATOR>

venkat.

Edited by: Alvaro Tejada Galindo on Mar 10, 2008 11:10 AM

Read only

0 Likes
1,648

It is it that everything works fine, but I don't want to display message type S. The S- Message is displayed although I have stored the BI- Messages in the message table.

Edited by: Eva Schießl on Mar 10, 2008 9:12 AM

Read only

0 Likes
1,648

All the messages are stored in an internal table. once you have all the messages (or before your transfer them from one internal table to yours), delete all the rows where 'MSGTYP' is equal to 'S'. You may not have a field named exactly as 'MSGTYP', but something similar should be there. If you are not sure which field, run it in debugger to find out all the fileds of your internal table.

Hope this helps!

Read only

0 Likes
1,648

The following is what you will need to delete rows from an internal table. Check out detailed syntax for "Delete".

DELETE itab WHERE logexp.

Read only

Former Member
0 Likes
1,648

If that's a message that doesn't affect the transaction (like an information message about sorting an alv) and you don't want to display it in a report, just delete that specific message from the messages table after call transaction is done.

Read only

Former Member
0 Likes
1,648

Eva - I don't think you can do this directly; however, once the batch input is finished, you could call your own message saying something like 'Transaction complete'. That will overwrite the success message.

Rob