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

Conditional Page call in smartforms

Former Member
0 Likes
3,886

Hi everybody,

I want to create a smartform with 2 pages.

i want to get the either of the page get called conditionally..

for example.

if material number starts with 11 the page 1 should get called

and if material number gets starts with 31 then page 2 should get called.

Is this possible.

9 REPLIES 9
Read only

Former Member
0 Likes
2,339

hi Kumar,

Please use Program Lines in your first page and check if the MATNR starts with 31 and set FLAG_NEXT = 'X'. Now call NEXT PAGE with condition maintained as FLAG_NEXT = 'X'.

In above scenario if the MATNR doesnt start with 31 (ie 11 matnr) then ur flag will be blank hence condition to call next page will fail and your current page would be (called) processed.

Please revert if still doubts.

Regards,

DN.

Read only

former_member220538
Active Participant
0 Likes
2,339

Hi,

Create two pages in the smartform.

In the first page, Use Program lines to check the material no start with 31 or not and If it starts with 31 then set a flag = 'X'.  Create a  Command and in the general attributes set go to page as PAGE2 if flag = 'X' .

Read only

Former Member
0 Likes
2,339

Hi


CONTROL_PARAMETERS.

In this structure you can pass the control parameters for the samrtform like the STARTPAGE of the SmartForm, and whether to show PREVIEW of the output etc.,,

Just have a condition in you Print(Driver) program as below before calling the SmartForm and pass the control parameters to the form Interface.

IF material number starts with 11.

CONTROL_PARAMETERS-STARTPAGE = 'PAGE1'.

ELSEIF material number gets starts with 31.

CONTROL_PARAMETERS-STARTPAGE = 'PAGE2'.

ENDIF.

* CALL YOUR Smartform

CALL FUNCTION Smartform_fm
   EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
CONTROL_PARAMETERS         = 
CONTROL_PARAMETERS
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =

Hope it will help you.

Thank you.

Regards,

Narayana Reddy A V L..

Read only

0 Likes
2,339

i tried this but it is throwing run time exception

Read only

0 Likes
2,339

Hello Kumar ,

Better You create Two Different Smartforms ( With Different Layouts as per MATNR )  for your Purpose and Based on Condition ( i.e MATNR ) trigger the corresponding FORM from the Driver Program.

Read only

0 Likes
2,339

Hi Kumar,

Apologies!!!

May I know the run time error description that you are getting.

If possible can you please share the screenshot of the Smartform(With Pages you have created) and the code.

Regards,

Narayana Reddy A V L.

Read only

0 Likes
2,339

Hi Kumar,

Just want to make clear that whether you have passed the page names of the First and Second pages of your SmartForm to the control parameters.

Lets say I have two pages in my smartform as follows with names FIRST and NEXT.

code should be as follows(Use Page names - Not "PAGE1" and "PAGE2"):

IF material number starts with 11.

CONTROL_PARAMETERS-STARTPAGE = 'FIRST'.

ELSEIF material number gets starts with 31.

CONTROL_PARAMETERS-STARTPAGE = 'NEXT'.

ENDIF.

Regards,

Narayana Reddy A V L.

Read only

0 Likes
2,339

Hi,

As

DATA: cp TYPE  ssfctrlop,
           v_no TYPE matnr VALUE '113634'.

SHIFT v_no LEFT DELETING LEADING '0'.

IF v_no(2) EQ 11.
  cp-startpage = 'PAGE1'.
ELSEIF v_no(2) EQ 22.
  cp-startpage = 'PAGE2'.
ENDIF.
"""""Use the Output of FM 'SSF_FUNCTION_MODULE_NAME' to call smartform.
CALL FUNCTION '/1BCDWB/SF00000401'

EXPORTING
    control_parameters = cp
    matnr              = v_no.

Read only

rosenberg_eitan
Active Contributor
0 Likes
2,339

Hi,

This is another post of the same question ?

See Here

http://scn.sap.com/message/14437535#14437535

Regards.

Re: Conditional Page call in smartforms