04-17-2020 6:00 PM
Hi, im actually doing bapiret2 in Class, below are the following code i inserted for bapiret.
the system field sy-msgv1 it seems like it is not working as the message is Empty (check screenshot)
Anything have i miseed?
ES_BAPIRET2 Exporting Type BAPIRET2
DATA: lv_type TYPE sy-msgty.
DATA: lv_id TYPE sy-msgid.
DATA: lv_no TYPE sy-msgno.
DATA: lv_v1 TYPE sy-msgv1.
DATA: lv_v2 TYPE sy-msgv2.
es_bapiret2-type = lv_type.
es_bapiret2-id = lv_id.
es_bapiret2-number = lv_no.
es_bapiret2-message_v1 = lv_v1.
es_bapiret2-message_v2 = lv_v2.
IF IV_MAX_ROWS GT 0.
es_bapiret2-type = 'S'.
es_bapiret2-id = 'Input rows found'.
es_bapiret2-message_v1 = 'Record with input rows found'.
select mandt ebeln bedat bsart lifnr waers knumv
FROM ekko into CORRESPONDING FIELDS OF table it_zheader UP TO IV_MAX_ROWS ROWS.
04-18-2020 11:58 AM
1. Where do the message variables get filled (lv_type, lv_id, lv_no, lv_v1, lv_v2)? It’s not shown in your coding.
"...
DATA: lv_type TYPEsy-msgty.
DATA: lv_id TYPEsy-msgid.
DATA: lv_no TYPEsy-msgno.
DATA: lv_v1 TYPEsy-msgv1.
DATA: lv_v2 TYPEsy-msgv2.
es_bapiret2-type = lv_type.
es_bapiret2-id = lv_id.
es_bapiret2-number = lv_no.
es_bapiret2-message_v1 = lv_v1.
es_bapiret2-message_v2 = lv_v2.
"...
2. In this part, you fill the message variables „manually“ and they are not based on existing ABAP repository messages.
"...
IF IV_MAX_ROWS GT0.
es_bapiret2-type ='S'.
es_bapiret2-id ='Input rows found'.
es_bapiret2-message_v1 ='Record with input rows found'.
select mandt ebeln bedat bsart lifnr waers knumv FROM ekko into
CORRESPONDING FIELDS OF table it_zheader UP TO IV_MAX_ROWS ROWS.
"...
3. if you want to replace placeholders in ABAP repository messages, you can use the MESSAGE statement or the FM BALW_BAPIRETURN_GET1
4. Have a look at this tutorial to learn a lot more about how to create custom message classes and messages as well as placeholders and how to replace those with dynamic values; and how to use all of this in coding:
5. Search also for other question and answers about bapiret2 structures, how to fill them and use them:
04-17-2020 7:05 PM
MESSAGE is empty because you don't fill it.
If you want to fill it:
MESSAGE ID lv_id TYPE lv_type NUMBER lv_no WITH lv_v1 lv_v2
INTO es_bapiret2-message.
04-18-2020 9:28 AM
To properly use BAPIRET2 messages;
TYPE - Type of message (S, E, A, X, I, W)
ID - Message class containing your message
NUMBER - Message number in message class used
MESSAGE - Actual Message
MESSAGE_V1 = Message variable 1
MESSAGE_V2 = Message variable 2
MESSAGE_V3 = Message variable 3
MESSAGE_V4 = Message variable 4
Then you can fill your BAPIRET2 like this:
MESSAGE ID lv_id
TYPE lv_type
NUMBER lv_no
WITH lv_v1 lv_v2
INTO es_bapiret2-message.
04-18-2020 11:58 AM
1. Where do the message variables get filled (lv_type, lv_id, lv_no, lv_v1, lv_v2)? It’s not shown in your coding.
"...
DATA: lv_type TYPEsy-msgty.
DATA: lv_id TYPEsy-msgid.
DATA: lv_no TYPEsy-msgno.
DATA: lv_v1 TYPEsy-msgv1.
DATA: lv_v2 TYPEsy-msgv2.
es_bapiret2-type = lv_type.
es_bapiret2-id = lv_id.
es_bapiret2-number = lv_no.
es_bapiret2-message_v1 = lv_v1.
es_bapiret2-message_v2 = lv_v2.
"...
2. In this part, you fill the message variables „manually“ and they are not based on existing ABAP repository messages.
"...
IF IV_MAX_ROWS GT0.
es_bapiret2-type ='S'.
es_bapiret2-id ='Input rows found'.
es_bapiret2-message_v1 ='Record with input rows found'.
select mandt ebeln bedat bsart lifnr waers knumv FROM ekko into
CORRESPONDING FIELDS OF table it_zheader UP TO IV_MAX_ROWS ROWS.
"...
3. if you want to replace placeholders in ABAP repository messages, you can use the MESSAGE statement or the FM BALW_BAPIRETURN_GET1
4. Have a look at this tutorial to learn a lot more about how to create custom message classes and messages as well as placeholders and how to replace those with dynamic values; and how to use all of this in coding:
5. Search also for other question and answers about bapiret2 structures, how to fill them and use them:
04-18-2020 6:19 PM