Application Development and Automation 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: 
Read only

No-Display parameter on a BDC session

Former Member
0 Likes
1,375

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
990

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.

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

7 REPLIES 7
Read only

Former Member
0 Likes
991

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.

Read only

Former Member
0 Likes
990

Hi,

I think you can use the system variable SY-BINPT and SY_BATCH before setting the parameter for no-display.

Hope this helps.

Read only

Former Member
0 Likes
990

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

Read only

Former Member
0 Likes
990

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

Read only

0 Likes
990

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

Read only

Former Member
0 Likes
990

do u have a tcode for this program????

Read only

Former Member
0 Likes
990

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