cancel
Showing results for 
Search instead for 
Did you mean: 

form routine in smartform development

Former Member
0 Kudos

Hi friends..

I am developing a custom smartform from scractch.. this one is initiated when PO is created..

In order to configure the form i need to give form name, program name and form routine to configure it..

Can someone tell me in detailed what exactly is form routine and how do i select it for my form and what name should i give to functinal team to configure it..

Apppreciate your comments.

Thanks,

Kanthi..

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181962
Active Contributor
0 Kudos

Form name is the name of the smartform you are creating.

Program name is the driver program that whihch fetches the data to be displayed in your smartform.

Routine name is the name of the subroutine that gets triggered in the driver program when you actually save a PO.

Regards,

Ravi

Former Member
0 Kudos

Hi..

Great.. Thanks for the clarification.. Appreciate if someone can post custom driver program that has a form routine defined in it for any scenario..

Thanks again..

Kanthi..

former_member181962
Active Contributor
0 Kudos

Hi Kanthi,

Programming in a driver program that gets automatically triggered from a transaction will typically look like this:

FORM ENTRY USING RETURN_CODE US_SCREEN.

CLEAR RETCODE.

XSCREEN = US_SCREEN.

PERFORM PROCESSING.

IF RETCODE NE 0.

RETURN_CODE = 1.

ELSE.

RETURN_CODE = 0.

ENDIF.

ENDFORM.

FORM PROCESSING.

data: fm_name type RS38L_FNAM.

data: control_parameters type SSFCTRLOP.

data: num type c.

data: i_slk like SLK.

  • Table internal

DATA: BEGIN OF t_SLK OCCURS 0.

INCLUDE STRUCTURE VTRLK.

DATA: END OF t_SLK.

PERFORM INITIALIZE_DATA.

PERFORM GET_DATA.

  • Get the function module for the smartform

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'Z_VICS_BILL_OF_LADING'

IMPORTING

FM_NAME = fm_name.

  • Store the control parameters to print preview through the transaction

move 'X' to control_parameters-no_dialog.

move 'X' to control_parameters-preview.

move 'PRINTER' to control_parameters-device.

  • Read the delivery table and determine if individual or master

describe table SLK lines sy-tabix.

if sy-tabix = 1.

move 'I' to num.

elseif sy-tabix > 1.

move 'M' to num.

endif.

  • Execute the function module - send the master

CALL FUNCTION fm_name

EXPORTING

CONTROL_PARAMETERS = control_parameters

SHIPMENT_NUM = SHIPMENT_NUM

VTTKVB = VTTKVB "Shipment Head

TVTK = TVTK "Shipmenttype

TVTKT = TVTKT "Description Shipmenttype

TTDS = TTDS "Disposition

TTDST = TTDST "Description Disposition

VBPLA = VBPLA "Packages

NUM = num "Master or Individual BOL

TABLES

VTTP = XVTTP "Shipment Items

TRLK = SLK "Delivery

TRLP = SLP "Delivery Item

VTTS = XVTTS "Shipment Segments

VTSP = XVTSP "Segments/Items

VBPA = XVBPA "Partner

VBADR = XVBADR "Address

VTFA = XVTFA "Flow

VBPLK = XVBPLK "Shipment Unit Header

VBPLP = XVBPLP "Shipment Unit

VBPLS = XVBPLS. "Shipment Unit Sum

  • print the individual deliveries

if num = 'M'.

num = 'I'.

loop at SLK into i_slk.

  • Store each delivery

append i_slk to t_slk.

  • Print the Bill of Lading for each individual delivery

CALL FUNCTION fm_name

EXPORTING

CONTROL_PARAMETERS = control_parameters

SHIPMENT_NUM = SHIPMENT_NUM

VTTKVB = VTTKVB "Shipment Head

TVTK = TVTK "Shipmenttype

TVTKT = TVTKT "Description Shipmenttype

TTDS = TTDS "Disposition

TTDST = TTDST "Description Disposition

VBPLA = VBPLA "Packages

NUM = num "Master or Individual BOL

TABLES

VTTP = XVTTP "Shipment Items

TRLK = t_slk "Delivery

TRLP = SLP "Delivery Item

VTTS = XVTTS "Shipment Segments

VTSP = XVTSP "Segments/Items

VBPA = XVBPA "Partner

VBADR = XVBADR "Address

VTFA = XVTFA "Flow

VBPLK = XVBPLK "Shipment Unit Header

VBPLP = XVBPLP "Shipment Unit

VBPLS = XVBPLS. "Shipment Unit Sum

clear t_slk[].

endloop.

endif.

ENDFORM.

in the perform processing, you should get all the data using nast structures.

Meaning, nast-objkey will have po number in your case.

Get all po related info by writing slects on EKKO anf EKPO tables.

Then you can call the FMs for smartform name and the FM for the smartform.

Regards,

Ravi

Former Member
0 Kudos

Thanks ravi..

So you mean to say that i need to assign a tcode for my driver program.. I though it is autommatically called when a PO is created or saved...

( So can you cleary tell me like if the driver program is called when a tcode is executed or when the PO is created or saved... do we really need to assing this driver program to any tcode...)

And regarding the form routine.. can i use the form entry as it is in the above example for all my custom forms or will there be different form routine names for different forms.....

Thanks for all your great answers and sorry for bit inexperience in this topic.....

Thanks,

Kanthi...

former_member181962
Active Contributor
0 Kudos

No Kanthi,

YOu do not need to assign a t code for your driver program.

For example when you create a PO in me21, there will be an output type that is attached to the me21 transaction.

That Output type will trigger your driver program automatically.

The control comes to the form entry after you save the transaction(me21 in your case).

YOu can use the name 'entry' for your form as well.Only thing you should remember is that you should have given the same name for the routine name in NACE transaction(where you configure your output type).

P.S: Nothing to feel sorry about...:)

Regards,

Ravi

Former Member
0 Kudos

Thanks ...

Looks like i got a clear idea now... Thanks for your answers.. if iam stuck hope i will post to get help from you guys..

thanks again..

kanthi..