Application Development 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: 

Sales pricing function module

Former Member
0 Kudos

I would like to know if there is a FM that can be used to perform pricing outside of a sales document. I would like a FM that the key pricing data can be passed to and a table returned with all relevant pricing.

Is there a way to do this? Any suggestions are appreciated.

Thank you.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try this code..

*

DATA: t_t682i LIKE TABLE OF t682i.
DATA: lwa_t682i LIKE t682i.
DATA  l_koprt TYPE koprt.

DATA: lwa_komk TYPE komk,
      lwa_komp TYPE komp.

DATA l_condition_records TYPE STANDARD TABLE OF a000.
DATA: lwa_condition_record TYPE a000.
DATA: lwa_konp TYPE konp.

PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY,
            p_matnr TYPE matnr OBLIGATORY,
            p_vtweg TYPE vtweg OBLIGATORY,
            p_waerk TYPE waerk OBLIGATORY,
            p_pltyp TYPE pltyp.

lwa_komk-vkorg = p_vkorg.
lwa_komk-vtweg = p_vtweg.
lwa_komk-prsdt = sy-datum.
lwa_komk-pltyp = p_pltyp.
lwa_komp-matnr = p_matnr.
lwa_komk-waerk = p_waerk.
lwa_komp-pmatn = lwa_komp-matnr.

* Get access
CALL FUNCTION 'SD_T682I_SINGLE_READ'
  EXPORTING
    kvewe_i      = 'A'
    kappl_i      = 'V'
    kozgf_i      = 'PR00'
    count_i      = 50
  TABLES
    t682i_tab_io = t_t682i
  EXCEPTIONS
    OTHERS       = 1.

LOOP AT t_t682i INTO lwa_t682i.

* Get condition
  CALL FUNCTION 'SD_COND_ACCESS'
    EXPORTING
      application          = 'V'
      condition_type       = 'PR00'
      date                 = lwa_komk-prsdt
      header_comm_area     = lwa_komk
      position_comm_area   = lwa_komp
      t682i_i              = lwa_t682i
      koprt_i              = l_koprt
    TABLES
      condition_records    = l_condition_records
    EXCEPTIONS
      field_is_initial     = 1
      not_read_unqualified = 2
      read_but_not_found   = 3
      read_but_blocked     = 4
      t682z_missing        = 5
      t681v_missing        = 6
      t681z_missing        = 7
      mva_error            = 8
      OTHERS               = 9.

  READ TABLE l_condition_records INTO lwa_condition_record INDEX 1.

  IF sy-subrc <> 0.
    CONTINUE.
  ENDIF.

  SELECT SINGLE * FROM konp
         INTO lwa_konp
         WHERE knumh = lwa_condition_record-knumh.

  WRITE: / lwa_konp-kbetr.

  EXIT.

ENDLOOP.

Thanks

Naren

0 Kudos

Hello Narendran, I was checking the use of FUNCTION 'SD_COND_ACCESS' and I feared it was very complicated.

From Your example I see it can be quite easy!

Thank you very much.

Martin

Madhurivs23
Participant
0 Kudos

Hi,

along with the above FMs ,there is one more FM 'pricing'.

Try out that one.

rgds

Madhuri