cancel
Showing results for 
Search instead for 
Did you mean: 

ASN Status trace

Former Member
0 Kudos

Hi Experts!!

How to check, on what basis ASN Status is generated ?

I checked BBP_PD program, i found CRM_JEST Where error message is coming.

But I have to check what basis Status is showing?

Which transaction code or basis of entry CRM_JEST is updating correspond to ASN?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

khan_voyalpadusman
Active Contributor
0 Kudos

please elaborate on what you are looking for?

what is the problem with the ASN? which SRM release are you using?

Former Member
0 Kudos

FUNCTION ZASNCREATE.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(DATA) TYPE STRING

*" EXPORTING

*" REFERENCE(ASNRESULT) TYPE STRING

*"----


*DATA: K TYPE i.

*k = 0.

*while k eq 0.

*

*endwhile.

*

*if SY-UNAME ne 'PRAVIN'.

  • return.

*endif.

DATA: BEGIN OF ITAB occurs 0,

value type string.

DATA: END OF ITAB.

DATA:oref TYPE REF TO cx_root,

lerr type i value 0,

lexciseerr type i value 0.

data: begin of file occurs 0,

*PO NUMBER

*ITEM NUMBER

*QTY

*INVOICE NO

*INVOICE DATE

*INVOICE AMT

*EXCISE AMT

*CURRENCY

*LR NO

*LR DATE

*VEHICLE NO

*TRANSPORTER NAME

PONUM(10),

ItemNo(5),

quantity(13),

zzinvoiceno(10),

zzinvoicedate(10),

zzinvoiceamt(15) type n,

zzexciseamt(15) type n,

currency(5),

zzlrno(10),

zzlrdate(10),

zzvehicleno(20),

transporter(20).

data: end of file.

DATA: lcheck_exciseamt(8) type p,

lcheck_invoiceamt(8) type p.

data: header(256),

content type string,

quantity type BBP_MNG,

no_of_error type i,

quan_avail type BBP_MNG.

data: line_return TYPE STRING.

constants: crlf type string value cl_abap_char_utilities=>cr_lf,

newline type string value cl_abap_char_utilities=>NEWLINE.

data: zquan_asn type bbp_pdigp-quan_asn,

zquan_asn_e type bbp_pdigp-quan_asn_e,

ziquan_asn type BBPD_PD_INDEX_I-IQUAN_ASN_E. " insert usman

data: errortext type string.

data: litemnolen type i,

lponum type i,

linvoiceno type i,

liexciseamt type i,

lqty type i,

linvoicedatelen type i,

linvoiceamtlen type i,

llrnolen type i,

llrdatelen type i,

lvehiclenolen type i,

ltransportlen type i.

content = data.

replace all occurrences of CL_ABAP_CHAR_UTILITIES=>NEWLINE in content

with ''.

replace all occurrences of CL_ABAP_CHAR_UTILITIES=>CR_LF(1) in content

with '~'.

split content at '~' into header content.

  • copy imported susasn-header into header structure for

  • procdoc function

data: li_procheader TYPE bbp_pds_header.

data: li_procitem TYPE bbp_pds_item OCCURS 0 WITH HEADER LINE.

while content is not initial.

DATA: le_guid LIKE crmd_orderadm_h-guid,

ponum TYPE bbp_btd_id,

e_item LIKE TABLE OF bbp_pds_susasn_item_icu,

itabitem like line of e_item,

le_item LIKE TABLE OF bbp_pds_suspo_ui_item_d,

le_partner LIKE TABLE OF bbp_pds_partner,

wa_partner LIKE LINE OF le_partner,

le_longtext LIKE TABLE OF bbp_pds_longtext,

le_limit LIKE TABLE OF bbp_pds_limit,

le_tax LIKE TABLE OF bbp_pds_tax,

le_messages LIKE TABLE OF bbp_pds_messages,

ls_messages_e LIKE line of le_messages,

le_actval LIKE TABLE OF bbp_pds_actval,

le_version LIKE TABLE OF bbp_pds_version_list_internal,

le_header_rel LIKE TABLE OF bbp_pds_hrel,

le_itmlim_rel LIKE TABLE OF bbp_pds_ilrel,

le_status LIKE TABLE OF bbp_pds_status,

