Application Development 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: 

Grey out fields

Former Member
0 Kudos

Hi

I am calling a transaction from a program with some fileds in the BDCDATA. Once the user sees that transaction I would like to have the fields grey so that he cannot enter something...can you help me?

Thanx

28 REPLIES 28

Former Member
0 Kudos

You mean to say that the user is executing your program in foreground and transaction is called with MODE 'A', so that all screens are displayed... While displaying the screens, the user has ability to change the input and you want to disable it?

If that is the case, why use mode 'A', you can use MODE 'E' to display the screens only at error? If my understanding is not correct, please elaborate

0 Kudos

No, because when the screen will appear to the user he will have the choice of running the transaction or going back t the other screen that called the transaction

0 Kudos

Most of the times, it is common to execute the BDC programs in background (in MODE 'N').. Unless there is a very specific requirement for user to do manipulation and it seems like there is no requirement in your case, I would stick with MODE 'N'... that way user will not be able to see the screens itself...

0 Kudos

However the requirement from analyst is for the user to chose either to run the transactions with the fields already entered or to cancel and go back to previous screen

0 Kudos

I don't know if this is feasible... You not only want to allow the user to pass a value to a screen and then turn around to ensure that same user cannot edit the screen value...

I would go back to your analyst and tell him that you can provide an ALV screen (from which the users can choose which transactions he want to POST)... and which transactions he doesn't want to Post... But once he has started on the journey, he has to continue thru the posting and will not have ability to cancel (in MODE 'N')

Or give him the full MODE access 'A' and make an assumption that Users are smart enough to not change the values.

I would really be interested in knowing business justification for such a requirement (and the transaction that he wants to post)

0 Kudos

they are using Z transactions and they want to do this to integrate a transaqction that runs in background. SO they either do the job or they just cancel it.

0 Kudos

Since it is a Z transaction, you can change it to test SY-BINPT and grey-out the fields as you see fiit.

Rob

0 Kudos

Im not sure I understand what sy-binpt would do?

0 Kudos

Maybe I misunderstood the question.

Is the transaction you are running in batch input a custom one or an SAP transaction (which one)?

Rob

0 Kudos

What is the transaction code used in Call Transaction? Is it 'Z' or standard SAP..

If your call transaction is 'Z', Rob is suggesting that you can then change the PBO screen of your call transaction program to check for SY-BINPT (SY-BINPT is a system variable that identifies if the program is called thru batch input)... If sy-binpt is set, you can set the screen attributes to be non-ediatble in PBO of your called transaction.

0 Kudos

Well, almost - further work would be needed.

Rob

0 Kudos

>

> Well, almost - further work would be needed.

>

> Rob

Could you please elaborate what else would be needed?

0 Kudos

It depends on which is the custom transaction. The OP needs to answer my question.

Rob

0 Kudos

Hi Kris and Rob,

the program also calls a Z transaction...so i will try doing what Kris told me...

Thanx

0 Kudos

The program calls a Z transaction and shows the user the selection screen. «so from the called program there is no other screen than the selection screen...how would i write in the PBO?

0 Kudos

So, you are calling a report program in batch input. Is that correct?

Rob

0 Kudos

im doing CALL TRANSACTION Z.

0 Kudos

OK, assuming this is a Z report, you can use SIBMIT rather than CALL TRANSACTION. and then in the AT SELECTION-SCREEN OUTPUT event, grey out the SELECT-OPTIONS and PARAMETERs if it is in the background.

Rob

0 Kudos

thanx Rob!! im not sure but should i use the SCREEN structure?

0 Kudos

Check the documentation on LOOP AT SCREEN.

Rob

0 Kudos

thanks, I tried LOOP at screen, it put the field in grey however the value that comes from the program is not visible...

0 Kudos

Can you please paste your code (both in calling and called program?), so that we can figure out why your values are not getting passed?

are you calling using 'WITH' expression or using selection parameters table? or clearing the SCREEN-INPUT value for the specified parameter?


SUBMIT progname VIA SELECTION-SCREEN
                               WITH P_VAR EQ 'XXX'
                               and return. 

daniel_ghisleni
Discoverer
0 Kudos

Be careful to use IN in order to fill SELECTION-SCREEN fields of the called program.

In other words, if your called program have SELECTION-SCREEN fields, you must use IN instead of EQ. For example:

SUBMIT progname

WITH p_date IN range_date

WITH p_print EQ chk_print.

Where:

p_date is the progname selection screen field

p_print is a progname checkbox

range_date is a RANGE on caller program, with some date

chk_print is a char PARAMETER on caller program, with X or space value

If you use EQ in SELECTION-SCREEN fields, no error occurs, but no value is filled on target program.

Hope that helps.

Att.

Daniel

Edited by: Daniel Ghisleni on Feb 9, 2011 10:00 PM

Edited by: Daniel Ghisleni on Feb 9, 2011 10:02 PM

0 Kudos

hi,

this is my code

CLEAR ls_bdctab.

ls_bdctab-program = 'ZMM'.

ls_bdctab-dynpro = '1000'.

ls_bdctab-dynbegin = 'X'.

APPEND ls_bdctab TO gt_bdctab.

CLEAR ls_bdctab.

ls_bdctab-fnam = 'P_NUMEXP'.

ls_bdctab-fval = s_nexp-low.

APPEND ls_bdctab TO gt_bdctab.

CLEAR ls_bdctab.

ls_bdctab-fnam = 'P_LIFNR'.

ls_bdctab-fval = s_lifnr-low.

APPEND ls_bdctab TO gt_bdctab.

CLEAR ls_bdctab.

ls_bdctab-fnam = 'P_FILE'.

ls_bdctab-fval = s_fname-low.

APPEND ls_bdctab TO gt_bdctab.

CALL TRANSACTION 'ZMM' USING gt_bdctab MODE 'A' UPDATE 'A'.

when the user sees this transaction, i would like for him not to be able to change the values already entered

0 Kudos

the SUBMIT VIA SELECTION-SCREEN seems to be working , however how can i check that this program is being called and that only if it is called than the fields should be grey?

0 Kudos

Check the Value of SY-CPROG to see if it is set with the calling program...

If not the other option is to use Get/set as illustrated below ; (you may need to reset the parameter after the program is executed)..

And if your calling program is associated with a t-code (which is different from your called program), you can check for SY-TCODE (little ugly, but will work the best)...

also you can check SY-CALLD is set to 'X', if the program is submitted thru call transaction or SUBMIT (same value from both SE38 / submitted).. so may not work...

http://help.sap.com/saphelp_nw70/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm

0 Kudos

I even tried the SET/GET....

sy-cprog has the same value whether the program is being called or is run on its own.

0 Kudos

submit program results in a new internal session... If your users are willing to use a T-code for your main program (calling program) then you can check with SY-TCODE...

Get / Set will probably work, but after getting the value from memory you may have to clear the PARAMETER using SET parameter (not particularly elegant)... I am assuming that users will be executing the main report in foreground, so I don't see why you cannot assign t-code to your calling Z program? And then check sy-tcode in your called Z program?