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

delivery block

Former Member
0 Likes
408

hi all,

by using VL02N transaction i want to remove delivery block (likp-lifsk ) based on cindition.

can you pls tel me by manual or by programatical.

thanku

sunny.

1 REPLY 1
Read only

former_member189629
Active Contributor
0 Likes
327

Sunny,

This code should help u...


* Declare tthe below structures
*--- BAPI STRUCTURES
*--- Structure to hold Communication Fields: SD Document Header
DATA: HEADER_IN   LIKE BAPISDHD1,
*--- Structure to hold Checkbox Fields for SD Document Header
      HEADER_IN_X LIKE BAPISDHD1X,
*--- Structure to hold Communication Fields: SD Document Item
      ITEM_IN     LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
*--- Structure to hold Communication Fields: SD Document Item
      ITEM_IN_X   LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,
*--- Structure to hold BAPI Return Parameter
      ST_RETURN      LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
*--- Structure to hold BAPI Structure of VBAK
      ITEMS_EX    LIKE BAPISDHD OCCURS 0 WITH HEADER LINE.



* Now, If your condition is met use the below code to update delivery block...
IF " condition

*--- Assigning values to be updated in VBAK
   HEADER_IN-DLV_BLOCK    = 'XYZ'.
   HEADER_IN_X-DLV_BLOCK  = 'X'.
   HEADER_IN_X-UPDATEFLAG = 'U'.

*--- Calling FM 'SD_SALESDOCUMENT_CHANGE' to update Del. Block in VBAK
  CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
    EXPORTING
   SALESDOCUMENT               = IT_VBAK-VBELN
   ORDER_HEADER_IN             = HEADER_IN
   ORDER_HEADER_INX            = HEADER_IN_X
*   SIMULATION                  = ' '
*   INT_NUMBER_ASSIGNMENT       = ' '
   BEHAVE_WHEN_ERROR           = 'P'
*   BUSINESS_OBJECT             = ' '
*   CONVERT_PARVW_AUART         = ' '
   CALL_FROM_BAPI              = 'X'
*   LOGIC_SWITCH                =
*   I_CRM_LOCK_MODE             = ' '
*   NO_STATUS_BUF_INIT          = ' '
* IMPORTING
*   SALES_HEADER_OUT            =
*   SALES_HEADER_STATUS         =
    TABLES
    RETURN                      = ST_RETURN
*   ITEM_IN                     =
*   ITEM_INX                    =
*   SCHEDULE_IN                 =
*   SCHEDULE_INX                =
*   PARTNERS                    =
*   PARTNERCHANGES              =
*   PARTNERADDRESSES            =
*   SALES_CFGS_REF              =
*   SALES_CFGS_INST             =
*   SALES_CFGS_PART_OF          =
*   SALES_CFGS_VALUE            =
*   SALES_CFGS_BLOB             =
*   SALES_CFGS_VK               =
*   SALES_CFGS_REFINST          =
*   SALES_CCARD                 =
*   SALES_TEXT                  =
*   SALES_KEYS                  =
*   CONDITIONS_IN               =
*   CONDITIONS_INX              = 'U'
*   SALES_CONTRACT_IN           =
*   SALES_CONTRACT_INX          =
*   EXTENSIONIN                 =
*   ITEMS_EX                    = ITEMS_EX.
*   SCHEDULE_EX                 =
*   BUSINESS_EX                 =
*   INCOMPLETE_LOG              =
*   EXTENSIONEX                 =
*   CONDITIONS_EX               =
*   SALES_SCHED_CONF_IN         =
*   DEL_SCHEDULE_EX             =
*   DEL_SCHEDULE_IN             =
*   DEL_SCHEDULE_INX            =
*   CORR_CUMQTY_IN              =
*   CORR_CUMQTY_INX             =
*   CORR_CUMQTY_EX              =
*   PARTNERS_EX                 =
*   TEXTHEADERS_EX              =
*   TEXTLINES_EX                =
*   BATCH_CHARC                 =
            .

*--- Looping at ST_RETURN to check for Errors
LOOP AT ST_RETURN WHERE TYPE = 'E'.
ENDLOOP.
*--- Commiting work only if there are no Errors
IF SY-SUBRC <> 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.

Hope this solves ur issue. Reward if helpful

NW.

Edited by: NW on Jun 5, 2008 4:49 AM

Edited by: NW on Jun 5, 2008 4:51 AM