Skip to Content
avatar image
Former Member

Credit Block released Sales order report

Hi Experts,

My client is given few sales orders (around 4)no and requesting us, to prepare the credit block released sales orders report (include released person user ID).

*.No change logs is existing for all sales order and deliveries.

For above requirement I am using CDHDR table data but I am not getting credit block released sales order report.

Below fields I am using in CDHDR Table.

Change doc.Object (objectclas) : VERKBELEG

Document No (CHANGENR): Sales order no XXXXXXX

Transaction no (TCODE) : VKM1,VKM2,VKM3

Date(UDATE) : 25.09.2011 to 09.11.2011

Experts, Can you please help me out for this.

Thanking you!!!!


Vijaykumar Kola

*.I'm already aware of this is a new development.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 15, 2011 at 09:59 AM

    Try this, simple report... Here we check the new value of credit status field VBUK-CMGST and if it is 'D' we know that someone used VKM* transaction to release the document. Also you need to format the sales order number with leading zeros so it occupies all 10 digits and pass it to CDHDR-OBJECTID field (and not CHANGENR field). In the below code I am using select option for sales order number, so I know it will be formatted with leading zeros and so select on CDHDR will be successful.

    *& Report  ZTV_TEST
    REPORT  ztv_test.
    TABLES: vbak, cdhdr.
    SELECT-OPTIONS: s_saldoc FOR vbak-vbeln OBLIGATORY,
                    s_udate FOR cdhdr-udate.
    RANGES: r_objid FOR cdhdr-objectclas.
    DATA: ls_cdhdr TYPE cdhdr,
          ls_cdpos TYPE cdpos.
    IF NOT s_saldoc IS INITIAL.
      LOOP AT s_saldoc.
        MOVE-CORRESPONDING s_saldoc TO r_objid.
        CONDENSE: r_objid-high, r_objid-low.
        APPEND r_objid.
    CHECK NOT r_objid[] IS INITIAL.
    SELECT *
      INTO ls_cdhdr
      FROM cdhdr
            WHERE objectclas = 'VERKBELEG' AND
                  objectid IN r_objid AND
                  udate IN s_udate AND
                  tcode LIKE 'VKM%'.
        INTO ls_cdpos
        FROM cdpos
          WHERE objectclas = ls_cdhdr-objectclas AND
                objectid = ls_cdhdr-objectid AND
                changenr = ls_cdhdr-changenr AND
                tabname = 'VBUK' AND
                fname = 'CMGST' AND
                value_new = 'D'.
      IF sy-subrc = 0.
        WRITE:/ ls_cdhdr-objectid(10), ls_cdhdr-username,
                ls_cdhdr-udate, ls_cdhdr-utime.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 15, 2011 at 10:09 AM

    Dear Vijay,

    Instead of passing sales order no. to CHANGENR pass the sales order no. in field OBJECTID and ensure prefixing zero's if any.



    Add comment
    10|10000 characters needed characters exceeded

  • Nov 15, 2011 at 04:50 PM

    Did you try t.code VKM2 for your requirement?

    In your logic, as mentioned by Mayank, pass the sales order no to ObjectID field and check.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 30, 2011 at 02:15 PM


    Add comment
    10|10000 characters needed characters exceeded