Application Development and Automation 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: 
Read only

Smartform - Debit note

0 Likes
3,757

i need to make a smartform for debit note. this smartform will be assigned to output type for VF02 T-code. Can any one tell me how can I pull the document number fro VF02 t-code, because on the basis of this doc number i will fetch data and display it in smartform.

1 ACCEPTED SOLUTION
Read only

former_member218424
Participant
0 Likes
3,174

once you define your output type in NACE transaction.. you will get the data into NAST table.

use NAST table to get document number for further processing of data..

15 REPLIES 15
Read only

former_member218424
Participant
0 Likes
3,175

once you define your output type in NACE transaction.. you will get the data into NAST table.

use NAST table to get document number for further processing of data..

Read only

0 Likes
3,174

Hi

select single docno from vbrk  into give the table 

this code write under programme lines under window where do you wan tot display

Read only

rajkumarnarasimman
Active Contributor
0 Likes
3,174

Hi Nitanshu,

Please find the code which is used to get the document number inside driver program.


"Table Declaration

TABLES: nast.

FORM form_show      USING subrc TYPE sy-subrc                         

                                    dynnr TYPE c.                                     

  "Assign Document Number

  doc_number = nast-objky+0(10).

ENDFORM.

Regards

Rajkumar Narasimman

Read only

0 Likes
3,174

what is DNNR u have used in form.....

what should i pass here while i write perform part

Read only

0 Likes
3,174

Hi.

Are you calling the smartform via Custom Transaction or Standard one? Is NACE is configured for the particular output type?

We are not going to use perform statement, if the particular smartform is called from standard Transaction.

If smartform, is configured for the particular output type in NACE. In there itself, we mention the driver program name and subroutine name as shown in the above screenshot.

Regards

Rajkumar Narasimman

Read only

0 Likes
3,174

HI....

Thnx for the help.....

but i still need some more clarifications....

i made a smartform...and a driver program....

in driver program i wrote a select query and passed data to smartform for display....

then if i wont write perform statement to fetch doc num then how would i get it.........

Am i going correct?

if not kindly tell me where m going wrong............

i really appreciate your concern.....

Read only

0 Likes
3,174

Hi..

If you configured the driver program for the output type, when pressing print preview button, system will call the appropriate subroutine.

NAST Structure will contain the document value. Place breakpoint inside the subroutine, and declare the structure NAST and you can find the document number.


"Use NAST Table in the program.

TABLES: NAST.

Also find the link below.

Template Driver Program for Smartforms Called from Nace transaction code. - Code Gallery - SCN Wiki

Unique Driver Program for any smartform of a transaction - Code Gallery - SCN Wiki

Regards

Rajkumar Narasimman

Read only

0 Likes
3,174

i followed the code given in link Unique Driver Program for any smartform of a transaction - Code Gallery - SCN Wiki u gave me....

formatting error is coming.....

can u help me in this

Read only

0 Likes
3,174

Hi. .

I hope the formatting error is an exception which is triggering in the FM at where the smartform is called. Kindly check the Table/Template width used in smartform.

Place the break-point inside driver program in CALL FUNCTION 'SMARFORM_NAME'.

Click Print Preview button, the debugger stops in driver program.

Debug the smartform, Press F9 and give the statement as MESSAGE and press ok.

Debugger will stops on every MESSAGE that helps to find at where the exception triggering.

Regards

Rajkumar Narasimman

Read only

0 Likes
3,174

hi,

very very thanx for the help. Finally itz done.

Read only

0 Likes
3,174

Hi Rajkumar,

i am converting the smartform to pdf......on my system it is running ok but on other systems error comes and does not download......'ERROR CALLING DATA PROVIDER' message no.FES011....

can u tell me why this is happening....

this is what i did for downloading. on my system it is running download and all but i gave it for internal testing to SD team then on i got to know that it is not getting downloaded on other systems.

**********************

concatenate 'C:\' v_doc_num '_debitnote.pdf' into v_path.

