Share ABAP_4 Programming.pdf

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Related Documents

Share

Transcript

4/8/2014 ABAP/4 Programminghttp://abap4programming.blogspot.in/ 1/13
SUNDAY, JUNE 22, 2008
BAPI For Goods Movement
BAPI FOR GOODS REECIPT FOR FOC MATERIALBapi example for goods movement 511We have a requirement to make a z-transaction to receive materialon free of goods .technically FOC material has 511 movement in t-mb1c , FOC material comes without any reference to purchase orderbut against a vendor code..There were two technical solution one was to make BDC and anotherwas to find a suitable BAPI for goods receipt.BAPIs are always preferred as they have standard coding checks whileposting the document .Also BAPIs have a test run environment whichchecks for any kind of error before posting .To sum up we found BAPIfor FOC “BAPI_GOODSMVT_CREATE ”.T-CODE BAPIà MATERIAL MANAGEMENT à INVENTORY MANAGEMENT àGOODS RECEIPT à CREATE FROM DATA SEE THE F.M.In this document I am only considering only that aspects(technicalfields and implementations) of BAPI which I used as per myrequirement. In my case I have a gate entry before Goods receipt forFOC , based on Gate entry number number we have to make BAPI.Lets talk about the structure of BAPI: -1. Goods movement header: This structure contains the header dataof the material document that is to be created. PSTNG_DATE : Datewhich is used when entering the document in Financial Accounting orControlling. Value = sy-datum. DOC_DATE: The document date is thedate on which the srcinal document was issued. Value = Gate entry
bill date. REF_DOC_NO: The reference document number can containthe document number of the customer/vendor. However it maycontain a different value. Value = bill no of vendor as on gate entry.BILL_OF_LADING: this field doesn’t appear in t-mb1c but whileposting data this filed is capture in mkpf , so we decided to pass gateentry number to this field so as to make record that goods receipt forthis gate entry has been made. HEADER_TXT: Manually input by theuser.2. Goods Movement Code: This parameter transfers the new keyassignment of the GM_CODE to the relevant transactions in InventoryManagement. Assign code to transaction for BAPI goods movement.Indicates the assignment of the code for the R/3 transaktionfor BAPIs
About Me
Vikram BajajSAP-ABAP Technical Consultant
View my complete profileBlog Archive
▼
2008 (5)
▼
June (1)BAPI For Goods Movement
►
May (4)
Share
0
More Next Blog» Create Blog Sign In
ABAP/4 Programming
Created By Vikram Bajaj SAP ABAP/4 Programmer and SD Consultant
4/8/2014 ABAP/4 Programminghttp://abap4programming.blogspot.in/ 2/13
for goods movements.Dependencies:Using this method, the system does not support goodsmovements that are initiated by other application components. Theseinclude:· Goods issue for delivery· Completion confirmation in production· Usage decision in QMGM_CODE: The following sample scenarios demonstrate which fieldshave to be filled for which business transactions/events (code).There are the following types of transactions/events:GM_Code 01: Goods receipt for purchase orderGM_Code 02: Goods receipt for production orderGM_Code 03: Goods issueGM_Code 04: Transfer postingGM_Code 05: Other goods receiptsGM_Code 06: Reversal of goods movementsGM_Code 07: Subsequent adjustment to a subcontract orderIn our case GM_CODE = ‘05’3. TESTRUN = SPACE (FOR LIVE POSTING) / ‘X’ FOR TEST CASE FORCHECKING ANY ERROR BEFORE POSTING.4. Goods movement Item: MATERIAL: From Gate Entry Number , multiple records of materialPLANT: input value STGE_LOC: input . MOVE_TYPE = '511'.VENDOR = LIFNR_1. lifnr in format 000002502ITEM_TEXT = inputENTRY_QNT = equals gate entry material quantity but in changedmode for goods receipt.ENTRY_UOM = MARA-MEINS5 .GOODS MOVEMENT HEADER : This structure transfers the fieldsthat are filled to the initiator when the material document wassuccessfully posted.MAT_DOC : Number of Material Document DOC_YEAR: MaterialDocument Year6 .RETURN: This table contains the return codes from the methodcall.Default : There are numerous error messages, which cannot beexplained in detail here. If errors occured during this method, the Return table is filled. Note that errors at header level arecharacterized by an item number =0. If the method was carried outwithout errors occuring, the Return table is reset to empty.MOVE DATA OF RETURN INTO ITAB_RETUNR AND WRITE TO LIST.NOTE: WHEN BAPI IS SUCCESSFUL WE MUST USE “COMMITWORK*******************SAMPLE CODE***********************GOODSMVT_HEADER_H-PSTNG_DATE = SY-DATUM.GOODSMVT_HEADER_H-DOC_DATE = BLDAT.GOODSMVT_HEADER_H-REF_DOC_NO = LFBNR .GOODSMVT_HEADER_H-GR_GI_SLIP_NO = MBLNR.GOODSMVT_HEADER_H-BILL_OF_LADING = MBLNR.GOODSMVT_HEADER_H-HEADER_TXT = HEADER_TXT.GOODSMVT_ITEM_I-PLANT = PLANT.GOODSMVT_ITEM_I-STGE_LOC = STGE_LOC.GOODSMVT_ITEM_I-MOVE_TYPE = '511'.
4/8/2014 ABAP/4 Programminghttp://abap4programming.blogspot.in/ 3/13
Posted by Vikram Bajajat 9:15 PM
GOODSMVT_ITEM_I-VENDOR = LIFNR_1. lifnr in format 000002502LOOP AT ITAB.GOODSMVT_ITEM_I-MATERIAL = ITAB-MATNR.GOODSMVT_ITEM_I-ENTRY_QNT = ITAB-ENTRY_QNT.GOODSMVT_ITEM_I-ITEM_TEXT = ITAB-MENGE.SELECT SINGLE * FROM MARA WHERE MATNR = ITAB-MATNR.IF SY-SUBRC = 0.GOODSMVT_ITEM_I-ENTRY_UOM = MARA-MEINS.ENDIF.APPEND GOODSMVT_ITEM_I.ENDLOOP.GOODSMVT_CODE_H-GM_CODE = '05'.TESTRUN_H = SPACE.CALL FUNCTION 'BAPI_GOODSMVT_CREATE'EXPORTINGGOODSMVT_HEADER = GOODSMVT_HEADER_HGOODSMVT_CODE = GOODSMVT_CODE_H* TESTRUN = 'X'IMPORTING* GOODSMVT_HEADRET =MATERIALDOCUMENT = MATERIALDOCUMENT_OMATDOCUMENTYEAR = DOC_YEARTABLESGOODSMVT_ITEM = GOODSMVT_ITEM_I* GOODSMVT_SERIALNUMBER =RETURN = RETURN_O .LEAVE TO LIST-PROCESSING.WRITE:/ MATERIALDOCUMENT_O,/ DOC_YEAR.LOOP AT RETURN_O.WRITE: / RETURN_O-MESSAGE,/ RETURN_O-MESSAGE_V1,/ RETURN_O-MESSAGE_V2,/ RETURN_O-MESSAGE_V3,/ RETURN_O-MESSAGE_V4.ENDLOOP.IF SY-SUBRC NE 0.COMMIT WORK.ENDIF.
No comments:
SUNDAY, MAY 18, 2008
To Change values of any database table directly indebuging
Step I: Display any table (E.g.: T001L) entries available with the helpof transaction code SE16.
4/8/2014 ABAP/4 Programminghttp://abap4programming.blogspot.in/ 4/13
Posted by Vikram Bajajat 9:53 PM
Step II: Select any rows and click on display button in toolbar.Step III: Type /H in command field and press enter once. It will switchon debugging.Step IV:Step V: Again Press Enter, following screen will come. Put one fieldnames as code and press enter. Change the value of code from SHOWto EDIT and click on Change button.Step VI: Now Click on Execute button (Run to cursor) or press F8.Step VII: Now display entry will come in change mode. It will allowchanging any field value and saving any value.Note: All Foreign Key checks will be applied.
No comments:
ALV Function Modules Documentation
Function group : SALVREUSE_ALV_COMMENTARY_WRITE List body comment block output REUSE_ALV_EVENTS_GET Returns table of possible events for a listtype REUSE_ALV_EVENTS_TRANSFER REUSE_ALV_EVENT_NAMES_GET Returns table of constant names of possible events for a list type REUSE_ALV_FIELDCATALOG_MERGE Create field catalog fromdictionary structure or internal table REUSE_ALV_HIERSEQ_LIST_DISPLAY Hierarchical sequential listoutput REUSE_ALV_LIST_DISPLAY Output a simple list (single line or severallines) REUSE_ALV_LIST_LAYOUT_INFO_GET Read current ALV listinformation REUSE_ALV_LIST_LAYOUT_INFO_SET Set current ALV list information REUSE_ALV_VARIANT_DEFAULT_GET Read default display variant(description only, w/o field catalog)REUSE_ALV_VARIANT_F4 Display variant selection dialog boxFunction group:SLVC_FULLSCREENã REUSE_ALV_GRID_COMMENTARY_SET ã REUSE_ALV_GRID_DISPLAY Output of a simple list (single-line) ã REUSE_ALV_GRID_DISPLAY_LVC ã REUSE_ALV_GRID_LAYOUT_INFO_GET Read current ALV listinformationã REUSE_ALV_GRID_LAYOUT_INFO_SET Set current ALV listinformationFunction REUSE_ALV_LIST_DISPLAYãThis module outputs an internal table with any structure as a

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.