Problem in uploading Bom through Bapi
Hi
i am uploading Bom data useing CSAP_MAT_BOM_CREATE bapi.
the header data through bapi is going fine but
i am not able to upload 2 line item...
i think i need to pass OBJECT_ID & IDENTIFIER though CSDEP_DAT ,CSDEP_DESC,CSDEP_SORC Structure.
can any body tell me from where i can get OBJECT_ID & IDENTIFIER ..as there no such fields in my file.
Regards
ABG.
Just a little word about "Bapi" : this FM is not a BAPI (it's a special kind of API, only BAPI* FMs are/can be BAPIs). CSAP_MAT_BOM_CREATE is just an API (SAP says you can use this FM).
Did you read the 100 threads about this FM, here are some of the threads for example:
1) did you read the example in the function module documentation? YOUR QUESTION IS ANSWERED IN THAT DOC
2) why don't you use BAPI_MATERIAL_BOM_GROUP_CREATE?
3) read other threads
Similar Messages
-
Some coponents are missing while network uploading(CN21) through BAPI
Hello,Friends,
Iam PP consultant and facing a problem of BOM components uploading through BAPI,for creating of the Network (CN21)
we have 300 components in the network activity and while uploading the BOM through BAPI , only 295 components has been uploaded.Others components has not uploaded.
Please suggest me what will be the Problem? and
What is the solution for the same?
Regards,
MYSHi Mangesh,
The upload skips the first 5 items or it has randomly missed some items ?
Regards,
Bala. -
Problem in uploading inforecords through "RM06IBI0"
Hi experts,
I am facing the problem when i amuploading the purchase info record data through the program RM06IBI0 for some records only(randomly).
This program is unable to upload the condition records data in the screen SAPMV13A-0201.It is giving the error filed konp-kmein(1) does not exist in the screen SAPMM06I 0102.
Can any body suggest me what is the cause? as an urgent basis.
Thanks and regards,
Vamsi.Function to Open job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = y_k_jobname
IMPORTING
jobcount = y_v_jobcount
EXCEPTIONS
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
IF sy-subrc NE 0.
MESSAGE text-016 TYPE y_k_s.
LEAVE LIST-PROCESSING.
ENDIF.
Insert program RM06IBI0
SUBMIT rm06ibi0 USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE y_v_rspar_tab
AND RETURN
VIA JOB y_k_jobname
NUMBER y_v_jobcount.
Insert program RSBDCSUB
SUBMIT rsbdcsub USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE y_v_rspar_tab1
AND RETURN
VIA JOB y_k_jobname
NUMBER y_v_jobcount.
MOVE: y_k_parm4 TO y_v_rspar_line2-selname,
y_k_p TO y_v_rspar_line2-kind,
y_k_i TO y_v_rspar_line2-sign ,
y_k_eq TO y_v_rspar_line2-option,
y_p_grp TO y_v_rspar_line2-low.
APPEND y_v_rspar_line2 TO y_v_rspar_tab2.
CLEAR y_v_rspar_line2.
MOVE: y_k_parm7 TO y_v_rspar_line2-selname,
y_k_p TO y_v_rspar_line2-kind,
y_k_i TO y_v_rspar_line2-sign ,
y_k_eq TO y_v_rspar_line2-option,
y_p_bfil TO y_v_rspar_line2-low.
APPEND y_v_rspar_line2 TO y_v_rspar_tab2.
CLEAR y_v_rspar_line2.
MOVE: y_k_parm11 TO y_v_rspar_line2-selname,
y_k_p TO y_v_rspar_line2-kind,
y_k_i TO y_v_rspar_line2-sign ,
y_k_eq TO y_v_rspar_line2-option,
y_v_fill TO y_v_rspar_line2-low.
APPEND y_v_rspar_line2 TO y_v_rspar_tab2.
MOVE: y_k_parm12 TO y_v_rspar_line2-selname,
y_k_p TO y_v_rspar_line2-kind,
y_k_i TO y_v_rspar_line2-sign ,
y_k_eq TO y_v_rspar_line2-option,
y_v_count1 TO y_v_rspar_line2-low.
APPEND y_v_rspar_line2 TO y_v_rspar_tab2.
IF sy-batch = 'X'.
Insert program RM06IBI0
SUBMIT ypuuprr0200 USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE y_v_rspar_tab2
AND RETURN
VIA JOB y_k_jobname
NUMBER y_v_jobcount.
ENDIF.
IF sy-subrc EQ y_k_zero.
MOVE: sy-datum TO y_t_starttime-sdlstrtdt,
sy-uzeit TO y_t_starttime-sdlstrttm,
y_k_x TO y_v_starttim.
Close job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = y_v_jobcount
jobname = y_k_jobname
strtimmed = y_v_starttim
targetsystem = y_v_host
EXCEPTIONS
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
OTHERS = 99.
ENDIF. "if sy-subrc eq 0
*if job not created properly delete the job
IF sy-subrc NE y_k_zero.
CALL FUNCTION 'BP_JOB_DELETE'
EXPORTING
jobcount = y_v_jobcount
jobname = y_k_jobname
EXCEPTIONS
cant_delete_event_entry = 1
cant_delete_job = 2
cant_delete_joblog = 3
cant_delete_steps = 4
cant_delete_time_entry = 5
cant_derelease_successor = 6
cant_enq_predecessor = 7
cant_enq_successor = 8
cant_enq_tbtco_entry = 9
cant_update_predecessor = 10
cant_update_successor = 11
commit_failed = 12
jobcount_missing = 13
jobname_missing = 14
job_does_not_exist = 15
job_is_already_running = 16
no_delete_authority = 17
OTHERS = 18.
ENDIF. "IF sy-subrc NE 0.
*Check for Foreground execution
IF sy-batch NE y_k_x.
DO.
IF sy-index EQ '10' OR y_v_fill1 > y_v_fill.
EXIT.
ELSE.
WAIT UP TO 3 SECONDS.
ENDIF.
*Fetch data from APQI
SELECT qid groupid qstate
INTO CORRESPONDING FIELDS OF TABLE y_i_apqi1
FROM apqi
WHERE groupid EQ y_p_grp
AND datatyp EQ 'BDC'
AND progid EQ 'RM06IBI0'
AND creator EQ sy-uname
AND credate EQ sy-datum.
DESCRIBE TABLE y_i_apqi1 LINES y_v_fill1.
ENDDO.
*Check new entry in table
IF y_v_fill1 > y_v_fill.
READ TABLE y_i_apqi1 INDEX y_v_fill1 INTO y_wa_apqi1.
IF sy-subrc EQ 0.
APPEND y_wa_apqi1 TO y_i_apqi2.
ENDIF.
ENDIF.
*check if table is empty
IF y_i_apqi2 IS INITIAL.
MESSAGE text-035 TYPE y_k_s.
LEAVE LIST-PROCESSING.
ELSE.
READ TABLE y_i_apqi2 INDEX 1 INTO y_wa_apqi1.
ENDIF.
*check if Session is finished
DO.
IF sy-index EQ '10' OR y_wa_apqi1-qstate EQ 'F' OR
y_wa_apqi1-qstate EQ 'E'.
EXIT.
ELSE.
WAIT UP TO 3 SECONDS.
ENDIF.
*Read table y_i_apqi1 into y_wa_apqi1 index 1.
SELECT qid groupid qstate
INTO CORRESPONDING FIELDS OF TABLE y_i_apqi2
FROM apqi
WHERE qid EQ y_wa_apqi1-qid AND
( qstate EQ 'F' OR qstate EQ 'E').
IF sy-subrc EQ 0.
EXIT.
ENDIF.
ENDDO.
*read table with status finished
READ TABLE y_i_apqi2 INDEX 1 INTO y_wa_apqi1.
IF y_wa_apqi1-qstate NE 'F' AND y_wa_apqi1-qstate NE 'E'.
MESSAGE text-036 TYPE y_k_s.
LEAVE LIST-PROCESSING.
ELSE.
*Use function to read session log
CALL FUNCTION 'YTI_BATCH_INPUT_SESSION_LOGS'
EXPORTING
NAME = y_p_grp
client = sy-mandt
date_from = sy-datum
date_to = sy-datum
qid = y_wa_apqi1-qid
status = y_k_r
TABLES
apqltab = y_i_apqi2
bdclm = y_i_bdclm
EXCEPTIONS
invalid_data = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE s305(00) WITH text-001 text-009 text-010.
ENDIF.
Thanks and regards,
Vamsi. -
Problem while uploading data through F-43
Hello Experts ,
I am facing a problem while data uploading through F-43.
Suppose I have many vendors with having several debit and credit items for each.So in t code same screen will appear for same vendor several times where we have to enter debit / credit items.
Please suggest how to solve this issue through LSMW/BDC program.
Thanks in adv.
A Miter.Hi..
Use BDC Recording MEthod ...
Develop BDC program, Before Recording the Transaction sit with Functional Consulatnt for REcord The f-43.
After that that u can do ur coding and built ur own logic.
Prabu -
Problem while Posting Assets through BAPI
Hi,
I am using BAPI_ACC_DOCUMENT_POST to handle assets postings in SAP.Here whenever i am running BAPI from SE37 using asset_no with regular length which is 6digits[730011] bapi is giving me correct results and documents gets posted successfully with assets.
The same thing when I do it from my program by populating values and filling the asset_no correctly in BAPI Structure I am getting error as below
"Asset 730011 not found in Company 1001".
but the same assets works fine through SE37.
Could anyone let me know why is this happening?
ThanksTry adding leading zeros.
( When you test via SE37 you come across conv_exit_module / kind of screen exit )
Hope this helps,
Erwan -
Problem in Material create through BAPI
Hi All,
For creating MATERIAL first used BAPI_MATERIAL_GETINTNUMBER for material no generation and for creation material master BAPI_MATERIAL_SAVEDATA.
<garbled code removed>
Moderator message: Post relevant portions of the code only!
My problem is material no is not created and passing into second bapi.
Help me out of this
Edited by: Suhas Saha on Jun 17, 2011 8:01 PMHi Venkatesh,
*Use This Bapi :BAPI_MATERIAL_SAVEREPLICA and pass values as mentioned below.*
Use this method to create new material master data or change existing material master data. Every time this method is called, data for one or more materials can be transferred.
When new material master data is created, the material number, the material type and the sector must be sent to the method. Furthermore, a short text and the language in which the short text has been created, have to be entered. When data is being changed, only the material number need be entered.
In the header data, at least one view has to be selected for which the data is to be created. Depending on the selected view, additional mandatory parameters that have been defined as such in Customizing have to be created. If not all mandatory fields are field with data, the method ends with an error message being displayed.
First, the appropriate fields in the tables (for example, CLIENTDATA) have to be filled with data by the user. These fields must also be flagged as the method data can only be written to the database if this is the case. The user must also provide data for the appropriate fields that have been selected in a checkbox table (for example, CLIENTDATAX). Checkbox tables exist for tables that do not contain language-dependent texts (MAKT, MLTX), European article numbers (MEAN) and tax classifications (MLAN). More than one data record can be created for a material in these tables (for all materials transferred to the method).
If a structure contains fields for a unit of measure (for example, structure CLIENTDATA, field BASE_UOM), language indicator (for example, structure MATERIALDESCRIPTION, field LANGU) or country identifier (for example, structure TAXCLASSIFICATIONS, field DEPCOUNTRY) then a similarly-named field ending with _ISO also exists. In doing so, the user has the option of using the internal SAP code or the ISO code for units of measure, language indicators or country identifiers. ISO codes are converted into an SAP code for further processing. The ISO code is only used if the SAP code is not displayed. In Customizing under "General Settings", a clear assignment has to be made between the ISO codes and the SAP codes for the following activities, if you want to use ISO codes:
If a structure contains fields for units of measurement (such as structure CLIENTDATA, field BASE_UOM), language indicators (such as structure MATERIALDESCRIPTION, field LANGU), or country indicators (such as structure TAXCLASSIFICATIONS, field DEPCOUNTRY), there is always a field of the same name with the ending _ISO. This makes it possible to transfer either the internally used SAP code or a standardized ISO code for the units of measurement, language indicators, or country indicators. ISO codes are converted to an SAP code internally for further processing. The ISO code is used only if the SAP code is not transferred. If you use ISO codes, there must be a unique assignment of the ISO code to the SAP code in the following activities in Customizing for Global Parameters:
Check Units of Measurement
Define Countries
If long texts (for example, basic data texts, internal notes, purchasing info texts, material notes or sales and distribution texts) or customer-specific fields have to be created for a material, some specific characteristics have to be taken into consideration. These characteristics are detailed in the documentation for parameters MATERIALLONGTEXT and EXTENSIONIN. -
Problem in uploading file through API
I want to upload files in to mycontent folder through our
application.After each steps followed, i get the status message ok
from the server, but file is not uploaded. Is there any idea about
this? Please help.what do you mean exactly with 'the file is not uploaded'?
you checked in the content directory and the file isn't
there?
if so, could you please post your server side upload
code? -
Problem of BOM components uploading through BAPI,for the Network(CN01)
Hello,Friends,
Iam PP consultant and facing a problem of BOM components uploading through BAPI,for creating of the Network (CN21)
we have 300 components in the network activity and while uploading the BOM through BAPI , only 295 components has been uploaded.Others components has not uploaded.
Please suggest me what will be the Problem? and
What is the solution for the same?
Regards,
MYSin customizing availability checked has been applied ,for this reason one additional screen is appearing in BAPI for all these components
How this screen could be by passed -
Encounter Problem when upload Data for T-Code CJ92
Dear All,
I want to upload Standard WBS element through transaction code CJ92. I am encountering a problem when I want to upload more than 13 Standard WBS for a project using recording (SHDB).
I have also tried to upload data through BAPI u201CBAPI_BUS2054_CREATE_MULTIu201D but this BAPI didnu2019t work for standard WBS.
Please provide me a solution to upload Standard WBS (CJ92).Thanks Shyam,
But this BAPI "BAPI_PROJECT_MAINTAIN" works only for operative WBS and I want to upload Standard WBS. The T-Code to create Standard WBS is CJ92. The screen upload can't be possible due to screen limitations.
Please provide me any solution to upload Standard WBS.
regards,
Saif -
Can't find Business Object for Functional Location BOM in BAPI
Hi all,
I've to make Upload Program through BAPI for Functional Location BOM,for making that Upload i can't find BUSINESS OBJECT for FUNCTIONAL LOCATION ,Equipment BOM and Fleet Object (Vehicle).Kindly tell what Business Object should i used to create that Upload Programme.I shall be very thankful to you.
Regards,
ABAPFKHi
you have to do all steps in LSMW
1.Maintain Object Attributes
2.Maintain Source Structures
3 Maintain Source Fields
4 Maintain Structure Relations
5 Maintain Field Mapping and Conversion Rules
7 Specify Files
8 Assign Files
9 Read Data
10 Convert Data
11 Create Batch Input Session
Please maintain source fields required.thats important.(maintain 2 level-header and item,also provide common name of column to link to 2 files
Header file:sample
RECORDNAME EQUNR Plant
10001031 10001031 3000
Item file:sample
RECORDNAME ITEM NO MATNR Item catg QTY
10001031 10 P-1001 L 1
Regards
Seenu -
Execute Infopackage Through BAPI Using Excel Macro (BAPI_IPAK_START)
Hi everyone,
I have a problem when execute infopackage through BAPI using excel macro. I have create a button in macro. When this button is clicked, BAPI for trigger InfoPackage will executed (BAPI_IPAK_START) and this button will disabled.
After this process completely done (traffic indicator for the request is green in update rules), the button will enabled again.
Here the subroutine or pseudocode that i will write :
Private Sub ClickButton()
Begin
1. ThisButton.Activated = False --> Disabled Button
2. Call BAPI/custom Function Module to execute InfoPackage (BAPI_IPAK_START)
4. ThisButton.Activated = True --> Enabled Button
End
The problem is i need some statement like this between statement no 2 and statement no 4
Statement That I Want :
3. Wait Until BAPI Execute Completely
So user can click this button again only after the process is finished completely. I don't know how to do this in macro (in ABAP i know i can use "WAIT ... SECOND"), others said this can be done using event in schedule option at infopackage. Anyone,please help me.
Thank you.
Regards,
Satria BEnter that req number in RSRQ and monitor the load
or right click on the DS - manage - you will req in yellow status which is in progress and you can click on the ...takes you monitor screen
Edited by: Srinivas on Jul 6, 2010 7:51 AM -
Long text problem while uploading Inspection plan through BDC.
Hi,
I am facing some problem while uploading the inspection plan. There are few MICs for which we are having long text, while uploading the inspection plan through BDC - some other long text is getting copied into the MIC's long text. After checking I came to know that in function module, read_text - some text which is stored in ABAP memory is getting copied into the inspection plan.
I am working in SAP release 4.7. I have checked with SAP notes: 97419, but it is also not satisfying.
Waiting for quick solution.
Thanks in advance.
FahiéHi a®s,
Thanks a lot for your kind reply.
My requirement is I want to maintain long text for few MICs (which are not having long texts at MIC level) in inspection plan (QP01).
When I am trying to manually assign the MIC's to inspection plan (QP01), long text is copied whereas I am not clicking the long text icon in (QP01). Long text is not maintained in MIC level, still some long text is copied to this MIC. This was also happening while uploading the inspection plan thro' BDC.
I believe what you have mentioned about function module SAVE_TEXT cannot be used here since long text is already copied before we pass the long text. Also if we pass some long text, still apart from the long text what we have passed there is some other long text copied (extra long text).
Waiting for quick solution.
Thanks in advance.
Fahié -
Profit Center not getting uploaded through BAPI for MM01. Pls help
Hello all,
I am getting an errror while uploading a file through BAPI for MM01 , The error says
Error:
Profit center 1000/sslcommon does not exist
for material: AC2
*& Report ZBAPI_DUMMY
REPORT ZBAPI_MM01.
*& Report ZBAPI2
TABLES
FLAGS *
DATA: F_STOP. " Flag used to stop processing
DATA DECLARATIONS *
DATA : V_EMPTY TYPE I, " No. of empty records
V_TOTAL TYPE I. " Total no. of records.
STRUCTURES & INTERNAL TABLES
*--- BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2, " Return Parameter
BAPI_MARDL LIKE BAPI_MARD,
BAPI_MARDX LIKE BAPI_MARDX.
*--- Internal table to hold excel file data
DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*--- Internal table to hold Matetrial descriptions
DATA: BEGIN OF IT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- Internal to hold the records in the text file
DATA : BEGIN OF IT_DATA OCCURS 100,
WERKS(4), " Plant
MTART(4), " Material type
MATNR(18), " Material number
MATKL(9) , " Material group
MBRSH(1), " Industry sector
MEINS(3), " Base unit of measure
SPART(2), " Division
EKGRP(3), " Purchasing group
PRCTR(10), " Profit Center
VPRSV(1), " Price control indicator
BKLAS(4), "Valuation Class
*stprs(12), " Standard price
PEINH(3), " Price unit
SPRAS(2), " Language key
MAKTX(40), " Material description
LGORT(4) , " storage location
DISMM(2) , "MRP TYPE
VERPR(23), " Moving Average Price
MTVFP(2) , " Availability Check
DISLS(2) , "Lot Size
DISPO(3) , "MRP Controller
BESKZ(1) , "Procurment Type
FHORI(3) , "SCHEDMARGIN KEY
PERKZ(1) , "Period Indicator
END OF IT_DATA.
SELECTION SCREEN. *
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY " Input File
PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 2 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK SCR1.
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
START-OF-SELECTION
START-OF-SELECTION.
*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
END OF SELECTION. *
END-OF-SELECTION.
*--- Perform to upload Material Master data
PERFORM UPLOAD_MATMAS.
Form : validate_input_file
Description : To provide F4 help for file if read from PC
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
ENDIF.
ENDFORM. " validate_input_file
*& Form CONVER_XLS_ITAB
text
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ENDFORM. " CONVERT_XLS_ITAB
*& Form MOVE_DATA
text
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS> .
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS> .
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO <FS> .
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form DELETE_HEADER_EMPTY_RECS
To delete the Header and empty records
FORM DELETE_HEADER_EMPTY_RECS.
DATA: LV_TABIX LIKE SY-TABIX.
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
P_HEADER = 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.
*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
V_EMPTY = V_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.
*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES V_TOTAL.
IF V_TOTAL = 0.
MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
F_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS
*& Form UPLOAD_MATMAS
to upload Material Master data
FORM UPLOAD_MATMAS .
LOOP AT IT_DATA.
Header
BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
BAPI_HEAD-storage_view ='X'.
bapi_head-mrp_view = 'X'.
bapi_head-COST_view ='X'.
Material Description
REFRESH IT_MAKT.
IT_MAKT-LANGU = IT_DATA-SPRAS.
IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
APPEND IT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
bapi_mara1-unit_of_wt = it_data-gewei.
BAPI_MARA1-DIVISION = IT_DATA-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = IT_DATA-WERKS.
BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
BAPI_MARC1-PROFIT_CTR = IT_DATA-PRCTR.
BAPI_MARC1-MRP_TYPE = IT_DATA-DISMM.
BAPI_MARC1-AVAILCHECK = IT_DATA-MTVFP.
BAPI_MARC1-LOTSIZEKEY = IT_DATA-DISLS.
BAPI_MARC1-MRP_CTRLER = IT_DATA-DISPO.
BAPI_MARC1-PROC_TYPE = IT_DATA-BESKZ.
BAPI_MARC1-SM_KEY = IT_DATA-FHORI.
BAPI_MARC1-PERIOD_IND = IT_DATA-PERKZ.
BAPI_MARCX-PLANT = IT_DATA-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
BAPI_MARCX-AVAILCHECK = 'X'.
BAPI_MARCX-PROFIT_CTR = 'X'.
BAPI_MARCX-MRP_TYPE = 'X'.
BAPI_MARCX-MRP_CTRLER = 'X'.
BAPI_MARCX-SM_KEY = 'X'.
BAPI_MARCX-LOTSIZEKEY = 'X'.
Storage Location.
BAPI_MARDL-PLANT = IT_DATA-WERKS.
BAPI_MARDL-STGE_LOC = IT_DATA-LGORT.
BAPI_MARDX-PLANT = IT_DATA-WERKS.
BAPI_MARDX-STGE_LOC = IT_DATA-LGORT.
Accounting
BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
BAPI_MBEW1-VAL_CLASS = IT_DATA-BKLAS.
BAPI_MBEW1-MOVING_PR = IT_DATA-VERPR.
bapi_mbew1-std_price = it_data-stprs.
BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
BAPI_MBEWX-MOVING_PR = 'X'.
*--- BAPI to create material
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA = BAPI_MARDL
STORAGELOCATIONDATAX = BAPI_MARDX
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = IT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,
IT_DATA-MATNR.
ELSEIF BAPI_RETURN-TYPE = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = BAPI_RETURN
WRITE: 'Successfully created material' ,IT_DATA-MATNR.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = BAPI_RETURN
ENDLOOP.
ENDFORM. " UPLOAD_MATMASthe Profit center 1000/sslcommon not created. first create the profit center and then upload your data.check tcode KE52 for created profit centers...
-
Problem in creating IR through BAPI_INCOMINGINVOICE_create BAPI
Hi,
Some problem in creating IR through the BAPI BAPI_INCOMINGINVOICE_create. I am able to see the IR number after executing the BAPI but unable to see the IR number in the table. The IR number is not getting updated in the database table even though we are doing the commit work after executing the BAPI. Could anyone help me out with this error.
Regards,
RamFirst of all I am assuming that you did not get any error in the BAPI return structure (even though you see document number populated).
Secondly, I guess you tested the BAPI with SE37 and did not get any error (functionally there are a number of BAPIs available to post an invoice and it is important to figure out the correct BAPI - e.g. PO, non-PO invoice, invoice as a GL entry only, etc.).
If that is not true (there is some error in posting), since during the BAPI call the next document number is obtained as a first step, you will see the document number but subsequently if for some reason it is not posted, you will see the result as you mentioned (no data in the database).
If you are using correct BAPI and have no errors, then in ABAP program make sure to call 'BAPI_TRANSACTION_COMMIT' after the BAPI call to post invoice.
For non-SAP external system, you need not have to call the commit BAPI but just closing the connection to SAP will help. -
I have problems with uploading images to my internet printing company when the images have been manipulated through CS6 and i have saved images as jpeg the printer company tell me they are not j peg,
but images saved from my phone or camera images that have not been manipulated upload fine, What am i doing wrong?Save/Export them as JPG. Photoshop defaults to PSD, so make sure you select JPG and not just rename the file to .jpg.
There are two ways to save them as JPG: Regular Save as option or Save for Web & Devices
Take your pick.
Maybe you are looking for
-
Update asset master record serial number when doing GR
Hi, The client has a requirement to update the serial# on an asset master record when the user process goods receipt through MIGO. Is there a BADI or another functionality that we can use to update the serial# on an asset master record upon GR? Thank
-
Hi all, I am trying to provide validation to Grpo document. my requierment is as follows. 1) i have one PO with 10 qty. 2) i create one grpo doc. based on this PO and i receive 4 qty now my open qty is 6. 3) when next time i create grpo based on this
-
CMP Datasource configuration in jboss
Hi every body, I am running CMP entity bean in jboss server4.2.2GA in netbeans and i am getting the following error..... [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. 14:37:26,702 INFO [ConnectionFactoryBindingService] {
-
PXI-5402 IVI in TestStand 4.2 returned "niFgen_InitWithOptions" Resource not found
Hi, i'm very new in TestStand. I hope someone could help me. I have a complete Sequence in which an ivi should initiate a PXI-5402. (It's an old sequence i inherited. It's now my job to get it working again). We have another System with an PXI-5401 (
-
Hi, I ame trying to generate an html report with SQL/Plus, I have read some tutorial but I have not understood well how I can approach the issue. Actually I have this report: SET TRIMSPOOL on SET PAGES 0 SET NEWPAGE 0 SET VERIFY OFF SET FEEDBACK OFF