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

problem with BAPI

Former Member
0 Likes
1,215

Hi,

We are using the BAPI BAPI_ALM_NOTIF_CREATE to create a plant maintenance notification. I have populated it with the following data :

maintenance notification type

equipment number in header

functional location in header

coding group in header

coding in header

I am using a wrapper bapi to house this one and am also calling a BAPI_TRANSACTION_COMMIT after this bapi is called .

However my problem is when the BAPI runs. The result has notification number which starts with a '%'. When i go into IW23 to check if a notification was created , none exists !

I used the same data and ran transaction IW21 directly, and the notification was successfully created. That means the data im using is correct and sufficient.

So why is it not being created properly with the BAPI ?

Any and all help will be greatly appreciated.

Thanks,

Amit

9 REPLIES 9
Read only

Former Member
0 Likes
1,147

HI Amit,

Can you show your code?

Did you try passing an external number for the notification?

Regards,

Ravi Kanth Talagana

Read only

0 Likes
1,147

Hi Ravi,

Thank you for your reply . I am not using external number . Heres the code im using :

FUNCTION Z_MMT_WRAPPER_BAPI_PM.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(NOTIFICATION_TYPE) TYPE QMART

*" VALUE(SHORT_TEXT) TYPE QMTXT OPTIONAL

*" VALUE(EQUIPMENT) TYPE EQUNR

*" VALUE(FUNCTIONAL_LOC) TYPE TPLNR

*" VALUE(CODING_GROUP) TYPE QMGRP OPTIONAL

*" VALUE(CODING) TYPE QMCOD OPTIONAL

*" EXPORTING

*" VALUE(BAPIOUTPUT) TYPE BAPI2080_NOTHDRE

*" TABLES

*" RETURN STRUCTURE BAPIRET2 OPTIONAL

*"----


data : notifheader like BAPI2080_NOTHDRI,

notifexport like BAPI2080_NOTHDRE,

returntab type table of bapiret2,

return_commit type bapiret2.

notifheader-equipment = equipment.

notifheader-funct_loc = functional_loc.

notifheader-short_text = short_text.

notifheader-code_group = coding_group.

notifheader-coding = coding.

CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'

EXPORTING

  • EXTERNAL_NUMBER =

NOTIF_TYPE = notification_type

NOTIFHEADER = notifheader

TASK_DETERMINATION = ' '

  • SENDER =

  • ORDERID =

IMPORTING

NOTIFHEADER_EXPORT = notifexport

TABLES

  • NOTITEM =

  • NOTIFCAUS =

  • NOTIFACTV =

  • NOTIFTASK =

  • NOTIFPARTNR =

  • LONGTEXTS =

  • KEY_RELATIONSHIPS =

RETURN = return

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

IMPORTING

RETURN = return_commit

.

bapioutput = notifexport.

ENDFUNCTION.

Im still getting the same output which goes something like this (this is the output notification header ) :

NOTIF_NO %00000000002

PLANPLANT 1000

LOC_ACC 000000002215

EQUIPMENT 10000000

ASSEMBLY

BREAKDOWN

STRMLFNDATE 19.12.2007

ENDMLFNDATE

STRMLFNTIME 19:49:21

ENDMLFNTIME 00:00:00

DOWNTIME 0,000000000000000E+00

UNIT

ISOCODE_UNIT

PLANGROUP 10

MNTPLAN

MNTCALL_NO 0

MAINTITEM

NOTIF_TYPE M2

SHORT_TEXT TESTING AGAIN

PRIOTYPE PM

PRIORITY

CREATED_BY

CREATED_ON

CHANGED_BY

CHANGED_ON

NOTIFTIME 19:49:21

NOTIF_DATE 19.12.2007

I do not understand why the notification number is starting with a %, and also it doesnt exist in the system !

Thanks

Amit

Read only

0 Likes
1,147

Hi Amit

in BAPI_TRANSACTION_COMMIT, try putting WAIT = 'X' and see

Cheers

~Arun

Read only

0 Likes
1,147

HI Amit,

Did you check if the notif got created wuth a number 00000000002?

Regards,

Ravi Kanth Talagana

Read only

0 Likes
1,147

Hi Ravi, thank you for your reply.

Apparently, the BAPI_ALM_NOTIF_CREATE cannot be used on its own. it will generate only a temperory number which then has to be fed to BAPI_ALM_NOTIF_SAVE. This will actually post the data to the tables.

Thanks,

Amit

Read only

Former Member
0 Likes
1,147

Even if I fill the required components of BAPI2080_NOTHDRI

-BREAKDOWN = 'X'

-STRMLFNDATE = '20071212'

-STRMLFNTIME = '123005'

and

-ENDMLFNDATE = '20071212'

-ENDMLFNTIME = '133005'

, BADI does not calculate DOWNTIME.

DOWNTIME returns 0.

why does it work like that?

Read only

0 Likes
1,147

Hi Experts,

got the same problem. The notification is created successful but the downtime is 0. Why? In IW21 the downtime is calculated automaticlly?

Regards Henryk

Read only

0 Likes
1,147

This BAPI does not calculate the downtime. Try to implement a user exit QQMA0025 / EXIT_SAPLIQS0_017with the code:


IF c_viqmel-msaus = 'X'
    c_viqmel-auszt = ( c_viqmel-ausbs - c_viqmel-ausvn ) * 24 * 60 * 60.
    c_viqmel-auszt =  c_viqmel-auszt +  ( c_viqmel-auztb - c_viqmel-auztv ).
    IF c_viqmel-auszt < 0 .
      CLEAR c_viqmel-auszt.
    ENDIF.
  ENDIF.

Edited by: Wojciech Rutkowski on Nov 3, 2010 4:46 PM

Read only

0 Likes
1,147

I can solve the problem with this exit.

Thanks!