Modify IDOC Status by Program - ABAP Development - SCN Wiki
Modify IDOC Status by Program - ABAP Development - SCN Wiki
ModifyIDOCStatusbyProgramABAPDevelopmentSCNWiki
GettingStarted
CommunityWIKI
SAPCommunity
Welcome,Guest
Login
Store
Register
ABAPDevelopment / / ALE,IDOC
ModifyIDOCStatusbyProgram
CreatedbyGuest,lastmodifiedbyBretHalfordonMay06,2014
SettingIDOCstatusviaCustomfunctionality
ThebusinessrequirementistosetIDOCtoacertainstatusviaaCustomProgram.ThiswasdoneasapartofIDOCArchival.TheIDOCthatqualifiedasperthecriteriawereselectedandtherestatus
wasmodified.TheBASISthentookuptheseIDOCsandcarriedoutIDOCArchivingfortheseIDOCs.
ThefollowingFMwereusedtochangethestatusofIDOCs:
EDI_DOCUMENT_OPEN_FOR_PROCESS
EDI_STATUS_ADD_BLOCK
EDI_DOCUMENT_CLOSE_PROCESSPROCESS
TheAboveIDOCsneedtobecalledoneaftertheanother.
EDI_DOCUMENT_OPEN_FOR_PROCESS
TheaboveFMbasicallyacquiresandopentheIDOCformodification.IttakesIDOCnumberasINPUTandreturnsControlRecordasOutput.
CALLFUNCTION'EDI_DOCUMENT_OPEN_FOR_PROCESS'
EXPORTING
document_number=idocnumber
IMPORTING
idoc_control=idoc_contrl
EXCEPTIONS
document_foreign_lock=01
document_not_exist=02
document_number_invalid=03
document_is_already_open=04.
EDI_STATUS_ADD_BLOCK
*Aftertheabovecall,thenwecalltheFM*EDI_STATUS_ADD_BLOCK.
IttakestheInputofIDOCnumberintoDOCUMENT_NUMBERandIDOCstatusrecordintoIDOC_STATUS_RECORDS.Forexample
wepassTB_EDI_DStoIDOC_STATUS_RECORDS.
TB_EDI_DSMANDT=SYMANDT.
TB_EDI_DSDOCNUM=DOCNUM_IV.
*TB_EDI_DSSTATUS=STATUS_IV."*HereyoupasstheStatustowhichIDOChastobemodifiedforexample68.
TB_EDI_DSLOGDAT=SYDATUM.
TB_EDI_DSLOGTIM=SYUZEIT.
TB_EDI_DSSTAMQU='SAP'.
TB_EDI_DSUNAME=SYUNAME.
AppendTB_EDI_DS.
EDI_DOCUMENT_CLOSE_PROCESSPROCESS
Aftertheabovementionedcallissuccessful,thenyoucalltheFMEDI_DOCUMENT_CLOSE_PROCESSPROCESSandpasstheIDOCDocumentnumbertoDOCUMENT_NUMBER
andthenCOMMITwork.
InthiswayyoucanmodifythestatusofIDOCsviayourownprogramf
ChangethestatusofanIDOC,Analternativeway.
AnotheralternativeistousethestandardSAPprogram:RC1_IDOC_SET_STATUS.
https://wiki.scn.sap.com/wiki/display/ABAP/Modify+IDOC+Status+by+Program
1/2
11/9/2016
ModifyIDOCStatusbyProgramABAPDevelopmentSCNWiki
RuntheprogramRC1_IDOC_SET_STATUS.
GivetheIdocnumbersforwhichyouwanttochangethestatusesintheselectionscreen.
Givethecurrentandthenewstatus.
UnchecktheTestRuncheckboxandpressF8.
Thestatusesoftheidocswillbechanged.
idoc
status
change
code
1ChildPage
ProgramstochangeidocStatus
ContactUs
Privacy
SAPHelpPortal
TermsofUse
LegalDisclosure
Copyright
https://wiki.scn.sap.com/wiki/display/ABAP/Modify+IDOC+Status+by+Program
FollowSCN
2/2