cancel
Showing results for 
Search instead for 
Did you mean: 

problem in printing net value of sales order (vbak-netwr) .

Former Member
0 Kudos

Hello gurus

I caught in a problem while designing a smartform

1. my objective of the smartform is to select the date(VBAK-AUDATt) in selection screen of of the driver program and

execute a select query in driver program selecting data for AURAT NETWR WAERK from VBAK table and print in smartform.

2. i created a structure in DDIC with field AUDAT AURAT NETWR WAERK

3.at the time of structure creation i give reference field Table VBAK and reference field WAEK.

4.my driver program is 'ZTESTCURRENCY'.




REPORT  ZTESTCURRENCY.

data : IT_DATA  type table of  zstruct1.
DATA : FM_NAME TYPE RS38L_FNAM.
DATA : FORM_NAME TYPE TDSFNAME.

selection-screen begin of block b1 with frame title text-000.

parameters p_date type vbak-audat.

selection-screen pushbutton /10(5) pb1 USER-COMMAND UC01.

selection-screen end of block b1.


initialization.

move 'PRINT' to pb1.

AT SELECTION-SCREEN.

case SY-UCOMM.

when 'UC01'.

PERFORM SELECT_DATA.

ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  SELECT_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM SELECT_DATA .
     FM_NAME =  '/1BCDWB/SF00000042'.
     FORM_NAME = 'ZSF_TESTSMARTFORM'.

     SELECT AUDAT
            AUART
            NETWR
            WAERK
            INTO TABLE IT_DATA FROM VBAK WHERE AUDAT = p_date.




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


            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'
*             IMPORTING
*               DOCUMENT_OUTPUT_INFO       =
*               JOB_OUTPUT_INFO            =
*               JOB_OUTPUT_OPTIONS         =
              TABLES
                IT_DATA                    =  IT_DATA
*             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.



ENDFORM.                    " SELECT_DATA

i c

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In smartform

i from interface IT_DATA TYPE TABLE OF ZSTRUCT1,

WA_STR TYPE ZSTRUCT1.

I WANT TO PRINT &WA_STR-NETWR& &WA_STR_-WAERK& IN SMARTFORM

WHEN I EXECUTE THE DRIVER PROGRAM A ERROR COMES

" Reference field wa_str-netwr unknown in form".

please suggest the answer.

thanks in advance.

Edited by: chitto123 on Sep 30, 2010 8:29 AM

Edited by: chitto123 on Sep 30, 2010 8:31 AM

brad_bohn
Active Contributor
0 Kudos

Is this used directly in a LOOP in a window or are you processing the data in a code node in the form? It makes a difference. However, your work area should be defined in the global definitions, not the form interface. Also, keep in mind that it makes no sense to define a currency reference field that isn't related in any way to your DDIC structure, i.e., VBAK-WAERK for ZSTRUC-NETWR. If you have the currency reference field in the structure, then use that field.

Former Member
0 Kudos

thanks for quick response sir

I applied loop in table of the smartform no program area defined in the node.

i only pass internal table to smartform from my program so only field in form interface is my internal table.

SAP mentioned that when ever there is currency or quantity field then we have to give reference field.

without giving reference field structure shows error during activation,

I also refered standaed sap smartform example SF_EXAMPLE_01 , SF_EXAMPLE02, SF_EXAMPLE03 but i didn't get the solution.

solution needed urgently.

<<Text removed>>

thanks in advance.

Edited by: Matt on Oct 7, 2010 9:30 AM

brad_bohn
Active Contributor
0 Kudos

i only pass internal table to smartform from my program so only field in form interface is my internal table.

Yes, but you stated that you defined the work area in the interface - or did you mean the global definition area? You must define your work area in the global defintion area of the form in order for it to be recognized in a LOOP node (and the text elements within it). This is something that should be caught at design time though (activation/check). You may have some other issue if this is a runtime error - did you debug and stop at the error?

SAP mentioned that when ever there is currency or quantity field then we have to give reference field.

You misunderstood my point - I did not say that you should not assign a reference field. Your reference field assignment should always make sense. It makes no sense to assign VBAK-WAERK to ZSTRUC-AMOUNT; you should assign ZSTRUC-CURRENCY to ZSTRUC-AMOUNT.

Former Member
0 Kudos

thank you sir

Answers (0)