2006 Sep 13 10:20 AM
Hi everyone
BDC sessions are not my speciality so I hope this makes sense!
We have a program that creates a batch job via BDC. The BDC needs to enter data into a parameter field on the selection screeen of the program it applies to. However, the program that is 'called' from the BDC session can also be run by users and we do not want the parameter to be available to them - only to the batch job. We have therefore created the parameter with the NO-DISPLAY option but this causes an error saying that the the field cannot be found. If we remove the NO-DISPLAY option then it works fine. Presumably as the BDC session emulates a user it is subject to the same restrictions as an ordinary user. Does anybody know of a way of solving this?
Thanks
Andy
2006 Sep 13 10:25 AM
you can do something like this :
in the case of batch mode,the system variable sy-batch will have value.
at selection-screen.
if sy-batch eq 'X'.
loop at screen.
if screen-name = <paramter name>.
screen-active = '0'.
modify screen.
else.
screen-active = '1'.
modify screen.
endif.
endloop.
endif.
you can do something like this :
in the case of batch mode,the system variable sy-batch will have value.
at selection-screen.
if sy-batch eq 'X'.
loop at screen.
if screen-name = <paramter name>.
screen-active = '0'.
modify screen.
else.
screen-active = '1'.
modify screen.
endif.
endloop.
endif.
2006 Sep 13 10:25 AM
you can do something like this :
in the case of batch mode,the system variable sy-batch will have value.
at selection-screen.
if sy-batch eq 'X'.
loop at screen.
if screen-name = <paramter name>.
screen-active = '0'.
modify screen.
else.
screen-active = '1'.
modify screen.
endif.
endloop.
endif.
2006 Sep 13 10:25 AM
Hi,
I think you can use the system variable SY-BINPT and SY_BATCH before setting the parameter for no-display.
Hope this helps.
2006 Sep 13 10:26 AM
Hi,
try below code
if sy-batch = 'X'
loop at screen.
if screen-name = 'P_TEST'.
screen-visible = 0.
modify screeen.
endloop.
endif.
Regards
Amole
2006 Sep 13 10:40 AM
Hi Andy,
What you can try out here is that U can try to modify the screen depending on the way ur executing the program. U can do this in the event AT SELECTION SCREEN OUTPUT.This event block allows you to modify the selection screen directly before it is displayed..Here's a piece of code from SAP help which may give u some idea.
PARAMETERS: TEST1(10) MODIF ID SC1,
TEST2(10) MODIF ID SC2,
TEST3(10) MODIF ID SC1,
TEST4(10) MODIF ID SC2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'SC1'.
SCREEN-INVISIBLE = '1'.
MODIFY SCREEN.
CONTINUE.
ENDIF.
IF SCREEN-GROUP1 = 'SC2'.
SCREEN-INVISIBLE = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Hope this will help.
Varun
2006 Sep 13 11:51 AM
Thanks everyone for your replies.
I had thought of using a variant but the data was going to change each time and as Anurag pointed out would still require ectivating de-activating the field anyway.
In the end I opted for the loop within the At selection-screen output event. I used most of the solution provided by Varun as specifying screen-name = 'P_TEST' did not hide the parameter label. However, I included an IF statement checking the value of sy-binpt ( = 'X' ) and did screen-active = '1' instead of -invisible = '1', which just sets the filed to have a '*' input mask. Here is my actual code for reference:.
PARAMETERS: p_test type c MODIF ID SC1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT screen.
IF screen-group1 = 'SC1'.
IF sy-binpt = 'X'.
screen-active = '0'.
MODIFY screen.
ENDIF.
ENDIF.
ENDLOOP.
Thanks again
Andy
2006 Sep 13 10:58 AM
2006 Sep 13 11:11 AM
Try to create a variant for the particular abap and call it from BDC using the defined variant. I think that should help.
<b>I just tried it and it does work..first you need to take out the no-display parameter and create the variant..and later introduce it again.</b>
Regards
Anurag
Message was edited by: Anurag Bankley
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |