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

BAPI Schedule lines

Former Member
0 Likes
1,546

Hi ,

I hav to create a BAPI program for uploading schedule line items for sales order .

Frnds can anyone hlp me in this regard.

If anyone hv any stuff regarding ths they can mail me at sanjayjaju33@gmail.com.

Thanking u all.

regards,

sanjay

8 REPLIES 8
Read only

ferry_lianto
Active Contributor
0 Likes
1,073

Hi Sanjay,

You can use this BAPI.

BAPI_AGREEMENT_MAINTAIN

BAPI_SALES_DEL_SCHEDULE_CREATE

Hope this will help.

Regards,

Ferry Lianto

Read only

0 Likes
1,073

hi thnks for ur reply but i m using bapi salesorderchange.

but i m not getting where to hook the code to upload the new schedule line data.

i need hlp regarding this.

can anyone hlp me in this coding.

regards,

sanjay

Read only

0 Likes
1,073

Hi Sanjay

As you have already mentioned, you can use BAPI: <b>BAPI_SALESORDER_CHANGE</b> for changing the schedule lines of a sales order.

Below are the parameters that you have to pass to change the schedule lines:

SALESDOCUMENT - Sales Document Number
ORDER_HEADER_INX 
-- UPDATEFLAG = 'U'
SCHEDULE_LINES
--ITM_NUMBER
  SCHED_LINE
  REQ_DATE
  REQ_QTY
SCHEDULE_LINESX
--ITM_NUMBER
  SCHED_LINE
  UPDATEFLAG = 'U'
  REQ_DATE = 'X'
  REQ_QTY = 'X'

Also remember to do explicit COMMIT in your program.

Hope this info helps you.

Kind Regards

Eswar

Read only

0 Likes
1,073

Hi Eshwar,

I m not getting from where to upload the new schedule line data.

Can anyone hlp me regarding this.

My mail id is sanjayjaju33@gmail.com

Read only

0 Likes
1,073

Hello Sanjay

Here is (in ABAP coding) what Eswar meant:

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_SALES_ORDER_CHANGE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_sales_order_change.


DATA:
  gt_return           TYPE bapirettab,
  gd_salesdocument    TYPE vbeln,
  gs_order_header_inx TYPE bapisdh1x,
*
  gs_schedule_line    TYPE bapischdl,
  gs_schedule_linex   TYPE bapischdlx,
  gt_schedule_lines   TYPE STANDARD TABLE OF bapischdl,
  gt_schedule_linesx  TYPE STANDARD TABLE OF bapischdlx.

START-OF-SELECTION.

  gs_schedule_line-itm_number = '000010'.
*  gs_schedule_line-sched_line = 01. " only required if multiple lines
  gs_schedule_line-req_date   = syst-datum.
  gs_schedule_line-req_qty    = 100.
  APPEND gs_schedule_line TO gt_schedule_lines.


  gs_schedule_linex-itm_number = '000010'.
*  gs_schedule_linex-sched_line = 01.
  gs_schedule_linex-updateflag = 'U'.  " or 'I' for insert
  gs_schedule_linex-req_date   = 'X'.  " should be updated
  gs_schedule_linex-req_date   = 'X'.  " should be updated
  APPEND gs_schedule_linex TO gt_schedule_linesx.



  gs_order_header_inx-updateflag = 'U'.

  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument               = gd_salesdocument
*     ORDER_HEADER_IN             =
      order_header_inx            = gs_order_header_inx
*     SIMULATION                  =
*     BEHAVE_WHEN_ERROR           = ' '
*     INT_NUMBER_ASSIGNMENT       = ' '
*     LOGIC_SWITCH                =
    TABLES
      return                      = gt_return
*     ORDER_ITEM_IN               =
*     ORDER_ITEM_INX              =
*     PARTNERS                    =
*     PARTNERCHANGES              =
*     PARTNERADDRESSES            =
*     ORDER_CFGS_REF              =
*     ORDER_CFGS_INST             =
*     ORDER_CFGS_PART_OF          =
*     ORDER_CFGS_VALUE            =
*     ORDER_CFGS_BLOB             =
*     ORDER_CFGS_VK               =
*     ORDER_CFGS_REFINST          =
      schedule_lines              = gt_schedule_lines
      schedule_linesx             = gt_schedule_linesx
*     ORDER_TEXT                  =
*     ORDER_KEYS                  =
*     CONDITIONS_IN               =
*     CONDITIONS_INX              =
*     EXTENSIONIN                 =
            .

  LOOP AT gt_return TRANSPORTING NO FIELDS
                    WHERE ( type CA 'AEX' ).
    EXIT.
  ENDLOOP.
  IF ( syst-subrc = 0 ).
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
*     IMPORTING
*       RETURN        =
              .

  ELSE.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait          = 'X'  " synchronous
*     IMPORTING
*       RETURN        =
              .

  ENDIF.

END-OF-SELECTION.

Regards

Uwe

Read only

0 Likes
1,073

Many Thanks Uwe.

Sanjay

Hope the code provided by Uwe helps you.

As you were saying, you dont know where to hook up the code -

You have to identify when and for which sales order the schedule lines have to be changed. You can get some idea, if you can discuss with the consultant who has provided you the requirement.

Kind Regards

Eswar

Read only

0 Likes
1,073

Thnk Uwe and Eshwar .

can u plzz tell me in which way to use GUI_UPLOAD and where to transfer all the new schedule line data.

need necessary hlp.

regards,

sanjay

Read only

0 Likes
1,073

Hi frnds can anyone hlp me regarding my doubt.

regards,

sanjay