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: 

SSCRFIELD : ONLI : Variant creation not possible

Former Member
0 Kudos

Hi all,

I have Selection Screen with pushbutton. And i have the User Command ONLI assigned to the Push Button. Since this allows me to reach Start of Selection.

At the Selection Screen Event, I am Capturing the ONLI when the User presses the Push Button and preforming some task.

The program works fine and well.

Problem:

When I am trying to create the VARIANT for the Selection, SAP throws me out of the Transaction.

My Code:

In the Selection Screen Event, I have a CASE stmt that does:

1. When ucomm = ONLI

I am doing the required task

2. When ucomm = others

I am leaving the program

When the Ucomm is SPOS( U get this ucomm, When u press SAVE), I am obviously out of Transaction.

But i have to create a VARIANT.

How do i fullfill this requirement????

Thanks

Kam

Message was edited by: Kam

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, just modify you code as this...




....

<b>when 'SPOS'.</b>
when others.
leave program.
endcase.


Add that line in BOLD,  It will stop your program from leaving when you click SAVE.

Regards,
Rich HEilman


9 REPLIES 9

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Post the code.

Regards,

RIch Heilman

0 Kudos

Rich,

Here is the part of Code:

selection-screen begin of block blk0 with frame.

  • Create Inspection Lot Button

selection-screen pushbutton 5(28) crteIns user-command ONLI.

selection-screen skip.

selection-screen begin of block blk3 with frame.

selection-screen begin of line.

selection-screen comment 2(18) text-000 for field pMatnr.

  • Material Number

parameters pMatnr type qals-matnr obligatory.

selection-screen comment 45(15) text-001 for field pDocNu.

  • Docket Number

parameters pDocNu(10) type c. "qals-ktextlos.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 2(18) text-002 for field pKunnr.

  • Customer(Bill To Party)

parameters pKunnr type qals-kunnr. "obligatory.

selection-screen comment 45(15) text-003 for field pWerk.

  • Plant(Accepting Office)

parameters pWerk type qals-werk obligatory.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 2(18) text-004 for field pInsDate.

  • Inspection Date

parameters pInsDate type sy-datum default sy-datum Obligatory.

selection-screen end of line.

selection-screen end of block blk3.

selection-screen skip.

selection-screen begin of block blk1 with frame title text-005.

  • Sampling/ Non-Sampling

parameters: pSamp radiobutton group grp0 default 'X',

pNonS radiobutton group grp0.

selection-screen end of block blk1.

selection-screen skip.

selection-screen begin of block blk2 with frame title text-006.

  • Create Inspection Lot/Result Recordings

parameters: pCreat radiobutton group grp1,

pResult radiobutton group grp1 default 'X'.

selection-screen end of block blk2.

selection-screen end of block blk0.

*****************************

at selection-screen .

case sscrfields-ucomm.

when CONLI or space.

if sscrfields-ucomm is initial.

message W007.

endif.

  • Clear the Data Structure

clear : iInsType[],iInsPlan[],bdcdata[],iMessage[].

clear : vKunnr,bdcdata.

  • Check for the Valid Material

select single * from mara where matnr = pMatnr.

if sy-subrc ne 0.

message E009 with pMatnr.

endif.

  • Check for Valid Plant

select single * from t001w where werks = pWerk.

if sy-subrc ne 0.

message E010 with pWerk.

endif.

  • Check the Business Rule --> 1 Inspection Type : 1 Material

perform CheckBusinessRule1.

  • Check the Business Rule --> 2 Inspection Plan : 1 Material

perform checkBusinessRule2.

  • sscrfields-ucomm = 'ONLI'.

when others.

leave program.

endcase.

at selection-screen on radiobutton group grp0.

  • When Enter

if sscrfields-ucomm is initial.

message W007.

leave to screen 1000.

endif.

  • When Sampling is Clicked

if pSamp eq CX.

if pKunnr is initial.

message S005.

leave to screen 1000.

endif.

endif.

  • When Non Sampling is Clicked

if pNons eq CX.

if pKunnr is not initial.

message S006.

endif.

Thanks

Kam

0 Kudos

Without seeing your code, I would assume that you could do something like this.



at selection-screen.


  case sy-ucomm.
    when space.
      sscrfields-ucomm = 'ONLI'.
    when 'SPOS'.
      sscrfields-ucomm = 'SPOS'.
    when others.
  endcase.



Regards,

Rich HEilman

0 Kudos

Rich,

Thanks for that!!!!

Why we added that code??? and hopefuly when ucom is SPOs, we do nothing??? Is in it??

Thanks

Kam

0 Kudos

Yes that is the reason, but I think you will have this kind of problem with any of the standard functions provided on that selection screen like execute in background, execute etc.

Your selection screen and the events are not designed properly. Can you please explain why you are doing all these complex operations on the selection screen? What is your requirement for the selection screen? Why could you not achieve the same with normal selection screen 'EXECUTE' button, instead of your pushbutton?

Srinivas

0 Kudos

Srinivas is right here. You should probably remove the following code. Then you shouldn't have any problems.

when others.
    leave program.

Regards,

Rich Heilman

0 Kudos

Srinivas,

I agree.. But there is no other go.. I have to keep the Button in the SElection Secreen. That was my Client Requirement. Becoz we are implementing this project where all the Users (end Users) are being now using similar program desined in other S/W.

We are providing the same functionality and same appearence BUT with SAP.

Thanks

Kam

Message was edited by: Kam

0 Kudos

See if you can use AT SELECTION-SCREEN OUTPUT or AT USER-COMMAND events. Also check the addition 'USER-COMMAND abcd' with the RADIOBUTTON definition.

Do not do everything in AT SELECTION-SCREEN event. See if you can split your logic between all the above events.

Srinivas

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, just modify you code as this...




....

<b>when 'SPOS'.</b>
when others.
leave program.
endcase.


Add that line in BOLD,  It will stop your program from leaving when you click SAVE.

Regards,
Rich HEilman