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

whats wrong here

Former Member
0 Likes
748

TABLES: t093c,bkpf.

CONSTANTS:l_gjahr(6) TYPE c VALUE '2008',

l_poper(3) TYPE c VALUE '01',

l_periv(2) TYPE c VALUE 'k4'.

  • end of CONST_REC.

DATA:l_budat LIKE sy-datum.

INITIALIZATION.

CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = '2008'

  • I_MONMIT = 00

i_periv = l_periv

i_poper = l_poper

IMPORTING

e_date = l_budat

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

  • RAISING input_false.

ENDIF.

WRITE: l_budat.

8 REPLIES 8
Read only

Former Member
0 Likes
689
*&---------------------------------------------------------------------*
*& Report  ZVBWORK                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  zvbwork                                 .

tables: t093c,bkpf.

constants:l_gjahr(6) type c value '2008',
l_poper(3) type c value '01',
l_periv(2) type c value 'k4'.


data: l_budat like sy-datum.


initialization.

  call function 'LAST_DAY_IN_PERIOD_GET'
    exporting
      i_gjahr        = '2008'
*      i_monmit       = 00
      i_periv        = 'K4'
      i_poper        = '01'
    importing
      e_date         = l_budat
    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
    raising input_false.
  endif.
  write: l_budat.

GIVE K4 IN CAPS

reward if usefull

Read only

Former Member
0 Likes
689

Which part, the compilation or the execution. This version at least compiles:

TABLES: t093c,bkpf.

CONSTANTS:l_gjahr(6) TYPE c VALUE '2008',
l_poper(3) TYPE c VALUE '01',
l_periv(2) TYPE c VALUE 'k4'.



DATA:l_budat LIKE sy-datum.


INITIALIZATION.
  CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr        = '2008'
      i_periv        = l_periv
      i_poper        = l_poper
    IMPORTING
      e_date         = l_budat
    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
     RAISING input_false.
  ENDIF.
  WRITE: l_budat.

Read only

Former Member
0 Likes
689

Use the code below observe the change in declaration of the varaibles

TABLES: t093c,bkpf.

CONSTANTS:l_gjahr(6) TYPE c VALUE '2008',
*l_poper TYPE T009B-POPER VALUE '01',*
*l_periv TYPE T009B-PERIV VALUE 'K4'.*

*end of CONST_REC.
DATA:l_budat LIKE sy-datum.


INITIALIZATION.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = '2008'


I_MONMIT = 00
i_periv = l_periv
i_poper = l_poper
IMPORTING
e_date = l_budat
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
.
*IF sy-subrc EQ 0.*

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING input_false.
ENDIF.
WRITE: l_budat.

Read only

Former Member
0 Likes
689

hi all

iam getting the dump when it is executed.

Read only

matt
Active Contributor
0 Likes
689

You are getting a dump when what is executed? Your original code? One of the solutions supplied? What is the nature of the dump?

Anyway, the cause was incorrectly defined data, as the dump says:

The solution given above will make it work - but you have to take the * off! ( You can't bold in code tags )

l_poper TYPE T009B-POPER VALUE '01',
l_periv TYPE T009B-PERIV VALUE 'K4'.

matt

Read only

0 Likes
689
REPORT zz_describe_struct.

TABLES: t093c,bkpf.

CONSTANTS:l_gjahr(6) TYPE c VALUE '2008',
l_poper              TYPE t009b-poper VALUE '01',
l_periv              TYPE t009b-periv VALUE 'K4',
l_year               TYPE t009b-bdatj VALUE '2008'.



DATA:l_budat LIKE sy-datum.


INITIALIZATION.
  CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr        = l_year
      i_periv        = l_periv
      i_poper        = l_poper
    IMPORTING
      e_date         = l_budat
    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.
  WRITE: l_budat.
Read only

Former Member
0 Likes
689

hi,

ur type mismatching in EXPORT And IMPORT..

just check ur export parameter type from ur FM...

Read only

0 Likes
689

*&---------------------------------------------------------------------*
*& Report  ZTEST_READ_CLUSTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ztest_read_cluster.

CONSTANTS: l_gjahr TYPE gjahr VALUE '2008',
           l_poper TYPE POPER VALUE '01',
           l_periv TYPE periv VALUE 'k4'.

* end of const_rec.

DATA: l_budat LIKE sy-datum.


INITIALIZATION.
  CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
  EXPORTING
  i_gjahr = '2008'
* i_monmit = 00
  i_periv = l_periv
  i_poper = l_poper
  IMPORTING
  e_date = l_budat
  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
* raising input_false.
  ENDIF.
  WRITE: l_budat.

Hope That Helps

Anirban M.