Track error records in Call Transaction method
Hi
I have used call transaction method for uploading legacy data.
I need to track the error record.
Please help me to find out the solution.
Thanks in advance
Reagards
shriraam
HI,
!. Obtain the messaged into an Interal table of type BDCMSGCOLL using Call Transaction syntax..
Call Transactio <Tcode>
using <BDC Table>
mode <A/N/P>
update <A/S>
messages INTO <mSGTAB>
2. Read the Msg table for eroors and success messages
3. Then format the messge with the help of Function Module :'Format_messages'.
4. Display the respective messges with the help of write statements or with the help of ALV.
Rgds
Umakanth
Similar Messages
-
How will you collect error records in call transaction method
hello
how will handle errors in call transaction method...DATA: BEGIN OF ITAB OCCURS 0,
F1(10) TYPE C,
F2(18) TYPE C,
F3(15) TYPE C,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
F1(2) TYPE C,
F2(10) TYPE C,
F3(18) TYPE C,
F4(15) TYPE C,
END OF ITAB1.
DATA : ITAB2 LIKE ITAB OCCURS 0 WITH HEADER LINE,
IT_SUCCESS LIKE ITAB OCCURS 0 WITH HEADER LINE,
IT_ERROR LIKE ITAB OCCURS 0 WITH HEADER LINE.
DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
T_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL TRANSACTION 'VA01' USING BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO T_BDCMSGCOLL.
PERFORM ERRORHANDLING TABLES ITAB2 USING COUNT1 COUNT2.
REFRESH BDCDATA.
FORM ERRORHANDLING TABLES P_ITAB2 STRUCTURE ITAB
USING P_COUNT1
P_COUNT2.
IF SY-SUBRC <> 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = '-D'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = T_BDCMSGCOLL
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF P_COUNT1 = 1.
WRITE : / ' The records not loaded are '.
P_COUNT1 = P_COUNT1 + 1.
ENDIF.
LOOP AT P_ITAB2.
WRITE : / P_ITAB2-F1 , P_ITAB2-F2 , P_ITAB2-F3 .
CLEAR P_ITAB2.
DELETE P_ITAB2 INDEX 1.
ENDLOOP.
WRITE : /.
ELSE.
IF P_COUNT2 = 1.
WRITE : / ' The records loaded are '.
P_COUNT2 = P_COUNT2 + 1.
ENDIF.
LOOP AT P_ITAB2.
WRITE : / P_ITAB2-F1 , P_ITAB2-F2 , P_ITAB2-F3 .
CLEAR P_ITAB2.
DELETE P_ITAB2 INDEX 1.
ENDLOOP.
WRITE : /.
ENDIF.
ENDFORM. " errorhandling -
How to upload error records in call transaction method
Hi all,
While uploading data by using call transaction. If any errors occured, how can we process that error records to database.
If all records are processed. How can we display the recent records which where uploaded.
AdvanceThanks for all.Hi Bharath
You can handle this in many ways. But the easiest option to do is as below,
once the call transaction ends in error, move that particular upload data to a separate internal table. Then finally download all these data to an error file.
Besides this after processing all the records diplay the log for error. So that users can modify the error in the file and can use the same for uploading again. For the data that has been processed successfully you can display the log similarly.
The error as well as sucess messages can be obtained from the messages table.
CALL TRANSACTION TCODE USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
Regards
Kathirvel -
Error in BDC CALL TRANSACTION METHOD..
hai i got an error in doing BDC CALL TRANSACTION METHOD
Error:diffrent number of parameters in FORM and PERFORM(routine :FILL_SCREEN_DETAILS:,number of formal parameters :3,number of actual parameters:1)
PROGRAM
REPORT ZDEMO_UPLOAD_COST_CENTER_DATA.
DATA:BEGIN OF WA_DATA,
KOKRS TYPE KOKRS,"CONTROLLING AREA
KOSTL TYPE KOSTL,"COST CENTER
DATAB TYPE DATAB,"START DATE
DATBI TYPE DATBI,"END DATE
KTEXT TYPE KTEXT,"NAME
LTEXT TYPE LTEXT,"DESCRIPTION
VERAK TYPE VERAK,"PERSON RESPONSIBLE
KOSAR TYPE KOSAR, "COST CENTER CATEGORY
KHINR TYPE KHINR,"HIERARCHY AREA
BUKRS TYPE BUKRS,"COMPANY CODE
GSBER TYPE GSBER,"BUISINESS AREA
END OF WA_DATA.
*TYPES:IT_DATA TYPE STANDARD TABLE OF TY_DATA.
DATA:IT_DATA LIKE TABLE OF WA_DATA,
IT_BDCDATA LIKE TABLE OF BDCDATA,
WA_BDCDATA LIKE LINE OF IT_BDCDATA,
IT_BDCMSGCOLL LIKE TABLE OF BDCMSGCOLL,
WA_BDCMSGCOLL LIKE LINE OF IT_BDCMSGCOLL.
DATA :V_FILE TYPE STRING.
CONSTANTS :C_KS01(4) TYPE C VALUE 'KS01',
C_X(1) TYPE C VALUE 'X',
C_A(1) TYPE C VALUE 'A'.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETER :PA_FILE LIKE FC03TAB-PL00_FILE OBLIGATORY.
SELECTION-SCREEN:END OF BLOCK B1.
*AT SELECTION SCREEN ON VALUE REQUEST
* EVENT TO BE TRIGGERED WHEN WE PRESS F4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FILE.
PERFORM GET_F4_FOR_FILE USING PA_FILE.
* START-OF-SELECTION
START-OF-SELECTION.
*WE NEED TO MOVE THE PA_FILE INTO ANOTHER VARIABLE OF TYPE STRING
*AS WE ARE GOING TO USE THE SAME IN THE FM:GUI_UPLOAD THERE THE FILE TYPE IS STRING
V_FILE = PA_FILE.
PERFORM UPLOAD_FILE_T0_ITAB USING V_FILE CHANGING IT_DATA.
*FILL THE SCREEN AND FIELD DETAILS
LOOP AT IT_DATA INTO WA_DATA.
REFRESH IT_BDCDATA.
*FIRST SCREEN DETAILS
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1''0200''X'.
*CURSOR DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_CURSOR''CSKSZ-KOKRS'.
*OK CODE DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_OKCODE''/00'.
*CONTROLLING AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KOKRS' WA_DATA-KOKRS.
*COST CENTER DETAILS
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KOSTL' WA_DATA-KOSTL.
* START DATE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-DATAB_ANFO' WA_DATA-DATAB.
*END DATE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-DATBI_ANFO' WA_DATA-DATBI.
*NEXT SCREEN DETAILS
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1''0299''X'.
*OKCODE DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_OKCODE''=BU'.
*SUBSCRN FIELD DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_SUBSCR''BDC-SUBSCR'.
*CURSOR DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_CURSOR''CSKSZ-WAERS'.
*NAME
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KTEXT' WA_DATA-KTEXT.
*DESCRIPTION
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-LTEXT' WA_DATA-LTEXT.
*PERSON RESPONSIBLE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-VERAK' WA_DATA-VERAK.
*COST CENTER CATEGORY
PERFORM FILL_FIELD_DETAILS USING'CSKSZ-KOSAR' WA_DATA-KOSAR.
*HIERARCHY AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KHINR' WA_DATA-KHINR.
*COMPANY CODE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-BUKRS' WA_DATA-BUKRS.
*BUISINESS AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-GSBER' WA_DATA-GSBER.
*CALL THE TRANSACTION
CALL TRANSACTION C_KS01 USING IT_BDCDATA
MODE C_A "ALL SCREENS
"N-NO SCREENS
"E-ERROR SCREENS ONLY
UPDATE 'A' "ASYNCHRONOUS
"SYNCHRONOUS
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
* FORM FILL SCREEN_DETAILS
FORM FILL_SCREEN_DETAILS USING PROGRAM LIKE BDCDATA-PROGRAM
DYNPRO LIKE BDCDATA-DYNPRO
DYNBEGIN LIKE BDCDATA-DYNBEGIN.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = DYNBEGIN.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDOFRM.
* FORM FILL_FIELD_DETAILS
FORM FILL_FIELD_DETAILS USING FNAM FVAL.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDFORM.
* FORM GETE_F4_FOR_FILE
*DISPLAY ALL THE FILES IN THE SYSTEM FOR SELECTION
*P_PA_FILE NAME OF THE FILE
FORM GET_F4_FOR_FILE USING P_PA_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
* EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'PA_FILE'
* STATIC = ' '
* MASK = ' '
CHANGING
FILE_NAME = PA_FILE.
* EXCEPTIONS
* MASK_TOO_LONG = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
* FORM UPLOAD_FILE_TO_ITAB
* FP_V_FILE = FILE NAME
*FP_IT_DATA = INTERNAL TABLE TO STORE THE DATA
FORM UPLOAD_FILE_TO_ITAB USING FP_V_FILE CHANGING FP_IT_DATA LIKE IT_DATA.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FP_V_FILE
HAS_FIELD_SEPARATOR = ' X'
TABLES
DATA_TAB =FP_IT_DATA.
ENDFORM.
Edited by: saifudheenc on Aug 7, 2010 5:09 PMhi
try to add spaces between parameters :
example:
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1' '0200' 'X'.
regards,darek -
How to track error message when calling Transaction: va02
Hi all,
As we all know, when we change an order through T-Code: VA02, system will update modified data to corresponding database. Meanwhile, if our operate is not legal or incorrect on T-code: VA02, system will call corresponding error messages to us.
Now I want to know:
1. how to track the error messages
2. Is there any Tcode such as: SM21 that we can see the message logs after our operation?
Thanks.Hi ,
message table for call transaction
DATA: BEGIN OF G_T_MSG OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF G_T_MSG.
Exucute transaction via Call Transaction
CALL TRANSACTION 'FB01'
USING g_t_bdcdata
MODE g_l_mode
UPDATE 'S'
MESSAGES INTO g_t_msg .
errors will be stpored in the table g_t_msg ..
Thanks . -
Hi all, BDC call transaction METHOD, trapping ERRORS
hi
i have developed BDC (recording via call transaction method) for VB01.
could u please tell me how to display records having errors after running recording or to give index of records having errors.
and is it possible to give transaction code for recording since my bdc is executable program.
plase answer both the questions.
thanxHere is the flow that Raja is explaining to you.
DATA: v_index LIKE sy-tabix.
LOOP AT itab.
v_index = sy-tabix.
*-- prepare the BDC data
CALL TRANSACTION 'VB01' USING bdcdata
MODE 'N'
MESSAGES INTO bdcmsgcoll.
READ TABLE bdcmsgcoll WITH KEY msgtyp = 'E'.
IF sy-subrc = 0.
*-- Error occured for the record with index <b>v_index</b>
ELSE.
*-- unless there is a success message with this number,
* it is not succesfull because 'No data for screen xxx'
* will not show up as an error message type, but will be
* a success message type
READ TABLE bdcmsgcoll WITH KEY msgnr = '312'.
IF sy-subrc = 0.
*-- success
ELSE.
*-- error with index <b>v_index</b>
ENDIF.
ENDIF.
ENDLOOP.
As you can see, now you have the index of the record where the error occured. Now this will become complicated if you are combining several records into one transaction call. In that case you need to find how you can know all the records that you just accumulated.
As an example, let us say you have an internal table with external number, customer, material, quantity and at every new external number, you want to create a sales order. Until you get a new external number, you will not do the call transaction because until then it will be items of the same sales order. So in this case, after the call transaction, you will have get all the records that belong to making this sales order by using the external number and then prepare your messages.
I hope this is clear.
Srinivas
Message was edited by: Srinivas Adavi -
How to send error record to session in call transaction method
Hi experts,
I want to send only the error record to session while executing the program in call transaction method. please give me example on this
regards,
siva kumarOne logiv that I can suggest is that after you have got the details of the record in error, you write another perform build_Session and put the below logic in that.
Logic:
1. Build a internal table for the error records similar to the internal table you used for looping for the call transaction. In short this internal table will have only the records that have an error in call transaction.
2. Copy the recordign that you have done before and put it in the perform inside the loop and build the BDC table.
3. Then .using this BDC table you can build the BDC session.
- Guru
Reward points for helpful answers
3. -
Error while updating data using session and call transaction method
Hi all,
i have to update data using MM01 transaction from flat file to database.i have used both session method and call transaction method to do that.in both the methods data has been transferred from internal tables to screens but while updating the data that is by clicking the ok-code at the end of the transaction iam getting a dialogue box stating
SAP EXPRESS DOCUMENT "UPDATE WAS TERMINATED" RECEIVED FROM AUTHOR "SAP".
please tell whether the problem lies and solution for that.
thanks and regards.hi,
check your recording.check whether u saved your material no in recording or not.
once again record the transacton mm01.
MATNR LIKE RMMG1-MATNR,
MBRSH LIKE RMMG1-MBRSH,
MTART LIKE RMMG1-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
BISMT LIKE MARA-BISMT,
EXTWG LIKE MARA-EXTWG,
these are the fields which u have to take in internal table.
this is the record which i took in my flatfile.use filetype as asc and hasfieldseperator as 'X'.
SUDHU-6 R ROH MATSUDHU " 001 7890 AA
i did the same.but i didn't get any error. -
I am trying to update the MARA table using Inbound Proxy.
i am able to do so by Create Session Method which i can Process using Transaction SM35.But i am unable to do the same by Call Transaction Method. What could be the reason For same?
Actually the code in the method is not Getting Triggered incase of Call transaction Method.
Also can there be some Queue problem???
How to configure out the same if the case is of Queue.
Message was edited by: Amit SinglaI am trying to update the MARA table using Inbound Proxy.
i am able to do so by Create Session Method which i can Process using Transaction SM35.But i am unable to do the same by Call Transaction Method. What could be the reason For same?
Actually the code in the method is not Getting Triggered incase of Call transaction Method.
Also can there be some Queue problem???
How to configure out the same if the case is of Queue.
Message was edited by: Amit Singla -
What are the parameters in Call transaction method?
Hi ABAPER'S,
Please give me what are the parameters in call transaction method?
Thanks,
PrakashProcessing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
<tcode> : Transaction code
<bdc_tab> : Internal table of structure BDCDATA.
<mode> : Display mode:
A
Display all
E
Display errors only
N
No display
<update> : Update mode:
S
Synchronous
A
Asynchronous
L
Local update
A program that uses CALL TRANSACTION USING to process legacy data should execute the following steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION 'TFCA' USING BDCDATA
MODE 'A'
UPDATE 'S'.
MESSAGES INTO MESSTAB.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
The MODE Parameter
You can use the MODE parameter to specify whether data transfer processing should be displayed as it happens. You can choose between three modes:
A Display all. All screens and the data that goes in them appear when you run your program.
N No display. All screens are processed invisibly, regardless of whether there are errors or not. Control returns to your program as soon as transaction processing is finished.
E Display errors only. The transaction goes into display mode as soon as an error in one of the screens is detected. You can then correct the error.
The display modes are the same as those that are available for processing batch input sessions.
The UPDATE Parameter
You use the UPDATE parameter to specify how updates produced by a transaction should be processed. You can select between these modes:
A Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.
Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.
If you use asynchronous updating, then you will need to use the update management facility (Transaction SM12) to check whether updates have been terminated abnormally during session processing. Error analysis and recovery is less convenient than with synchronous updating.
S Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.
L Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program. (See the ABAP keyword documentation on SET UPDATE TASK LOCAL for more information.)
The MESSAGES Parameter
The MESSAGES specification indicates that all system messages issued during a CALL TRANSACTION USING are written into the internal table <MESSTAB> . The internal table must have the structure BDCMSGCOLL .
You can record the messages issued by Transaction TFCA in table MESSTAB with the following coding:
(This example uses a flight connection that does not exist to trigger an error in the transaction.)
DATA: BEGIN OF BDCDATA OCCURS 100.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDCDATA.
DATA: BEGIN OF MESSTAB OCCURS 10.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF MESSTAB.
BDCDATA-PROGRAM = 'SAPMTFCA'.
BDCDATA-DYNPRO = '0100'.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
CLEAR BDCDATA.
BDCDATA-FNAM = 'SFLIGHT-CARRID'.
BDCDATA-FVAL = 'XX'.
APPEND BDCDATA.
BDCDATA-FNAM = 'SFLIGHT-CONNID'.
BDCDATA-FVAL = '0400'.
APPEND BDCDATA.
CALL TRANSACTION 'TFCA' USING BDCDATA MODE 'N'
MESSAGES INTO MESSTAB.
LOOP AT MESSTAB.
WRITE: / MESSTAB-TCODE,
MESSTAB-DYNAME,
MESSTAB-DYNUMB,
MESSTAB-MSGTYP,
MESSTAB-MSGSPRA,
MESSTAB-MSGID,
MESSTAB-MSGNR.
ENDLOOP.
The following figures show the return codes from CALL TRANSACTION USING and the system fields that contain message information from the called transaction. As the return code chart shows, return codes above 1000 are reserved for data transfer. If you use the MESSAGES INTO <table> option, then you do not need to query the system fields shown below; their contents are automatically written into the message table. You can loop over the message table to write out any messages that were entered into it.
Return codes:
Value
Explanation
0
Successful
<=1000
Error in dialog program
> 1000
Batch input error
System fields:
Name:
Explanation:
SY-MSGID
Message-ID
SY-MSGTY
Message type (E,I,W,S,A,X)
SY-MSGNO
Message number
SY-MSGV1
Message variable 1
SY-MSGV2
Message variable 2
SY-MSGV3
Message variable 3
SY-MSGV4
Message variable 4
Error Analysis and Restart Capability
Unlike batch input methods using sessions, CALL TRANSACTION USING processing does not provide any special handling for incorrect transactions. There is no restart capability for transactions that contain errors or produce update failures.
You can handle incorrect transactions by using update mode S (synchronous updating) and checking the return code from CALL TRANSACTION USING. If the return code is anything other than 0, then you should do the following:
write out or save the message table
use the BDCDATA table that you generated for the CALL TRANSACTION USING to generate a batch input session for the faulty transaction. You can then analyze the faulty transaction and correct the error using the tools provided in the batch input management facility. -
Bdc error message in call transaction
Hi all,
Can anyone send me a program where they have used the ' BDCMSGCOLL ' structure and format_message FM. I need only complete program, please don't send sample codings or just a part of coding.
Points are assured.
Thanks and regards,
subbu.Hi,
Here is the BDC recording program for updating a custom field (out of 3 custom fields) in CALL TRANSACTION method depends upon which value is given in text file, based on that the corresponding radio button will be selected for that PERNR in PA30.(For 3 custom fields in PA0007) created.
Flat file contains 1) PENR 2) Custom field1 3) CF2 4) CF3.
The values are like [ '636363', ' ', 'X', ' ' ] .
Here is the complete program using BDCMSGCOLL structure.
report Y0007_BDC NO STANDARD PAGE HEADING MESSAGE-ID RP LINE-SIZE 180." LINE-COUNT 28.
DATA DECLARATION *
TYPES : BEGIN OF TY_0007,
PERNR TYPE PERNR, " PERNR
SCHKZ TYPE SCHKN, " Work Schudule
ZTERF TYPE PT_ZTERF, " Time Magmt Status
R1 TYPE C,
R2 TYPE C,
R3 TYPE C,
END OF TY_0007.
DATA : INT_0007 TYPE STANDARD TABLE OF TY_0007 WITH HEADER LINE,
WA_0007 TYPE TY_0007.
DATA: P_FNAME TYPE IBIPPARMS-PATH.
DATA : begin of int_out occurs 0,
pernr type persno,
mesg(300),
end of int_out.
DATA : BEGIN OF int_err occurs 0,
pernr type persno,
mesg(300),
end of int_err.
include bdcrecx1.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS : P_PATH TYPE string.
SELECTION-SCREEN END OF BLOCK B.
SELECTION-SCREEN END OF BLOCK A.
CALL FUNCTION FOR INPUT FILE NAME *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FNAME.
p_path = p_fname.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_PATH
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = INT_0007
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
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 open_group.
*Looping pernr values*
LOOP AT INT_0007 INTO WA_0007.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*INSERTING THE PERNR VALUE*
perform bdc_field using 'RP50G-PERNR'
WA_0007-PERNR. "'00001011'.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC'
'0007'.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-PERNR'.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
perform bdc_field using 'RP50G-PERNR'
WA_0007-PERNR. "'1011'.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'RP50G-CHOIC'
'Planned Working Time - 0007'.
perform bdc_dynpro using 'MP000700' '2000'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0007-BEGDA'
'12/01/2007'.
perform bdc_field using 'P0007-ENDDA'
'12/31/9999'.
*INSERTING THE WORK SCHEDULE*
perform bdc_field using 'P0007-SCHKZ'
WA_0007-SCHKZ. "'N12'.
perform bdc_field using 'P0007-ZTERF'
WA_0007-ZTERF. "'1'.
*INSERTING THE OVERTIME CLASS*
IF WA_0007-R1 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_ELGBLE'
'X'.
ELSEIF WA_0007-R2 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_NOTELG'
'X'.
ELSEIF WA_0007-R3 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_TMPELG'
'X'.
ENDIF.
*BDC output for transaction code*
perform bdc_transaction using 'pa30'. (STD)
perform f_bdc_output using 'pa30'. (write on our own)
ENDLOOP.
**Writing the output**
PERFORM f_write_output.
perform close_group.
*& Form f_write_output
text
--> p1 text
<-- p2 text
FORM f_write_output .
*For Successfull Records*
if int_OUT[] IS NOT INITIAL.
WRITE : /50 TEXT-004 color 4.
write : / sy-uline.
LOOP AT INT_OUT.
WRITE : /40 int_out-pernr,50 '-->',54 int_out-mesg.
ENDLOOP.
ENDIF.
write / sy-uline.
SKIP 2.
*For Error records*
if int_err[] IS NOT INITIAL.
WRITE /53 text-005 color 6.
write / sy-uline.
LOOP AT int_err.
write :/40 int_err-pernr,50 '-->',54 int_err-mesg.
ENDLOOP.
endif.
write / sy-uline.
ENDFORM. " f_write_output
*& Form f_bdc_output
text
-->P_0369 text
FORM f_bdc_output USING VALUE(P_0369).
DATA: L_MSTRING(480).
DATA: L_SUBRC LIKE SY-SUBRC.
REFRESH MESSTAB.
*Capturing the output message*
CALL TRANSACTION 'PA30' USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
IF SMALLLOG <> 'X'.
LOOP AT MESSTAB.
*Selection for capturing the text for records*
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
*Moving the text from T100 to local variable*
L_MSTRING = T100-TEXT.
IF ( MESSTAB-MSGTYP = 'W' or
MESSTAB-MSGTYP = 'S' OR
MESSTAB-MSGTYP = 'E' ).
*Moving the success records pernr and text to internal table*
IF MESSTAB-MSGTYP = 'S'.
INT_OUT-PERNR = WA_0007-PERNR.
INT_OUT-MESG = L_MSTRING.
APPEND INT_OUT.
CLEAR INT_OUT.
*Moving the success records pernr and text to internal table*
ELSEIF MESSTAB-MSGTYP = 'E'.
*For getting the error text exactly*
IF L_MSTRING CS '&1'.
REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ELSE.
REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ENDIF.
CONDENSE L_MSTRING.
INT_ERR-PERNR = WA_0007-PERNR.
INT_ERR-MESG = L_MSTRING.
APPEND INT_ERR.
CLEAR INT_ERR.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
*& CALL FUNCTION 'BDC_OPEN_GROUP'
IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = E_GROUP
USER = E_USER
KEEP = E_KEEP
HOLDDATE = E_HDATE.
E_GROUP_OPENED = 'X'.
ENDIF.
*& CALL FUNCTION 'BDC_INSERT'
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'PA30'
TABLES
DYNPROTAB = BDCDATA.
*& CALL FUNCTION 'BDC_CLOSE_GROUP'
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
REFRESH BDCDATA.
ENDFORM. " f_bdc_output
Hope it helps u..
Kindly reward points if helpful
Regards,
Shanthi -
Hi,
I am uplaoding CoA profile data using BDC call transaction method, but records could not be uplaoded because of the error " Screen 0000 is too large for internal batch input Area". I didnt understand what is the reason for this error.
Could you plesae help in this?Hi,
Keep the REFRESH KTAB after first Endloop.
Like
LOOP AT ITAB.
LOOP AT KTAB.
ENDLOOP.
REFRESH KTAB.
ENDLOOP.
Edited by: subas Bose on Mar 26, 2010 7:17 PM -
Reg Vendor master upload using BDC Call Transaction Method
Hi All,
Thanks in advance.
I am uploading vendor master data using bdc call transaction method for XK01. In that i am getting an error message that the fields " smtp_addr" ( for email) and "time_zone" (for time zone) doesnot exist on the screen '0110' ( this is the second screen) . the field timezone will be displayed on the screen only when we go for communications button and select the URL field .
Do anybody have the solution for this problem. if possible can you give me the code for that screen.Create a recording via SM35 (menu go to=>recording), this will generate automatically the code for filling your bdcdata-table...
-
Caprturing error log in call transaction?
hoiw can i get all the error in call transaction method, can any one guide me?
see this
*& Report ZMATERIAL
report zmaterial_fert.
selection-screen :begin of block bl1 with frame title text-001.
parameters : p_fname type rlgrap-filename,
p_lgort type rlgrap-filename,
p_update(1) default 'N',
p_bdcgrp(12) default 'MM_MASTER'.
selection-screen end of block bl1.
data: v_chr_opengrp type c,
r_matnr like mara-matnr,
r_werks like marc-werks,
v_str_fname type string.
data : begin of bdc_itab occurs 0.
include structure bdcdata.
data : end of bdc_itab.
data: begin of messtab occurs 0.
include structure bdcmsgcoll.
data: end of messtab.
data: begin of count,
inrec(9) type n, " input I_MATERIAL count
create(9) type n, " create count
error(9) type n, " error count
bdc(9) type n, " count of BDC creates
end of count.
data : begin of i_material occurs 0,
matnr(018) type c, "Material number
mbrsh(001) type c, "Industry sector
mtart(004) type c, "Material type
werks(004) type c, "Plant
lgort(004),
lgnum(004),
vkorg(004),
vtweg(002),
mtpos_mara(004),
spart(002),
dwerk(004),
taxkm(001),
versg(001),
MTPOS(004),
maktx(040) type c, "Material description
meins(003) type c, "Base unit of measure
matkl(009) type c, "Material group
bismt(018), "old material code
brgew(017) type c, "Gross weight
gewei(003) type c, "Weight unit
ntgew(017) type c, "Net weight
magrv(004) type c, "Matl grp pack matls
tragr(004), "
ladgr(004),
prctr(007),
EKGRP(004),
EKWSL(004),
chap(012),
mattype(001),
nogrs(001),
outmat(018),
valid(010),
curr(005),
netdeal(018),
asess(018),
disgr(004),
dismm(002) type c,
dispo(003),
LGORT(004),
disls(002),
maabc(001),
lgpro(004),
webaz(003),
lgfsb(004),
plifz(003),
STRGR(002),
fhori(003),
sfepr(004),
fevor(003),
sfcpf(006),
beskz(001),
perkz(001),
VRMOD(001),
VINT1(003),
VINT2(003),
ALTSL(001),
SBDKZ(001),
FERVOR(002),
SFCPF(006),
stprs(015),
AWSLS(006),
mtvfp(002),
STGRP(002),
*PRCTR(007),
bklas(004),
vprsv(001),
peinh(006),
*EKALR(015),
verpr(015),
hrkft(002),
*HKMAT,
kosgr(010),
*LOSGR(018),
end of i_material.
at selection-screen on value-request for p_fname.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = 'Z_MM_MATERIAL_UPLOAD'
dynpro_number = '1000'
field_name = 'P_FNAME'
changing
file_name = p_fname.
at selection-screen on value-request for p_lgort.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = 'ZMATERIAL'
dynpro_number = '1000'
field_name = 'P_FNAME'
changing
file_name = p_lgort.
start-of-selection.
if p_fname is initial.
message i016(rp) with 'Please enter a file name'.
leave list-processing.
else.
move p_fname to v_str_fname.
endif.
call function 'GUI_UPLOAD'
exporting
filetype = 'ASC'
filename = v_str_fname
has_field_separator = 'X'
tables
data_tab = i_material
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
loop at i_material.
r_matnr = i_material-matnr.
r_werks = i_material-werks.
add 1 to count-inrec.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
i_material-matnr.
perform bdc_field using 'RMMG1-MTART'
i_material-mtart.
perform bdc_field using 'RMMG1-MBRSH'
i_material-mbrsh.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(17)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(03)'
'X'.
*PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(07)'
*'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(08)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(05)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(06)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(04)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(09)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(10)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(11)'
'X'.
*PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(12)'
*'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(13)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(14)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(15)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(16)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(17)'
'X'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(07)'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(03)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(04)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(05)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '0080'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-LGNUM'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS'
i_material-werks.
perform bdc_field using 'RMMG1-LGORT'
i_material-lgort.
perform bdc_field using 'RMMG1-LGNUM'
i_material-lgnum.
perform bdc_field using 'RMMG1-VKORG'
i_material-vkorg.
perform bdc_field using 'RMMG1-VTWEG'
i_material-vtweg.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MEINS'
i_material-meins.
perform bdc_field using 'MARA-MATKL'
i_material-matkl.
perform bdc_field using 'MARA-BISMT'
i_material-bismt.
perform bdc_field using 'MARA-BRGEW'
i_material-brgew.
perform bdc_field using 'MARA-GEWEI'
i_material-gewei.
perform bdc_field using 'MARA-NTGEW'
i_material-ntgew.
perform bdc_field using 'MARA-MAGRV'
i_material-magrv.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MEINS'
i_material-meins.
perform bdc_field using 'MARA-MATKL'
i_material-matkl.
perform bdc_field using 'MARA-SPART'
i_material-spart.
perform bdc_field using 'MVKE-DWERK'
i_material-dwerk.
perform bdc_field using 'BDC_CURSOR'
'MG03STEUER-TAXKM(01)'.
perform bdc_field using 'MG03STEUER-TAXKM(01)'
i_material-taxkm.
perform bdc_dynpro using 'SAPLMGMM' '4200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MTPOS_MARA'
i_material-mtpos_mara.
perform bdc_field using 'MVKE-versg'
i_material-versg.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-BRGEW'
i_material-brgew.
perform bdc_field using 'MARA-GEWEI'
i_material-gewei.
perform bdc_field using 'MARA-NTGEW'
i_material-ntgew.
perform bdc_field using 'BDC_CURSOR'
'MARA-MAGRV'.
perform bdc_field using 'MARA-MAGRV'
i_material-magrv.
perform bdc_field using 'MARA-TRAGR'
i_material-tragr.
perform bdc_field using 'MARC-LADGR'
i_material-ladgr.
perform bdc_field using 'MARC-PRCTR'
i_material-prctr.
perform bdc_field using 'MARC-MTVFP'
i_material-mtvfp.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'BDC_CURSOR'
'J_1IASSVAL-J_1IVALASS'.
perform bdc_field using 'J_1IMTCHID-J_1ICHID'
i_material-chap.
perform bdc_field using 'J_1IMTCHID-J_1ISUBIND'
'X'..
perform bdc_field using 'J_1IMTCHID-J_1ICAPIND'
i_material-mattype.
perform bdc_field using 'J_1IMTCHID-J_1IGRXREF'
i_material-nogrs.
perform bdc_field using 'J_1IMODDET-J_1IMOOM'
i_material-outmat.
perform bdc_field using 'J_1IASSVAL-J_1IFRDATE'
i_material-valid.
perform bdc_field using 'J_1IASSVAL-J_1IWAERS'
i_material-curr.
perform bdc_field using 'J_1IASSVAL-J_1IVALNDP'
i_material-netdeal.
perform bdc_field using 'J_1IASSVAL-J_1IVALASS'
i_material-asess.
*perform bdc_dynpro using 'SAPLMGMM' '4000'.
*perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
*perform bdc_field using 'MAKT-MAKTX'
I_MATERIAL-MAKTX.
*perform bdc_field using 'MVKE-MTPOS'
I_MATERIAL-MTPOS.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'ENTR'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MEINS'
i_material-meins.
perform bdc_field using 'BDC_CURSOR'
'MARC-DISMM'.
perform bdc_field using 'MARC-DISMM'
i_material-dismm.
perform bdc_field using 'MARC-DISPO'
i_material-dispo.
perform bdc_field using 'MARC-DISLS'
i_material-disls.
perform bdc_field using 'MARC-MAABC'
i_material-maabc.
perform bdc_field using 'MARC-DISGR'
i_material-disgr.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARC-FHORI'
i_material-fhori.
perform bdc_field using 'MARC-LGPRO'
i_material-lgpro.
perform bdc_field using 'MARC-LGFSB'
i_material-lgfsb.
perform bdc_field using 'MARC-PLIFZ'
i_material-plifz.
*perform bdc_field using 'MARC-STRGR'
I_MATERIAL-STRGR.
perform bdc_field using 'MARC-BESKZ'
i_material-beskz.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
*perform bdc_field using 'MARC-STRGR'
I_MATERIAL-STRGR.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARC-SAUFT'
'X'.
perform bdc_field using 'MARC-SFEPR'
i_material-sfepr.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MArc-FEVOR'
i_material-fevor.
perform bdc_field using 'MARC-SFCPF'
i_material-sfcpf.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'BDC_CURSOR'
'MBEW-BKLAS'.
perform bdc_field using 'MBEW-BKLAS'
i_material-bklas.
perform bdc_field using 'MBEW-VPRSV'
i_material-vprsv.
perform bdc_field using 'MBEW-PEINH'
i_material-peinh.
perform bdc_field using 'MBEW-STPRS'
i_material-stprs.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'Mbew-kosgr'
i_material-kosgr.
perform bdc_field using 'Mbew-HKMAT'
'X'.
perform bdc_field using 'Mbew-HRKFT'
i_material-hrkft.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
*perform bdc_field using 'Mbew-KOSGR'
I_MATERIAL-KOSGR.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform post_transaction.
refresh bdc_itab.
clear bdc_itab.
endloop.
end-of-selection.
perform finalization.
Start new screen *
form bdc_dynpro using program dynpro.
clear bdc_itab.
bdc_itab-program = program.
bdc_itab-dynpro = dynpro.
bdc_itab-dynbegin = 'X'.
append bdc_itab.
endform. "bdc_dynpro
Insert field *
form bdc_field using fnam fval.
if fval <> ''.
clear bdc_itab.
bdc_itab-fnam = fnam.
bdc_itab-fval = fval.
append bdc_itab.
endif.
endform. "bdc_field
*& Form POST_TRANSACTION
form post_transaction.
refresh messtab.
clear messtab.
call transaction 'MM01' using bdc_itab
mode p_update
update 'S'
messages into messtab.
submit zrpt_plantext with flatfile = p_lgort
with p_matnr = r_matnr
with p_werks = r_werks and return.
read table messtab with key msgtyp = 'E'.
if sy-subrc eq 0.
perform process_error_messages.
add 1 to count-bdc.
if v_chr_opengrp is initial.
perform bdc_open_group.
endif.
call function 'BDC_INSERT'
exporting
tcode = 'MM01'
tables
dynprotab = bdc_itab
exceptions
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
others = 5.
if sy-subrc <> 0.
case sy-subrc.
when 1.
write: / 'Internal error'.
when 2.
write: / 'Not open error'.
when 3.
write: / 'queue error'.
when 4.
write: / 'tcode invalid error'.
when others.
write: / 'other error'.
endcase.
endif.
else.
add +1 to count-create.
format intensified off.
format color col_normal.
format color col_normal off.
endif.
clear bdc_itab.
refresh bdc_itab.
endform. " POST_TRANSACTION
*& Form PROCESS_ERROR_MESSAGES
form process_error_messages.
data: begin of loc_aux_message.
include structure message.
data: end of loc_aux_message.
data : msgno type sy-msgno.
loop at messtab.
move messtab-msgnr to msgno.
call function 'WRITE_MESSAGE'
exporting
msgid = messtab-msgid
msgno = msgno
msgty = messtab-msgtyp
msgv1 = messtab-msgv1
msgv2 = messtab-msgv2
msgv3 = messtab-msgv3
msgv4 = messtab-msgv4
importing
messg = loc_aux_message
exceptions
others = 1.
if sy-subrc eq 0.
format color col_negative on.
write: /10 i_material-matnr.
write: /10 loc_aux_message.
format color col_negative off.
else.
format color col_negative on.
write: /10 i_material-matnr.
write: / 'Error creating message'.
format color col_negative off.
exit.
endif.
endloop.
endform. " PROCESS_ERROR_MESSAGES
*& Form BDC_OPEN_GROUP
form bdc_open_group.
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = p_bdcgrp
holddate = sy-datum
keep = 'X'
user = sy-uname
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11.
if sy-subrc eq 0.
v_chr_opengrp = 'X'.
endif.
endform. " BDC_OPEN_GROUP
*& Form FINALIZATION
form finalization.
if v_chr_opengrp = 'X'.
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
endif.
get time.
skip 2.
write: / 'Time', sy-uzeit.
skip.
format color col_total on.
write: / 'Total Records: ', 40 count-inrec.
write: / 'PERNR not of Emp Group 6 ', 40 count-error.
write: / 'Records Created: ', 40 count-create.
write: / 'BDC Create in group: ', 40 count-bdc.
if v_chr_opengrp = 'X'.
skip 1.
format intensified on.
format color col_negative on.
write: / 'PLEASE USE TRANSACTION "SM35" ',
'TO PROCESS THE GENERATED BDC SESSION ... ',
p_bdcgrp.
endif.
endform. " FINALIZATION -
Mappimg and updation in bdc 'session ' and 'call transaction' methods
What will happen if error record comes while updating in session method and call transaction method.
Hi,
If any error comes in Session method U can find that error in SM35->Log
and updste again database for those enteries
In cll transaction Method U have to handel error manually . for this u have to use structure BDCMSGCOL and Table T100.
Regards
Gaurav
Maybe you are looking for
-
The option to edit in Photoshop from lightroom is grey out.
I'm on a PC, been editing photos in lightroom. Just downloaded some photoshop presets. Edited some photos using the presets. Now when I go to edit photos using the photos/edit in...all options are greyed out. I've restarted my compute, updated both l
-
Editing 5.1 Using SPDIF
I am using a sound card from my computer that outputs over my digital SPDIF connection directly to a receiver that decodes Dolkby, PCM, etc... If I am watchign a movie or listening to audio that is encoding, I have no problem with surround sound. I w
-
Logic for this comparision of character type operands.
Source field name: ZDCNFG Target Info Objects: ZDVD59 ZDVD10 ZDVD14 ZDVD18 ZDVD25 ZDVD50 Scenario1: If ZDCNFG = 2(10). 2 is quantity and 10 in brackets is part number (DVD format). So I will have to update the quantity respective field as shown below
-
ISE wireless CPP with redirect exclusions, possible?
Hi all, a little bit of a tricky situation here. I've got a wireless network and ISE 1.1.1. The wireless is mixed 7.0 and 7.3 code. On an ISE wired installation it's easy to have an authorization rule that URL redirects users to the client provisioni
-
How do I uninstall labview application with no uninstall program
I have built an application and selected to not have an "uninstall" application in the various 5.1 app builder options. I did not think this would be a problem since I thought the application would show up in my add/remove programs and could be remov