Application Development 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: 

HOW TO FETCH SMARTFORM NAME FOR THE FM SSF_FUNCTION_MODULE_NAME FROM THE TABLE TNAPR

martinlydia
Explorer
0 Kudos

Hiii,

I have to fetch the smartform name from the table TNAPR and pass it to the FM SSF_FUNCTION_MODULE_NAME.

Can someone tell me how to do a select query so that I'll get the appropriate form name.

Thanks and regards,

Lydia Martin..

1 ACCEPTED SOLUTION

aoyang
Contributor
0 Kudos

Do not know what the requirement is but if you know the conditions to specify the exact row you want in TNAPR, here is a sample code you can refer to. Fields KSCHL,NACHA,KAPPL are used here to make the fetched data unique but please replace with your own conditions. In this case smartform LE_TRA_CONF_STAT is fetched and its FM name is stored in LV_FM_NAME.

DATA:LV_SMARTFORM  TYPE TNAPR-SFORM,
     LV_FM_NAME    TYPE RS38L_FNAM.

SELECT SINGLE SFORM
  FROM TNAPR
  INTO LV_SMARTFORM
 WHERE KSCHL = 'CPAC'
   AND NACHA = '5'
   AND KAPPL = 'V7'.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME                 = LV_SMARTFORM
   IMPORTING
      FM_NAME                  = LV_FM_NAME
   EXCEPTIONS
     NO_FORM                  = 1
     NO_FUNCTION_MODULE       = 2
     OTHERS                   = 3.
If this did not solve it, let me know your requirement in detail.
6 REPLIES 6

FredericGirod
Active Contributor

Lydia, don't write text in upper case

the TNAPR table is managed by the standard, SAP call from this customizing a print program with a form name. You just have to be here, and you will find in memory this information.

What is the object you would like to print ?

martinlydia
Explorer
0 Kudos

Hii,

I want to print a smartform for repair report

Sandra_Rossi
Active Contributor

There are hundreds of "repair" reports in S/4HANA. Please be precise.

aoyang
Contributor
0 Kudos

Do not know what the requirement is but if you know the conditions to specify the exact row you want in TNAPR, here is a sample code you can refer to. Fields KSCHL,NACHA,KAPPL are used here to make the fetched data unique but please replace with your own conditions. In this case smartform LE_TRA_CONF_STAT is fetched and its FM name is stored in LV_FM_NAME.

DATA:LV_SMARTFORM  TYPE TNAPR-SFORM,
     LV_FM_NAME    TYPE RS38L_FNAM.

SELECT SINGLE SFORM
  FROM TNAPR
  INTO LV_SMARTFORM
 WHERE KSCHL = 'CPAC'
   AND NACHA = '5'
   AND KAPPL = 'V7'.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME                 = LV_SMARTFORM
   IMPORTING
      FM_NAME                  = LV_FM_NAME
   EXCEPTIONS
     NO_FORM                  = 1
     NO_FUNCTION_MODULE       = 2
     OTHERS                   = 3.
If this did not solve it, let me know your requirement in detail.

0 Kudos

Thanks...Solved it with your suggestion..

Regards,

Lydia Martin

Sandra_Rossi
Active Contributor

The concerned line of TNAPR is stored in the "Tables Work Area" memory (kind of shared memory), you should be able to get it implicitly in your program or smart form by just declaring its name with "TABLES", and after that, you may access its components:

TABLES tnapr. 
...
DATA(smart_form_name) = tnapr-sform.