cancel
Showing results for 
Search instead for 
Did you mean: 

Condition at SD Document Catagory(VBTYP)

Former Member
0 Kudos

Hi Experts,

I have one requirement, i.e based on the sd document catagory(vbtyp)

if gs_vbrk-vbtyp = 'm'

then it will execute commercial invoice form and

if gs_vbrk-vbtyp = 'u'.

then it will execute stock transfer form.

These two are developed in only one Smartform

Please anyone help me on this, How can i put the logic in smartform

Thanks in Advanced,

Prabharam

Edited by: prabhashram on Aug 25, 2010 8:15 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi friend,

We can call as many smartforms from one driver program itself. But you should frame the logic in a way like all the required data for form printing is ready in driver program itself. Follow the below steps,

1. Create global structures based on the data you want to display in form like Z_HEADER, Z_BODY etc,. Then create internal tables using these structures.

2. Make sure the structure that you create is common for both forms, I mean all the data of both forms should be accompanied in these internal tables.

3. Check the condition as one of our friend coded above and call the function module of smartform with required internal tables. At a time, internal table will contain only required data with respect to the form that you are going to display. So the remaining data should be blank no need of that.

4. Just the print form using the data and check it.

I hope this solve your problem, if it is not clear kindly update here so then we can discuss more.

Cheers...

Former Member
0 Kudos

Hi,

You will have to create 2 different forms.

For that you will have to call 2 smartforms based on your condition in your print program itself.

E.g.

if gs_vbrk-vbtyp = 'm'.

   Call smartform for commercial invoice.

elseif gs_vbrk-vbtyp = 'u'.

   Call smartform for stock transfer.

ENDIF.

Thanks,

Archana

Former Member
0 Kudos

thanks for giving answer,

Actually we develop one print program for all the Smart forms

that's why we write the logic in smart form itself,.

Former Member
0 Kudos

Hi,

So you can acheive the same as i explained above. You just need to call 2 smartforms in the single print program itself.

Or you can create different output types for different smartforms and configure it (which is done by functional consultant).

Or do you want to aceive something else?

Thanks,

Archana

Former Member
0 Kudos

erm, this is not recommended.

Using one driver program for all your smartforms seems not really clever to me, unless you are talking of just all the invoice related forms.

doing what you want in a smartforms is not recommended as well, no need to process a form just to process another form from there.

If you really want to do this manually then do it in your driver program.

But actually most clever would be to make 2 seperate output types. most probably you will have different VBRK-FKART for your different VBTYP.

Former Member
0 Kudos

Hi,

You can create two flag variable in the driver program for each of the types.

In smartform pass these in the form interface.

Make use of the Conditions(Tab) options available at table/text level to print whatever is appropriate based on the flag.

For eg. In main window u can create 2 tables.

In one table pass the condition of flag_invoice = X

In other table pass the condition of flag_stock = X.

Hope it Helps.

Regards,

Apeksha Desai