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

Reg Material get list...

Hi all ,

Is there any BAPI or Function module to get the material data by passing the last change date.

Regards,

Krishnamoorthy.V.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 08:13 AM

    BAPI_COSTESTIMATE_UPDATE_PRICE

    BAPI-step by step procedure

    http://www.sapgenie.com/abap/bapi/example.htm

    list of all BAPI's

    http://www.planetsap.com/LIST_ALL_BAPIs.htm

    Rewards if useful..............

    Minal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 08:19 AM

    hi,

    use fm CHANGEDOCUMENT_READ_HEADERS.

    we can get required data from cdpos and cdhdr tables

    check this code it helps u

    TABLES : MARC.

    DATA :BEGIN OF GI_MARC OCCURS 0,

    MATNR LIKE MARC-MATNR,

    WERKS LIKE MARC-WERKS,

    DISPO LIKE MARC-DISPO,

    END OF GI_MARC.

    DATA : CHAR TYPE I,

    COUNT TYPE I,

    VAR TYPE I.

    DATA : BEGIN OF GI_FINAL OCCURS 2000,

    MATNR LIKE MARC-MATNR,

    DISPO LIKE MARC-DISPO,

    USERNAME LIKE CDHDR-USERNAME,

    UDATE LIKE CDHDR-UDATE,

    UTIME LIKE CDHDR-UTIME,

    TCODE LIKE CDHDR-TCODE,

    TABNAME LIKE CDPOS-TABNAME,

    TABKEY LIKE CDPOS-TABKEY,

    FNAME LIKE CDPOS-FNAME,

    VALUE_NEW LIKE CDPOS-VALUE_NEW,

    VALUE_OLD LIKE CDPOS-VALUE_OLD,

    CHANGENR LIKE CDHDR-CHANGENR,

    END OF GI_FINAL.

    DATA : MATNR LIKE MARC-MATNR,

    DISPO LIKE MARC-DISPO,

    USERNAME1 LIKE CDHDR-USERNAME,

    UDATE1 LIKE CDHDR-UDATE,

    UTIME LIKE CDHDR-UTIME,

    TCODE LIKE CDHDR-TCODE,

    CHANGENR LIKE CDHDR-CHANGENR.

    DATA : GI_CDHDR LIKE CDHDR OCCURS 0 WITH HEADER LINE.

    DATA : GI_CDPOS LIKE CDPOS OCCURS 0 WITH HEADER LINE.

    DATA : OBJECTCLAS LIKE CDHDR-OBJECTCLAS VALUE 'MATERIAL',

    OBJECTID LIKE CDHDR-OBJECTID,

    USERNAME LIKE CDHDR-USERNAME VALUE 'RSS-SPE',

    UDATE LIKE CDHDR-UDATE VALUE '20070101',

    CHANGE_IND LIKE CDHDR-CHANGE_IND VALUE 'U'.

    type-pools: slis.

    data: gt_slis_fcat type slis_t_fieldcat_alv.

    data: gt_fieldcat type slis_t_fieldcat_alv.

    *data: gt_fieldcatall type slis_t_fieldcat_alv.

    data: g_repid like sy-repid.

    data: gs_layout type slis_layout_alv.

    gs_layout-zebra = 'X'.

    gs_layout-colwidth_optimize = 'X'.

    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-110.

    SELECT-OPTIONS : P_DISPO FOR MARC-DISPO.

    SELECT-OPTIONS : RECORDS FOR CHAR.

    SELECTION-SCREEN : END OF BLOCK B1.

    START-OF-SELECTION.

    perform process_data.

    perform f_fieldcat_init using gt_fieldcat[].

    perform alv_display tables gi_final using gt_fieldcat[].

    form process_data.

    SELECT MATNR WERKS DISPO FROM MARC INTO TABLE GI_MARC

    WHERE DISPO IN P_DISPO

    AND WERKS = '1011'." Becoz we hav to chk the

    • the changes made in the material while extendin tht matrl frm 1011 to

    *other plant.

    IF NOT GI_MARC[] IS INITIAL.

    IF NOT RECORDS-LOW IS INITIAL .

    IF NOT RECORDS-HIGH IS INITIAL.

    DESCRIBE TABLE GI_MARC LINES COUNT.

    IF RECORDS-HIGH < COUNT.

    DELETE GI_MARC FROM RECORDS-HIGH TO COUNT.

    ENDIF.

    IF RECORDS-LOW <> 1.

    IF RECORDS-LOW <> 0.

    DELETE GI_MARC FROM 1 TO RECORDS-LOW.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDIF.

    LOOP AT GI_MARC.

    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

    EXPORTING

    INPUT = GI_MARC-MATNR

    IMPORTING

    OUTPUT = GI_MARC-MATNR

    • EXCEPTIONS

    • LENGTH_ERROR = 1

    • OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    OBJECTID = GI_MARC-MATNR .

    *

    CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

    EXPORTING

    • ARCHIVE_HANDLE = 0

    DATE_OF_CHANGE = UDATE

    OBJECTCLASS = OBJECTCLAS

    OBJECTID = OBJECTID

    • TIME_OF_CHANGE = '000000'

    USERNAME = USERNAME

    • LOCAL_TIME = ' '

    • DATE_UNTIL = '99991231'

    • TIME_UNTIL = '235959'

    TABLES

    I_CDHDR = GI_CDHDR

    EXCEPTIONS

    NO_POSITION_FOUND = 1

    WRONG_ACCESS_TO_ARCHIVE = 2

    TIME_ZONE_CONVERSION_ERROR = 3

    OTHERS = 4

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = 'Processing'.

    IF NOT GI_CDHDR[] IS INITIAL.

    LOOP AT GI_CDHDR.

    MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.

    MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.

    MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.

    MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.

    MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.

    MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.

    VAR = 1.

    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

    EXPORTING

    INPUT = GI_FINAL-MATNR

    IMPORTING

    OUTPUT = GI_FINAL-MATNR

    EXCEPTIONS

    LENGTH_ERROR = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    ENDIF.

    OBJECTID = GI_FINAL-MATNR ."to ensure that objid is in proper

    *format

    SELECT *

    FROM CDPOS

    INTO TABLE GI_CDPOS

    • PACKAGE SIZE 100

    • FOR ALL ENTRIES IN GI_cdhdr

    WHERE OBJECTID = OBJECTID

    AND CHANGENR = GI_CDHDR-CHANGENR

    AND OBJECTCLAS = OBJECTCLAS

    AND CHNGIND = CHANGE_IND." only those values will b

    *takn which have been modified nd nt created

    IF SY-SUBRC = 0.

    LOOP AT GI_CDPOS.

    MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.

    MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.

    MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.

    MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.

    MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.

    MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.

    MOVE GI_CDPOS-TABNAME TO GI_FINAL-TABNAME.

    MOVE GI_CDPOS-TABKEY TO GI_FINAL-TABKEY.

    MOVE GI_CDPOS-FNAME TO GI_FINAL-FNAME.

    MOVE GI_CDPOS-VALUE_NEW TO GI_FINAL-VALUE_NEW.

    MOVE GI_CDPOS-VALUE_OLD TO GI_FINAL-VALUE_OLD.

    APPEND GI_FINAL.

    CLEAR GI_FINAL.

    • ENDIF.

    VAR = VAR + 1.

    • ENDSELECT.

    ENDLOOP.

    ENDIF.

    ENDLOOP.

    CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = 'Processing'.

    ENDIF.

    ENDLOOP.

    endform.

    form f_fieldcat_init using lt_fieldcat type slis_t_fieldcat_alv.

    data: ls_fieldcat type slis_fieldcat_alv.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'MATNR'.

    ls_fieldcat-seltext_l = 'Material number'.

    • ls_fieldcat-tabname = 'GI_final'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'DISPO'.

    ls_fieldcat-seltext_l = 'mrp controller'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'USERNAME'.

    ls_fieldcat-seltext_l = 'Username'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'CHANGENR'.

    ls_fieldcat-seltext_l = 'Change Number'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'UDATE'.

    ls_fieldcat-seltext_l = 'modified date'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'UTIME'.

    ls_fieldcat-seltext_l = 'MODIFIED TIME'.

    append ls_fieldcat to lt_fieldcat.

    • clear ls_fieldcat.

    • ls_fieldcat-fieldname = 'UDATE'.

    • ls_fieldcat-seltext_l = 'MODIFIED DATE'.

    • append ls_fieldcat to lt_fieldcat.

    *

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'TCODE'.

    ls_fieldcat-seltext_l = 'TRANSACTION CODE'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'TABNAME'.

    ls_fieldcat-seltext_l = 'TABLE NAME'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'TABKEY'.

    ls_fieldcat-seltext_l = 'TABLE KEY'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'FNAME'.

    ls_fieldcat-seltext_l = 'FNAME'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'FVALUE'.

    ls_fieldcat-seltext_l = 'FVALUE'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'VALUE_NEW'.

    ls_fieldcat-seltext_l = 'NEW VALUE'.

    append ls_fieldcat to lt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'VALUE_OLD'.

    ls_fieldcat-seltext_l = 'OLD VALUE'.

    append ls_fieldcat to lt_fieldcat.

    endform. " f_fieldcat_init

    form alv_display tables gi_final using gt_fieldcat .

    call function 'REUSE_ALV_LIST_DISPLAY'

    exporting

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = ' Material list '

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • I_STRUCTURE_NAME =

    is_layout = gs_layout

    it_fieldcat = gt_fieldcat

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    • IT_EVENTS =

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    tables

    t_outtab = gi_final

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

    .

    if sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    endif.

    endform.

    regards

    siva

    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.