cancel
Showing results for 
Search instead for 
Did you mean: 

Standard invoice form and print program

Former Member
0 Kudos

I am trying to run the standard print program and smart form so i can print preview some sample data. I have created copies of RLB_INVOICE and LB_BIL_INVOICE and for my print program i have moved the includes as well

I want to be able to run the print program so I can see the form output. In Z_RLB_INVOICE I have changed lf_formname = tnapr-sform. to myformname

But when I run the program it gives me a dump. I am trying to figure out how to run this standard form

Accepted Solutions (1)

Accepted Solutions (1)

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please ensure the output type configuration is done properly (transaction NACE) for custom smartform. Then you can use this program SD70AV3A to generate invoice form.

Regards,

Ferry Lianto

Answers (8)

Answers (8)

Former Member
0 Kudos

I have set up the Output processing in Invoice.

When i look at the processing log it says Processing routine ENTRY in program Z_SD_PRINTPROG does not exist

My print prog is merely a copy of the std RLB_INVOICE

Former Member
0 Kudos

Ok here is the std program

My form is ZNAF

How to run this so my form will be executed and i can see some print preview

the output hasnt been set .. can i not run this without setting the output determination

REPORT rlb_invoice.

* declaration of data
INCLUDE Z_RLB_INVOICE_DATA_DECLARE.
*INCLUDE rlb_invoice_data_declare.
* definition of forms
INCLUDE Z_RLB_INVOICE_FORM01.
*INCLUDE rlb_invoice_form01.
INCLUDE Z_RLB_PRINT_FORMS.
*INCLUDE rlb_print_forms.

*---------------------------------------------------------------------*
*       FORM ENTRY
*---------------------------------------------------------------------*
FORM entry USING return_code us_screen.

  DATA: lf_retcode TYPE sy-subrc.
  CLEAR retcode.
  xscreen = us_screen.
  PERFORM processing USING us_screen
                     CHANGING lf_retcode.
  IF lf_retcode NE 0.
    return_code = 1.
  ELSE.
    return_code = 0.
  ENDIF.

ENDFORM.                    "ENTRY
*---------------------------------------------------------------------*
*       FORM PROCESSING                                               *
*---------------------------------------------------------------------*
FORM processing USING proc_screen
                CHANGING cf_retcode.

  DATA: ls_print_data_to_read TYPE lbbil_print_data_to_read.
  DATA: ls_bil_invoice        TYPE lbbil_invoice.
  DATA: lf_fm_name            TYPE rs38l_fnam.
  DATA: ls_control_param      TYPE ssfctrlop.
  DATA: ls_composer_param     TYPE ssfcompop.
  DATA: ls_recipient          TYPE swotobjid.
  DATA: ls_sender             TYPE swotobjid.
  DATA: lf_formname           TYPE tdsfname.
  DATA: ls_addr_key           LIKE addr_key.
  DATA: ls_dlv-land           LIKE vbrk-land1.
  DATA: ls_job_info           TYPE ssfcrescl.

* SmartForm from customizing table TNAPR
  lf_formname = tnapr-sform.
  *lf_formname = 'ZNAF'.

* determine print data
  PERFORM set_print_data_to_read USING    lf_formname
                                 CHANGING ls_print_data_to_read
                                 cf_retcode.

  IF cf_retcode = 0.
* select print data
    PERFORM get_data USING    ls_print_data_to_read
                     CHANGING ls_addr_key
                              ls_dlv-land
                              ls_bil_invoice
                              cf_retcode.
  ENDIF.

  IF cf_retcode = 0.
    PERFORM set_print_param USING    ls_addr_key
                                     ls_dlv-land
                            CHANGING ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     cf_retcode.
  ENDIF.

  IF cf_retcode = 0.
* determine smartform function module for invoice
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
         EXPORTING  formname           = lf_formname
*                 variant            = ' '
*                 direct_call        = ' '
         IMPORTING  fm_name            = lf_fm_name
         EXCEPTIONS no_form            = 1
                    no_function_module = 2
                    OTHERS             = 3.
    IF sy-subrc <> 0.
*   error handling
      cf_retcode = sy-subrc.
      PERFORM protocol_update.
    ENDIF.
  ENDIF.

  IF cf_retcode = 0.
    PERFORM check_repeat.
    IF ls_composer_param-tdcopies EQ 0.
      nast_anzal = 1.
    ELSE.
      nast_anzal = ls_composer_param-tdcopies.
    ENDIF.
    ls_composer_param-tdcopies = 1.
    DO nast_anzal TIMES.
* In case of repetition only one time archiving
      IF sy-index > 1 AND nast-tdarmod = 3.
        nast_tdarmod = nast-tdarmod.
        nast-tdarmod = 1.
        ls_composer_param-tdarmod = 1.
      ENDIF.
      IF sy-index NE 1 AND repeat IS INITIAL.
        repeat = 'X'.
      ENDIF.
* call smartform invoice
      CALL FUNCTION lf_fm_name
           EXPORTING
                      archive_index        = toa_dara
                      archive_parameters   = arc_params
                      control_parameters   = ls_control_param
*                 mail_appl_obj        =
                      mail_recipient       = ls_recipient
                      mail_sender          = ls_sender
                      output_options       = ls_composer_param
                      user_settings        = space
                      is_bil_invoice       = ls_bil_invoice
                      is_nast              = nast
                      is_repeat            = repeat
           importing  job_output_info      = ls_job_info
*                     document_output_info =
*                     job_output_options   =
           EXCEPTIONS formatting_error     = 1
                      internal_error       = 2
                      send_error           = 3
                      user_canceled        = 4
                      OTHERS               = 5.
      IF sy-subrc <> 0.
