cancel
Showing results for 
Search instead for 
Did you mean: 

value not showing in printpriview of smartforms.......?

former_member185158
Participant
0 Kudos

i have to add a zsmart forms for vf02. i have copied  standard programRLB_INVOICE for vf02 into zprogram and in nace i add zsmartforrm and zprogram.

now i fcaeing a problem when i execute vf02 and give the billing doc no the print priview  is showing but no value is display in smartform but when i execute the smart form through tcode smartforms it shows all value.where is the problem ?

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member185158
Participant
0 Kudos

here is my code and see attachment for smartforms.......where is the problem ?

*----------------------------------------------------------------------*

*      Print of a invoice by  SMART FORMS               *

*----------------------------------------------------------------------*



REPORT ztest_program.





* declaration of data

INCLUDE zrlb_invoice_data_declare.

* definition of forms

INCLUDE zrlb_invoice_form01.

INCLUDE zrlb_print_forms.



*SELECTION-SCREEN: begin of BLOCK b1 with FRAME title text-000.

*TYPES : BEGIN OF ty_VBRP,

*        VBELN TYPE VBRP-VBELN,

*        KURSK TYPE VBRP-KURSK,

*        FKIMG TYPE VBRP-FKIMG,

*        NETWR TYPE VBRP-NETWR,

*        VGBEL TYPE VBRP-VGBEL,

*        END OF Ty_VBRP.

*  TYPES : BEGIN OF ty_VBRK,

*         VBELN TYPE VBRK-vbeln,

*         VKORG TYPE VBRK-VKORG,

*         FKDAT TYPE VBRK-FKDAT,

*         ZTERM TYPE VBRK-ZTERM,

*         BUKRS TYPE VBRK-BUKRS,

*         NETWR TYPE VBRK-NETWR,

*         kunag TYPE VBRK-KUNAG,

*          END OF Ty_VBRK.



*  parameter: LV_vbeln type vbrk-vbeln  .

*  SELECTION-SCREEN: end of BLOCK b1 .

  DATA : t_vbrk LIKE STANDARD TABLE OF vbrk.





DATA: t_vbrp LIKE STANDARD TABLE OF vbrp,

      t_TVKO like standard table of tvko,

      t_ADRC like standard table of adrc,

      t_T001 like standard table of T001.

*

DATA : wa_vbrk LIKE LINE OF t_vbrk,         " Holds BillingDoc Header Details

       wa_vbrp LIKE LINE OF t_vbrp,

       WA_TVKO like line of t_tvko,

       WA_ADRC like line of t_adrc,

       WA_T001 like line of t_T001.

data: lv_vbeln type LBBIL_INVOICE-HD_GEN-BIL_NUMBER.

*if lv_vbeln is not initial.

*SELECT SINGLE vbeln

*                erdat

*                zterm

*                knumv

*                vkorg

*                kunrg

*                netwr  FROM vbrk

*                INTO wa_vbrk

*                WHERE vbeln = gv_vbeln.



*SELECTION-SCREEN: end of BLOCK b1 .

*---------------------------------------------------------------------*

*       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.



*

*  SELECT *

*    FROM vbrk

*    INTO TABLE t_vbrk

*   WHERE  vbeln EQ lv_vbeln.

*

*  SELECT *

*    FROM vbrp

*    INTO TABLE t_vbrp

*     FOR ALL ENTRIES IN t_vbrk

*   WHERE vbeln = t_vbrk-vbeln.

*    endform.

*                erdat

*                zterm

*                knumv

*                vkorg

*                kunrg

*                netwr  FROM vbrk

*                INTO wa_vbrk

*                WHERE vbeln = lv_vbeln.

* tables : nast.





endform.



                    "ENTRY

*---------------------------------------------------------------------*

*       FORM PROCESSING                                               *

*---------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*&  Include           ZFETCH_DATA

*&---------------------------------------------------------------------*







                  " FETCH_DATA



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.



