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

passing value to a variable

Former Member
0 Likes
1,321

Hi,

I am using Determine_due_date function module as shown.

Tables: Faede.

CALL FUNCTION 'DETERMINE_DUE_DATE'

EXPORTING

i_faede = faede

IMPORTING

e_faede = faede

EXCEPTIONS

OTHERS = 1.

Function module is working fine but i want to fetch the field FAEDE-NETDT into a variable so that i can pas the

variable to a message can anyone help me with this.

CALL FUNCTION 'DETERMINE_DUE_DATE'

EXPORTING

i_faede = faede

IMPORTING

e_faede = faede

EXCEPTIONS

OTHERS = 1.

w_duedate = FAEDE-NETDT.

MESSAGE s000(zdue_v1) WITH w_duedate.

But message is not displaying in my case where i am going wrong ?

Regards

VEnk@

10 REPLIES 10
Read only

Former Member
0 Likes
1,228

Hi,

FAEDE is of type structure thus you must have declared it as a internal table. you may have to loop at it and assing the variable w_duedate.


CALL FUNCTION 'DETERMINE_DUE_DATE'


EXPORTING
i_faede = faede
IMPORTING
e_faede = faede
EXCEPTIONS
OTHERS = 1.

if not faede[] is initial.
loop at faede.
w_duedate = FAEDE-NETDT.
MESSAGE s000(zdue_v1) WITH w_duedate.
endloop.
endif.

Regards,

Vikranth

Read only

GauthamV
Active Contributor
0 Likes
1,228

Are you not getting value to variable or not getting message ?

you can trigger the message for particular condition.


CALL FUNCTION 'DETERMINE_DUE_DATE'

EXPORTING
i_faede = faede
IMPORTING
e_faede = faede
EXCEPTIONS
OTHERS = 1.

if sy-subrc = 0.

w_duedate = FAEDE-NETDT.

MESSAGE s000(zdue_v1) WITH w_duedate.

endif.

Read only

Former Member
0 Likes
1,228

I have followed both you guys suggestions. No use.

Read only

Former Member
0 Likes
1,228

Hi

Your code seems to be ok, but where u place it? In which event?

Max

Read only

Former Member
0 Likes
1,228

Hi,

Did you debug and check if the reference structure FAEDE is populated or not after calling the FM DETERMINE_DUE_DATE?

Regards,

Vikranth

Read only

Former Member
0 Likes
1,228

Hi MAx,

Here is my function module source code where i am using my Determine_due_date.

Tables: FAEDE,

INVFO,

T052.

*----


Structures that are passed to central function module ---

DATA: sklin2 LIKE sklin.

DATA g_status(1). "01: FB60 02: FV60 03: vollst.

STATICS: warning_sent.

DATA: koart LIKE bseg-koart. "Rel. acc. type for screen det.

DATA: old_netdt LIKE faede-netdt. "Note 565953

DATA: W_DUEDATE TYPE FAEDE-NETDT.

DATA: fs_bseg type bseg,

fs_bkpf type bkpf.

*----


New ZTERM or new base line date -


read table t_bseg into fs_bseg index 1.

read table t_bkpf into fs_bkpf index 1.

CALL FUNCTION 'FI_FIND_PAYMENT_CONDITIONS'

EXPORTING

i_zterm = fs_bseg-zterm

i_bldat = fs_bkpf-bldat

i_budat = fs_bkpf-budat

i_cpudt = sy-datum

IMPORTING

e_t052 = t052

e_zfbdt = fs_bseg-zfbdt

e_sklin = sklin2

EXCEPTIONS

terms_incorrect = 1

terms_not_found = 2

no_day_limit_found = 3

OTHERS = 4.

read table t_bseg into fs_bseg index 1.

read table t_bkpf into fs_bkpf index 1.

  • CHECK NOT bseg-zfbdt IS INITIAL. "P00K009405

faede-shkzg = fs_bseg-shkzg.

faede-koart = koart.

faede-zfbdt = fs_bseg-zfbdt.

faede-zbd1t = fs_bseg-zbd1t.

faede-zbd2t = fs_bseg-zbd2t.

faede-zbd3t = fs_bseg-zbd3t.

faede-rebzg = fs_bseg-rebzg.

faede-rebzt = fs_bseg-rebzt.

faede-bldat = fs_bkpf-bldat.

CALL FUNCTION 'DETERMINE_DUE_DATE'

EXPORTING

i_faede = faede

IMPORTING

e_faede = faede

EXCEPTIONS

OTHERS = 1.

if sy-subrc = 0.

w_duedate = FAEDE-netdt.

MESSAGE s000(zdue_v1) WITH w_duedate.

endif.

Regards

VEnk@

Read only

Former Member
0 Likes
1,228

Hi

I don't think the problem is your code, but where your code is placed?

 DATA g_status(1). "01: FB60 02: FV60 03: vollst.

That means u're are in trx FB60 and FV60? So you're in a BADI?

Try to change the message type, try to use I (information) instead of S

Max

Read only

Former Member
0 Likes
1,228

Hi,

i tried it like this:


DATA: I_FAEDE TYPE FAEDE.
DATA: E_FAEDE TYPE FAEDE.
*
I_FAEDE-KOART = 'K'.
I_FAEDE-ZFBDT = '20091201'.
I_FAEDE-ZBD1T = 20.
I_FAEDE-ZBD2T = 10.
I_FAEDE-ZBD3T = 0.
*
CALL FUNCTION 'DETERMINE_DUE_DATE'
  EXPORTING
    I_FAEDE                    = I_FAEDE
  IMPORTING
    E_FAEDE                    = E_FAEDE
  EXCEPTIONS
    ACCOUNT_TYPE_NOT_SUPPORTED = 1
    OTHERS                     = 2.
IF SY-SUBRC <> 0.
  WRITE: / 'Error:', SY-SUBRC.
ELSE.
  MESSAGE I010 WITH E_FAEDE-NETDT.
ENDIF.

and it works

I_FAEDE and E_FAEDE ers structures not tables.

Regards, Dieter

Read only

Former Member
0 Likes
1,228

Hi,

MESSAGE s000(zdue_v1) WITH w_duedate

could you pls tell me the message text for 000 under message class zdue_v1.

Regards,

zashok

Read only

Former Member
0 Likes
1,228

Hi,

Did u declare the w_duedate of type faede-netdt?

Also while writing the message, add the & symbol at the end - for instance like

'The message is successful on &' (add the & symbol to add the date to the message).

While I was trying, got the message like:

'The message is successful on 17.09.2009'

Is this what u were looking at?

Regards,

Swetha