*   error handling
        cf_retcode = sy-subrc.
        PERFORM protocol_update.
* get SmartForm protocoll and store it in the NAST protocoll
        PERFORM add_smfrm_prot.
      ENDIF.
    ENDDO.
* get SmartForm spoolid and store it in the NAST protocoll
    DATA ls_spoolid LIKE LINE OF ls_job_info-spoolids.
    LOOP AT ls_job_info-spoolids INTO ls_spoolid.
      IF ls_spoolid NE space.
        PERFORM protocol_update_spool USING '342' ls_spoolid
                                            space space space.
      ENDIF.
    ENDLOOP.
    ls_composer_param-tdcopies = nast_anzal.
    IF NOT nast_tdarmod IS INITIAL.
      nast-tdarmod = nast_tdarmod.
      CLEAR nast_tdarmod.
    ENDIF.

  ENDIF.

* get SmartForm protocoll and store it in the NAST protocoll
* PERFORM ADD_SMFRM_PROT.

Former Member
0 Kudos

Hi Ferry

I am using your code as my test print program.

I enter my Kunnr 220

my invoice 90000753

fname z_sd_invoice

but when i run it , it gives me dump saying the parameter IS_BIL_INVOICE was not specified. Is this not the invoice number ?

Former Member
0 Kudos

Hi

Just as I said in my prevoius answer you should copy a std program calls RLB_INVOICE (for example RSNAST00 like in my sample),

Anyway IS_BIL_INVOICE is based on complex structure LBBIL_INVOICE.

Max

ferry_lianto
Active Contributor
0 Kudos

Hi,

For testing purposes, you can create test program to display smart form.

Check this sample program.


REPORT  ZZFL_SF001.
                                                        
TABLES: EKPO.
                                          
SELECTION-SCREEN BEGIN OF BLOCK BX1 WITH FRAME TITLE TEXT-001.
PARAMETERS:     P_KUNNR  LIKE KNA1-KUNNR.
SELECT-OPTIONS: SO_EBELN FOR EKPO-EBELN.
SELECTION-SCREEN SKIP 1.
PARAMETERS:     P_FNAME   TYPE TDSFNAME,
                P_PRNT(4) DEFAULT 'LOCA'.
SELECTION-SCREEN END OF BLOCK BX1.
                                            
DATA: BEGIN OF I_EBELN OCCURS 0.
        INCLUDE STRUCTURE BAPIEKKO.
DATA: END OF I_EBELN.
                     
DATA: FUNC_MOD_NAME      TYPE RS38L_FNAM,
      OUTPUT_OPTIONS     TYPE SSFCOMPOP,
      CONTROL_PARAMETERS TYPE SSFCTRLOP.

START-OF-SELECTION.
  SELECT EBELN
  INTO TABLE I_EBELN
  FROM EKPO
  WHERE EBELN IN SO_EBELN.
                   
  SORT I_EBELN.
  DELETE ADJACENT DUPLICATES FROM I_EBELN.
                    
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME           = P_FNAME
    IMPORTING
      FM_NAME            = FUNC_MOD_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.
              
  OUTPUT_OPTIONS-TDDEST        = P_PRNT.
  CONTROL_PARAMETERS-NO_DIALOG = 'X'.
  CONTROL_PARAMETERS-PREVIEW   = 'X'.

  CALL FUNCTION FUNC_MOD_NAME
    EXPORTING
      CONTROL_PARAMETERS = CONTROL_PARAMETERS
      OUTPUT_OPTIONS     = OUTPUT_OPTIONS
      USER_SETTINGS      = SPACE
      IS_CUSTOMER        = P_KUNNR
    TABLES
      IS_EBELN           = I_EBELN
    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.
             
END-OF-SELECTION.

You can use the print program and attach to output type configuration in order to display/generate the smart form based on SAP document/transaction.

Regards,

Ferry Lianto

Former Member
0 Kudos

I want to display the Invoice number 90000753. I go to my smart form lb_bil_invoice and press f8 which gives me the function module press f8 again which brings me to the function module initial screen

what do i do next

Former Member
0 Kudos

When running a smart form do you execute the smart form or the print program to run it and get some output

Former Member
0 Kudos

Every smartform needs a program to run it, but here the problem is program like RLB_INVOICE is created only to be called by antoher program to print the document.

The main program to print an invoice is VF31, but it can use VF03 or program RSNAST00.

So if you want to creat an own program to run only onw smartform you should create a copy of VF31(report SD70AV3A).

For example you can create ZRSNAST00 and modify these lines:

*PERFORM (TNAPR-RONAM) IN PROGRAM (TNAPR-PGNAM) USING *RETURNCODE

*US_SCREEN

PERFORM ENTRY IN PROGRAM Z_RLB_INVOICE USING RETURNCODE

US_SCREEN

And initilize the selection-screen with the application for invoice:

INITIALIZATION.

S_KAPPL-LOW = 'V3'.

APPEND S_KAPPL.

Max

Former Member
0 Kudos

Hi,

Goto NACE transactcion code, there we did the SCRIPT configuration, there select the correct Application type then press the Output Routiens, there seelct the Correct output type, then double click there you will find the Script name and the Driver program name, see and if you want to configure your G alyout, then change it

Regards

Sudheer

Former Member
0 Kudos

For testing purposes may be i need to create my own print program as I dont quite understand RLB_INVOICE yet since its based on output message

Former Member
0 Kudos

Hi

The program RLB_INVOICE (so your copy Z_RLB_INVOICE) can't running alone, here there are only the routines called by main program to print the invoice.

If you want to create an your own program based on RLB_INVOICE, you should insert the code to select the data of the message from NAST table.

I believe it's easier to set the right data by NACE trx instead of to create an own program.

Max