li_header LIKE bbp_pds_susasn_header_ic,

le_pdlist LIKE TABLE OF bbp_pds_suspo_pdlist,

  • lasnleg LIKE zasnlegacy,

kitem like bbp_pdigp,

  • lpdigp type zasnlegacy,

lorpdigp type bbp_pdigp,

KHEADER TYPE BBP_PDS_SUSPO_UI_HEADER_D.

data : oldyear(4) type c,

newyear(4) type c,

MM(2) type c,

P_YY(4) type c,

N_YY(4) type c,

START_DATE LIKE SY-DATUM,

END_DATE LIKE SY-DATUM,

ZPARTNER TYPE BU_PARTNER,

ZVENMAP TYPE TABLE OF VENMAP,

ZZVEND LIKE LINE OF ZVENMAP,

zvendor_guid like CRMD_PARTNER-PARTNER_NO,

itab_bbp_pdhsc type bbp_pdhsc,

asn_no type crmd_orderadm_h-object_id,

VENDLEN TYPE I.

split content at '~' into itab-value content.

***Start ASN creation process

*PO NUMBER

*ITEM NUMBER

*QTY

*INVOICE NO

*INVOICE DATE

*INVOICE AMT

*EXCISE AMT

*CURRENCY

*LR NO

*LR DATE

*VEHICLE NO

*TRANSPORTER NAME

split itab-value at ',' into file-ponum file-itemno file-quantity

file-zzinvoiceno file-zzinvoicedate file-zzinvoiceamt

file-zzexciseamt file-zzlrno file-zzlrdate

file-zzvehicleno file-transporter.

*PO No is mandatory

lponum = STRLEN( file-ponum ).

if lponum gt 0.

  • if file-ponum is not initial.

ponum = file-ponum.

else.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter PO Number' into errortext separated by '.'.

ls_messages_e-message = 'Enter PO Number'.

APPEND ls_messages_e TO le_messages.

endif.

*{ DELETE SR4K900219 3

\ASN not to be created, if corressponding PO/SA not accepted

*\ CALL FUNCTION 'BBP_PD_SUSPO_GETLIST'

*\ EXPORTING

*\ I_SUBTYPE = ''

*\ I_SRC_OBJECT_ID = ponum

*\ TABLES

*\ E_PDLIST = le_pdlist

*\ E_MESSAGES = le_messages.

*\

*\ DATA: wa_le_pdlist TYPE bbp_pds_suspo_pdlist,

*\ kguid type bbp_guid,

*\ mstatus type BBPT_PDS_STATUS,

*\ lmstatus like line of mstatus,

*\ noofstatus type i.

*\

*\ DELETE LE_PDLIST WHERE DESCRIPTION EQ 'DELINS'.

*\ READ TABLE le_pdlist INTO wa_le_pdlist INDEX 1.

*\

*\ if sy-subrc eq 0 and lponum gt 0.

*\

*\ select single guid into (kguid) from \

*\ crmd_orderadm_h where object_id

*\eq wa_le_pdlist-OBJECT_ID.

*\

*\ CALL FUNCTION 'BBP_PD_STATUS_GETDETAIL'

*\ EXPORTING

*\ IV_GUID = kguid

*\ IV_OBJECT_TYPE = 'SUSPO'

*\ TABLES

*\ ET_STATUS = mstatus.

*\

*\ clear wa_le_pdlist.

*\ describe table mstatus lines noofstatus.

*\ read table mstatus into lmstatus with key stat = 'I1333'

*\ INACT = ' '.

*\ if SY-SUBRC NE 0.

*\ concatenate errortext 'ASN cannot be sent as Scheduling Agreement'

*\ 'is not accepted by you' into errortext separated by '.'.

*\

*\ ls_messages_e-msgty = 'E'.

*\

*\ concatenate 'ASN can not be sent as Scheduling Agreement'

*\'is not accepted by you' into \

*\ ls_messages_e-message separated by '.'.

*\ APPEND ls_messages_e TO le_messages.

*\ endif.

*\

*\ clear: mstatus,noofstatus.

*\ refresh: mstatus,le_pdlist.

*} DELETE

