This website is not affiliated with, sponsored by, or approved by SAP AG.

Default customer blcoking- changes made to customer master

Logistics : SD and its sub-modules (Inquires, Quotes, Order Entry, SIS, Sales Contacts, Dist. & Billing)

Moderators: Snowy, thx4allthefish, mike_ac, Lost Identity

Default customer blcoking- changes made to customer master

Postby sam1966 » Thu Jun 19, 2014 2:46 am

HI, EXperts,

please provide the solution for sap sd problem.My requirement is to block the customer for sales areas/co.code for creation of sale order as and when the changes made to the customer master by a master maintenance clerk and authorisation provided to sales manager to remove the blcok. For that we have written a program in the user exist:ZXF04U01 as given below. It is working fine in testing client:200 and Quality client:400, but not in Production client.For testing we have given total "SAP ALL" authorisations to the user still it is not working.pl. arrange to give the solution for the following program.

Report YV_CUST_BLOCK1 . "YCI_TRM00 .

Code: Select all
TYPES   BEGIN OF TY_BDCDATA      .
         INCLUDE STRUCTURE BDCDATA.
TYPES   END OF TY_BDCDATA        .

TYPES  BEGIN OF TY_MESSAGES         .
         INCLUDE STRUCTURE BDCMSGCOLL.
TYPES  END OF TY_MESSAGES           .

DATA :  IS_BDCDATA         TYPE  TY_BDCDATA            ,
        IT_BDCDATA        TYPE   STANDARD  TABLE  OF   TY_BDCDATA      ,
        IT_MESSAGES       TYPE   STANDARD  TABLE  OF   TY_MESSAGES     .

CONSTANTS : C_NO_DISPLAY(1)                    VALUE    'N'     ,
            C_UPDATE_SYNC(1)                   VALUE    'S'     ,
            C_MSGTYP          TYPE   BDC_MART  VALUE    'S'     ,
            C_MSGNR           TYPE   BDC_MNR   VALUE    '312'   ,
            C_MSGID           TYPE   BDC_MID   VALUE    'F5'    .

DATA I TYPE MAXBT.

DATA : W_KUNNR TYPE KUNNR,
        W_VTWEG TYPE VTWEG,
        W_SPART TYPE SPART.

DATA : IT_YYV_CUSTBLOCK TYPE STANDARD TABLE OF YYV_CUSTBLOCK,
       IS_YYV_CUSTBLOCK TYPE YYV_CUSTBLOCK.

SELECT * FROM YYV_CUSTBLOCK INTO TABLE IT_YYV_CUSTBLOCK.
IF SY-SUBRC EQ 0.
   READ TABLE IT_YYV_CUSTBLOCK INTO IS_YYV_CUSTBLOCK INDEX 1.
   IF SY-SUBRC EQ 0.
     W_KUNNR = IS_YYV_CUSTBLOCK-KUNNR.
     W_VTWEG = IS_YYV_CUSTBLOCK-VTWEG.
     W_SPART = IS_YYV_CUSTBLOCK-SPART.

   ENDIF.
ENDIF.

*           CALL FUNCTION 'ENQUEUE_EYYV_CUSTBLOCK'
*   EXPORTING
*     MODE_YYV_CUSTBLOCK         = 'E'
*     MANDT                = SY-MANDT
*     KUNNR                = I_KNVV-KUNNR
*   EXCEPTIONS
*     FOREIGN_LOCK         = 1
*     SYSTEM_FAILURE       = 2
*     OTHERS               = 3.

*      DELETE YYV_ACQ FROM TABLE IT_ITEM.
DELETE  YYV_CUSTBLOCK FROM IS_YYV_CUSTBLOCK .
COMMIT WORK.

*      MODIFY YYV_CUSTBLOCK FROM IS_YYV_CUSTBLOCK.
*      COMMIT WORK.

CALL FUNCTION 'DEQUEUE_EYYV_CUSTBLOCK'
   EXPORTING
     MODE_YYV_CUSTBLOCK = 'E'
     MANDT              = SY-MANDT
     KUNNR              = W_KUNNR.

* IMPORT W_KUNNR FROM MEMORY ID 'WKUNNR'.
* IMPORT W_VTWEG FROM MEMORY ID 'WVTWEG'.
* IMPORT W_SPART FROM MEMORY ID 'WSPART'.
*
*        W_KUNNR = '0000012085'.
*        W_VTWEG = '10'.
*        W_SPART = '10'.


* WRITE : W_KUNNR,W_VTWEG,W_SPART.
SHIFT W_KUNNR  LEFT DELETING LEADING '0'.
* WRITE : '///', W_KUNNR,W_VTWEG,W_SPART.

