Skip to Content
author's profile photo Former Member
Former Member

Authority-Check

Hi All..

My requirement is to incorporate the Authority-Check for Sales Organization field ( VBAK-VKORG) inthe selection screen. In the meanwhlie, i should restrict further processing of Report, if unauthorized Sales Organzations.

Please help me in explaining the meaning of above requirement and can any one give me the code sample for this..????

Its urgent issue and kindly request you to help me out...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2006 at 07:15 AM

    Hi..

    When restricting the report execution by sales organization, i need to follow the logic below.

    - If none of the sales organizations input in the selection screen is authorized, give a message ‘No authorization for any Sales Org input’.

    - If some of the sales organizations are authorized but others not, retrieve the data of the authorized sales organizations and display them in the report.

    Please give me code sample, as i am unable to make it happen... 😔

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      TABLES TVKO.

      SELECT-OPTIONS: SO_VKORG FOR TVKO-VKORG.

      DATA IT_TVKO LIKE STANDARD TABLE OF TVKO WITH HEADER LINE.

      AT SELECTION-SCREEN.

      SELECT * FROM TVKO INTO TABLE IT_TVKO WHERE VKORG IN SO_VKORG.

      LOOP AT IT_TVKO.

      AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'

      ID 'VKORG' FIELD IT_TVKO-VKORG

      ID 'VTWEG' DUMMY

      ID 'SPART' DUMMY

      ID 'ACTVT' FIELD '03'.

      IF SY-SUBRC <> 0.

      DELETE IT_TVKO.

      ENDIF.

      ENDLOOP.

      DESCRIBE TABLE IT_TVKO LINES SY-TABIX.

      IF SY-TABIX < 1.

      MESSAGE E208(00) WITH 'No authorization for any Sales Org input'.

      ENDIF.

      Max

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2006 at 06:01 AM

    Please check if the below code helps you:

    One way is as below.

      DATA: BEGIN OF lt_tvko OCCURS 0,
              vkorg TYPE vkorg,
              bukrs TYPE bukrs,
            END OF lt_tvko.
     
      SELECT vkorg bukrs FROM tvko INTO TABLE lt_tvko
        WHERE vkorg IN lr_vkorg.
      IF sy-subrc NE 0.
        MESSAGE e085(wv).
      ENDIF.
    * Check all retrieved co.codes
      SORT lt_tvko BY bukrs.
      DELETE ADJACENT DUPLICATES FROM lt_tvko COMPARING bukrs.
      LOOP AT lt_tvko.
    *   Error Message: No authorization for sales organization &1
        PERFORM f_bukrs_auth_chk_p USING lt_tvko-bukrs 'ICC_FI_CN' 'E' '010'
                                         lt_tvko-vkorg '' '' ''.
      ENDLOOP.
     
     
    FORM f_bukrs_auth_chk_p USING value(lc_bukrs) TYPE bukrs
                                  value(lc_msgid) LIKE sy-msgid
                                  value(lc_msgty) LIKE sy-msgty
                                  value(ln_msgno) LIKE sy-msgno
                                  value(lc_msgv1)
                                  value(lc_msgv2)
                                  value(lc_msgv3)
                                  value(lc_msgv4).
     
      AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
        ID 'BUKRS' FIELD lc_bukrs
        ID 'ACTVT' FIELD '03'.
      IF sy-subrc NE 0.
        MESSAGE ID lc_msgid TYPE lc_msgty NUMBER ln_msgno
          WITH lc_msgv1 lc_msgv2 lc_msgv3 lc_msgv4.
      ENDIF.
     
    ENDFORM.                    "f_bukrs_auth_chk_p

    Select the sales organization mapping to Company code and then restrict.

    Kind Regards

    Eswar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.