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

Getting item data from cdhdr cdpos

Former Member
0 Likes
2,345

Hi,

I am working on creating a report for changed documents for scheduling agreement.

I am reading tables cdhdr and cdpos for getting the changed doc data.

How can I get data for schedule Line number and Item number from CDPos or cdhdr ? as this needs to be displayed in the output as well.

Is it available in other tables ? or any FM can be used?

Regards,

Shital.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,168

Try this function module..


 CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
    EXPORTING
      date_of_change                   = p_datefr
      objectclass                      = 'MATERIAL'
      date_until                       = p_dateto
      username                         = '*'
    TABLES
      i_cdhdr                          = i_cdhdr
    EXCEPTIONS
      no_position_found                = 1
      wrong_access_to_archive          = 2
      time_zone_conversion_error       = 3
      OTHERS                           = 4.

  LOOP AT i_cdhdr.
**For each change document header, read the corresponding change document line items
    refresh: editpos.
    CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
      EXPORTING
        changenumber                  = i_cdhdr-changenr
      TABLES
        editpos                       = editpos
      EXCEPTIONS
        no_position_found             = 1
        wrong_access_to_archive       = 2
        OTHERS                        = 3.
ENDLOOP.

Prabhu

Edited by: Prabhu Das on May 21, 2009 7:53 PM

Try this function module..


 CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
    EXPORTING
      date_of_change                   = p_datefr
      objectclass                      = 'MATERIAL'
      date_until                       = p_dateto
      username                         = '*'
    TABLES
      i_cdhdr                          = i_cdhdr
    EXCEPTIONS
      no_position_found                = 1
      wrong_access_to_archive          = 2
      time_zone_conversion_error       = 3
      OTHERS                           = 4.

  LOOP AT i_cdhdr.
**For each change document header, read the corresponding change document line items
    refresh: editpos.
    CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
      EXPORTING
        changenumber                  = i_cdhdr-changenr
      TABLES
        editpos                       = editpos
      EXCEPTIONS
        no_position_found             = 1
        wrong_access_to_archive       = 2
        OTHERS                        = 3.
ENDLOOP.

Prabhu

Edited by: Prabhu Das on May 21, 2009 7:53 PM

3 REPLIES 3
Read only

Former Member
0 Likes
1,169

Try this function module..


 CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
    EXPORTING
      date_of_change                   = p_datefr
      objectclass                      = 'MATERIAL'
      date_until                       = p_dateto
      username                         = '*'
    TABLES
      i_cdhdr                          = i_cdhdr
    EXCEPTIONS
      no_position_found                = 1
      wrong_access_to_archive          = 2
      time_zone_conversion_error       = 3
      OTHERS                           = 4.

  LOOP AT i_cdhdr.
**For each change document header, read the corresponding change document line items
    refresh: editpos.
    CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
      EXPORTING
        changenumber                  = i_cdhdr-changenr
      TABLES
        editpos                       = editpos
      EXCEPTIONS
        no_position_found             = 1
        wrong_access_to_archive       = 2
        OTHERS                        = 3.
ENDLOOP.

Prabhu

Edited by: Prabhu Das on May 21, 2009 7:53 PM

Read only

0 Likes
1,168

Thanks.

Could you please tell me which field in the editpos table will correspond to line item number and schedule line number?

REgards,

Shital

Read only

0 Likes
1,168

check in you system where used list and see the sample code...

this is how it is going to use..



SELECT SINGLE matnr maktx  INTO (w_matnr, w_maktx)
           FROM makt WHERE matnr = i_cdhdr-objectid AND      "header data 
                           spras = sy-langu.

**Loop thru all change document line items and filter out changes to the
**US material tax classification indicator
    LOOP AT editpos WHERE tabname = 'MARC' AND
                          tabkey = 'US UTXJ'.

            IF editpos-chngind = 'U'.
               w_text = 'Changes done'.
              read respective table and display.
  ENDLOOP.

Prabhudas