*{ INSERT SR4K900246 5

**Changes done by Gouri: to remove SA confirmation dependancy.

*ASN not to be created, if corressponding PO/SA not accepted

  • CALL FUNCTION 'BBP_PD_SUSPO_GETLIST'

  • EXPORTING

  • I_SUBTYPE = ''

  • I_SRC_OBJECT_ID = ponum

  • TABLES

  • E_PDLIST = le_pdlist

  • E_MESSAGES = le_messages.

*

  • DATA: wa_le_pdlist TYPE bbp_pds_suspo_pdlist,

  • kguid type bbp_guid,

  • mstatus type BBPT_PDS_STATUS,

  • lmstatus like line of mstatus,

  • noofstatus type i.

*

  • DELETE LE_PDLIST WHERE DESCRIPTION EQ 'DELINS'.

  • READ TABLE le_pdlist INTO wa_le_pdlist INDEX 1.

*

  • if sy-subrc eq 0 and lponum gt 0.

*

  • select single guid into (kguid) from

  • crmd_orderadm_h where object_id

*eq wa_le_pdlist-OBJECT_ID.

*

  • CALL FUNCTION 'BBP_PD_STATUS_GETDETAIL'

  • EXPORTING

  • IV_GUID = kguid

  • IV_OBJECT_TYPE = 'SUSPO'

  • TABLES

  • ET_STATUS = mstatus.

*

  • clear wa_le_pdlist.

  • describe table mstatus lines noofstatus.

  • read table mstatus into lmstatus with key stat = 'I1333'

  • INACT = ' '.

  • if SY-SUBRC NE 0.

  • concatenate errortext 'ASN cannot be sent as Scheduling Agreement'

  • 'is not accepted by you' into errortext separated by '.'.

*

  • ls_messages_e-msgty = 'E'.

*

  • concatenate 'ASN can not be sent as Scheduling Agreement'

*'is not accepted by you' into

  • ls_messages_e-message separated by '.'.

  • APPEND ls_messages_e TO le_messages.

  • endif.

*

  • clear: mstatus,noofstatus.

  • refresh: mstatus,le_pdlist.

*} INSERT

*Item No is mandatory

*{ REPLACE SR4K900219 2

*\ litemnolen = STRLEN( file-itemno ).

litemnolen = STRLEN( file-itemno ).

*} REPLACE

if litemnolen le 0.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Item Number' into errortext separated by

'.'.

ls_messages_e-message = 'Enter Item Number'.

APPEND ls_messages_e TO le_messages.

endif.

TRANSLATE file-itemno TO UPPER CASE.

if file-itemno

ca 'ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_-+=,;:"/\|<>?[]{}'.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Item No not a numeric field ' into errortext

separated by '.'.

ls_messages_e-message = 'Enter Item Number'.

APPEND ls_messages_e TO le_messages.

endif.

*Quantity is mandatory

lerr = 0. " reseting exception variable

TRANSLATE file-quantity TO UPPER CASE.

if file-quantity

ca 'ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_-+=,;:"/\|<>?[]{}'.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Quantity not a numeric field ' into errortext

separated by '.'.

ls_messages_e-message = 'Enter Quantity'.

APPEND ls_messages_e TO le_messages.

elseif file-quantity is not initial.

TRY.

quantity = file-quantity.

CATCH cx_root INTO oref.

lerr = 1.

ENDTRY.

else.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Quantity' into errortext separated by '.'.

ls_messages_e-message = 'Enter Quantity'.

APPEND ls_messages_e TO le_messages.

endif.

if lerr eq 1.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Invalid Quantity not a numeric field ' into

errortext separated by '.'.

ls_messages_e-message = 'Enter Quantity'.

APPEND ls_messages_e TO le_messages.

elseif quantity le 0.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Quantity should be greater than zero' into

errortext separated by '.'.

ls_messages_e-message = 'Enter Quantity'.

APPEND ls_messages_e TO le_messages.

endif.

*INVOICE NO is mandatory

linvoiceno = STRLEN( file-zzinvoiceno ).

if linvoiceno le 0.

  • if file-zzinvoiceno is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Invoice No' into errortext separated by '.'

.

ls_messages_e-message = 'Enter Invoice No'.

APPEND ls_messages_e TO le_messages.

else.

  • k = file-zzinvoiceno.length.

li_header-zzinvoiceno = file-zzinvoiceno.

endif.

*INVOICE DATE