CALL FUNCTION 'GUI_DOWNLOAD'

   EXPORTING

*   BIN_FILESIZE                    =

     filename                        = v_path

    FILETYPE                        = 'BIN'

*   APPEND                          = ' '

*   WRITE_FIELD_SEPARATOR           = ' '

*   HEADER                          = '00'

*   TRUNC_TRAILING_BLANKS           = ' '

*   WRITE_LF                        = 'X'

*   COL_SELECT                      = ' '

*   COL_SELECT_MASK                 = ' '

*   DAT_MODE                        = ' '

*   CONFIRM_OVERWRITE               = ' '

*   NO_AUTH_CHECK                   = ' '

*   CODEPAGE                        = ' '

*   IGNORE_CERR                     = ABAP_TRUE

*   REPLACEMENT                     = '#'

*   WRITE_BOM                       = ' '

*   TRUNC_TRAILING_BLANKS_EOL       = 'X'

*   WK1_N_FORMAT                    = ' '

*   WK1_N_SIZE                      = ' '

*   WK1_T_FORMAT                    = ' '

*   WK1_T_SIZE                      = ' '

*   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE

*   SHOW_TRANSFER_STATUS            = ABAP_TRUE

* IMPORTING

*   FILELENGTH                      =

   tables

     data_tab                        = g_tab_i_pdf

*   FIELDNAMES                      =

* EXCEPTIONS

*   FILE_WRITE_ERROR                = 1

*   NO_BATCH                        = 2

*   GUI_REFUSE_FILETRANSFER         = 3

*   INVALID_TYPE                    = 4

*   NO_AUTHORITY                    = 5

*   UNKNOWN_ERROR                   = 6

*   HEADER_NOT_ALLOWED              = 7

*   SEPARATOR_NOT_ALLOWED           = 8

*   FILESIZE_NOT_ALLOWED            = 9

*   HEADER_TOO_LONG                 = 10

*   DP_ERROR_CREATE                 = 11

*   DP_ERROR_SEND                   = 12

*   DP_ERROR_WRITE                  = 13

*   UNKNOWN_DP_ERROR                = 14

*   ACCESS_DENIED                   = 15

*   DP_OUT_OF_MEMORY                = 16

*   DISK_FULL                       = 17

*   DP_TIMEOUT                      = 18

*   FILE_NOT_FOUND                  = 19

*   DATAPROVIDER_EXCEPTION          = 20

*   CONTROL_FLUSH_ERROR             = 21

*   OTHERS                          = 22

           .

***********OPEN DOWNLOADED DOCUMENT********************************************************************************************

call method cl_gui_frontend_services=>execute

     exporting

       document               = v_path

     exceptions

       cntl_error             = 1

       error_no_gui           = 2

       bad_parameter          = 3

       file_not_found         = 4

       path_not_found         = 5

       file_extension_unknown = 6

       error_execute_failed   = 7

       synchronous_failed     = 8

       not_supported_by_gui   = 9

       others                 = 10.

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
3,174

I'm confused - why do you need to reinvent the bicycle? Can't you just use the standard output program and a copy of the standard billing document form? Check SAP notes for information on standard forms. The form can be used for multiple document types if the layout is the same. I believe the standard form already prints different header based on the document type.

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
3,174

Nitanshu, not sure why you chose to ignore my question (it is still valid). There are standard programs and forms available. From what I see, this shouldn't require any custom development in the first place. But whatever motives you have - wouldn't it make sense at least to look at the standard programs and forms and spend some time understanding how they work?

I believe that before writing any custom output programs one actually needs to understand very well how standard output works. If you did you wouldn't be having these questions.

Read only

0 Likes
3,174

Hi Jelena,

Its not I ignored your question, i just didn't find any standard form for debit note.

can u tell me which form/program i should refer to.

coz this scenario is new to me.....output type and all.

Read only

0 Likes
3,174

Google -> 'standard smartform invoice site:sap.com' finds tons of posts, including this wiki page. Same form works for all billing documents.