This website is not affiliated with, sponsored by, or approved by SAP AG.

Smartform Error in Price Value

Development SAPscript/ Smartforms

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Smartform Error in Price Value

Postby Sapslzr » Tue Mar 22, 2011 5:51 pm

I have activated Smartform Y640_SDORC_A but when it prints it puts item price as in internal price condition VPRS (which also happens to be the last row) instead of the correct price condition.

On the smarform code I have program GET_ITEM_COND :

Code: Select all
DATA    cv_itm_unit_price   TYPE kbetr.
DATA    cv_itm_amount       TYPE kwert.
DATA    cv_itm_freight_tot  TYPE kwert.
DATA    cv_itm_tax_tot      TYPE kwert.
DATA    ct_itm_vat_konv     TYPE TABLE OF komvd.

CLEAR gt_itm_disp_konv.
CLEAR gv_itm_amount.
CLEAR gv_itm_all_tot.

DATA    lt_komvd       TYPE t_komvd_tab.
PERFORM get_itm_price_table

USING     <fs>
is_vbdka
gv_price_print_mode
is_nast-spras
CHANGING
gt_komv
lt_komvd
gs_last_komk.

PERFORM get_itm_price_info_new
USING     is_vbdka-knumv
<fs>-posnr
control_parameters-langu
lt_komvd
CHANGING    gs_itm_price
*            GV_ITM_UNIT_PRICE
gv_itm_amount
*            GV_ITM_NET_VAL
cv_itm_freight_tot
cv_itm_tax_tot
gv_itm_all_tot
gt_itm_disp_konv
ct_itm_vat_konv.

*************************************
*ADD GV_ITM_NET_VAL     TO GV_NET_SUM.
*ADD GV_ITM_ALL_TOT     TO GV_ALL_SUM.
ADD cv_itm_tax_tot     TO gv_tax_sum.
ADD cv_itm_freight_tot TO gv_freight_sum.

*GT_ITM_DISP_KONV[] = CT_ITM_DISP_KONV[]

DATA ls_itm_tax_konv TYPE komvd.
DATA ls_tax_konv     TYPE komvd.
LOOP AT ct_itm_vat_konv INTO ls_itm_tax_konv.
ADD ls_itm_tax_konv-kawrt TO gv_tax_base_sum.
READ TABLE gt_tax_konv INTO ls_tax_konv
WITH KEY mwskz = ls_itm_tax_konv-mwskz.
IF sy-subrc = 0.
ADD: ls_itm_tax_konv-kawrt TO ls_tax_konv-kawrt,
ls_itm_tax_konv-kwert TO ls_tax_konv-kwert.
MODIFY gt_tax_konv FROM ls_tax_konv
TRANSPORTING kawrt kwert WHERE
mwskz = ls_tax_konv-mwskz .
ELSE.
APPEND ls_itm_tax_konv TO gt_tax_konv.
ENDIF.
ENDLOOP.



Where can I see the function "get_itm_price_info_new" ?

Thank you,
Regards
Carlos
Meditate Everyday
Sapslzr
 
Posts: 119
Joined: Sat Oct 24, 2009 11:43 am

Re: Smartform Error in Price Value

Postby Sapslzr » Thu Mar 24, 2011 1:02 pm

In the Form Routines tab i have "FORM get_itm_price_info" and it reads from an internal table and displays it:

Code: Select all
  LOOP AT it_komvd INTO ls_konv.
    DATA lv_vtext TYPE vtxtk.

   IF sy-tabix = 1 AND
      ( ls_konv-koaid = 'B' OR ls_konv-kschl = space ).
      " The first condition line AND condition
      " class KOAID = 'B' (Prices)
      " CS_ITM_PRICE is the item overview price info
      cs_itm_price = ls_konv.
      ADD ls_konv-kwert TO cv_itm_all_tot.
      MOVE ls_konv-kwert TO cv_itm_amount.
      break-point.
    ELSEIF ls_konv-mwskz NE ''.
      " Tax condition
      ADD ls_konv-kwert TO cv_itm_all_tot.
      ADD ls_konv-kwert TO cv_itm_tax_tot.
      APPEND ls_konv    TO ct_itm_disp_konv.
      APPEND ls_konv    TO ct_itm_vat_konv.
    ELSEIF ls_konv-kntyp = 'F'.
      " Freight condition
      ADD ls_konv-kwert TO cv_itm_fright_tot.
      ADD ls_konv-kwert TO cv_itm_all_tot.
      APPEND ls_konv    TO ct_itm_disp_konv.
    ELSEIF ls_konv-kschl = 'PNTP'.
      " if PNTP EXIST, COPY THIS CONDITION VALUE TO ITEM NET VALUE
      cs_itm_price = ls_konv.
      MOVE ls_konv-kwert TO cv_itm_all_tot.
      APPEND ls_konv    TO ct_itm_disp_konv.
    ELSEIF ls_konv-kwert IS INITIAL.
    ELSE.
      ADD ls_konv-kwert TO cv_itm_all_tot.
      APPEND ls_konv    TO ct_itm_disp_konv.
    ENDIF.
  ENDLOOP.


But from what I can read with a break point, it_komvd table just has 1 row and not in condition PR00 as it should but with internal cost condition VPRS.

How can I modify or check it_komvd so it gets created correctly?
Meditate Everyday
Sapslzr
 
Posts: 119
Joined: Sat Oct 24, 2009 11:43 am

Re: Smartform Error in Price Value

Postby SHS » Fri Mar 25, 2011 9:02 am

I think that your pricing procedure determines the filling of tables KOMVD and KOMV (I'm doing this by heart so I might be wrong in the name).

Not sure how is decided which conditions end up in KOMVD and which ones end up in KOMV, but if I recall correctly KOMVD is a subset of KOMV.
So probably you will have to read KOMV to get the PR00 condition.
SHS
 
Posts: 483
Joined: Mon Mar 06, 2006 3:57 am


Return to SAPscript/Smartforms

Who is online

Users browsing this forum: No registered users and 2 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.