Application Development and Automation 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: 
Read only

Function Module Issues

Former Member
0 Likes
508

Hi all,

Am trying to create one report in that previously they are using one functional module

ZCALCULATE_TAX_PO_ITEM

but the issue is tht fn module not existed in my server.

i want to get is there any fn modules like this to use..

in tht fn module..

my i/p is : ebeln ebelp

tables:komv

Pl guide me.. waitng for reply...

regards:

Manoj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
472

FUNCTION ZCALCULATE_TAX_PO_ITEM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(W_EBELN) TYPE  EBELN
*"     REFERENCE(W_EBELP) TYPE  EBELP
*"  TABLES
*"      PC_KOMV STRUCTURE  KOMV
*"  EXCEPTIONS
*"      PO_EBELN
*"      PO_EBELP
*"      PO_NOT_FOUND
*"----------------------------------------------------------------------


  CLEAR:ekko,
        ekpo.

  CALL FUNCTION 'REFRESH_TAX_TABLES'
    EXCEPTIONS
      OTHERS = 1.

* Refresh the table
  REFRESH:pc_komv.
  IF w_ebeln IS INITIAL.
    RAISE po_ebeln.
  ENDIF.

  IF w_ebelp IS INITIAL.
    RAISE po_ebelp.
  ENDIF.

  SELECT SINGLE * FROM ekko
         WHERE ebeln = w_ebeln.

* Error Message
  IF sy-subrc NE 0.
    RAISE po_not_found.
  ENDIF.

  SELECT SINGLE * FROM ekpo
          WHERE ebeln = ekko-ebeln
            AND ebelp = w_ebelp .
* Error Message
  IF sy-subrc NE 0.
    RAISE po_not_found.
  ENDIF.

  taxcom-bukrs = ekpo-bukrs.
  taxcom-budat = ekko-bedat.
  taxcom-waers = ekko-waers.
  taxcom-kposn = ekpo-ebelp.
  taxcom-mwskz = ekpo-mwskz.
  taxcom-txjcd = ekpo-txjcd.
  taxcom-shkzg = 'H'.
  taxcom-xmwst = 'X'.
  IF ekko-bstyp EQ 'F'.
    taxcom-wrbtr = ekpo-netwr.
  ELSE.
    taxcom-wrbtr = ekpo-zwert.
  ENDIF.
  taxcom-lifnr = ekko-lifnr.
  taxcom-land1 = ekko-lands.                              "WIA
  taxcom-ekorg = ekko-ekorg.
  taxcom-hwaer = ekko-waers.
  taxcom-llief = ekko-llief.
  taxcom-bldat = ekko-bedat.
  taxcom-matnr = ekpo-matnr.         "HTN-Abwicklung
  taxcom-werks = ekpo-werks.
  taxcom-bwtar = ekpo-bwtar.
  taxcom-matkl = ekpo-matkl.
  taxcom-meins = ekpo-meins.
*- Mengen richtig fuellen ---------------------------------------------*
  IF ekko-bstyp EQ 'F'.
    taxcom-mglme = ekpo-menge.
  ELSE.
    IF ekko-bstyp EQ 'K' AND ekpo-abmng GT 0.
      taxcom-mglme = ekpo-abmng.
    ELSE.
      taxcom-mglme = ekpo-ktmng.
    ENDIF.
  ENDIF.
  IF taxcom-mglme EQ 0.  "falls keine Menge gesetzt --> auf 1 setzen
    taxcom-mglme = 1000.  "z.B. bestellte Banf nochmal bestellt
  ENDIF.

  taxcom-mtart = ekpo-mtart.
  IF NOT ekko-llief IS INITIAL.
    taxcom-lifnr = ekko-llief.
  ENDIF.

  CALL FUNCTION 'CALCULATE_TAX_ITEM'
    EXPORTING
      i_taxcom     = taxcom
      display_only = 'X'
      dialog       = ' '
    IMPORTING
      e_taxcom     = taxcom
*    nav_anteil   = hwert
  TABLES
     t_xkomv      = pc_komv
  EXCEPTIONS
      OTHERS       = 01.

  IF sy-subrc NE 0.
    RAISE po_not_found.
  ENDIF.
ENDFUNCTION.
3 REPLIES 3
Read only

Former Member
0 Likes
473

