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

Ffactory calendar id

Former Member
0 Likes
1,358

Hi friends,

How to get our factory calendar id?... is tr any tran code for this...

plz tel in detail... i need this one for my Funtion module ( DATE_CHECK_WORKINGDAY) pgm... to calculate the working days...

Hi friends,

How to get our factory calendar id?... is tr any tran code for this...

plz tel in detail... i need this one for my Funtion module ( DATE_CHECK_WORKINGDAY) pgm... to calculate the working days...

4 REPLIES 4
Read only

Former Member
0 Likes
1,068

Hi Sasikanth,

table : t001w

field : fabkl

but you must pass plant value

Read only

former_member386202
Active Contributor
0 Likes
1,068

Hi,

Check tables TFACS and TFACD

Regards,

Prashant

Read only

Former Member
0 Likes
1,068

Hi Sasikanth,

table : t001w

field : fabkl

but you must pass plant value

in more detail...



select single * from t001w where werks eq p_werks.  "p_werks plant

CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
    EXPORTING
      date                       = date
      factory_calendar_id        = t001w-fabkl 
      message_type               = 'S'
    EXCEPTIONS
      date_after_range           = 1
      date_before_range          = 2
      date_invalid               = 3
      date_no_workingday         = 4
      factory_calendar_not_found = 5
      message_type_invalid       = 6
      OTHERS                     = 7.
  IF sy-subrc <> 0.

Read only

Former Member
0 Likes
1,068

Hi Sasikanth,

See table SCAL-FCALID

also...

refer include FV60C360.

TABLES: *MSEG, *T001W.

DATA: BEGIN OF J_1H_VBFA OCCURS 10. "Key Buffer

INCLUDE STRUCTURE VBFA.

DATA: END OF J_1H_VBFA.

DATA: BEGIN OF J_1H_COMWA. "Return table from fn.

INCLUDE STRUCTURE VBCO6.

DATA: END OF J_1H_COMWA.

DATA: J_1H_KONV LIKE KONV,

J_1H_SAVE_KONV LIKE KONV.

DATA: T_VBRK TYPE STANDARD TABLE OF VBRK. "Billing header

DATA: WA_VBRK TYPE VBRK. "Work area for Billing

DATA: BEGIN OF ZUK,

MODUL(3) VALUE '360',

BUPLA LIKE VBRK-BUPLA,

LIFNR LIKE LFA1-LIFNR,

MWSKZ LIKE VBRP-MWSKZ,

END OF ZUK.

DATA: D_KURDT LIKE VBRK-FKDAT. "Currency exch. rate date

STATICS: D_FKDAT LIKE VBRK-FKDAT.

  • Component check for country - Thailand

CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'

EXPORTING

BUKRS = VBRK-BUKRS

COMPONENT = 'TH'

EXCEPTIONS

COMPONENT_NOT_ACTIVE = 1

OTHERS = 2.

CHECK SY-SUBRC = 0.

  • Determine BUPLA from Plant

SELECT SINGLE * FROM *T001W WHERE WERKS = VBRP-WERKS.

IF SY-SUBRC = 0.

ZUK-BUPLA = *T001W-J_1BBRANCH.

ENDIF.

  • Determine BUPLA from original invoice if credit/debit note, return

IF NOT VBAK-VGBEL IS INITIAL.

SELECT * FROM VBRK INTO TABLE T_VBRK

WHERE VBELN EQ VBAK-VGBEL

AND BUKRS EQ VBRK-BUKRS.

READ TABLE T_VBRK INTO WA_VBRK INDEX 1.

IF SY-SUBRC EQ 0.

IF NOT WA_VBRK-BUPLA IS INITIAL.

MOVE WA_VBRK-BUPLA TO VBRK-BUPLA.

ENDIF.

ENDIF.

ENDIF.

*------- For Thailand, the business place is required. "596215

*... This will allow the user to enter BUPLA

*... before release billing to accounting.

data: begin of xtemp occurs 1.

include structure sval.

data: end of xtemp.

data returncode(1).

if sy-batch is initial

and vbrk-bupla is initial.

select single PARVA from USR05

into vbrk-bupla

where bname = vbrk-ernam

and parid = 'ID_BUPLA'.

clear xtemp.

move: 'J_1HVAT_OFF_NUM' to xtemp-tabname,

'BUKRS' to xtemp-fieldname,

vbrk-bukrs to xtemp-value,

'02' to xtemp-field_attr.

collect xtemp.

clear xtemp.

move: 'J_1HVAT_OFF_NUM' to xtemp-tabname,

'BRNCH' to xtemp-fieldname,

vbrk-bupla to xtemp-value,

'X' to xtemp-field_obl.

collect xtemp.

call function 'POPUP_GET_VALUES_DB_CHECKED'

exporting

check_existence = 'X'

popup_title = sy-title

importing

returncode = returncode

tables

fields = xtemp

exceptions

error_in_fields = 1

others = 2.

read table xtemp index 2.