linvoicedatelen = STRLEN( file-zzinvoicedate ).

if linvoicedatelen le 0.

  • if file-zzinvoicedate is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Invoice Date' into errortext separated by

'.'.

ls_messages_e-message = 'Enter Invoice Date'.

APPEND ls_messages_e TO le_messages.

else.

li_header-zzinvoicedate = file-zzinvoicedate.

endif.

*INVOICE AMT

linvoiceamtlen = STRLEN( file-zzinvoiceamt ).

lerr = 0. " reseting exception variable

TRANSLATE file-zzinvoiceamt TO UPPER CASE.

if file-zzinvoiceamt

ca 'ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_-+=,;:"/\|<>?[]{}'.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Invoice Amount not a numeric field ' into

errortext separated by '.'.

ls_messages_e-message = 'Enter Invoice Amount'.

APPEND ls_messages_e TO le_messages.

elseif ( linvoiceamtlen le 0 ).

  • if file-zzinvoiceamt is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Invoice Amount' into errortext separated

by '.'.

ls_messages_e-message = 'Enter Invoice Amount'.

APPEND ls_messages_e TO le_messages.

else.

TRY.

li_header-zzinvoiceamt = file-zzinvoiceamt.

lcheck_invoiceamt = file-zzinvoiceamt.

CATCH cx_root INTO oref.

lerr = 1.

ENDTRY.

endif.

if lerr eq 1.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Invalid Invoice Amount not a numeric field '

into errortext separated by '.'.

ls_messages_e-message = 'Enter Invoice Amount.'.

APPEND ls_messages_e TO le_messages.

endif.

*EXCISE AMT

  • if file-zzexciseamt is initial.

lexciseerr = 0.

liexciseamt = STRLEN( file-zzexciseamt ).

TRANSLATE file-zzexciseamt TO UPPER CASE.

if file-zzexciseamt

ca 'ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_-+=,;:"/\|<>?[]{}'.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Excise Amount not a numeric field ' into

errortext separated by '.'.

ls_messages_e-message = 'Enter Excise Amount'.

APPEND ls_messages_e TO le_messages.

elseif liexciseamt le 0.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Excise Amount' into errortext separated

by '.'.

ls_messages_e-message = 'Enter Excise Amount'.

APPEND ls_messages_e TO le_messages.

else.

TRY.

li_header-zzexciseamt = file-zzexciseamt.

lcheck_exciseamt = file-zzexciseamt.

CATCH cx_root INTO oref.

lexciseerr = 1.

ENDTRY.

endif.

if lexciseerr eq 1.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Invalid Excise Amount not a numeric field '

into errortext separated by '.'.

ls_messages_e-message = 'Enter Excise Amount.'.

APPEND ls_messages_e TO le_messages.

endif.

  • Excise amount should be less that invoice amt

if lcheck_exciseamt ge lcheck_invoiceamt and lerr eq 0 and lexciseerr

eq 0.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Excise Amt should be less than Inv Amt' into

errortext

separated by '.'.

ls_messages_e-message = 'Enter correct Amount'.

APPEND ls_messages_e TO le_messages.

endif.

*CURRENCY is hardcoded

file-currency = 'INR'.

*LR NO

llrnolen = STRLEN( file-zzlrno ).

if llrnolen le 0.

  • if file-zzlrno is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter LR No' into errortext separated

by '.'.

ls_messages_e-message = 'Enter LR No.'.

APPEND ls_messages_e TO le_messages.

else.

li_header-zzlrno = file-zzlrno.

endif.

*LR DATE

llrdatelen = STRLEN( file-zzlrdate ).

if llrdatelen le 0.

  • if file-zzlrdate is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter LR Date' into errortext separated

by '.'.

ls_messages_e-message = 'Enter LR Date.'.

APPEND ls_messages_e TO le_messages.

else.

li_header-zzlrdate = file-zzlrdate.

endif.

*VEHICLE NO

lvehiclenolen = STRLEN( file-zzvehicleno ).

if lvehiclenolen le 0.

  • if file-zzvehicleno is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Vehicle No' into errortext separated

by '.'.

ls_messages_e-message = 'Enter Vehicle No.'.

APPEND ls_messages_e TO le_messages.

endif.

*TRANSPORTER NAME

