cancel
Showing results for 
Search instead for 
Did you mean: 

Validations in Webdynpro

Former Member
0 Kudos

Hi,

I'm new to WDABAP. In my webdynpro I have used one zBAPI and in that BAPI there are few validations which are already maintained. So, now in my webdynpro how to use those validations?

Can some one guide me regarding these validations to maintain in Webdynpro.

Regards,

Smitha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Smitha,

I understood your requirement . Initially ensure that your Zbapi is returning any stucture called bapiret2.

secondly in webdynpro call use the Code generator and select the option called Generate Message and select the method called REPORT_T100_message.

declare as

Data: lt_retun type bapiret2,

ls_return type bapiret2.

Loop at lt_return into ls_return.

  • report message

CALL METHOD lo_message_manager->report_t100_message

EXPORTING

msgid = ls_return-id

msgno = ls_return-number

msgty = ls_return-type.

endloop.

Follow this procedure it will solve your problem .

Regards,

Misbah

Former Member
0 Kudos

Hi Smitha,

I am not clear with your requirement but in case if you want to catch the error and waring messages thrown by BAPI in that case in your web dynpro code after calling the BAPI you have to catch all the error messages which BAPI must be returning in some internal table. In web Dynpro you can display all these messages using Message Manager. Here is the small example:

Suppose this is a BAPI call:

CALL FUNCTION 'BAPI_GOODSMVT_GETDETAIL'

EXPORTING

MATERIALDOCUMENT = LS_DOCNO_OUTPUT-MAT_DOC

MATDOCUMENTYEAR = LS_DOCNO_OUTPUT-DOC_YEAR

  • IMPORTING

  • GOODSMVT_HEADER =

TABLES

GOODSMVT_ITEMS = DOC_ITEM_DETAILS

RETURN = LT_RETURN

Now here LT_RETURN is the table which will have errors if any. So you can simply display all these errors by the following code:

DATA: LV_WDCOMPONENT TYPE REF TO IF_WD_COMPONENT,

LV_MESSAGE TYPE REF TO IF_WD_MESSAGE_MANAGER.

LV_WDCOMPONENT = WD_THIS->WD_GET_API( ).

LV_MESSAGE = LV_WDCOMPONENT->GET_MESSAGE_MANAGER( ).

LOOP AT LT_RETURN INTO WA_RETURN.

DATA: MESSAGE TYPE STRING.

MESSAGE = WA_RETURN-MESSAGE.

LV_MESSAGE->REPORT_ERROR_MESSAGE( MESSAGE_TEXT = MESSAGE ).

ENDLOOP.

This was just a sample code to give you a start. You can explore IF_WD_MESSAGE_MANAGER and other classes more to get idea about several methods of these classes.

In case if this was not you qurey please frame you question again so that may be I or somebody can help you out.

Regards,

Neha

.