*perform bdc_dynpro      using 'SAPMF02D' '0500'.
CLEAR IS_BDCDATA.
IS_BDCDATA-PROGRAM  = 'SAPMF02D'."PROGRAM.
IS_BDCDATA-DYNPRO   = '0500'."DYNPRO.
IS_BDCDATA-DYNBEGIN = 'X'.
APPEND IS_BDCDATA TO IT_BDCDATA.
*
*perform bdc_field       using 'BDC_CURSOR'
*                              'RF02D-SPART'.

CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'BDC_CURSOR'."FNAM.
IS_BDCDATA-FVAL = 'RF02D-SPART'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'BDC_OKCODE'
*                              '/00'.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'BDC_OKCODE'."FNAM.
IS_BDCDATA-FVAL =  '/00'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'RF02D-KUNNR'
*                              '0000012085' ."record-KUNNR_001.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'RF02D-KUNNR'."FNAM.
IS_BDCDATA-FVAL = W_KUNNR."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'RF02D-BUKRS'
*                              'SCCL'."record-BUKRS_002.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'RF02D-BUKRS'."FNAM.
IS_BDCDATA-FVAL = 'SCCL'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'RF02D-VKORG'
*                              'SCCL'."record-VKORG_003.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'RF02D-VKORG'."FNAM.
IS_BDCDATA-FVAL = 'SCCL'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'RF02D-VTWEG'
*                              '10'."record-VTWEG_004.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'RF02D-VTWEG'.
IS_BDCDATA-FVAL = W_VTWEG.""FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'RF02D-SPART'
*                              '10'."record-SPART_005.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'RF02D-SPART'.
IS_BDCDATA-FVAL = W_SPART.""FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_dynpro      using 'SAPMF02D' '0510'.
CLEAR IS_BDCDATA.
IS_BDCDATA-PROGRAM  = 'SAPMF02D'."PROGRAM.
IS_BDCDATA-DYNPRO   = '0510'."DYNPRO.
IS_BDCDATA-DYNBEGIN = 'X'.
APPEND IS_BDCDATA TO IT_BDCDATA.

*perform bdc_field       using 'BDC_CURSOR'
*                              'KNVV-LIFSD'.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'BDC_CURSOR'.
IS_BDCDATA-FVAL = '01'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'BDC_OKCODE'
*                              '=UPDA'.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'BDC_OKCODE'.
IS_BDCDATA-FVAL = '=UPDA'.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'KNA1-AUFSD' ''.
**                              record-AUFSD_006.
CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'KNA1-AUFSD'.
IS_BDCDATA-FVAL = '01'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'KNVV-AUFSD' ''.
**                              record-AUFSD_007.
*  CLEAR IS_BDCDATA.
IS_BDCDATA-FNAM = 'KNVV-AUFSD'.
IS_BDCDATA-FVAL = '01'."FVAL.
APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'KNA1-LIFSD' ''.
**                              record-LIFSD_008.
**  CLEAR IS_BDCDATA.
**  IS_BDCDATA-FNAM = 'KNA1-LIFSD'.
**  IS_BDCDATA-FVAL = '01'."FVAL.
**  APPEND IS_BDCDATA TO IT_BDCDATA.
*perform bdc_field       using 'KNVV-LIFSD' ''.
**                              record-LIFSD_009.
**  CLEAR IS_BDCDATA.
**  IS_BDCDATA-FNAM = 'KNVV-LIFSD'.
**  IS_BDCDATA-FVAL = '01'."FVAL.
**  APPEND IS_BDCDATA TO IT_BDCDATA.
*
**  Sub Routine to call XD05.

I = 0.
WHILE I < 100000.

   I = I + 1.
ENDWHILE.

* AUTHORITY-CHECK OBJECT 'YV_CUSTCRT'
*                     ID 'AUFSD' FIELD '01'.
* IF SY-SUBRC EQ 0.

   CALL TRANSACTION 'XD05' USING   IT_BDCDATA
                                   MODE          C_NO_DISPLAY
                                   UPDATE        C_UPDATE_SYNC
                                   MESSAGES INTO IT_MESSAGES.

* ENDIF.


Thanks & Regards
sam
Last edited by Gothmog on Thu Jun 19, 2014 3:22 am, edited 1 time in total.
Reason: code tags
sam1966
 
Posts: 1
Joined: Thu Jun 19, 2014 1:52 am

Return to Logistics SD

Who is online

Users browsing this forum: No registered users and 2 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.