ltransportlen = STRLEN( file-transporter ).

if ltransportlen le 0.

  • if file-transporter is initial.

ls_messages_e-msgty = 'E'.

concatenate errortext 'Enter Transporter' into errortext separated

by '.'.

ls_messages_e-message = 'Enter Transporter.'.

APPEND ls_messages_e TO le_messages.

endif.

clear: zpartner,zvenmap.

refresh: zvenmap.

CALL FUNCTION 'BBPU_GET_COMPANY_OF_VENDOR'

EXPORTING

USERNAME = SY-UNAME

IMPORTING

COMPANY = ZPARTNER.

CALL FUNCTION 'Z_BBP_VENDOR_READ_DETAIL'

EXPORTING

IV_PARTNER = ZPARTNER

TABLES

ET_VENMAP = ZVENMAP.

READ TABLE ZVENMAP INDEX 1 INTO ZZVEND.

zvendor_guid = ZZVEND-PARTNER_GUID.

clear no_of_error.

describe table le_messages lines no_of_error.

if no_of_error eq 0.

DATA: COUNT TYPE i.

CALL FUNCTION 'BBP_PD_SUSPO_GETLIST'

EXPORTING

I_PARTNER = zvendor_guid

i_src_object_id = ponum

i_asn_possible = 'X'

TABLES

e_pdlist = le_pdlist

e_messages = le_messages.

CLEAR COUNT.

DESCRIBE TABLE le_pdlist LINES count.

IF COUNT GT 0.

*{ REPLACE SR4K900219 4

\ DATA: wa_le_pdlist TYPE bbp_pds_suspo_pdlist.

*Changes done by Gouri: to remove SA confirmation dependancy.

DATA: wa_le_pdlist TYPE bbp_pds_suspo_pdlist.

*} REPLACE

READ TABLE le_pdlist INTO wa_le_pdlist INDEX 1.

le_guid = wa_le_pdlist-guid.

CALL FUNCTION 'BBP_PD_SUSPO_GETDETAIL_UI'

EXPORTING

iv_guid = le_guid

IMPORTING

ES_HEADER_PO = kheader

TABLES

et_item_po = le_item

et_partner = le_partner

et_messages = le_messages

et_actval = le_actval.

CLEAR COUNT.

DESCRIBE TABLE le_partner LINES count.

IF count GT 5.

DELETE le_partner FROM 6 TO count.

ELSE.

IF count LT 5.

READ TABLE le_partner INTO wa_partner INDEX count.

APPEND wa_partner TO le_partner.

ENDIF.

ENDIF.

li_header-guid = le_guid.

  • li_header-description = 'DELINS'.

li_header-susasn_transtype = '0002'.

li_header-SUSASN_BILL_LAD = file-transporter. "Transporter Name

li_header-susasn_transid = file-zzvehicleno.

li_header-process_type = 'ASNS'.

li_header-be_refobj = kheader-src_object_id." Usman

li_header-be_log_system = kheader-src_logsys. "usman

li_header-POSTING_DATE = sy-datum.

DATA: wa1_item LIKE bbp_pds_suspo_ui_item_d.

DATA: wa2_item LIKE bbp_pds_susasn_item_icu.

DATA: date(14).

CONCATENATE sy-datum sy-uzeit INTO date.

DATA: itemno(5).

DATA: availquan TYPE TABLE OF bbp_pds_suspo_ui_item_d.

DATA: availquan1 TYPE bbp_pds_suspo_ui_item_d.

data: litem like line of le_item.

DATA: wa_item LIKE bbp_pds_suspo_ui_item_d.

DATA: wa_item_temp LIKE bbp_pds_suspo_ui_item_d.

DATA: lt_asn_item_icu TYPE bbp_pdt_susasn_item_icu.

DATA: wa_actval LIKE bbp_pds_actval.

*Added for sorting based on delivery date

SORT le_item BY deliv_date number_ext.

***Only to consider items which are same as Item No

if kheader-description eq 'DELINS'.

li_header-description = 'DELINS'.

delete le_item where number_ext+0(5) ne file-itemno.

else.

li_header-description = 'PO'.

delete le_item where number_ext+5(5) ne file-itemno.

endif.

***

clear: kheader.

CLEAR COUNT.

