cancel
Showing results for 
Search instead for 
Did you mean: 

case statement in smartforms

Former Member
0 Kudos

hi GURUS!!

i gave the following case statement in form routine(global definitions-form routine) of the smartform:

CASE VBDKA-VBTYP.

WHEN 'A'.

INQUIRY

WHEN 'B'.

Quotation

WHEN 'C'.

Order confirmation

WHEN 'E'.

Scheduling Agreement Confirmation

WHEN 'G'.

Contract Information

WHEN 'H'.

Returns

WHEN 'I'.

Free-of-charge delivery

WHEN 'K'.

Credit memo request

WHEN 'L'.

Debit memo request

WHEN OTHERS.

Order confirmation

ENDCASE.

I get the error message that "statement in context not permitted".

I declared the case variable vbtyp in the global definitions.

Can someone tell me what could be the mistake here?

Regards

Srihari.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi try this example:-

IF IS_BIL_INVOICE-HD_GEN-BIL_CAT = 'P'.

TITLE = 'Factura'.

ELSE.

CASE IS_BIL_INVOICE-HD_GEN-BIL_VBTYPE.

when 'M'.

TITLE = 'Factura'.

when 'U'.

TITLE = 'Proforma Invoice'.

when 'N'.

TITLE = 'Cancelamento de Factura'.

endcase.

ENDIF.

And declare INPUT PARAMETERS = IS_BIL_INVOICE

AND OUTPUT PARAMETERS= TITLE.

Former Member
0 Kudos

vishwa,

keep break-point. in the routine and observe it .. whether it is processing properly or not ....

and in the initilization or programlines.... make sure input parameters(using) and output parameters (changing).... these output parameters can be used globally in the smartform....

feel free to contact if still the problem is persisting ..

Cheers,

Sreenivasa sarma k.

Edited by: sharmashree kashi on Mar 28, 2008 6:09 PM

Former Member
0 Kudos

thanks for the replies!! they were really helpful.

Thanks Once again.

Regards,

Srihari.

Former Member
0 Kudos

Hi hari,

I have tried in my system its not giving any error....find the below example....


global definitions: *form routines tab....*

FORM GET_TEXTNAME1 using    GF_TDNAME.
CASE  GF_TDNAME.
	WHEN 'x'.
	WHEN '2'.
	WHEN OTHERS.
ENDCASE.
endform.
*in the initilization.tab....*

PERFORM GET_TEXTNAME1 using    GF_TDNAME.

note: make sure GF_TDNAME is in *input parameters*

Dont forgot to Reward me points .....

All the very best....

Regards,

Sreenivasa sarma K.

Edited by: sharmashree kashi on Mar 28, 2008 6:01 PM

Former Member
0 Kudos

Hi,

Problem with the code that you have written was u hadnot written 'form..endform'.

Please modify below code as per your requirement.

*form Case_temp using w_a

changing w_string.*

CASE w_a.

WHEN 'A'.

w_string = 'INQUIRY'.

WHEN 'B'.

w_string = 'Quotation'.

WHEN 'C'.

w_string = 'Order confirmation'.

WHEN 'E'.

w_string = 'Scheduling Agreement Confirmation'.

WHEN 'G'.

w_string = 'Contract Information'.

WHEN 'H'.

w_string = 'Returns'.

WHEN 'I'.

w_string = 'Free-of-charge delivery'.

WHEN 'K'.

w_string = 'Credit memo request'.

WHEN 'L'.

w_string = 'Debit memo request'.

WHEN OTHERS.

w_string = 'Order confirmation'.

ENDCASE.

endform.

Write PERFORM for above 'form...endform' as follows:

perform Case_temp using w_actual changing w_string_act.

Please Note: w_a and w_string need not be declared in Global Data as they are local parameters. But, w_actual and w_string_act should be declared in the global data as they are actual parameters.

I think this should solve your problem.

Please reward points if useful.

regards,

Ashlesha

Former Member
0 Kudos

Hi,

Declare the variable in Global Data tab in Global Definations

In initialization write


perform test using vbtyp.

In input parameter write vbtyp.

In form routine write



*&---------------------------------------------------------------------*
*&      Form  test
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PR_VBTYP   text
*----------------------------------------------------------------------*
FORM test USING pr_vbtyp TYPE vbtyp.
  CASE pr_vbtyp.

    WHEN 'A'.
     
    WHEN 'B'.
     

  ENDCASE.

ENDFORM.                    "test

regards

Sandipan

Edited by: Sandipan Ghosh on Mar 28, 2008 3:15 PM

Former Member
0 Kudos

Thanks for the reply.

Another doubt pls.

When I Check it it says, Inquiry is not defined check spelling.

I gave Inquiry under When 'a'.

What could be the reason.

Thanks

Regards,

Srihari.

Former Member
0 Kudos

hi,

Write Like This

WHEN 'A'.

write: 'inquiry'.

regards

Sandipan