*  data: lv_vbeln type LBBIL_INVOICE-HD_GEN-BIL_NUMBER.

* SmartForm from customizing table TNAPR

  lf_formname = tnapr-sform.



* BEGIN: Country specific extension for Hungary

  DATA: lv_ccnum TYPE IDHUCCNUM,

        lv_error TYPE c.



*perform data.

* If a valid entry exists for the form in customizing view

* IDHUBILLINGOUT then the localized output shall be used.

  SELECT SINGLE ccnum INTO lv_ccnum FROM IDHUBILLINGOUT WHERE

    kschl = nast-kschl.



  IF sy-subrc EQ 0.

    IF lv_ccnum IS INITIAL.

      lv_ccnum = 1.

    ENDIF.



    IF ( nast-delet IS INITIAL OR nast-dimme IS INITIAL ).



      nast-delet = 'X'.

      nast-dimme = 'X'.



      sy-msgid = 'IDFIHU'.

      sy-msgty = 'W'.

      sy-msgno = 201.

      sy-msgv1 = nast-objky.



      CALL FUNCTION 'NAST_PROTOCOL_UPDATE'

        EXPORTING

        MSG_ARBGB = sy-msgid

        MSG_NR    = sy-msgno

        MSG_TY    = sy-msgty

        MSG_V1    = sy-msgv1

        MSG_V2    = ''

        MSG_V3    = ''

        MSG_V4    = ''

      EXCEPTIONS

        OTHERS    = 1.

    ENDIF.

  ELSE.

    CLEAR lv_ccnum.

  ENDIF.

* END: Country specific extension for Hungary



* 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.

* BEGIN: Country specific extension for Hungary

    IF lv_ccnum IS NOT INITIAL.

      IF nast-repid IS INITIAL.

        nast-repid = 1.

      ELSE.

        nast-repid = nast-repid + 1.

      ENDIF.

      nast-pfld1 = lv_ccnum.

    ENDIF.



    DATA: t_otf_from_fm TYPE ssfcrescl.



*IF xscreen = 'X'.

*

*    w_cparam-getotf       = ' '.

*

*    w_cparam-preview    = 'X'.

*    w_cparam-no_dialog = ' '.

**    w_cparam-tdnoprev  = ' '.

**    w_cparam-tdimmed  = 'X'.

*  ELSE.

*    w_cparam-preview = ''.

*    w_cparam-no_dialog = 'X'.

*  ENDIF.







.





*  ls_control_param-no_dialog = 'X'.

*  ls_control_param-preview = SPACE.

*  ls_control_param-getotf = 'X'.

* ls_composer_param-tddest = 'LP01'.



*

*    CALL FUNCTION lf_fm_name

*  EXPORTING

**   ARCHIVE_INDEX              = toa_dara

**   ARCHIVE_INDEX_TAB          = arc_params

**   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"SSFCOMPOP"W_OUTOPTIONS

*    USER_SETTINGS              = 'X'

*    P_VBELN                    =  p_vbeln

* IMPORTING

**   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            = t_otf_from_fm

**   JOB_OUTPUT_OPTIONS         = ls_job_info

* EXCEPTIONS

*   FORMATTING_ERROR           = 1

*   INTERNAL_ERROR             = 2

*   SEND_ERROR                 = 3

*   USER_CANCELED              = 4

*   OTHERS                     = 5.

*

*IF SY-SUBRC <> 0.

*  PERFORM protocol_update.

*   cf_retcode = sy-subrc.

** Implement suitable error handling here

*ENDIF.

*



CALL FUNCTION lf_fm_name"'/1BCDWB/SF00000010'

  EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

*   CONTROL_PARAMETERS         =

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

*   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = 'X'

    P_VBELN                    = lv_vbeln

    IS_BIL_INVOICE             = ls_bil_invoice

    IS_NAST                    = nast

    IS_REPEAT                  = repeat

* IMPORTING

*   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            =

*   JOB_OUTPUT_OPTIONS         =

* EXCEPTIONS

