cancel
Showing results for 
Search instead for 
Did you mean: 

Converting smartform into executable(report) program..........

Former Member
0 Kudos

Hi Abapers,

I had a requirement to convert the smartform 'zpurchase'(customized std. PO form /SMB80/MMPO_ES), into an executable(report) program..so tat the user can execute this program by giving the Po Number in the run time and get the required form print out....

I had written a print program(zpo) for this form, but after executing i got only the layout not the values .... So guide me how to pull the values from tcode ME23N.....


REPORT  ZPO.

tables: ekko,pekko,ekpo,ekpa,eket,ekkn,ekek,komk.
*parameters: iv_druvo like druvo.
parameters: iv_ekpo like ekpo-ebeln.

data : fm_name type rs38l_fnam.
data: it_ekpo like standard table of ekpo,
      it_ekpa like standard table of ekpa,
      it_pekpo like standard table of pekpo,
      it_eket like standard table of eket,
      it_tkomv like standard table of komv,
      it_ekkn like standard table of ekkn,
      it_ekek like standard table of ekek,
      it_komk like standard table of komk.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    FORMNAME                 = 'ZPURCHASE'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
 IMPORTING
    FM_NAME                  = fm_name
* 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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thread closed...

Former Member
0 Kudos

Code as follows..........


CALL FUNCTION fm_name
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
    IS_EKKO                    = ekko
    IS_PEKKO                   = pekko
*   IS_NAST                    =
*   IV_FROM_MEM                =
*    IV_DRUVO                   = druvo
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    IT_EKPO                    = it_ekpo
    IT_EKPA                    = it_ekpa
    IT_PEKPO                   = it_pekpo
    IT_EKET                    = it_eket
    IT_TKOMV                   = it_tkomv
    IT_EKKN                    = it_ekkn
    IT_EKEK                    = it_ekek
    IT_KOMK                    = it_komk
* 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.

alex_m
Active Contributor
0 Kudos

Hi,

I dont see in your code all the internal table you passed to the FM doesnt populated any values, you need to populate the values to the table then only you able to see the values in form.

Former Member
0 Kudos

Hi Alex,

Can u eloborate how to populate values to internal tables in program... as i m new to this print program r how to do this...

Thanks,

BDK...

Former Member
0 Kudos

Hi BDK,

If your smartform alone is working fine and populating values with out driver program.

then you can change the form interface of your smartform

i.e., remove all the tables you declared in Form interface -> Tables

and declare them in the Global declarations as below

IT_EKPO type table of ekpo

IT_EKPA type table of ekpa so on.....

only thing you need to pass to the smartform is the Purchase order number from your driver program.

This will help you not to change anything in your report except calling the function module of the smartform again in the driver program

(or)

you can change the report program by writing the Select query in you program and populate the tables then pass them to the smartform.

either one of them will work.

Thanks&Regards

Sarves

Former Member
0 Kudos

Hi Sarves,

I customized what r the changes u told, but still i m getting only the smartform layout.

When excuting the form 'zpurchase' i m getting only the layout.

Can u tell me how to pass to the smartform ,the Purchase order number from my driver program.

Thanks,

BDK........

Former Member
0 Kudos

Hi,

Declare a variable in the form interface of the smartform as ebeln,

when you call the function module in the driver program you can see the value that you have declared in the export parameters, now pass the parameter to the PO declared in the smartform like below

CALL FUNCTION fm_name
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
    vbeln          = iv_ekpo  " ----> passing the purchase order to smartform

Thanks&Regards

Sarves

Former Member
0 Kudos

Hi Sarves,

Thnx for ur reply.... I made changes as u told,but still i m not getting the same layout....


CALL FUNCTION fm_name
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
    IS_EKKO                    = ekko
    IS_PEKKO                   = pekko
*   IS_NAST                    =
*   IV_FROM_MEM                =
*   IV_DRUVO                   =
    PO_NUMBER                  = EKPO-EBELN
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =

Thanks,

Dilip.B

Former Member
0 Kudos

Hi

Change the below

you need to give the parameter name not the type of it..

CALL FUNCTION fm_name
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
    IS_EKKO                    = ekko
    IS_PEKKO                   = pekko
*   IS_NAST                    =
*   IV_FROM_MEM                =
*   IV_DRUVO                   =
    PO_NUMBER                  = iv_ekpo "---> change it to this
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =

and one more thing can you just confirm whether you are getting the print preview without the print driver program..

i mean if you directly execute the program from the smartform

Regards

Sarves

Former Member
0 Kudos

Hi Sarves,

Thnx for ur immediate replies....

S, i had the parameter as u told, but still no required o/p.

One more thing i m getting the print preview without the driver program ....

Thanks,

Dilip.B

Former Member
0 Kudos

Hi,

Just check the select query you wrote in the smartform to fill the details into the internal table.

may be you have not populated it correctly..

check in your where condition you have mentioned the EBELN = PO_NUMBER or not...

that might be a reason why the internal tables are not getting populated...

may be you forgot to change the where condition perfectly..

check this once ..

Regards

Sarves