2009 Aug 28 7:18 PM
Hi experts -
We have created a screen variant for ME22N where GL account is display only. However, we only want this to be triggered when BLART = 'ZAR1'.
How can we put this condition in?
Can it be done in a BADI, Exit or even in SHD0? If so, how?
Thanks,
Mark
Hi experts -
We have created a screen variant for ME22N where GL account is display only. However, we only want this to be triggered when BLART = 'ZAR1'.
How can we put this condition in?
Can it be done in a BADI, Exit or even in SHD0? If so, how?
Thanks,
Mark
2009 Aug 28 7:36 PM
Hi,
Create a custom variant transaction and use enhancement spots in PO program and use leave to transaction to call that transaction if EKKO-BLART suffices your condition.
Here you have to be careful to check the transaction if the current transaction is ME22N only then call the new Z-Transaction. I hope you got the idea.
Regards,
Himanshu
2009 Aug 28 8:59 PM
Thanks for the replies.
It's still not working for me.
I'm placing the code in here:
METHOD IF_EX_ME_PROCESS_PO_CUST~OPEN
It hits my code and I don't get any errors, but the Screen variant is not taking effect.
Any ideas?
Here is my code:
TYPES: BEGIN OF type_scvar,
tcvariant TYPE utcvariant, "Transaction Variant
scvariant TYPE scvariant, "Screen Variant
progname TYPE bdc_prog, "Program Name
dynpro TYPE bdc_dynr, "SCreen Number
END OF type_scvar.
DATA : s_scvar TYPE type_scvar. "local structure for type s_scvar
DATA: ls_mepoheader TYPE mepoheader.
ls_mepoheader = im_header->get_data( ).
IF ls_mepoheader-bsart = 'ZAR1' OR ls_mepoheader-bsart = 'ZAR2'.
Get Transaction Variant Details
SELECT SINGLE ctcvariant cscvariant pdynpro pprogname
INTO (s_scvar-tcvariant, s_scvar-scvariant,
s_scvar-dynpro, s_scvar-progname)
FROM shdtvsvciu AS c
INNER JOIN shdsvci AS p
ON cscvariant = pscvariant
WHERE c~tcvariant = 'ZME22N'.
IF iv_progname = s_scvar-progname.
Assign Screen Variant
CALL FUNCTION 'RS_HDSYS_SET_SC_VARIANT'
EXPORTING
progname = s_scvar-progname
dynpro = s_scvar-dynpro
scvariant = s_scvar-scvariant
overwrite_scvariant = 'X'
set_immediately = 'X'.
ENDIF.
Thanks,
Mark
2009 Sep 01 4:37 PM
Hi,
Any ideas where to place the code, so the variant will take effect?
Thanks,
Mark
2009 Sep 01 4:52 PM
Hi Mark,
I am not sure but why dont you try leave to transaction rather than the FM like below:
IF ls_mepoheader-bsart = 'ZAR1' OR ls_mepoheader-bsart = 'ZAR2'.
leave to transaction ZME22N'.
ENDIF>
but for the above to work we need to create a parameter transaction ZME22N and assign the screen variant that you ahve created.
Regards,
Himanshu
2009 Aug 28 7:42 PM
Try this way
Create 2 screen variants ( 1 with GL Account in display mode and 2 with GL account with editable mode)
then write a program C
parameters : ebeln like ekpo-ebeln.
" Using the EBELN and find the BLART
if blart eq 'ZAR1'.
call function 'RS_HDSYS_SET_SC_VARIANT'
exporting
progname = sy-repid
scvariant = scvariant " Call Variant 1
overwrite_scvariant = 'X'.
else.
call function 'RS_HDSYS_SET_SC_VARIANT'
exporting
progname = sy-repid
scvariant = scvariant " Call Variant 2
overwrite_scvariant = 'X'.
endif.
and also check this link
http://help.sap.com/saphelp_nw04s/helpdata/en/7d/f63a16015111d396480000e82de14a/content.htm
a®