Program to cancel PO?
Hi all,
Is there any BAPI or FM to cancel the Purchase orders?
If no please provide the sample BDC program to cancel PO.
Thanks,
Vamshi.
Hi Vamshi,
I also had similar requirement,when client uploaded cut-over data of 6000+ PO and unfortunately all were wrong.
I used BAPI to delete all line items for PO.The following is the BAPI code:
REPORT ZMM_BAPI_PO_DELETE MESSAGE-ID ZSW LINE-SIZE 255.
DATA : W_EBELN TYPE BAPIMEPOHEADER-PO_NUMBER,
WA_POHEADER TYPE BAPIMEPOHEADER,
WA_POHEADERX TYPE BAPIMEPOHEADERX,
RETURN TYPE TABLE OF BAPIRET2,
WA_RETURN TYPE BAPIRET2,
IT_POITEM TYPE TABLE OF BAPIMEPOITEM WITH HEADER LINE,
IT_POITEMX TYPE TABLE OF BAPIMEPOITEMX WITH HEADER LINE.
DATA: IT_EXCELFILE TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF RECORD OCCURS 0,
EBELN TYPE EKKO-EBELN,
END OF RECORD.
DATA : BEGIN OF IT_EBELP OCCURS 0,
EBELP TYPE EKPO-EBELP,
END OF IT_EBELP.
DATA : BEGIN OF IT_FINAL OCCURS 0,
EBELN TYPE EKKO-EBELN,
TY TYPE BAPIRET2-TYPE,
MESSAGE TYPE BAPIRET2-MESSAGE,
END OF IT_FINAL.
* Temporary work variables
DATA : WRK_LI TYPE I,
W_SUC(10) TYPE N,
W_ERR(10) TYPE N.
FIELD-SYMBOLS : <L_FS> .
* Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_INFILE LIKE RLGRAP-FILENAME.
PARAMETERS : P_SKIP(2) TYPE N OBLIGATORY DEFAULT '1'.
SELECTION-SCREEN END OF BLOCK B1 .
* AT SELECTION-SCREEN ON VALUE REQUEST *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
PERFORM OPEN_FILE.
* AT Selection-Screen
AT SELECTION-SCREEN.
IF P_INFILE IS INITIAL.
MESSAGE E000 WITH 'Please provide filename'.
ENDIF.
PERFORM READ_FILE.
* START-OF-SELECTION *
START-OF-SELECTION.
PERFORM MOVE_EXCEL_ITTABLE.
START-OF-SELECTION.
LOOP AT RECORD.
CLEAR : WA_POHEADER,WA_POHEADERX,W_EBELN,IT_EBELP,IT_POITEMX,IT_POITEM.
REFRESH : IT_EBELP,IT_POITEMX,IT_POITEM,RETURN.
W_EBELN = RECORD-EBELN.
WA_POHEADER-PO_NUMBER = RECORD-EBELN.
WA_POHEADERX-PO_NUMBER = 'X'.
SELECT EBELP INTO TABLE IT_EBELP FROM EKPO WHERE EBELN = RECORD-EBELN.
IF SY-SUBRC <> 0.
IT_FINAL-EBELN = RECORD-EBELN.
IT_FINAL-TY = 'E'.
IT_FINAL-MESSAGE = 'This PO does not exist/No items found'.
APPEND IT_FINAL.
W_ERR = W_ERR + 1.
ELSE.
LOOP AT IT_EBELP.
IT_POITEM-PO_ITEM = IT_EBELP-EBELP.
IT_POITEM-DELETE_IND = 'L'.
APPEND IT_POITEM.
IT_POITEMX-PO_ITEM = IT_EBELP-EBELP.
IT_POITEMX-DELETE_IND = 'X'.
APPEND IT_POITEMX.
CLEAR : IT_POITEMX,IT_POITEM.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = W_EBELN
POHEADER = WA_POHEADER
POHEADERX = WA_POHEADERX
TABLES
RETURN = RETURN
POITEM = IT_POITEM
POITEMX = IT_POITEMX.
READ TABLE RETURN INTO WA_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
W_ERR = W_ERR + 1.
LOOP AT RETURN INTO WA_RETURN.
IT_FINAL-EBELN = RECORD-EBELN.
IT_FINAL-TY = WA_RETURN-TYPE.
IT_FINAL-MESSAGE = WA_RETURN-MESSAGE.
APPEND IT_FINAL.
CLEAR : WA_RETURN,IT_FINAL.
ENDLOOP.
ELSE.
W_SUC = W_SUC + 1.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
LOOP AT RETURN INTO WA_RETURN.
IT_FINAL-EBELN = RECORD-EBELN.
IT_FINAL-TY = WA_RETURN-TYPE.
IT_FINAL-MESSAGE = WA_RETURN-MESSAGE.
APPEND IT_FINAL.
CLEAR : WA_RETURN,IT_FINAL.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
* END-OF-SELECTION *
END-OF-SELECTION.
ULINE.
READ TABLE RECORD.
WRITE : 'Total Records Processed : ' COLOR 4 ,SY-TFILL COLOR 4.
WRITE : / 'Success Records : ' COLOR 5 ,W_SUC COLOR 5,
/ 'Error Records : ' COLOR 6 ,W_ERR COLOR 6.
ULINE.
LOOP AT IT_FINAL.
IF IT_FINAL-TY <> 'E'.
WRITE : / IT_FINAL-EBELN,'|',IT_FINAL-TY,'|',IT_FINAL-MESSAGE.
ELSE.
WRITE : / IT_FINAL-EBELN COLOR 6,'|',IT_FINAL-TY COLOR 6,'|',IT_FINAL-MESSAGE COLOR 6.
ENDIF.
ENDLOOP.
*& Form read_file
FORM READ_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_INFILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 100
I_END_ROW = 65536
TABLES
INTERN = IT_EXCELFILE
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF IT_EXCELFILE[] IS INITIAL.
MESSAGE E000.
ENDIF.
ENDFORM. " read_file
*& Form OPEN_FILE
* text
FORM OPEN_FILE .
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = SPACE
DEF_PATH = P_INFILE
MASK = ',*.* ,*.*.'
MODE = 'O'
TITLE = 'Please Select File'
IMPORTING
FILENAME = P_INFILE
EXCEPTIONS
INV_WINSYS = 04
NO_BATCH = 08
SELECTION_CANCEL = 12
SELECTION_ERROR = 16.
ENDFORM. " open_file
*& Form MOVE_EXCEL_ITTABLE
* text
FORM MOVE_EXCEL_ITTABLE .
REFRESH RECORD.
CLEAR RECORD.
DATA : WRK_ROW TYPE I.
CLEAR: WRK_ROW.
DATA : WRK_TABIX LIKE SY-TABIX.
WRK_ROW = P_SKIP + 1.
READ TABLE IT_EXCELFILE WITH KEY ROW = WRK_ROW.
IF SY-SUBRC = 0.
WRK_TABIX = SY-TABIX.
LOOP AT IT_EXCELFILE FROM WRK_TABIX.
ASSIGN COMPONENT IT_EXCELFILE-COL
OF STRUCTURE RECORD TO <L_FS>.
MOVE IT_EXCELFILE-VALUE TO <L_FS> .
AT END OF ROW .
IF RECORD IS NOT INITIAL.
APPEND RECORD.
CLEAR RECORD.
ENDIF.
ENDAT.
ENDLOOP .
ENDIF.
ENDFORM. "MOVE_EXCEL_ITTABLE
Thanks & Reagrds,
Rock.
Similar Messages
-
Switch from to the Photography Program and cancel the Acrobat subscription?
How do I switch from to the Photography Program and cancel the Acrobat subscription? I currently have the Adobe Acrobat Pro subscription and want to add Photoshop but need to know how to change my program subscription to the Photography Program for personal use?
Cancel what you have... which requires Adobe support to cancel a subscription
-start here https://forums.adobe.com/thread/1703848
-or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html
--and two links which may provide more details, if the above links don't help you
-http://helpx.adobe.com/x-productkb/policy-pricing/return-cancel-or-change-order.html
-http://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html
Then buy new - Cloud Plans https://creative.adobe.com/plans -
ABAP program to Cancel messages in Scheduled/Recorded status?
Hi,
Thanks for reading my post...
Can anyone tell me whether there is an ABAP program available (or a variant) that will Cancel messages that are in Scheduled (or Recorded) status?
Messages to be sent from ECC to PI were not sent and are left in Recorded status in ECC. I cannot find the documentation to explain what this status is, but I'm presuming that it's similar to the Scheduled status in PI (though there's not much documentation about that either - for example, what's the difference between the 'green flag' Scheduled and the 'green flag' Released for Processing (WS)? ). {Note to SAP: Could we have a state transition diagram please? Simple, concise and effective.}
Anyway, the 'tick-pencil' button in SXMB_MONI (aka. CTRL-F8) can be used to cancel the messages in Scheduled/Recorded status. But I'm looking for an ABAP program to do this. The documentation seems to 'suggest' that this button might do the same thing as the ABAP program RSXMB_CANCEL_MESSAGES. However, this ABAP program does not cancel messages in Scheduled status (only the messages in Error), whereas the SXMB_MONI CTRL-F8 'tick-pencil' will cancel messages in Scheduled status if they are selected.
Is there another ABAP program available to cancel messages in Scheduled status - or is it possible to create a variant of RSXMB_CANCEL_MESSAGES that will do this? (I'm not an ABAP programmer and I've never created a variant, but looking at the code, it seemed it might be possible to get the program to read messages in Scheduled status rather than Error status.)
Many thanks for any help.
MarkMessages are in scheduled status because they still in the queue in either 'READY' status or 'EXECUTING' status (see SMQ1/SMQ2). You don't want to automatically cancel messages that are in scheduled status because that means you are also going to cancel good messages. However, in some cases, you may want to cancel such messages especially when the message in the queue has been in 'Executing' status for long time (happens in case of long running mapping program or dropped connection etc). Such cases warrant manual intervention and hence the behavior as noted by you.
If you can tell me why exactly you want to cancel messages that are in scheduled status, I can help you more.
Thanks
KK -
Program to cancel xml message with status error or schedule ?
Hi,
Any program that can cancel xml message base on period. because i have about 100 thousand unuse xml message that accidentaly generated. because it is too long if i need to cancel 1 by one.
Regards
FernandHi All,
I already try this program below :
RSXMB_CANCEL_Message - cancel the meesage with errors.
RSXMB_CANCEL_NO_COMMIT_MSG -cancel the message processing for messages without commit.
RSXMB_CANCEL_NOT_REST_MESSAGES - Cancel Xi messages with errors that cannot be restarted
but then no result selected. i need to select manual those message and cancel using cancel button.
please advise.
Thank you and best regards
Fernand -
Is there a way to delete the mail program or cancel so it doesn't open automatically
The Apple mail program pops up in the dock and opens automatically. As I use other mail programs this pop up is annoying and there must be a way to eliminate or cancel soot doesnot continually pop up?
I've tried to hide it but it comes back after awhile. It also is open in background as it always seems to stop shutdowns and restarts.You may have Mail.app as one of your log-in items - check Users & Groups and your user name to see if it is a log-in item.
The only other reason that the app would automatically launch is that you have it open when you restart or shutdown and have 'reopen windows..." ticked when you shutdown or restart.
Clinton -
App. Error - Click on OK to terminate the program Click CANCEL to debug ???
this is the wondow that pops up
Application Error
The exception Privileged instruction.
(0xc0000096) occurred in the application at location 0x1004ece0.
Click on OK to terminate the program
Click on CANCEL to debug the program
Anyone seen this window that pops up randomly??? The cancel button just freezes iTunes and the OK button just closes it immediately. Anything info on this would be amazing. I'm not sure if its my computer's fault or what.
Uninstalling and re-installing hasn't worked.
Thanks...Ok I saw on a previous post to look for Add-ins and plug ins but I checked to make sure and I do not have any.
The other window that comes up says iTunes has encountered a problem and needs to be closed immediately -
I recently purchased a subscription a couple days ago and cancelled it that day and still haven't received my refund. Just curious as to when i will get my money back?
I do not see any refund being initiated, please contact Adobe Support for the refund. Cancellation can be done online.https://helpx.adobe.com/contact.html?product=acrobat
Regards
Rajshree -
ABAP program is cancel , Function ROLLBACK on connection failed
We have an ABAP program (Z), the following program executes this task:
1.-Read table A (about 3 million records)
2.-Read table B (about 6 million records)
3.-Instert in to B table the match between A and B table
When the program run in batch or dialog process, it stops without apparently reason, it don not trace any log in ST22 transaction. When we trace it in SM21 trace the following log:
18:30:23
DIA
004
100
SE38
BZ
Y
Unexpected return value 1 when calling up DbSlR
18:30:23
DIA
004
100
SE38
BY
J
Function ROLLBACK on connection R/3 failed
18:30:24
DIA
004
100
SE38
R3
9
Error in DB rollback/SyFlush, return code 016384
18:30:25
DIA
004
100
SE38
Q0
2
Stop Workproc 4, PID 8583
18:30:47
DIA
004
100
R4
7
Delete session 003 after error 023
The tables and ABAP program are in a BW system in a DB2 v9 database
Some idea?
Best RegardsHi Malte, I did not find dev_w4, but we found:
dev_rfc4 bwdadm 25.11.2008 18:30:41
stderr1 bwdadm 25.11.2008 18:30:25
The stderr1 file was created on the same time that "Stop Workproc 4" event, at 18:30:25
The stderr1 trace the next log:
(8558) New Child Process created.
(8558) Starting local Command:
Command: dw.sapBWD_DVEBMGS00
pf=/usr/sap/BWD/SYS/profile/BWD_DVEBMGS00_MXMLNBW01
[Thr 1] MtxInit: 30002 0 2
ICM up and operational (pid: 8577)
work process W20 died => ThIRollBack: db_rollback
work process W19 died => ThIRollBack: db_rollback
work process W1 died => ThIRollBack: db_rollback
work process W19 died => ThIRollBack: db_rollback
work process W22 died => ThIRollBack: db_rollback
work process W19 died => ThIRollBack: db_rollback
work process W19 died => ThIRollBack: db_rollback
work process W21 died => ThIRollBack: db_rollback
The issue is. Why the process is aborted?
Best Regards
Edited by: Carlos Orencio on Nov 26, 2008 5:52 PM -
One Q&A in your FAQs has attracted my attention.
~~~~~
Do Creative Cloud members have access to previous versions of Creative Cloud apps?
Yes. Creative Cloud paid members have access to a select set of archived versions of the desktop apps. Starting with CS6, select older versions of the desktop creative apps will be archived and available for download. Archived versions are provided "as is" and are not updated to work with the latest hardware and software platforms.
~~~~~
Does this mean as a CC subscriber I can cancel my subscription at any time and walk away with a usable version of the 'select set' of software? Be it CS6 or what ever may be archived in the future at the time of subscription cancellation.Sjaani wrote:
Does this mean as a CC subscriber I can cancel my subscription at any time and walk away with a usable version of the 'select set' of software? Be it CS6 or what ever may be archived in the future at the time of subscription cancellation.
If only it was that easy.
No, you must be a current "Creative Cloud paid member" to have access to any Cloud versions: current or archived.
When you cancel your membership or allow it to expire then your access to all versions of the software ceases. That's the only exit strategy available.
The idea is that, as a current subscriber, if you're using CC or some later version and you absolutely must access CS6 to complete a project or collaborate with someone then you can. -
Standard Background Job getting cancelled
Hello Guru ,
In my BI dev server one standard event periodic job is geting cancelled due to following reason
Job Name : AP_CCMS_MONI_BATCH_STARTUP_DP
Program: RSAL_BATCH_TOOL_STARTUPDISP
cancelled error
No alerts in configuration range
Internal error:
Job cancelled after system exception ERROR_MESSAGE
can anybody help me in this regards
Regards
DeepakRun the job once again and lets see what happens... sometimes system cancels the job....check in ST22 if there is short dump.
Thanks....
Shambhu -
Auto Cancellation of Messages in the Integration Engine.
Dear all,
Issue: Auto Cancellation of Messages in the Integration Engine.
Description: Actually Today, I'm facing Problem in message mapping and its showing error "JCO_SYSTEM_FAILURE". Finally the message is Auto Canceled and showing the status in the Message Monitoring as Canceled with Errors.
I have doubt here how the messages are Auto Canceled with Error? Is there any system or ABAP program which cancelling these messages?
Waiting for yours valuable reply on the above issueu2026
Edited by: BhavinPatel on Oct 7, 2010 8:15 AMHi Bhavin,
Two report program are there to cancel error msgs automatically..
1) RSQIWKEX
2) RSXMB_CANCEL_MESSAGES
Regds,
Pinangshuk. -
BW Upgrade "Execute the conversion programs for the product master "
Hi BW Gurus,
We are in the process of upgrading BW 3.5 to BW 7.0. We did not get any conversion error in BW Dev but in BWQ we got error in one of ABAP program. The error message in log is :-
"Value '######' of characteristic 0TIME is not a number with 000006 spaces"
and job pertaining to the program is canceled in SM37.
My question is, are we suppose to run any conversion program before or after the upgrade?
Warm Regards,
AnilHi Chandu,
I am also looking for the same if u have fond a bapi for any other program please forward the information.
Thanks & Regards,
Basheer -
Cancel all items in the purchase order
we need a program to cancel all items in the purchase order .
exists any BAPI or funcion or metod to do this ?
becuase if we to do this for the TC ME22N we need to do this item by item.
our programmer suggest us an update of the table EKPOHere is an example program using the BAPI to set the deletion indicator on all line items of a PO.
report zrich_0001.
data: return type table of bapiret2 with header line,
poheader type bapimepoheader,
poheaderx type bapimepoheaderx,
poitem type table of bapimepoitem with header line,
poitemx type table of bapimepoitemx with header line.
data: iekpo type table of ekpo with header line.
parameters: p_ebeln type ekpo-ebeln.
start-of-selection.
poheader-po_number = p_ebeln.
clear iekpo. refresh iekpo.
select * into table iekpo from ekpo
where ebeln = p_ebeln.
loop at iekpo.
poitem-po_item = iekpo-ebelp.
poitem-delete_ind = 'X'.
append poitem.
poitemx-po_item = iekpo-ebelp.
poitemx-po_itemx = 'X'.
poitemx-delete_ind = 'X'.
append poitemx.
endloop.
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = p_ebeln
poheader = poheader
poheaderx = poheaderx
tables
return = return
poitem = poitem
poitemx = poitemx.
commit work.
loop at return.
write:/ return.
endloop.
Regards,
RIch Heilman -
How to do batch cancel confirmation
Hi:
guru, I can use C013 to cancel confirmation one operation by one operation. can i cancel all confirmation of one production order or severel production orders just one step. is there any solution for Standard SAP.Hi Wang,
Use CORS to reverse the phases.
After canceling if you want to view it again then use CORT (here there is one check box named 'Reversed' means that phase is reversed).
If there is a Inspection lot in between then you need to use customize program to cancel the usage decision.
regards,
Chintan -
Hello all,
can any one give one simple program for Insert Update Delete
i have taken 9 fields and in a simple screen.
and have 3 button. through this i want to Insert Update and Delete Data in customize table.
Thaks.
Rajesh.* MODULE POOL *
PROGRAM YP_BOOKMASTER_MAINTENANCE MESSAGE-ID ZZ.
* TABLES *
TABLES ZBKMA. "book master table
* VARIABLES *
DATA : V_NUMBER(5) TYPE N, "variable to store random number
V_LINE TYPE I, "variable to get total no of lines
V_FLAG LIKE SY-TABIX. "variable for checking
* INTERNAL TABLE *
* internal table to store book numbers (i.e random numbers)
DATA : BEGIN OF IT_RANDOMNUMBERS OCCURS 0,
BKNUM LIKE ZBKMA-BKNUM, "book number
END OF IT_RANDOMNUMBERS.
* internal table to store only numeric part of book number
* eg : if book no is HUM00100 ,this table will only store 00100
DATA : BEGIN OF IT_NUMBERS OCCURS 0,
NUMBER(5) TYPE N, " a number
END OF IT_NUMBERS.
*internal table to store book details
DATA : BEGIN OF IT_BOOKMASTER OCCURS 0,
BKNUM LIKE ZBKMA-BKNUM, "BOOK NUMBER
BKNAM LIKE ZBKMA-BKNAM, "BOOK NAME
AUTHR LIKE ZBKMA-AUTHR, "AUTHOR
SRCHT LIKE ZBKMA-SRCHT, "SEARCH TERM
PUBSH LIKE ZBKMA-PUBSH, "PUBLISHER
YRPUB LIKE ZBKMA-YRPUB, "YEAR OF PUBLISHING
VERNO LIKE ZBKMA-VERNO, "VERSION NUMBER
DATPR LIKE ZBKMA-DATPR, "DATE OF PURCHASE
BKCOD LIKE ZBKMA-BKCOD, "BOOKCODE
END OF IT_BOOKMASTER .
*& Module STATUS_0090 OUTPUT
* PBO OF SCREEN 090(screen contains three buttons ADD , DELETE , MODIFY)
MODULE STATUS_0090 OUTPUT.
SET PF-STATUS 'BOOKMASTER_FIRST'.
SET TITLEBAR 'BOOKMASTER'.
ENDMODULE. " STATUS_0090 OUTPUT
*& Module USER_COMMAND_0090 INPUT
* PAI OF SCREEN 90
MODULE USER_COMMAND_0090 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN '0'. "go back
WHEN 'EXIT'.
LEAVE PROGRAM. "exit the program
WHEN 'CANCEL'.
leave to screen '0'. "cancel the screen
WHEN 'ADD'.
CLEAR IT_BOOKMASTER. "clears the contents of the fields.
CALL SCREEN '0100'.
WHEN 'DELETE'.
CLEAR IT_BOOKMASTER. "clears the contents of the fields.
CALL SCREEN '0200'.
WHEN 'MODIFY'.
CLEAR IT_BOOKMASTER. "clears the contents of the fields.
CALL SCREEN '0300'.
ENDCASE. "end sy-ucomm
ENDMODULE. " USER_COMMAND_0090 INPUT
*& Module STATUS_0100 OUTPUT
* PBO OF 100 ( ADD THE BOOKS )
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BOOKMASTER'.
SET TITLEBAR 'UPDATE BOOKMASTER'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* PAI OF 100 ( ADD THE BOOKS )
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM. "check the screen 100 actions
WHEN 'BACK'.
LEAVE TO SCREEN '0'. "go back
WHEN 'EXIT'.
LEAVE PROGRAM. "exit the program
WHEN 'CANCEL'.
LEAVE to screen '0' . "cancel the screen 100
WHEN 'ADD'.
* add the books to the master records
PERFORM FORM_ADDBOOK. " add the
WHEN 'RESET'.
CLEAR IT_BOOKMASTER. "reset the screen
SET SCREEN '0100'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FORM_ADDBOOK
* ADDING THE BOOKS
FORM FORM_ADDBOOK .
*TO ASSIGN BOOK NUMBER
PERFORM FORM_ASSIGN_BOOKNO.
* INSERTING THE BOOKS
ZBKMA-BKNAM = IT_BOOKMASTER-BKNAM.
ZBKMA-AUTHR = IT_BOOKMASTER-AUTHR.
ZBKMA-SRCHT = IT_BOOKMASTER-SRCHT.
ZBKMA-PUBSH = IT_BOOKMASTER-PUBSH.
ZBKMA-YRPUB = IT_BOOKMASTER-YRPUB.
ZBKMA-VERNO = IT_BOOKMASTER-VERNO.
ZBKMA-DATPR = IT_BOOKMASTER-DATPR.
ZBKMA-BKCOD = IT_BOOKMASTER-BKCOD.
IF NOT IT_BOOKMASTER-BKNAM IS INITIAL. "if the book number is not initial
INSERT ZBKMA.
ENDIF. "endif check initial
IF SY-SUBRC = 0.
MESSAGE S003(ZCHA) WITH IT_BOOKMASTER-BKNUM.
ENDIF. "endif success
ENDFORM. " FORM_ADDBOOK
*& Form FORM_DELETEBOOK
* delete books from the master data
* --> p1 text
* <-- p2 text
FORM FORM_DELETEBOOK .
* check the it is initial
IF NOT IT_BOOKMASTER-BKNUM IS INITIAL.
*get the book numbers present already
SELECT SINGLE BKNUM
FROM ZBKMA
INTO ZBKMA-BKNUM
WHERE BKNUM = IT_BOOKMASTER-BKNUM.
*check if select is successful
IF SY-SUBRC = 0.
DELETE FROM ZBKMA WHERE BKNUM = IT_BOOKMASTER-BKNUM.
MESSAGE S004(ZCHA) WITH IT_BOOKMASTER-BKNUM. "if book deleted
ELSE.
MESSAGE S005(ZCHA) WITH IT_BOOKMASTER-BKNUM. "if book not found
ENDIF.
ENDIF.
ENDFORM. " FORM_DELETEBOOK
*& Form FORM_MODIFYBOOK
* MODIFING THE BOOK
FORM FORM_MODIFYBOOK.
*validiate the book number
SELECT SINGLE BKNUM
FROM ZBKMA
INTO ZBKMA-BKNUM
WHERE BKNUM = IT_BOOKMASTER-BKNUM.
*check for the success
IF SY-SUBRC NE 0.
MESSAGE S005(ZCHA) WITH IT_BOOKMASTER-BKNUM.
ENDIF.
ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.
ZBKMA-BKNAM = IT_BOOKMASTER-BKNAM.
ZBKMA-AUTHR = IT_BOOKMASTER-AUTHR.
ZBKMA-SRCHT = IT_BOOKMASTER-SRCHT.
ZBKMA-PUBSH = IT_BOOKMASTER-PUBSH.
ZBKMA-YRPUB = IT_BOOKMASTER-YRPUB.
ZBKMA-VERNO = IT_BOOKMASTER-VERNO.
ZBKMA-DATPR = IT_BOOKMASTER-DATPR.
UPDATE ZBKMA. "update the book master table
IF SY-SUBRC = 0.
MESSAGE S006(ZCHA) WITH IT_BOOKMASTER-BKNUM.
ENDIF.
ENDFORM. " FORM_MODIFYBOOK
*& Form FORM_ASSIGN_BOOKNO
* TEXT
FORM FORM_ASSIGN_BOOKNO .
*select the books already there from bookmaster
SELECT BKNUM
FROM ZBKMA
INTO TABLE IT_RANDOMNUMBERS
WHERE BKCOD = IT_BOOKMASTER-BKCOD.
*if the book is first book i.e. first entry
IF IT_RANDOMNUMBERS[] IS INITIAL.
V_NUMBER = 1. "start with 1
CONCATENATE IT_BOOKMASTER-BKCOD V_NUMBER INTO IT_BOOKMASTER-BKNUM.
ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM. "assign booknumber
EXIT.
ENDIF. "check for initial
CLEAR IT_NUMBERS[]. "clear the temporary table
CLEAR IT_NUMBERS.
* check for the book numbers if there is no book start from first in other
* cases look for first gap and assign that number
LOOP AT IT_RANDOMNUMBERS.
IT_NUMBERS-NUMBER = IT_RANDOMNUMBERS-BKNUM+3(5). "get the last 5 digits
"and store it in it_number
APPEND IT_NUMBERS.
ENDLOOP.
SORT IT_NUMBERS BY NUMBER. "sort
DESCRIBE TABLE IT_NUMBERS LINES V_LINE. "get no. of lines in table
*check for book number gap
LOOP AT IT_NUMBERS.
V_FLAG = SY-TABIX.
* if the book number is not equal to the index of table i.e. some gap in book number
* or only one record
IF IT_NUMBERS-NUMBER NE SY-TABIX OR V_LINE = 1.
V_NUMBER = SY-TABIX. "fill the gap
if v_line = 1. "if only one record
v_number = v_line + 1. "increment the book number
endif. "only one record check
CONCATENATE IT_BOOKMASTER-BKCOD V_NUMBER INTO IT_BOOKMASTER-BKNUM.
ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM. "assign
EXIT.
ENDIF. "check for gap
*if no gap in book number assign next number
IF V_FLAG = V_LINE.
V_NUMBER = IT_NUMBERS-NUMBER + 1.
CONCATENATE IT_BOOKMASTER-BKCOD V_NUMBER INTO IT_BOOKMASTER-BKNUM.
ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.
EXIT.
ENDIF. "book number increment
ENDLOOP. "check number gap
ENDFORM. " FORM_ASSIGN_BOOKNO
*& Module STATUS_0200 OUTPUT
* PBO OF SCREEN 200 ( DELETE BOOKS)
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'DELETE'.
SET TITLEBAR 'DELETE'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
* PAI OF SCREEN 200 (DELETE BOOKS)
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM. "check for screen 200 actions
WHEN 'BACK'.
LEAVE TO SCREEN '0'. "go back
WHEN 'EXIT'.
LEAVE PROGRAM. "leave program
WHEN 'CANCEL'.
LEAVE to screen '0'. "cancel screen
WHEN 'DELETE'.
* delete the book from master data
PERFORM FORM_DELETEBOOK.
WHEN 'RESET'. "reset the screen
CLEAR IT_BOOKMASTER.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Module STATUS_0300 OUTPUT
* PBO OF SCREEN 300 ( FOR MODIFYING )
MODULE STATUS_0300 OUTPUT.
SET PF-STATUS 'MODIFY'.
SET TITLEBAR 'MODIFY'.
ENDMODULE. " STATUS_0300 OUTPUT
*& Module USER_COMMAND_0300 INPUT
* text
MODULE USER_COMMAND_0300 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN '0'.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN '0'.
WHEN 'MODIFY'.
PERFORM FORM_MODIFYBOOK. "update the record
WHEN 'RESET'.
CLEAR IT_BOOKMASTER. "screen reset
ENDCASE.
ENDMODULE. " USER_COMMAND_0300 INPUT
*& Module MODULE_CANCEL INPUT
* ACTIONS AT EXIT COMMAND
MODULE MODULE_CANCEL INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN '0'.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " MODULE_CANCEL INPUT
Message was edited by: Chandrasekhar Jagarlamudi
Maybe you are looking for
-
I have hundreds of empty localstore{xxx}.rdf and perf{xxx}.js files in my profile folder. Where {xxx} denotes a number. New, higher numbered files appear every time I open/close firefox. There ate two pref files (perf.js and perf1.js) which are not e
-
A certain folder on my Mac has been in the trash for a while (along with a bunch of other files)... when I came to empty the trash it wouldn't. So I had to manually empty the trash by rm-ing in the Terminal until I found the folder that wouldn't dele
-
Hot to run old developer/2000 .fmx files
Hi all! I have to run a legacy application written with Oracle developer/2000. Is there a free of charge runtime enviroment that I can use to run it? I have a 5 NUP Oracle Database Standard Edition One license. What I need to buy to run the legacy ap
-
Classification view for material
Hi all I am creating materials using BAPI_MATERIAL_SAVEDATA. I need to fill the characteristics values of the material also. Can anyone please tell How to create the Classification view for material using BAPI_MATERIAL_SAVEDATA. Thanks Neelima.
-
Can I select the language when installing iWork 09?
Can I choose the language iWork 09 should be installed in on my Mac, no matter where I bought the iWork DVD?