DESCRIBE TABLE le_item LINES count. " check for line item

if count gt 0.

*Commented by vishal 24.05

refresh: availquan.

clear: availquan,availquan1.

*For Open quantity

LOOP AT LE_ITEM INTO WA_ITEM.

if wa_item-quantity gt 0.

select single quan_asn_e into zquan_asn_e from bbp_pdigp

where guid eq wa_item-guid.

MOVE-corresponding wa_item to AVAILQUAN1.

AVAILQUAN1-QUANTITY = WA_ITEM-QUANTITY - ZQUAN_ASN_E.

if availquan1-quantity gt 0.

*To add all open quantity

quan_avail = quan_avail + ( WA_ITEM-QUANTITY - ZQUAN_ASN_E ).

append AVAILQUAN1 TO availquan.

ENDIF.

clear zquan_asn_e.

clear wa_item.

endif.

ENDLOOP.

*End - vishal 24.05

if quan_avail ge quantity.

LOOP AT availquan INTO availquan1.

MOVE-CORRESPONDING availquan1 TO wa2_item.

IF quantity LE availquan1-quantity.

wa2_item-quantity = quantity.

  • wa2_item-be_refobj = availquan1-ctr_hdr_number.

wa2_item-be_refobj = availquan1-src_object_id.

wa2_item-number_int = availquan1-number_int.

wa2_item-be_refobj_item = availquan1-number_ext.

wa2_item-CTR_HDR_NUMBER = availquan1-src_object_id.

wa2_item-ctr_item_number = availquan1-number_ext.

wa2_item-ORDERED_PROD = availquan1-ORDERED_PROD.

wa2_item-deliv_date = sy-datum.

wa2_item-shipping_ts = date.

APPEND wa2_item TO e_item.

EXIT.

ELSE.

wa2_item-quantity = availquan1-quantity.

quantity = quantity - availquan1-quantity.

  • wa2_item-be_refobj = availquan1-ctr_hdr_number.

wa2_item-be_refobj = availquan1-src_object_id.

wa2_item-be_refobj_item = availquan1-number_ext.

wa2_item-CTR_HDR_NUMBER = availquan1-src_object_id.

wa2_item-ctr_item_number = availquan1-number_ext.

wa2_item-deliv_date = sy-datum.

wa2_item-shipping_ts = date.

APPEND wa2_item TO e_item.

CONTINUE.

ENDIF.

ENDLOOP.

DATA: asnheader TYPE bbp_pds_susasn_header_d.

CALL FUNCTION 'BBP_PD_SUSASN_CREATE'

EXPORTING

i_header = li_header

i_src_guid = le_guid

IMPORTING

e_header = asnheader

TABLES

i_item = e_item

i_partner = le_partner

e_messages = le_messages.

data: lv_changed(1),

ls_asn_header_u TYPE bbp_pds_susasn_header_u.

MOVE-CORRESPONDING asnheader TO ls_asn_header_u.

CALL FUNCTION 'BBP_PD_SUSASN_SAVE'

EXPORTING

iv_header_guid = asnheader-guid.

CALL FUNCTION 'BBP_PD_SUSASN_STATUS_CHANGE'

EXPORTING

i_guid = asnheader-guid

i_activity = 'SFSD'

i_save_db = 'X'

TABLES

e_messages = le_messages

CHANGING

e_changed = lv_changed.

clear: wa2_item.

DATA: idx TYPE sy-tabix.

LOOP AT e_item into WA2_ITEM.

idx = sy-tabix.

wa2_item-parent = asnheader-guid.

modify e_item INDEX idx from wa2_item.

ENDLOOP.

  • CALL FUNCTION 'BBP_PD_SUSASN_UPDATE'

  • EXPORTING

    • I_PARK =

  • I_SAVE = 'X'

    • IV_REJECT =

  • I_HEADER = ls_asn_header_u

    • IT_ATTACH =

    • IV_MSG_SCENARIO =

  • IMPORTING

  • E_CHANGED = lv_changed

  • TABLES

  • I_ITEM = E_ITEM

    • I_PARTNER =

    • I_LONGTEXT =

    • I_TAX =

  • E_MESSAGES = LE_MESSAGES.

*

*

  • MOVE-CORRESPONDING ls_asn_header_u TO li_procheader.