*   FORMATTING_ERROR           = 1

*   INTERNAL_ERROR             = 2

*   SEND_ERROR                 = 3

*   USER_CANCELED              = 4

*   OTHERS                     = 5

          .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.



*  EXPORTING

**   ARCHIVE_INDEX              =

**   ARCHIVE_INDEX_TAB          =

**   ARCHIVE_PARAMETERS         =

**   CONTROL_PARAMETERS         =

**   MAIL_APPL_OBJ              =

**   MAIL_RECIPIENT             =

**   MAIL_SENDER                =

**   OUTPUT_OPTIONS             =

*    USER_SETTINGS              = 'X'

*    P_VBELN                    = lv_vbeln

** IMPORTING

**   DOCUMENT_OUTPUT_INFO       =

**   JOB_OUTPUT_INFO            =

**   JOB_OUTPUT_OPTIONS         =

* EXCEPTIONS

*   FORMATTING_ERROR           = 1

*   INTERNAL_ERROR             = 2

*   SEND_ERROR                 = 3

*   USER_CANCELED              = 4

*   OTHERS                     = 5

*          .

*IF SY-SUBRC <> 0.

** Implement suitable error handling here

*ENDIF.



*CALL FUNCTION lf_fm_name"'/1BCDWB/SF00000009'

* EXPORTING

**   ARCHIVE_INDEX              =

**   ARCHIVE_INDEX_TAB          =

**   ARCHIVE_PARAMETERS         =

**   CONTROL_PARAMETERS         =

**   MAIL_APPL_OBJ              =

**   MAIL_RECIPIENT             =

**   MAIL_SENDER                =

**   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = 'X'

** IMPORTING

**   DOCUMENT_OUTPUT_INFO       =

**   JOB_OUTPUT_INFO            =

**   JOB_OUTPUT_OPTIONS         =

* EXCEPTIONS

*   FORMATTING_ERROR           = 1

*   INTERNAL_ERROR             = 2

*   SEND_ERROR                 = 3

*   USER_CANCELED              = 4

*   OTHERS                     = 5

*          .

*IF SY-SUBRC <> 0.

** Implement suitable error handling here

*ENDIF.





* END: Country specific extension for Hungary

* 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.



ENDFORM.                    "PROCESSING

*&---------------------------------------------------------------------*

*&      Form  FETCH_DATA

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

*FORM FETCH_DATA .

*

*  SELECT *

*    FROM vbrk

*    INTO TABLE t_vbrk

*   WHERE  vbeln EQ p_vbeln.

*

*  SELECT *

*    FROM vbrp

*    INTO TABLE t_vbrp

*     FOR ALL ENTRIES IN t_vbrk

*   WHERE vbeln = t_vbrk-vbeln.

*

*SELECT SINGLE *

**         vbeln

**         VKORG

**         FKDAT

**         ZTERM

**         BUKRS

*   FROM VBRK

*   INTO WA_VBRK

*   WHERE VBELN = P_VBELN.

*IF SY-SUBRC = 0.

*

*  SELECT SINGLE * FROM TVKO

*                  INTO WA_TVKO

*                WHERE VKORG = WA_VBRK-VKORG.

*  IF SY-SUBRC = 0.

*

*    SELECT SINGLE * FROM ADRC

*                    INTO WA_ADRC

*                  WHERE ADDRNUMBER = WA_TVKO-ADRNR.

*

*    SELECT SINGLE * FROM T001

*                    INTO WA_T001

*                  WHERE BUKRS = WA_VBRK-BUKRS.

*endif.

*SELECT *

*      FROM vbrp

*      INTO TABLE t_vbrp

*      WHERE vbeln = WA_VBRK-vbeln.

*ENDIF.

*ENDFORM.                    " FETCH_DATA

*&---------------------------------------------------------------------*

*&      Form  DATA

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

*FORM DATA .

*SELECT *

*    FROM vbrk

*    INTO TABLE t_vbrk

*   WHERE  vbeln EQ lv_vbeln.