FUNCTION ZCALCULATE_TAX_PO_ITEM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(W_EBELN) TYPE  EBELN
*"     REFERENCE(W_EBELP) TYPE  EBELP
*"  TABLES
*"      PC_KOMV STRUCTURE  KOMV
*"  EXCEPTIONS
*"      PO_EBELN
*"      PO_EBELP
*"      PO_NOT_FOUND
*"----------------------------------------------------------------------


  CLEAR:ekko,
        ekpo.

  CALL FUNCTION 'REFRESH_TAX_TABLES'
    EXCEPTIONS
      OTHERS = 1.

* Refresh the table
  REFRESH:pc_komv.
  IF w_ebeln IS INITIAL.
    RAISE po_ebeln.
  ENDIF.

  IF w_ebelp IS INITIAL.
    RAISE po_ebelp.
  ENDIF.

  SELECT SINGLE * FROM ekko
         WHERE ebeln = w_ebeln.

* Error Message
  IF sy-subrc NE 0.
    RAISE po_not_found.
  ENDIF.

  SELECT SINGLE * FROM ekpo
          WHERE ebeln = ekko-ebeln
            AND ebelp = w_ebelp .
* Error Message
  IF sy-subrc NE 0.
    RAISE po_not_found.
  ENDIF.

  taxcom-bukrs = ekpo-bukrs.
  taxcom-budat = ekko-bedat.
  taxcom-waers = ekko-waers.
  taxcom-kposn = ekpo-ebelp.
  taxcom-mwskz = ekpo-mwskz.
  taxcom-txjcd = ekpo-txjcd.
  taxcom-shkzg = 'H'.
  taxcom-xmwst = 'X'.
  IF ekko-bstyp EQ 'F'.
    taxcom-wrbtr = ekpo-netwr.
  ELSE.
    taxcom-wrbtr = ekpo-zwert.
  ENDIF.
  taxcom-lifnr = ekko-lifnr.
  taxcom-land1 = ekko-lands.                              "WIA
  taxcom-ekorg = ekko-ekorg.
  taxcom-hwaer = ekko-waers.
  taxcom-llief = ekko-llief.
  taxcom-bldat = ekko-bedat.
  taxcom-matnr = ekpo-matnr.         "HTN-Abwicklung
  taxcom-werks = ekpo-werks.
  taxcom-bwtar = ekpo-bwtar.
  taxcom-matkl = ekpo-matkl.
  taxcom-meins = ekpo-meins.
*- Mengen richtig fuellen ---------------------------------------------*
  IF ekko-bstyp EQ 'F'.
    taxcom-mglme = ekpo-menge.
  ELSE.
    IF ekko-bstyp EQ 'K' AND ekpo-abmng GT 0.
      taxcom-mglme = ekpo-abmng.
    ELSE.
      taxcom-mglme = ekpo-ktmng.
    ENDIF.
  ENDIF.
  IF taxcom-mglme EQ 0.  "falls keine Menge gesetzt --> auf 1 setzen
    taxcom-mglme = 1000.  "z.B. bestellte Banf nochmal bestellt
  ENDIF.

  taxcom-mtart = ekpo-mtart.
  IF NOT ekko-llief IS INITIAL.
    taxcom-lifnr = ekko-llief.
  ENDIF.

  CALL FUNCTION 'CALCULATE_TAX_ITEM'
    EXPORTING
      i_taxcom     = taxcom
      display_only = 'X'
      dialog       = ' '
    IMPORTING
      e_taxcom     = taxcom
*    nav_anteil   = hwert
  TABLES
     t_xkomv      = pc_komv
  EXCEPTIONS
      OTHERS       = 01.

  IF sy-subrc NE 0.
    RAISE po_not_found.
  ENDIF.
ENDFUNCTION.
Read only

0 Likes
472

sir tht fn module raise po here no such things sir..

very simple..

eg:

call function 'ZCALCULATE_TAX_PO_ITEM'

exporting

ebeln = itmseg-ebeln

ebelp = itmseg-ebelp

tables

komv = itkomv.

pl guide me..

Regards:

Manoj

Read only

0 Likes
472

as u said that u do not have the fm ZCALCULATE_TAX_PO_ITEM in ur server...so i tried to give u a code to make ur own function module...

make a function module with the above code and use it in ur own program.