*

  • clear: wa2_item.

  • REFRESH li_procitem.

  • LOOP AT e_item into wa2_item.

  • CLEAR li_procitem.

  • MOVE-CORRESPONDING wa2_item TO li_procitem.

*

  • APPEND li_procitem.

*

  • ENDLOOP.

  • Check new function to update table May 10 2005

*CALL FUNCTION 'BBP_PROCDOC_UPDATE'

  • EXPORTING

    • i_park = ""

  • i_save = 'X'

    • iv_reject = ""

  • i_header = li_procheader

    • it_attach = it_attach

    • iv_msg_scenario = iv_msg_scenar

  • TABLES

  • i_item = li_procitem

  • i_partner = le_partner

    • i_longtext = i_longtext

    • i_tax = i_tax

  • e_messages = le_messages

  • CHANGING

  • e_changed = lv_changed.

*

  • End new function

*Added by vishal on 24.05

loop at e_item into wa2_item.

select single quan_asn quan_asn_e from bbp_pdigp into

(zquan_asn,zquan_asn_e) where guid eq wa2_item-guid.

select single IQUAN_ASN_E from BBPD_PD_INDEX_I into

(ziquan_asn) where ITEM_GUID eq wa2_item-guid.

zquan_asn = zquan_asn + wa2_item-quantity.

zquan_asn_e = zquan_asn_e + wa2_item-quantity.

ziquan_asn = ziquan_asn + wa2_item-quantity.

update bbp_pdigp set quan_asn = zquan_asn

quan_asn_e = zquan_asn_e

where guid = wa2_item-guid.

update BBPD_PD_INDEX_I set IQUAN_ASN_E = ziquan_asn

where ITEM_GUID = wa2_item-guid.

clear: zquan_asn,zquan_asn_e,ziquan_asn.

endloop.

*end addition by vishal

COMMIT work and wait.

else.

concatenate errortext 'Quantity not available in Schedule'

into errortext separated by '.'.

ENDIF. "quan_avail ge quantity

else.

concatenate errortext 'Wrong Item Number' into errortext separated

by '.'.

endif.

else.

concatenate errortext 'Wrong Purchase Order Number' into

errortext separated by '.'.

endif. "IF COUNT GT 0.

else.

endif. "if no_of_error eq 0.

*{ DELETE SR4K900219 1

*\ else.

*\ concatenate errortext 'Wrong Purchase Order Number' into

*\ errortext separated by '.'.

*\

*\ endif.

*} DELETE

*{ INSERT SR4K900246 6

*Changes done by Gouri: to remove SA confirmation dependancy.

*else.

  • concatenate errortext 'Wrong Purchase Order Number' into

  • errortext separated by '.'.

*

  • endif.

*} INSERT

if file-zzinvoiceno is initial.

file-zzinvoiceno = '~'.

endif.

if file-ponum is initial.

file-ponum = '~'.

endif.

if file-itemno is initial.

file-itemno = '~'.

endif.

if asnheader-ref_doc_no is initial.

asnheader-ref_doc_no = 0.

endif.

if quantity is initial.

quantity = '0'.

endif.

if errortext is initial.

errortext = '~'.

endif.

replace '.' in errortext with ''.

CONCATENATE ASNRESULT file-ponum file-itemno file-zzinvoiceno

file-quantity asnheader-ref_doc_no errortext INTO ASNRESULT

SEPARATED BY ','.

clear: itab,ponum,quantity,file,E_ITEM,AVAILQUAN1,LI_HEADER,

LV_CHANGED,WA_ITEM,WA1_ITEM,WA2_ITEM,errortext,asnheader,quan_avail.

REFRESH: E_ITEM, AVAILQUAN,LE_PARTNER,

LE_MESSAGES,LE_ACTVAL,LE_PDLIST.

endwhile.

ENDFUNCTION.

I am using 5.0 SRM Version.

In bbp_pd status showing incomplete, Where as following process completed successfully.

*PO NUMBER

*ITEM NUMBER

*QTY

*INVOICE NO

*INVOICE DATE

*INVOICE AMT

*EXCISE AMT

*CURRENCY

*LR NO

*LR DATE

*VEHICLE NO

*TRANSPORTER NAME

How to correct this error ? Cud you suggest me ??

Answers (0)