*ENDFORM.                    " DATA

*&---------------------------------------------------------------------*

*&      Form  SUB_VBRK

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

*FORM SUB_VBRK .

*sELECT *

*    FROM vbrk

*    INTO TABLE t_vbrk

*   WHERE  vbeln EQ lv_vbeln.

*ENDFORM.                    " SUB_VBRK

**&---------------------------------------------------------------------*

**&      Form  SUB_VBRP

**&---------------------------------------------------------------------*

**       text

**----------------------------------------------------------------------*

**  -->  p1        text

**  <--  p2        text

**----------------------------------------------------------------------*

*FORM SUB_VBRP .

*SELECT *

*    FROM vbrp

*    INTO TABLE t_vbrp

*     FOR ALL ENTRIES IN t_vbrk

*   WHERE vbeln = t_vbrk-vbeln.

*ENDFORM.                    " SUB_VBRP

former_member198834
Participant
0 Kudos

hi mukherjee,

in debug mode pls check u r billing doc number passing to smart form or nt

if its working in tcode bt nt in billing , may be this is one of reason, pls check in debug mode

Suresh

former_member185158
Participant
0 Kudos

hI  SURESH,

yes billing doc no not passing.

in smart form I chose vbrk-vbeln for billing doc no but in my program billdoc no take from nast-objky.

I copy standard program.

what to do now?

former_member184080
Active Contributor
0 Kudos

Hi Sharmistha,

Now, this is going towards ABAP. I request you to post this under ABAP space: http://scn.sap.com/community/abap

Regards, Sai Krishna.

former_member198834
Participant
0 Kudos

hi mukherjee,

USE THIS SAMPLE LOGIC

1 .

data : retcode like sy-subrc,         "Returncode

        xscreen(1) type c,

        g_tdname type tdobname,

        p_vbeln type vbrk-vbeln.

2.

form entry using return_code type i

                  us_screen type c.

   clear retcode.

   xscreen = us_screen.

   perform processing.

   if retcode ne 0.

     return_code = 1.

   else.

     return_code = 0.

   endif.

endform.

3.

form processing .

   tables : nast.

   p_vbeln = nast-objky.

*/ validate the billing document

   perform validate_bill_document.

*/ fetch billing header

   perform sub_vbrk.

*/ fetch billing item

   perform sub_vbrp.

*/ fetch material

   perform sub_mara.

*/ fetch material text

   perform sub_makt.

*/ fetch vendor

   perform sub_lfa1.

*/ fetch item conditions

   perform sub_konv.

*/ fetch sales document

   perform sub_vbak.

*/ fetch sales item

   perform sub_vbap.

*/ move data to final

   perform sub_move_final.

*/ display smart form

   perform sub_disp_smartform.

endform

HOPE THIS WILL WORK

suresh



former_member184080
Active Contributor
0 Kudos

Hi Sharmistha,

Are you able to see any data or its completely blank. If you are able to see few details and not appearing only some values then you have to check with ABAPer as to why the information is not coming. May be some logic is not added in the form program.

But, if you don't see any data then you have to check the below link.

http://scn.sap.com/thread/2021737

You need to approach your ABAPer.

Regards, Sai Krishna.

former_member185158
Participant
0 Kudos

Hi Sai Krishna.,

when I call the smartform through vf02 then its completely blank except windows r disply oonly but in smartforms tcode all data is disply with window.

former_member184080
Active Contributor
0 Kudos

Hi Sharmistha,

Its nothing to do from our end. You have to take help from ABAPer to get the data.

As I mentioned my previous post, please ask your ABAP guy to verify this link.

http://scn.sap.com/thread/2021737

Regards, Sai Krishna.

former_member186385
Active Contributor
0 Kudos

Hi,

Check the Value in the Billing document

in the smartform also, check if VBRK-NETWR is coded ?

if everything looks good, then you have to debugg the Smartform and try, believe some condition is not satisfying and hence value is not getting populated

regards,

santosh