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

Transfering Substitution data trough BAPI.

Former Member
0 Likes
747

Hello !

I'm aiming to use BAPI to insert new records to IT2003 infotype (substitutions)

i only want to supply start time end time date and PERNR for the records - because thats all data i have and it should be sufficient (it is sufficient when manually inserting data trogh PA30)

Ah - all data are individual schedules.

So i use this small ABAP to fill interface tables :

DATA:
        geninfo like BAPI7031_1 OCCURS 0 WITH HEADER LINE,
        intervals like BAPI7031_2 OCCURS 0 WITH HEADER LINE,
        ret LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.


  geninfo-EXTSYSTEM = 'DEVCLNT010'.
  geninfo-EXTAPPLICATION = 'EXT'.
  geninfo-EXTDOCUMENTNO = '0001'.


  geninfo-EMPLOYEENUMBER = 6.
  geninfo-DATE = sy-datum.

  append geninfo.
  intervals-EXTSYSTEM = 'DEVCLNT010'.
  intervals-EXTAPPLICATION = 'EXT'.
  intervals-EXTDOCUMENTNO = '0001'.
  intervals-START_TIME = '080000'.
  intervals-END_TIME = '160000'.
*  intervals-DWS_INTERVALTYPE = ''.
  append intervals.



  CALL FUNCTION 'BAPI_PTMGREXTWOSCHED_INSWCOST'
    TABLES
      WORKSCHEDULE_GENERAL_INFO       = geninfo
      WORKSCHEDULE_INTERVALS          = intervals
      RETURN                          = ret
            .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
          .
WRITE 'OK'.

Basicaally after that i have record in all 3 interface tables.

I run report RPTEXTPT to transfer data.

Report finishes whithout errors - says that 1 record was "booked".

After clicking on i icon (blue one - summary) it says that 1 record header was procesed but - interval records were.

Do you guys have any idea about the cause of this ?

My guess is i dont have all required data in the structures - but i have no idea where to look for each field explanation.... (SE11 dosent help much)

Thanks in advance !.

2 REPLIES 2
Read only

Former Member
0 Likes
537

okay - so i investigatd further :

1. Record is inserted in "direct mode" when field DAILYWORKSCHED is set.

However i aim to supply only Start time and end time for interval - whithout schedule

2. When i run it in background mode it gives me error type S because PA2003-VARIA is hidden in my case - even if i supply empty field it it -it still wants to fill it

Can someone help ?

When i run the following code :

DATA:
        geninfo like BAPI7031_1 OCCURS 0 WITH HEADER LINE,
        intervals like BAPI7031_2 OCCURS 0 WITH HEADER LINE,
        ret LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
  DELETE FROM PTEX2003SPEC.
  DELETE FROM PTEX2003GEN.
  DELETE FROM PTEXDIR.


  geninfo-EXTSYSTEM = 'DEVCLNT010'.
  geninfo-EXTAPPLICATION = 'CATS'.
  geninfo-EXTDOCUMENTNO = '0001'.


  geninfo-EMPLOYEENUMBER = 6.
  geninfo-DATE = sy-datum.
  geninfo-WS_SPEC_TYPE = '01'.
  geninfo-DAILYWORKSCHED = 'WH'.

  append geninfo.
  intervals-EXTSYSTEM = 'DEVCLNT010'.
  intervals-EXTAPPLICATION = 'CATS'.
  intervals-EXTDOCUMENTNO = '0001'.
  intervals-START_TIME = '080000'.
  intervals-END_TIME = '160000'.
*  intervals-DWS_INTERVALTYPE = ''.
  append intervals.



  CALL FUNCTION 'BAPI_PTMGREXTWOSCHED_INSWCOST'
    TABLES
      WORKSCHEDULE_GENERAL_INFO       = geninfo
      WORKSCHEDULE_INTERVALS          = intervals
      RETURN                          = ret
            .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
          .
WRITE 'OK'.

As a result i have DAILYWORKSCHED inserted ok but no hours,

My guess is that somehow interval data canot be hooked up with header data - but question is - why ?

Edited by: Jacek Zebrowski on Jan 22, 2009 11:22 AM

Read only

0 Likes
537

I achieved what i was going for, however this bapi shows poor preformance for me - its slower than inserting by PA30 !

is there any way to speed things up ?

Im wondering if theres a way to insert one records that spans for a few days - ie ENDDA <> BEGDA - bacause now i create new header interval pair for each day and id like to insert more data at once - any ideas on this ?