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

NagaM
Explorer
0 Likes
426

Hi

can any one suggest the function module that can read 2 field from the table and disply another field

suppose read 2 fields record no ,calyear from table and display fiscal period from the table.

please suggest me if any one can,,

naga

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
389

Hi Naga,

Why can't you write your own function module to get the fiscal period by passing record no and calyear? I mean import two fields and export one field like this.

==================================================

FUNCTION Z_TEST.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(CARR_ID) LIKE SFLIGHT-CARRID

*" REFERENCE(FL_DATE) LIKE SFLIGHT-FLDATE

*" EXPORTING

*" REFERENCE(CONN_ID) LIKE SFLIGHT-CONNID

*"----


clear conn_id.

Select single connid from sflight into conn_id

where carrid = carr_id and fldate = fl_date.

if sy-subrc eq 0.

message s000(zabap) with 'success'.

endif.

ENDFUNCTION.

====================================================

Hope this helps.

Regards,

Vivek

PS: Award points if helpful

3 REPLIES 3
Read only

Former Member
0 Likes
389

HI Naga,

 Check GET_CURRENT_YEAR-->Get the current fiscal year. 


data: curry like bsid-gjahr.
 
  call function 'GET_CURRENT_YEAR'
       exporting
            bukrs = knb1-bukrs
            date  = dd_stida
       importing
            curry = curry.

Regards,

Santosh

Message was edited by: Santosh Kumar P

Read only

Former Member
0 Likes
390

Hi Naga,

Why can't you write your own function module to get the fiscal period by passing record no and calyear? I mean import two fields and export one field like this.

==================================================

FUNCTION Z_TEST.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(CARR_ID) LIKE SFLIGHT-CARRID

*" REFERENCE(FL_DATE) LIKE SFLIGHT-FLDATE

*" EXPORTING

*" REFERENCE(CONN_ID) LIKE SFLIGHT-CONNID

*"----


clear conn_id.

Select single connid from sflight into conn_id

where carrid = carr_id and fldate = fl_date.

if sy-subrc eq 0.

message s000(zabap) with 'success'.

endif.

ENDFUNCTION.

====================================================

Hope this helps.

Regards,

Vivek

PS: Award points if helpful

Read only

Former Member
0 Likes
389

Hii Naga,

check this ..

DATA : 
       V_REPID       LIKE  SY-REPID ,
       V_DATE        TYPE  SY-DATUM ,
       V_PERIOD      TYPE  T009B-POPER, " Fiscal Period
       V_YEAR        LIKE  T009B-BDATJ. " Fiscal Year

  V_REPID = SY-REPID.
  V_DATE  = SY-DATUM.

* To Calculate the  Fiscal Period
  CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
          EXPORTING
            I_DATE               = V_DATE
            I_MONMIT             =  00
            I_PERIV              = 'Z1'
          IMPORTING
            E_BUPER              = V_PERIOD
           E_GJAHR               = V_YEAR
         EXCEPTIONS
           INPUT_FALSE          = 1
           T009_NOTFOUND        = 2
           T009B_NOTFOUND       = 3
           OTHERS               = 4
            .
  IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Reward Points if helpful

Revert back for more help

Regards

Naresh