cancel
Showing results for 
Search instead for 
Did you mean: 

smart forms

Former Member
0 Kudos

hi folks,

iam doing smartforms ,i have to add additional form to the existing form does that mean adding page to existing form if so how should i do ?i have to create a form with required layout ,i i have write select queries in form to retrive data in database and give values ,where do in write these quries in driver program r in form ?my layout contain two fields with diff description (VBAK-VBELN) another field down to it and another field toth top of the right side ,below material no next to its description and tow more fields , how should i create layout please help and quiries where should i write ,points will be awarded for the answers.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vinay,

Here I am sending you the sample code for driver program.

REPORT z50871mm_smartform.

----


  • INTERNAL TABLE DECLARATIONS

  • WORKAREA DECLARATIONS

----


DATA : it_ekpo TYPE z50871_ekpo_t.

DATA : wa_ekko TYPE z50871_ekko_s,

wa_lfa1 TYPE z50871_lfa1_s.

*Variable Declarations

DATA : v_funcname TYPE rs38l_fnam, "Function Module Name

v_ebeln TYPE ebeln. "Purchase Document Number

----


  • SELECTION-SCREEN

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE tit1.

PARAMETERS : p_ebeln TYPE ekko-ebeln OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

----


  • INITIALIZATION

----


INITIALIZATION.

tit1 = text-001.

----


  • AT SELECTION-SCREEN

----


AT SELECTION-SCREEN ON p_ebeln.

PERFORM validate_ebeln.

----


  • START-OF-SELECTION

----


START-OF-SELECTION.

PERFORM get_headerdata.

PERFORM get_itemdata.

PERFORM get_vendordata.

PERFORM call_smartform.

&----


*& Form get_headerdata

&----


FORM get_headerdata.

SELECT SINGLE ebeln bstyp bsart aedat ernam

INTO wa_ekko

FROM ekko

WHERE ebeln = p_ebeln.

ENDFORM. "get_headerdata

&----


*& Form get_vendordata

&----


FORM get_vendordata.

SELECT SINGLE lflifnr lfname1 lfort01 lfland1 lf~adrnr

INTO wa_lfa1

FROM lfa1 AS lf INNER JOIN ekko AS ek

ON lflifnr = eklifnr

WHERE ek~ebeln = p_ebeln.

ENDFORM. "get_vendordata

&----


*& Form get_itemdata

&----


FORM get_itemdata.

SELECT ebelp ematn matkl netpr

INTO TABLE it_ekpo

FROM ekpo

WHERE ebeln = p_ebeln.

ENDFORM. "get_itemdata

&----


*& Form validate_ebeln

&----


FORM validate_ebeln.

SELECT SINGLE ebeln

FROM ekko

INTO v_ebeln

WHERE ebeln = p_ebeln.

IF sy-subrc NE 0.

MESSAGE e020(z50871msg) WITH 'Purchase Document Number Is Invalid'(002).

EXIT.

ENDIF.

ENDFORM. "VALIDATE_EBELN

&----


*& Form CALL_SMARTFORM

&----


FORM call_smartform.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z50871MM_SMARTFORM'

IMPORTING

fm_name = v_funcname

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

****/1BCDWB/SF00000721

CALL FUNCTION v_funcname

EXPORTING

wa_lfa1 = wa_lfa1

wa_ekko = wa_ekko

TABLES

it_ekpo = it_ekpo[]

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. "CALL_SMARTFORM

In the smartform , I am displaying Purchase order header details, Item details, and vendor details.

So, those parameters I am passing from here.(wa_lfa1, wa_ekko,it_ekpo).

This you can use it as a reference.

Regards

Sandeep Reddy

Former Member
0 Kudos

Hi,

1.Create a layout,by using the Form painter.

2.Write code in program Lines.

window--->Program Lines.

3.Here you can write the select statements etc.

For more info:

http://www.saptechnical.com/Tips/SmartForms/SFMain1.htm

Regards,

Kumar

Former Member
0 Kudos

Hi,

you can write the extra logic in the initialization tab in global definitions and get the data.

or

you can write the extra logic in the program lines.

Thanks,

NN.