CALLING SMART FORM FORM PRINT PROGRAM

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 lf~lifnr lf~name1 lf~ort01 lf~land1 lf~adrnr
INTO wa_lfa1
FROM lfa1 AS lf INNER JOIN ekko AS ek
ON lf~lifnr = ek~lifnr
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

1 comment:

  1. Dear Sir,

    report is very simple and good. But where is 'Z50871MM_SMARTFORM' smartforms? please send details about 'Z50871MM_SMARTFORM'.

    Best regards,

    S.Umar(mcaumarfarook@yahoo.co.in)

    ReplyDelete