2006 Oct 14 11:58 AM
Hi I am using this BAdI CUSTOMER_ADD_DATA and the method I am using is check_all_data . The purpose is to make a field mandatory for a required condition ( else I need to display a message ). The problem is I am unable to display the message on the screen which contains the field .
below are details .
The transaction is fd01 or fd02.
the badi is triggered when i try to save .
expected solution .
I guess i can move to the required screen by using the last 3 parameters of the method where i can specify the screen number and screen group to navigate to . But I am unable to do so .
any help wud be highly appreciated .
2006 Oct 14 1:33 PM
Hello Prince
Assuming you want to make a field on tabstrip "Address" (screen '0301') mandatory then you have to return the message (E_MSGID, E_MSGNO, E_MSGV1,...) and E_DYNNR = '0301' (leaving E_SCRGR and E_FCODE empty).
To see which values for E_DYNNR, E_SCRGR (attribute of the screens) and E_FCODE are possible have a look at the following coding (just behind the BAdI call) in SAPMF02D (form CHECK_ALL_DATA):
*&---------------------------------------------------------------------*
*& Form check_all_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM CHECK_ALL_DATA .
DATA: L_MSGID TYPE SYMSGID,
L_MSGTY TYPE SYMSGTY,
L_MSGNO TYPE SYMSGNO,
L_MSGV1 TYPE SYMSGV,
L_MSGV2 TYPE SYMSGV,
L_MSGV3 TYPE SYMSGV,
L_MSGV4 TYPE SYMSGV,
L_DYNNR TYPE SYDYNNR,
L_SCRGR TYPE CUST_SCGR,
L_FCODE TYPE TAXITABS-FCODE,
L_TARGET_DYNNR TYPE SYDYNNR.
PERFORM GET_BADI_INSTANCE.
check not g_additional_data is initial. " TP 563352
CALL METHOD G_ADDITIONAL_DATA->CHECK_ALL_DATA
EXPORTING
I_ACTIVITY = T020-AKTYP
S_KNA1 = KNA1
S_KNB1 = KNB1
S_KNVV = KNVV
T_KNAS = XKNAS[]
T_KNB5 = XKNB5[]
T_KNBK = XKNBK[]
T_KNEX = XKNEX[]
T_KNVA = XKNVA[]
T_KNVD = XKNVD[]
T_KNVI = XKNVI[]
T_KNVK = XKNVK[]
T_KNVL = XKNVL[]
T_KNVP = XKNVP[]
T_KNZA = XKNZA[]
CHANGING
E_MSGID = L_MSGID
E_MSGNO = L_MSGNO
E_MSGV1 = L_MSGV1
E_MSGV2 = L_MSGV2
E_MSGV3 = L_MSGV3
E_MSGV4 = L_MSGV4
E_DYNNR = L_DYNNR
E_SCRGR = L_SCRGR
E_FCODE = L_FCODE.
* Fehlerbehandlung uebernehmen
CHECK NOT L_MSGID IS INITIAL.
* Wandelt E-message in W-message, wenn man navigieren muss
IF NOT ( L_DYNNR IS INITIAL
AND L_SCRGR IS INITIAL
AND L_FCODE IS INITIAL ).
PERFORM DETERMINE_TARGET_SCREEN USING L_DYNNR
L_SCRGR
L_FCODE
CHANGING L_TARGET_DYNNR.
ENDIF.
CLEAR OK-CODE.
IF NOT L_TARGET_DYNNR IS INITIAL.
MESSAGE ID L_MSGID TYPE 'S' NUMBER L_MSGNO DISPLAY LIKE 'E'
WITH L_MSGV1 L_MSGV2 L_MSGV3 L_MSGV4.
PERFORM NAVIGATE_TO_AFFECTED_SCREEN USING L_TARGET_DYNNR
L_SCRGR
L_FCODE.
ELSE.
* Dieser Fall tritt nur auf, wenn L_DYNNR, L_SCRGR und L_FCODE keine
* sinnvolle Kombination darstellen.
* Nur als Notlösung vorgesehen, damit die Sicherung nicht beendet wird
MESSAGE ID L_MSGID TYPE 'E' NUMBER L_MSGNO
WITH L_MSGV1 L_MSGV2 L_MSGV3 L_MSGV4.
ENDIF.
ENDFORM. " check_all_data
Note that I tested this in our IDES system (with the available BAdI implementations) and it worked.
Regards
Uwe
2006 Oct 14 1:33 PM
Hello Prince
Assuming you want to make a field on tabstrip "Address" (screen '0301') mandatory then you have to return the message (E_MSGID, E_MSGNO, E_MSGV1,...) and E_DYNNR = '0301' (leaving E_SCRGR and E_FCODE empty).
To see which values for E_DYNNR, E_SCRGR (attribute of the screens) and E_FCODE are possible have a look at the following coding (just behind the BAdI call) in SAPMF02D (form CHECK_ALL_DATA):
*&---------------------------------------------------------------------*
*& Form check_all_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM CHECK_ALL_DATA .
DATA: L_MSGID TYPE SYMSGID,
L_MSGTY TYPE SYMSGTY,
L_MSGNO TYPE SYMSGNO,
L_MSGV1 TYPE SYMSGV,
L_MSGV2 TYPE SYMSGV,
L_MSGV3 TYPE SYMSGV,
L_MSGV4 TYPE SYMSGV,
L_DYNNR TYPE SYDYNNR,
L_SCRGR TYPE CUST_SCGR,
L_FCODE TYPE TAXITABS-FCODE,
L_TARGET_DYNNR TYPE SYDYNNR.
PERFORM GET_BADI_INSTANCE.
check not g_additional_data is initial. " TP 563352
CALL METHOD G_ADDITIONAL_DATA->CHECK_ALL_DATA
EXPORTING
I_ACTIVITY = T020-AKTYP
S_KNA1 = KNA1
S_KNB1 = KNB1
S_KNVV = KNVV
T_KNAS = XKNAS[]
T_KNB5 = XKNB5[]
T_KNBK = XKNBK[]
T_KNEX = XKNEX[]
T_KNVA = XKNVA[]
T_KNVD = XKNVD[]
T_KNVI = XKNVI[]
T_KNVK = XKNVK[]
T_KNVL = XKNVL[]
T_KNVP = XKNVP[]
T_KNZA = XKNZA[]
CHANGING
E_MSGID = L_MSGID
E_MSGNO = L_MSGNO
E_MSGV1 = L_MSGV1
E_MSGV2 = L_MSGV2
E_MSGV3 = L_MSGV3
E_MSGV4 = L_MSGV4
E_DYNNR = L_DYNNR
E_SCRGR = L_SCRGR
E_FCODE = L_FCODE.
* Fehlerbehandlung uebernehmen
CHECK NOT L_MSGID IS INITIAL.
* Wandelt E-message in W-message, wenn man navigieren muss
IF NOT ( L_DYNNR IS INITIAL
AND L_SCRGR IS INITIAL
AND L_FCODE IS INITIAL ).
PERFORM DETERMINE_TARGET_SCREEN USING L_DYNNR
L_SCRGR
L_FCODE
CHANGING L_TARGET_DYNNR.
ENDIF.
CLEAR OK-CODE.
IF NOT L_TARGET_DYNNR IS INITIAL.
MESSAGE ID L_MSGID TYPE 'S' NUMBER L_MSGNO DISPLAY LIKE 'E'
WITH L_MSGV1 L_MSGV2 L_MSGV3 L_MSGV4.
PERFORM NAVIGATE_TO_AFFECTED_SCREEN USING L_TARGET_DYNNR
L_SCRGR
L_FCODE.
ELSE.
* Dieser Fall tritt nur auf, wenn L_DYNNR, L_SCRGR und L_FCODE keine
* sinnvolle Kombination darstellen.
* Nur als Notlösung vorgesehen, damit die Sicherung nicht beendet wird
MESSAGE ID L_MSGID TYPE 'E' NUMBER L_MSGNO
WITH L_MSGV1 L_MSGV2 L_MSGV3 L_MSGV4.
ENDIF.
ENDFORM. " check_all_data
Note that I tested this in our IDES system (with the available BAdI implementations) and it worked.
Regards
Uwe
2006 Oct 16 10:14 AM