if sy-subrc = 0

and returncode is initial.

move xtemp-value to vbrk-bupla.

endif.

if vbrk-bupla is initial.

CALL FUNCTION 'CUSTOMIZED_MESSAGE'

EXPORTING

I_ARBGB = 'F5'

I_DTYPE = 'E'

I_MSGNR = '883'.

endif.

endif.

*----


BoI 415711 -


*------- Vendor Consignment: In Thailand,consignor name&address

*... has to be printed on Tax Invoice, Debit/Credit Note

*... Read document flow for mat.document

data t_konv like konv occurs 0 with header line.

select * from vbfa where vbelv = vbrp-vgbel "Delivery

and vbtyp_n = 'R'.

move: vbfa-vbeln to *mseg-mblnr,

vbfa-posnn to *mseg-zeile.

select * from *mseg where mblnr eq *mseg-mblnr

and zeile eq *mseg-zeile.

move *mseg-lifnr to zuk-lifnr.

exit.

endselect.

exit.

endselect.

*----


Use only taxable tax code

*... if only one taxable, combine non-taxable

select * from konv into table t_konv

where knumv = vbak-knumv

and kappl = 'V'

and koaid = 'D'

and kntyp = 'D'

and kschl = 'MWST'.

loop at t_konv.

select single mwsk1 from konp into t_konv-mwsk1

where knumh = t_konv-knumh

and kopos = t_konv-kopos.

modify t_konv.

endloop.

clear zuk-mwskz.

loop at t_konv into konv

where mwsk1 <> t001-mwska "Non-taxable

and mwsk1 <> t001-mwskv

and mwsk1 <> space.

if zuk-mwskz = space.

move konv-mwsk1 to zuk-mwskz.

elseif konv-mwsk1 <> zuk-mwskz.

move '*' to zuk-mwskz.

endif.

endloop.

*----


if more than one taxable, split for each tax code

*... include non-taxable.

if zuk-mwskz = '*'.

read table t_konv into konv

with key knumv = vbak-knumv

kposn = vbap-posnr.

if sy-subrc = 0.

move konv-mwsk1 to zuk-mwskz.

endif.

endif.

*----


EoI 415711 -


  • ... Pass to VBRK

VBRK-ZUKRI = ZUK.

  • Set currency exchange rate date by working day before billing date

  • Only TVCPF-PFKUR = 'C' (Exchange rate from billing date).

  • 'X' assigned after first line item proceed.

CHECK TVCPF-PFKUR CA 'CX'.

  • Keep billing date in statics varible

IF D_FKDAT IS INITIAL.

D_FKDAT = VBRK-FKDAT.

ENDIF.

  • Begin from billing date - 1

D_KURDT = D_FKDAT - 1.

  • Retreive factory calendar

SELECT SINGLE * FROM *T001W WHERE WERKS = VBRP-WERKS.

DO.

CALL FUNCTION '<b>DATE_CHECK_WORKINGDAY</b>'

EXPORTING

DATE = D_KURDT

FACTORY_CALENDAR_ID = <b>*T001W-FABKL</b>

MESSAGE_TYPE = 'W'

EXCEPTIONS

DATE_AFTER_RANGE = 1

DATE_BEFORE_RANGE = 2

DATE_INVALID = 3

DATE_NO_WORKINGDAY = 4

FACTORY_CALENDAR_NOT_FOUND = 5

MESSAGE_TYPE_INVALID = 6

OTHERS = 7.

IF SY-SUBRC EQ 0.

EXIT.

ENDIF.

D_KURDT = D_KURDT - 1.

ENDDO.

  • Use exchange rate type that maintain in customer master. - NOTE 22781

IF T001-BUKRS NE VBRK-BUKRS.

SELECT SINGLE * FROM T001 WHERE BUKRS = VBRK-BUKRS.

ENDIF.

  • get new exchange rate from table TCUR

IF VBRK-WAERK NE T001-WAERS AND VBRK-KURST NE SPACE.

CALL FUNCTION 'READ_EXCHANGE_RATE'

EXPORTING

  • date = vbrk-fkdat

DATE = D_KURDT

FOREIGN_CURRENCY = VBRK-WAERK

LOCAL_CURRENCY = T001-WAERS

TYPE_OF_RATE = VBRK-KURST

IMPORTING

EXCHANGE_RATE = VBRK-KURRF

EXCEPTIONS

NO_RATE_FOUND = 1.

IF SY-SUBRC NE 0.

VBRK-KURRF = 0.

ELSE.

VBRK-CPKUR = 'X'.

VBRK-KURRF_DAT = D_KURDT.

VBRP-KURSK = VBRK-KURRF.

VBRP-KURSK_DAT = D_KURDT.

TVCPF-PFKUR = 'X'. "Ignore standard re-determine exch.rate

ENDIF.

ENDIF.

ENDFORM.

Hope it will solve your problem

<b>Reward points if useful.</b>

Thanks & Regards

ilesh 24x7