cancel
Showing results for 
Search instead for 
Did you mean: 

How to Get Each line item Create and Approval dates for a SHOPPING CART in SAP SRM (ABAP Programming)

JanjanamRamesh
Participant
0 Kudos

Hi All,

I have to Get Each line item Create and Approval dates for a SHOPPING CART in SAP SRM. Either a table, or any Function module, Method, please let me know ASAP. Same i can use in my Program.

Thank you Very much.

Regards,

Ramesh J.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I also need to fetch the approval dates for Shopping Cart items. Any resolution?

JanjanamRamesh
Participant
0 Kudos

Hello Isha - Yes i resolved it.

Just try to debug the BBP_PD and you definitely get all the required FM's to sort out.

Still you did not get, let me know i will give you the code for sure.

Many thanks,

Ramesh Janjanam.

JanjanamRamesh
Participant
0 Kudos

The Tables used for this data retrieval:

USR02,TJ02T,CRMC_PROC_TYPE,CRMD_ORDERADM_H,CRMD_ORDERADM_I,
USER_ADDR,BBP_PDHGP,BBP_PDIGP,CRM_JEST,BBP_PDBEI,BBP_LOCMAP,
BUT000,CRMC_PROC_TYPE_T,BBPC_SUBOB_CAT_T.

The Below function modules are used for retrieving appropriate data to the internal Table

Shopping cart Details

CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid       = wa_crmd_orderadm_h-guid
i_object_id  = wa_crmd_orderadm_h-object_id
TABLES
e_header_rel = t_header_rel.

RFx Details

CALL FUNCTION 'BBP_PD_BID_GETDETAIL'           

EXPORTING
i_guid       = wa_header_rel-guid_b
IMPORTING
e_header     = l_header_bid
TABLES
e_header_rel = t_header_rel
e_status     = t_status.

Contract details

      CALL FUNCTION 'BBP_PD_CTR_GETDETAIL'
EXPORTING
i_guid   = wa_header_rel-guid_b
IMPORTING
e_header = l_header_ctr
TABLES
e_status = t_status.

PO Details

       CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_guid   = wa_header_rel-guid_b
IMPORTING
e_header = l_header_po
TABLES
e_status = t_status.

Getting each version

   CALL FUNCTION 'BBP_PROCDOC_VERSION_GETLIST'
EXPORTING
iv_header_guid              = wa_header_rel-guid_b
iv_read_all_change_versions = 'X'
TABLES
et_pdlist                   = t_version.

Getting Status of Each document

CALL FUNCTION 'BBP_GET_STATUS'
EXPORTING
iv_guid              = p_guid
iv_object_type       = p_object_type
IMPORTING
es_status            = ls_status

Method which is used for Process history of each document

CALL METHOD /sapsrm/cl_wf_apv_facade=>retrieve_process_history
EXPORTING
iv_document_guid = p_wa_header_rel_guid_b
iv_agent_id      = lv_agent_id
iv_language      = sy-langu
IMPORTING
es_process       = ls_wf_process.

UNASSIGN: <fs_tab>, <fs_wa>.
lt_process_lvl_list ls_wf_process-process_level_list[].



READ TABLE lt_process_lvl_list INTO wa_process_lvl_list

          WITH KEY level_status = 'COMPLETED'.

ASSIGN COMPONENT 'DECISIONSET_LIST' OF STRUCTURE

                   wa_process_lvl_list TO <fs_tab>.
IF sy-subrc EQ 0.
READ TABLE <fs_tab> INTO wa_decisionset INDEX 1.
IF sy-subrc EQ 0.
UNASSIGN <fs_tab>.
ASSIGN COMPONENT 'WORKITEM_LIST' OF STRUCTURE wa_decisionset TO <fs_tab>.
IF sy-subrc EQ 0.
READ TABLE <fs_tab> INTO ls_workitem_list INDEX 1.
p_appr_name = ls_workitem_list-agent. "Approver Name

CONVERT TIME STAMP ls_workitem_list-etime
TIME ZONE c_tzone
INTO DATE lv_date TIME lv_time.

p_end_date = lv_date . "Date Complete

CLEAR : lv_date,lv_time.
CONVERT TIME STAMP ls_workitem_list-ctime "stime
TIME ZONE c_tzone
INTO DATE lv_date TIME lv_time.

p_strt_date = lv_date.

ENDIF.
ENDIF.
ENDIF.

Custom function module had been created for calculating number of working days between two dates based on the Calendar: Z_SELECT_FACTDAYS_FOR_PERIOD

CALL FUNCTION 'Z_SELECT_FACTDAYS_FOR_PERIOD' DESTINATION 'ECC_BACKEND'
EXPORTING
i_indat               = p_lv_sdate
i_outdat              = p_lv_edate
IMPORTING
no_of_working_days    = p_lv_days
EXCEPTIONS
date_conversion_error = 1
OTHERS                = 2.