Hi bdc
hi
i have uploaded data from flat file for VA01 successfully.
now system generates sales order no automatically after uploading data.
i want to show this sales order no in bdc report.
the difficult is that sales order no vbeln itself is a primary key so how can i display
in the bdc report the system generated sales order no.
important vbeln itself is a primary key.
since it is missing how can i display in the bdc report sales order no.
we can not use select querry for this for sure.
thanx
rocky
all the message will be saved in a message table in bdc...where ever message type is 'S' then it resembles that its posted catch that message to a itab and display...below is a prg that i used to catch the document no for prd posting...just look at that.
it consists of a include file ...im displaying it below the main program
the messages are caught in the main program after a call transaction is made...
MAIN PROGRAM
REPORT ZBDC_POSTING
NO STANDARD PAGE HEADING LINE-SIZE 255
MESSAGE-ID ZPP.
INCLUDE BDCRECX1.
*PARAMETERS: dataset(132) LOWER CASE.
TYPE-POOLS :SLIS.
TABLES : MAKT, MKAL.
DATA: WK_ELPRO TYPE MKAL-ALORT,
WK_MAKT TYPE MAKT-MAKTX,
WK_SUCCESS(5) TYPE C,
WK_FAILURE(5) TYPE C,
L_MSTRING(480),
T_DATE TYPE ZSERVICE_DATE,
WK_LINES(5) TYPE C,
LINES(5) TYPE C,
WK_LEN(150) TYPE C,
WK_ALP TYPE I,
LENT TYPE I,
B(4).
DATA: ALVFLD TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
V_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,
WK_EVENTS LIKE LINE OF V_EVENTS,
IT_LIST_COMMENTS TYPE SLIS_T_LISTHEADER,
WK_LIST_COMMENTS LIKE LINE OF IT_LIST_COMMENTS,
WA_COLOR TYPE LVC_S_SCOL,
WK_LAYOUT TYPE SLIS_LAYOUT_ALV.
CONSTANTS: C_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME
VALUE 'F_TOP_OF_PAGE'.
--TO STORE FINAL DATA TO BE POSTED--
Generated data section with specific formatting - DO NOT CHANGE ***
DATA: BEGIN OF RECORD OCCURS 0,
BUDAT_002(010),
BKTXT_004(025),
MATNR_005(018),
WERKS_006(004),
ALORT_007(004),
ERFMG_008(017),
END OF RECORD.
End generated data section ***
DATA: BEGIN OF MESSAGES OCCURS 0, "TO STORE FINAL STATUS DISPLAY
BUDAT_002(010),
BKTXT_004(025),
MATNR_005(018),
MAKTX TYPE MAKT-MAKTX,
WERKS_006(004),
ALORT_007(004),
ERFMG_008(017),
MSG_E(100),
MSG_S(100),
MSGTYP TYPE C,
LINE_COLOR(4),
END OF MESSAGES.
DATA: BEGIN OF ST_RECORD1 ,
MATNR_005(018),
WERKS_006(004),
BUDAT_002(010),
BKTXT_004(025),
ERFMG_007(017),
ERFMG_008(017),
ALORT_007(004),
END OF ST_RECORD1.
DATA : RECORD1 LIKE TABLE OF ST_RECORD1 WITH HEADER LINE,
IT_EXCEL LIKE TABLE OF ALSMEX_TABLINE WITH HEADER LINE,
MESSTAB1 LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE,
IT_ACC LIKE TABLE OF RECORD WITH HEADER LINE,
IT_REJ LIKE TABLE OF RECORD WITH HEADER LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS: P_FILE TYPE LOCALFILE OBLIGATORY .
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
FILE_NAME = P_FILE.
AT SELECTION-SCREEN ON P_FILE.
WK_LEN = P_FILE.
CONDENSE WK_LEN NO-GAPS.
LENT = STRLEN( WK_LEN ).
WK_ALP = LENT - 4.
B = WK_LEN+WK_ALP(LENT).
IF ( B NE '.txt' ) AND ( B NE '.xls' ).
MESSAGE E939.
CLEAR P_FILE.
STOP.
ENDIF.
START-OF-SELECTION.
PERFORM UPLOAD_FUN.
PERFORM OPEN_GROUP.
PERFORM FILL_BDC_TABLE.
PERFORM CLOSE_GROUP.
PERFORM ASSIGN_COLORS.
PERFORM F_EVENT_BUILD.
SORT MESSAGES BY MATNR_005 ASCENDING.
PERFORM ASSIGN_COLUMNS.
PERFORM COUNT.
IF CTU = 'X'.
PERFORM ALV.
ENDIF.
FREE:MESSAGES,MESSTAB1,RECORD1.
END-OF-SELECTION.
--FORM UPLOAD_FUN--
FORM UPLOAD_FUN.
REFRESH: RECORD1, IT_ACC, IT_REJ, RECORD, MESSAGES, MESSTAB1, IT_EXCEL.
PERFORM FETCH_FROM_FLAT_FILE.
CLEAR IT_EXCEL.
DESCRIBE TABLE IT_EXCEL.
IF SY-TFILL = 0.
MESSAGE I937.
STOP.
ENDIF.
LOOP AT IT_EXCEL.
CASE IT_EXCEL-COL.
WHEN '0001'.
MOVE: IT_EXCEL-VALUE TO RECORD1-MATNR_005.
WHEN '0002'.
MOVE: IT_EXCEL-VALUE TO RECORD1-WERKS_006.
WHEN '0003'.
MOVE: IT_EXCEL-VALUE TO RECORD1-BUDAT_002.
WHEN '0004'.
MOVE: IT_EXCEL-VALUE TO RECORD1-BKTXT_004.
WHEN '0005'.
MOVE: IT_EXCEL-VALUE TO RECORD1-ERFMG_007.
WHEN '0006'.
MOVE: IT_EXCEL-VALUE TO RECORD1-ERFMG_008.
WHEN '0007'.
MOVE: IT_EXCEL-VALUE TO RECORD1-ALORT_007.
ENDCASE.
AT END OF ROW.
APPEND RECORD1.
CLEAR RECORD1.
ENDAT.
ENDLOOP.
CLEAR RECORD1.
DELETE RECORD1 WHERE MATNR_005 EQ ' '.
--DO NOT UPLOAD WHERE PRD QTY = 0--
DELETE RECORD1 WHERE ( ERFMG_007 = 0 OR ERFMG_007 = ' ' )
AND ( ERFMG_008 = 0 OR ERFMG_008 = ' ' ).
DESCRIBE TABLE RECORD1[].
IF SY-TFILL > 0.
--MOVE ACCEPTED QTY AND FETCH THE RESPECTIVE STGLOC-**
LOOP AT RECORD1 WHERE ERFMG_007 NE 0 AND ERFMG_007 NE ' '.
MOVE: RECORD1-BUDAT_002 TO IT_ACC-BUDAT_002,
RECORD1-BKTXT_004 TO IT_ACC-BKTXT_004,
RECORD1-MATNR_005 TO IT_ACC-MATNR_005,
RECORD1-WERKS_006 TO IT_ACC-WERKS_006,
RECORD1-ERFMG_007 TO IT_ACC-ERFMG_008.
APPEND IT_ACC.
CLEAR: IT_ACC,RECORD1.
ENDLOOP.
--MOVE ELPRO FOR THE ACCEPTED ENTRIES--
LOOP AT IT_ACC.
SELECT SINGLE ELPRO INTO WK_ELPRO FROM MKAL CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATNR = IT_ACC-MATNR_005
AND WERKS = IT_ACC-WERKS_006.
MOVE WK_ELPRO TO IT_ACC-ALORT_007.
MODIFY IT_ACC.
CLEAR: WK_ELPRO, IT_ACC.
ENDLOOP.
--MOVE PRD QTY FOR REJECTED QTY--
LOOP AT RECORD1 WHERE ERFMG_008 NE 0 AND ERFMG_008 NE ' '.
MOVE: RECORD1-BUDAT_002 TO IT_REJ-BUDAT_002,
RECORD1-BKTXT_004 TO IT_REJ-BKTXT_004,
RECORD1-MATNR_005 TO IT_REJ-MATNR_005,
RECORD1-WERKS_006 TO IT_REJ-WERKS_006,
RECORD1-ERFMG_008 TO IT_REJ-ERFMG_008,
RECORD1-ALORT_007 TO IT_REJ-ALORT_007.
APPEND IT_REJ.
CLEAR: IT_REJ, RECORD1.
ENDLOOP.
--MOVE ACCEPTED AND REJECTED READINGS TO FINAL TABLE
APPEND LINES OF IT_ACC TO RECORD.
APPEND LINES OF IT_REJ TO RECORD.
FREE : IT_REJ, IT_ACC, RECORD1.
ELSE.
MESSAGE I937.
STOP.
ENDIF.
ENDFORM. " UPLOAD_FUN
--FORM fill_bdc_table--
FORM FILL_BDC_TABLE.
IF NOT RECORD[] IS INITIAL.
LOOP AT RECORD.
PERFORM BDC_DYNPRO USING 'SAPLBARM' '0800'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'RM61B-BKTXT'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ISTDA'.
PERFORM BDC_FIELD USING 'RM61B-BUDAT' RECORD-BUDAT_002.
PERFORM BDC_FIELD USING 'RM61B-BKTXT' RECORD-BKTXT_004.
PERFORM BDC_FIELD USING 'RM61B-MATNR' RECORD-MATNR_005.
PERFORM BDC_FIELD USING 'RM61B-WERKS' RECORD-WERKS_006.
PERFORM BDC_FIELD USING 'RM61B-ALORT' RECORD-ALORT_007.
PERFORM BDC_FIELD USING 'RM61B-ERFMG' RECORD-ERFMG_008.
PERFORM BDC_DYNPRO USING 'SAPLCOWB' '0130'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=WEIT'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'G_COWB_HEADER-MNGTXT'.
PERFORM BDC_TRANSACTION USING 'MFBF'.
CLEAR MESSTAB.
APPEND LINES OF MESSTAB TO MESSTAB1.
CLEAR MESSTAB1.
LOOP AT MESSTAB1 WHERE MSGTYP = 'S' OR MSGTYP = 'E' OR MSGTYP = 'W'.
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB1-MSGSPRA
AND ARBGB = MESSTAB1-MSGID
AND MSGNR = MESSTAB1-MSGNR.
IF SY-SUBRC = 0.
L_MSTRING = T100-TEXT.
IF L_MSTRING CS '&1'.
REPLACE '&1' WITH MESSTAB1-MSGV1 INTO L_MSTRING.
REPLACE '&2' WITH MESSTAB1-MSGV2 INTO L_MSTRING.
REPLACE '&3' WITH MESSTAB1-MSGV3 INTO L_MSTRING.
REPLACE '&4' WITH MESSTAB1-MSGV4 INTO L_MSTRING.
ELSE.
REPLACE '&' WITH MESSTAB1-MSGV1 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB1-MSGV2 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB1-MSGV3 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB1-MSGV4 INTO L_MSTRING.
ENDIF.
CONDENSE L_MSTRING.
IF MESSTAB1-MSGTYP = 'E'.
MOVE L_MSTRING TO MESSAGES-MSG_E.
MOVE 'E' TO MESSAGES-MSGTYP.
ELSEIF MESSTAB1-MSGTYP = 'S'.
MOVE L_MSTRING TO MESSAGES-MSG_S.
MOVE 'S' TO MESSAGES-MSGTYP.
ENDIF.
ENDIF.
CLEAR L_MSTRING.
ENDLOOP.
MOVE-CORRESPONDING RECORD TO MESSAGES.
SELECT SINGLE MAKTX INTO WK_MAKT FROM MAKT CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATNR = MESSAGES-MATNR_005.
MOVE:WK_MAKT TO MESSAGES-MAKTX.
APPEND MESSAGES.
CLEAR: MESSAGES, WK_MAKT, MESSTAB1.
REFRESH MESSTAB1.
ENDLOOP.
ENDIF.
ENDFORM. "fill_bdc_table
--FORM assign_columns--
FORM ASSIGN_COLUMNS .
REFRESH ALVFLD.
MOVE :'1' TO ALVFLD-COL_POS.
MOVE :'MATNR_005' TO ALVFLD-FIELDNAME.
MOVE :'PART NO' TO ALVFLD-SELTEXT_M.
MOVE :'X' TO ALVFLD-FIX_COLUMN.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'2' TO ALVFLD-COL_POS.
MOVE :'MAKTX' TO ALVFLD-FIELDNAME.
MOVE :'DESCRIPTION' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'3' TO ALVFLD-COL_POS.
MOVE :'WERKS_006' TO ALVFLD-FIELDNAME.
MOVE :'PLANT' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'4' TO ALVFLD-COL_POS.
MOVE :'BUDAT_002' TO ALVFLD-FIELDNAME.
MOVE :'POSTING DATE' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'5' TO ALVFLD-COL_POS.
MOVE :'BKTXT_004' TO ALVFLD-FIELDNAME.
MOVE :'SHIFT' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'6' TO ALVFLD-COL_POS.
MOVE :'ERFMG_008' TO ALVFLD-FIELDNAME.
MOVE :'QTY' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'7' TO ALVFLD-COL_POS.
MOVE :'ALORT_007' TO ALVFLD-FIELDNAME.
MOVE :'STGLOC' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'8' TO ALVFLD-COL_POS.
MOVE :'MSG_E' TO ALVFLD-FIELDNAME.
MOVE :'ERRORS' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
MOVE :'9' TO ALVFLD-COL_POS.
MOVE :'MSG_S' TO ALVFLD-FIELDNAME.
MOVE :'STATUS' TO ALVFLD-SELTEXT_M.
APPEND ALVFLD.CLEAR ALVFLD.
ENDFORM. " assign_columns
--FORM f_event_build--
FORM F_EVENT_BUILD .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS[].
READ TABLE V_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO WK_EVENTS.
WK_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
WK_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
IF SY-SUBRC = 0.
MOVE C_FORMNAME_TOP_OF_PAGE TO WK_EVENTS-FORM.
MODIFY V_EVENTS FROM WK_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " f_event_build
--FORM f_top_of_page--
FORM F_TOP_OF_PAGE.
WRITE SY-DATUM TO T_DATE.
CLEAR: IT_LIST_COMMENTS[].
WK_LIST_COMMENTS-TYP = 'H'. "H=Header, S=Selection, A=Action
WK_LIST_COMMENTS-KEY = ''.
WK_LIST_COMMENTS-INFO = 'UPLOAD STATUS FOR PRODUCTION POSTING'.
APPEND WK_LIST_COMMENTS TO IT_LIST_COMMENTS.
CLEAR WK_LIST_COMMENTS.
WK_LIST_COMMENTS-TYP = 'S'. "H=Header, S=Selection, A=Action
WK_LIST_COMMENTS-KEY = ''.
CONCATENATE 'Uploaded Date:' T_DATE INTO WK_LIST_COMMENTS-INFO
SEPARATED BY SPACE.
APPEND WK_LIST_COMMENTS TO IT_LIST_COMMENTS.
CLEAR WK_LIST_COMMENTS.
DESCRIBE TABLE MESSAGES LINES WK_LINES.
LINES = WK_LINES.
WK_LIST_COMMENTS-TYP = 'S'. "H=Header, S=Selection, A=Action
WK_LIST_COMMENTS-KEY = ''.
CONCATENATE 'Total No of records:' LINES INTO WK_LIST_COMMENTS-INFO
SEPARATED BY SPACE.
APPEND WK_LIST_COMMENTS TO IT_LIST_COMMENTS.
CLEAR WK_LIST_COMMENTS.
WK_LIST_COMMENTS-TYP = 'S'. "H=Header, S=Selection, A=Action
WK_LIST_COMMENTS-KEY = ''.
CONCATENATE 'Successfull Entries:' WK_SUCCESS INTO
WK_LIST_COMMENTS-INFO SEPARATED BY SPACE.
APPEND WK_LIST_COMMENTS TO IT_LIST_COMMENTS.
CLEAR WK_LIST_COMMENTS.
WK_LIST_COMMENTS-TYP = 'S'. "H=Header, S=Selection, A=Action
WK_LIST_COMMENTS-KEY = ''.
CONCATENATE 'Failed Entries:' WK_FAILURE INTO WK_LIST_COMMENTS-INFO
SEPARATED BY SPACE.
APPEND WK_LIST_COMMENTS TO IT_LIST_COMMENTS.
CLEAR WK_LIST_COMMENTS.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = IT_LIST_COMMENTS.
ENDFORM. "F_TOP_OF_PAGE
--FORM assign_colors--
FORM ASSIGN_COLORS .
LOOP AT MESSAGES.
CASE MESSAGES-MSGTYP.
WHEN 'E'.
MESSAGES-LINE_COLOR = 'C601'.
WHEN 'S'.
MESSAGES-LINE_COLOR = 'C501'.
ENDCASE.
MODIFY MESSAGES.
ENDLOOP.
ENDFORM. " assign_colors
--FORM COUNT--
FORM COUNT .
LOOP AT MESSAGES.
CASE MESSAGES-MSGTYP.
WHEN 'E'.
ADD 1 TO WK_FAILURE.
WHEN 'S'.
ADD 1 TO WK_SUCCESS.
ENDCASE.
ENDLOOP.
ENDFORM. " COUNT
--FORM ALV--
FORM ALV .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_BACKGROUND_ID = 'ALV_BACKGROUND'
IS_LAYOUT = WK_LAYOUT
IT_FIELDCAT = ALVFLD[]
IT_EVENTS = V_EVENTS[]
TABLES
T_OUTTAB = MESSAGES
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " ALV
--FETCH_FROM_FLAT_FILE--
FORM FETCH_FROM_FLAT_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1 "From 1st Column
I_BEGIN_ROW = 2 "From 2nd row
I_END_COL = 7 "Till &th Column
I_END_ROW = 65000 "Till Row
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
ENDFORM. " FETCH_FROM_FLAT_FILE
INCLUDE***************
***INCLUDE BDCRECX1.
for programs doing a data transfer by creating a batch-input session
and
for programs doing a data transfer by CALL TRANSACTION USING
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS SESSION RADIOBUTTON GROUP CTU. "create session
SELECTION-SCREEN COMMENT 3(20) TEXT-S07 FOR FIELD SESSION.
SELECTION-SCREEN POSITION 45.
PARAMETERS CTU RADIOBUTTON GROUP CTU. "call transaction
SELECTION-SCREEN COMMENT 48(20) TEXT-S08 FOR FIELD CTU.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S01 FOR FIELD GROUP.
SELECTION-SCREEN POSITION 25.
PARAMETERS GROUP(12). "group name of session
SELECTION-SCREEN COMMENT 48(20) TEXT-S05 FOR FIELD CTUMODE.
SELECTION-SCREEN POSITION 70.
PARAMETERS CTUMODE LIKE CTU_PARAMS-DISMODE DEFAULT 'N'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S02 FOR FIELD USER.
SELECTION-SCREEN POSITION 25.
PARAMETERS: USER(12) DEFAULT SY-UNAME. "user for session in batch
SELECTION-SCREEN COMMENT 48(20) TEXT-S06 FOR FIELD CUPDATE.
SELECTION-SCREEN POSITION 70.
PARAMETERS CUPDATE LIKE CTU_PARAMS-UPDMODE DEFAULT 'L'.
"S: synchronously
"A: asynchronously
"L: local
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S03 FOR FIELD KEEP.
SELECTION-SCREEN POSITION 25.
PARAMETERS: KEEP AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN COMMENT 48(20) TEXT-S09 FOR FIELD E_GROUP.
SELECTION-SCREEN POSITION 70.
PARAMETERS E_GROUP(12). "group name of error-session
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S04 FOR FIELD HOLDDATE.
SELECTION-SCREEN POSITION 25.
PARAMETERS: HOLDDATE LIKE SY-DATUM.
SELECTION-SCREEN COMMENT 51(17) TEXT-S02 FOR FIELD E_USER.
SELECTION-SCREEN POSITION 70.
PARAMETERS: E_USER(12) DEFAULT SY-UNAME. "user for error-session
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 51(17) TEXT-S03 FOR FIELD E_KEEP.
SELECTION-SCREEN POSITION 70.
PARAMETERS: E_KEEP AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 51(17) TEXT-S04 FOR FIELD E_HDATE.
SELECTION-SCREEN POSITION 70.
PARAMETERS: E_HDATE LIKE SY-DATUM.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) TEXT-S10 FOR FIELD NODATA.
PARAMETERS: NODATA DEFAULT '/' LOWER CASE. "nodata
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) FOR FIELD SMALLLOG.
PARAMETERS: SMALLLOG AS CHECKBOX. "' ' = log all transactions
"'X' = no transaction logging
SELECTION-SCREEN END OF LINE.
data definition
Batchinputdata of single transaction
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
messages of call transaction
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
error session opened (' ' or 'X')
DATA: E_GROUP_OPENED.
message texts
TABLES: T100.
at selection screen *
AT SELECTION-SCREEN.
group and user must be filled for create session
IF SESSION = 'X' AND
GROUP = SPACE OR USER = SPACE.
MESSAGE E613(MS).
ENDIF.
open dataset *
FORM OPEN_DATASET USING P_DATASET.
OPEN DATASET P_DATASET
FOR INPUT IN TEXT MODE
ENCODING DEFAULT.
IF SY-SUBRC <> 0.
WRITE: / TEXT-E00, SY-SUBRC.
STOP.
ENDIF.
ENDFORM.
close dataset *
FORM CLOSE_DATASET USING P_DATASET.
CLOSE DATASET P_DATASET.
ENDFORM.
create batchinput session *
(not for call transaction using...) *
FORM OPEN_GROUP.
IF SESSION = 'X'.
SKIP.
WRITE: /(20) 'Create group'(I01), GROUP.
SKIP.
open batchinput group
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING CLIENT = SY-MANDT
GROUP = GROUP
USER = USER
KEEP = KEEP
HOLDDATE = HOLDDATE.
WRITE: /(30) 'BDC_OPEN_GROUP'(I02),
(12) 'returncode:'(I05),
SY-SUBRC.
ENDIF.
ENDFORM.
end batchinput session *
(call transaction using...: error session) *
FORM CLOSE_GROUP.
IF SESSION = 'X'.
close batchinput group
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
(12) 'returncode:'(I05),
SY-SUBRC.
ELSE.
IF E_GROUP_OPENED = 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /.
WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
E_GROUP_OPENED = ' '.
ENDIF.
ENDIF.
ENDFORM.
Start new transaction according to parameters *
FORM BDC_TRANSACTION USING TCODE.
DATA: L_MSTRING(480).
DATA: L_SUBRC LIKE SY-SUBRC.
batch input session
IF SESSION = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING TCODE = TCODE
TABLES DYNPROTAB = BDCDATA.
IF SMALLLOG <> 'X'.
WRITE: / 'BDC_INSERT'(I03),
TCODE,
'returncode:'(I05),
SY-SUBRC,
'RECORD:',
SY-INDEX.
ENDIF.
call transaction using
ELSE.
REFRESH MESSTAB.
CALL TRANSACTION TCODE USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
IF SMALLLOG <> 'X'.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
LOOP AT MESSTAB.
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
L_MSTRING = T100-TEXT.
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.
WRITE: / MESSTAB-MSGTYP, L_MSTRING(250).
ELSE.
WRITE: / MESSTAB.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
Erzeugen fehlermappe ************************************************
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'
EXPORTING TCODE = TCODE
TABLES DYNPROTAB = BDCDATA.
ENDIF.
ENDIF.
REFRESH BDCDATA.
ENDFORM.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
Similar Messages
-
Error while running a BDC for the Transaction F-02
Hi,
I'm getting an error <b><i>"Parking not possible during Batch Input"</i></b> while running a BDC for the transaction F-02.
When i click on the error message it displays the message [b<i>]"In Customizing, you can control whether an error message is issued."</b></i>
How to solve this issue?.
Waiting for ur replies.........
Regards
N.SenthilHi,
When you are doing the recording in SHDB, and in the same screen where the TCODE to be recorded is given, there are options that you can choose called "Recording Parameters"...Select the checkbox which says "Not a Batch Input Session", this will set the sy-binpt variable to " "(in a recording by default it is "X")...and you will not get this error...
Also make sure while writing the BDC program to make use of the "bdc options" parameter which has this property to switch of sy-binpt...
Refer below theard for sample bdc code for f-02.
https://forums.sdn.sap.com/click.jspa?searchID=5126766&messageID=1538409
Regards -
Unable to update the serial number through bdc in Sales Order
Hi experts,
I written the inboud FM for to update the 3rd party items serial number to the sales orders through BDC Call transaction Method.
Here i am facing a problem when i have the 19 item Quan ,it is updating correct through idoc , when ever there is moe than 19 and at that if any serial number repeated for that if i am changing at that time it is loosing the control of the BDC and giving the control to the salesorder screen.
how can i handle that control again has to come to BDC prgrm......
Thnks,
Regards,
BharaniHi,
Can you please let me know the segment in ORDERS05 Idoc to process the Payment card information and if the standard Function Module can handle the creation of a Sales Order with data for Payment Card.
We have a requirement to map the Tokenized Number of the Credit Card send from a store front end to ECC mapping via SAP-PI.
Thanks in Advance, -
MULTIPLE ITEM PROBLEM IN VL31N BDC
hI FRIENDS ,
I AM POSTING A BDC OF TRANSACTION VL31N ,ie FOR SCHEDULE AGREEMENT INBOUND DELIVERY.I CREATE A FUNCTIONAL MODULE OF THE SAME AND CALL IT FROM AN ASP PAGE,IN THAT THERE IS PO NUMBER 5500000986 WHICH HAS TWO ITEMES 62 AND 95 RESPECTIVLY OF SAME MATARIAL NUMBER R010230123041002 AND DIE NUMBER 2304P,NOW THE PROBLEM IS THIS BDC IS WORKING WHEN THERE IS ONLY ONE ITEM BUT GIVES AN ERROR "CANT CREAT INBOUND DELIVERY FOR PO NO ...' WNEN IT HAS MULTIPLE ITEM.WHAT SHOULD I DO ? I ALSO USED LOOP BUT IT ALSO DOSENT WORK AS IT WILL ADD ALL OPEN QTY OF PO 986 AND UPDATE AGAINST ITEM NO 95.
CODE IS AS FOLLOWS:.........
FUNCTION y_synie_bdcinbdly.
""Local interface:
*" IMPORTING
*" VALUE(CTU) LIKE APQI-PUTACTIVE DEFAULT 'X'
*" VALUE(MODE) LIKE APQI-PUTACTIVE DEFAULT 'N'
*" VALUE(UPDATE) LIKE APQI-PUTACTIVE DEFAULT 'L'
*" VALUE(GROUP) LIKE APQI-GROUPID OPTIONAL
*" VALUE(USER) LIKE APQI-USERID OPTIONAL
*" VALUE(KEEP) LIKE APQI-QERASE OPTIONAL
*" VALUE(HOLDDATE) LIKE APQI-STARTDATE OPTIONAL
*" VALUE(NODATA) LIKE APQI-PUTACTIVE DEFAULT '/'
*" VALUE(EXTNID) LIKE MAKT-MAKTG
*" VALUE(VENDORNO) LIKE LFA1-LIFNR
*" VALUE(PONUMBER) LIKE EKKO-EBELN
*" VALUE(ITEMNUMBER) LIKE LIPS-VGPOS
*" VALUE(MATERIAL) LIKE MAKT-MAKTG
*" VALUE(DLYQTY) LIKE LIPS-LFIMG
*" VALUE(BTCHNO) LIKE LIPS-CHARG
*" VALUE(POSLR) LIKE EKES-EBELP OPTIONAL
*" EXPORTING
*" VALUE(SUBRC) LIKE SYST-SUBRC
*" VALUE(INDELYNO) LIKE SY-MSGV2
*" VALUE(MSG1) LIKE SY-MSGV1
*" VALUE(MSG2) LIKE SY-MSGV2
*" VALUE(MSG3) LIKE SY-MSGV3
*" VALUE(MSG4) LIKE SY-MSGV4
*" TABLES
*" MESSTAB STRUCTURE BDCMSGCOLL
*" ERRTAB STRUCTURE YSYNERRMSGS
*" INDLYTAB STRUCTURE YSYN_QTYTAB
Updated by ANAND SYNISE 19.1.2007
DATA: BEGIN OF bdctab OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdctab.
DATA: datenow(10) TYPE c,
fldvar(30) TYPE c,
fldno TYPE i,
flditoc(6) TYPE c,
qty(13) TYPE c.
DATA maxposnr LIKE lips-posnr.
DATA testposnr TYPE posnr.
DATA itemnoint TYPE i.
CONCATENATE sy-datum6(2) '.' sy-datum4(2) '.' sy-datum+0(4) INTO datenow.
CLEAR bdctab.
REFRESH bdctab.
PERFORM open_group USING group user keep holddate ctu.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '4007'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'RV50A-VERUR_LA'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = '/00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIKP-LIFNR'.
bdctab-fval = vendorno.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LV50C-BSTNR'.
bdctab-fval = ponumber.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFDAT_LA'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFUHR_LA'.
bdctab-fval = '00:00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-VERUR_LA'.
bdctab-fval = extnid.
APPEND bdctab.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '1000'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = '=MKAL_T'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'LIKP-BLDAT'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIKP-BLDAT'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFDAT_LA'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFUHR_LA'.
bdctab-fval = '00:00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '1000'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = '=POPO_T'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIKP-BLDAT'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'LIPS-POSNR(01)'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFDAT_LA'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFUHR_LA'.
bdctab-fval = '00:00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '0111'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'RV50A-PO_MATNR'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = 'WEIT'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-PO_MATNR'.
bdctab-fval = material.
APPEND bdctab.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '1000'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = '=POLO_T'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIKP-BLDAT'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'LIPS-POSNR(01)'.
APPEND bdctab.
*ADDED BY ANAND ON 22-01-2007
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = ITEMNUMBER . "ITEMNUMBER = LIPS-VGPOS
APPEND bdctab.
************ENDED***********************
ADDED BY MILIND 19.01.2007
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = poslr .
APPEND bdctab.
* ENDED * *
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFDAT_LA'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFUHR_LA'.
bdctab-fval = '00:00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LIPS_SELKZ(01)'.
bdctab-fval = ''.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '1000'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = '/00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIKP-BLDAT'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'LIPS-CHARG(01)'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFDAT_LA'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFUHR_LA'.
bdctab-fval = '00:00'.
APPEND bdctab.
CLEAR bdctab.
QTY = INDLYTAB-DLYQTY.
qty = dlyqty.
bdctab-fnam = 'LIPSD-G_LFIMG(01)'.
bdctab-fval = QTY.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIPS-CHARG(01)'.
* BDCTAB-FVAL = INDLYTAB-BTCHNO.
bdctab-fval = btchno.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-program = 'SAPMV50A'.
bdctab-dynpro = '1000'.
bdctab-dynbegin = 'X'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_OKCODE'.
bdctab-fval = '=SICH_T'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'LIKP-BLDAT'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_CURSOR'.
bdctab-fval = 'LIPS-MATNR(02)'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFDAT_LA'.
bdctab-fval = datenow.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'RV50A-LFUHR_LA'.
bdctab-fval = '00:00'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CLEAR bdctab.
bdctab-fnam = 'BDC_SUBSCR'.
bdctab-fval = 'SAPMV50A'.
APPEND bdctab.
CALL TRANSACTION 'VL31N' USING bdctab MODE 'N' MESSAGES INTO messtab.
subrc = sy-subrc.
PERFORM close_group USING ctu.
CLEAR bdctab.
REFRESH bdctab.
IF sy-subrc EQ 0.
indelyno = sy-msgv2.
ENDIF.
LOOP AT messtab.
MOVE: messtab-msgid TO errtab-msgid,
messtab-msgnr TO errtab-msgnr,
messtab-msgv1 TO errtab-msg1,
messtab-msgv2 TO errtab-msg2,
messtab-msgv3 TO errtab-msg3,
messtab-msgv4 TO errtab-msg4.
APPEND ERRtab.
ENDLOOP.
LOOP AT errtab.
SELECT SINGLE text FROM t100
INTO errtab-errmsg
WHERE msgnr EQ errtab-msgnr AND arbgb EQ errtab-msgid
AND sprsl EQ sy-langu.
MODIFY errtab.
ENDLOOP.
ENDFUNCTION.Hi,
Check this code:
REPORT Z_CUSTOMER_UPLOAD .
D A T A D E C L A R A T I O N S *
DATA:BEGIN OF IT_CUSTOMER OCCURS 0,
KUNNR LIKE MV10A-KUNNR,
VKORG LIKE MV10A-VKORG,
VTWEG LIKE MV10A-VTWEG,
MATNR LIKE MV10A-MATNR,
KDMAT LIKE MV10A-KDMAT,
MEGRU LIKE MV10A-MEGRU,
SELKZ TYPE C value 'X',
LPRIO LIKE MV10A-LPRIO,
ANTLF LIKE MV10A-ANTLF,
END OF IT_CUSTOMER.
DATA:BEGIN OF IT_success OCCURS 0,
KUNNR LIKE MV10A-KUNNR,
VKORG LIKE MV10A-VKORG,
VTWEG LIKE MV10A-VTWEG,
MATNR LIKE MV10A-MATNR,
KDMAT LIKE MV10A-KDMAT,
MEGRU LIKE MV10A-MEGRU,
SELKZ TYPE C value 'X',
LPRIO LIKE MV10A-LPRIO,
ANTLF LIKE MV10A-ANTLF,
END OF IT_success.
DATA:BEGIN OF IT_error OCCURS 0,
KUNNR LIKE MV10A-KUNNR,
VKORG LIKE MV10A-VKORG,
VTWEG LIKE MV10A-VTWEG,
MATNR LIKE MV10A-MATNR,
KDMAT LIKE MV10A-KDMAT,
MEGRU LIKE MV10A-MEGRU,
SELKZ TYPE C value 'X',
LPRIO LIKE MV10A-LPRIO,
ANTLF LIKE MV10A-ANTLF,
END OF IT_error.
DATA: L_INDEX TYPE SY-TABIX.
DATA:IT_BDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
ERROR MESSAGE TABLE
DATA:IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : C_S TYPE C VALUE 'S',
C_E TYPE C VALUE 'E'.
*DATA: IT_SUCCESS LIKE IT_CUSTOMER OCCURS 0,
IT_ERROR LIKE IT_CUSTOMER OCCURS 0.
DATA : V_RECTOT TYPE I,
V_RECERR TYPE I,
V_RECSUC TYPE I.
S E L E C T I O N - S C R E E N *
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER : P_FILE LIKE RLGRAP-FILENAME .
SELECTION-SCREEN : END OF BLOCK B1.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
to get F4 help for p_file
PERFORM F4_FILENAME USING P_FILE.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
Uploading data from flat file into it_tab
PERFORM BDC_UPLOAD USING P_FILE.
PERFORM PROCESS_DATA.
PERFORM POPULATE_BDC.
E N D O F S E L E C T I O N *
*END-OF-SELECTION.
PERFORM DISPLAY_REPORT.
*& Form F4_FILENAME
text
-->P_P_FILE text
FORM F4_FILENAME USING P_P_FILE.
DATA:L_FILE TYPE IBIPPARMS-PATH.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = L_FILE .
P_P_FILE = L_FILE.
ENDFORM. " F4_FILENAME
*& Form BDC_UPLOAD
text
-->P_P_FILE text
FORM BDC_UPLOAD USING P_P_FILE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 8
I_END_ROW = 1000
TABLES
INTERN = IT_DATA
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
ENDFORM. " BDC_UPLOAD
*& Form PROCESS_DATA
text
--> p1 text
<-- p2 text
FORM PROCESS_DATA.
SORT IT_DATA BY ROW COL.
LOOP AT IT_DATA.
CASE IT_DATA-COL.
WHEN 1.
IT_CUSTOMER-KUNNR = IT_DATA-VALUE.
WHEN 2.
IT_CUSTOMER-VKORG = IT_DATA-VALUE.
WHEN 3.
IT_CUSTOMER-VTWEG = IT_DATA-VALUE.
WHEN 4.
IT_CUSTOMER-MATNR = IT_DATA-VALUE.
WHEN 5.
IT_CUSTOMER-KDMAT = IT_DATA-VALUE.
WHEN 6.
IT_CUSTOMER-MEGRU = IT_DATA-VALUE.
WHEN 7.
IT_CUSTOMER-LPRIO = IT_DATA-VALUE.
WHEN 8.
IT_CUSTOMER-ANTLF = IT_DATA-VALUE.
APPEND IT_CUSTOMER.
ENDCASE.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form POPULATE_BDC
text
--> p1 text
<-- p2 text
FORM POPULATE_BDC.
DATA:L_COUNTER TYPE N,
L_STRING TYPE STRING.
LOOP AT IT_CUSTOMER.
AT NEW KUNNR.
CLEAR L_COUNTER.
L_INDEX = SY-TABIX.
READ TABLE IT_CUSTOMER INDEX L_INDEX.
perform bdc_dynpro using 'SAPMV10A' '0100'.
perform bdc_field using 'MV10A-KUNNR'
IT_CUSTOMER-KUNNR.
perform bdc_field using 'MV10A-VKORG'
IT_CUSTOMER-VKORG.
perform bdc_field using 'MV10A-VTWEG'
IT_CUSTOMER-VTWEG.
perform bdc_field using 'BDC_OKCODE'
'/00'.
ENDAT.
L_COUNTER = L_COUNTER + 1.
CLEAR L_STRING.
perform bdc_dynpro using 'SAPMV10A' '0200'.
CONCATENATE 'MV10A-MATNR(' L_COUNTER ')' INTO L_STRING.
perform bdc_field using L_STRING
IT_CUSTOMER-MATNR.
CONCATENATE 'MV10A-KDMAT(' L_COUNTER ')' INTO L_STRING.
perform bdc_field using L_STRING
IT_CUSTOMER-KDMAT.
CONCATENATE 'MV10A-MEGRU(' L_COUNTER ')' INTO L_STRING.
perform bdc_field using L_STRING
IT_CUSTOMER-MEGRU.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*-- For Page down in Call Transaction Mode
IF L_COUNTER = 14.
CLEAR L_COUNTER.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=P+'.
ENDIF.
perform bdc_dynpro using 'SAPMV10A' '0200'.
CONCATENATE 'MV10A-SELKZ(' L_COUNTER ')' INTO L_STRING.
perform bdc_field using L_STRING
IT_CUSTOMER-SELKZ.
perform bdc_field using 'BDC_OKCODE'
'=SELE'.
perform bdc_dynpro using 'SAPMV10A' '0300'.
perform bdc_field using 'MV10A-KDMAT'
IT_CUSTOMER-KDMAT.
perform bdc_field using 'MV10A-LPRIO'
IT_CUSTOMER-LPRIO.
perform bdc_field using 'MV10A-ANTLF'
IT_CUSTOMER-ANTLF.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/EBACK'.
at end of kunnr.
READ TABLE IT_CUSTOMER INDEX L_INDEX.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
CALL TRANSACTION 'VD51' USING IT_BDC MODE 'A' UPDATE 'S'
MESSAGES INTO IT_MESSAGES.
CLEAR IT_BDC.
REFRESH IT_BDC.
ENDAT.
IF NOT IT_MESSAGES[] IS INITIAL.
PERFORM FORMAT_MESSAGE.
ENDIF.
ENDLOOP.
ENDFORM. " POPULATE_BDC
*& Form bdc_dynpro
text
-->P_0273 text
-->P_0274 text
FORM bdc_dynpro USING VALUE(P_0273)
VALUE(P_0274).
IT_BDC-PROGRAM = P_0273.
IT_BDC-DYNPRO = P_0274.
IT_BDC-DYNBEGIN = 'X'.
APPEND IT_BDC.
CLEAR IT_BDC.
ENDFORM. " bdc_dynpro
*& Form bdc_field
text
-->P_0278 text
-->P_RECORD_KUNNR_001 text
FORM bdc_field USING VALUE(P_0278)
VALUE(P_0279).
IT_BDC-FNAM = P_0278.
IT_BDC-FVAL = P_0279.
APPEND IT_BDC.
CLEAR IT_BDC.
ENDFORM. " bdc_field
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE.
DATA: L_MSG(100).
LOOP AT IT_MESSAGES.
READ TABLE IT_CUSTOMER INDEX L_INDEX.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MESSAGES-MSGID
LANG = SY-LANGU
NO = IT_MESSAGES-MSGNR
V1 = IT_MESSAGES-MSGV1
V2 = IT_MESSAGES-MSGV2
V3 = IT_MESSAGES-MSGV3
V4 = IT_MESSAGES-MSGV4
IMPORTING
MSG = L_MSG
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.
write:/ l_msg.
ENDLOOP.
ENDFORM. " FORMAT_MESSAGE
reward if helpful,
keerthi -
Creation of PGI using BDC for tc VL02N is not happening..
Hi All,
i need to do Post Goods Issue (PGI) thro' BDC and after that i need to update the flag in Ztable.
its giving Success message and updating the database also.
but its not issuing the PGI.and further i want to create billing doc.So its compulsory to me to post PGI.
if i look into the BDCMSGCOLL structure its giving "NO BATCH INPUT DATA FOR SCREEN"? why this is happening?
please let me know immediately....
REFRESH: tt_bdcmsgcoll .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_created-document_numb
IMPORTING
output = wa_created-document_numb.
REFRESH tt_bdcdata.
PERFORM bdc_dynpro USING text-001 text-002.
PERFORM bdc_field USING text-008
text-014.
PERFORM bdc_field USING text-009
text-011.
PERFORM bdc_field USING text-014
wa_created-document_numb.
PERFORM bdc_dynpro USING text-001 text-003.
PERFORM bdc_field USING text-009
text-036.
PERFORM bdc_field USING text-025
sy-datum.
PERFORM bdc_field USING text-008
text-035.
PERFORM bdc_field USING text-037
sy-datum.
PERFORM bdc_field USING text-038
text-029.
PERFORM bdc_field USING text-016
c_x.
CALL TRANSACTION c_t_del USING tt_bdcdata
MODE c_m
UPDATE c_u
MESSAGES INTO tt_bdcmsgcoll .
SORT tt_bdcmsgcoll BY msgtyp.
READ TABLE tt_bdcmsgcoll INTO wa_bdcmsgcoll WITH KEY msgtyp = c_e.
IF sy-subrc EQ 0.
LOOP AT tt_bdcmsgcoll INTO wa_bdcmsgcoll WHERE msgtyp = c_e.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_bdcmsgcoll-msgid
lang = text-010
no = wa_bdcmsgcoll-msgnr
v1 = wa_bdcmsgcoll-msgv1
v2 = wa_bdcmsgcoll-msgv2
v3 = wa_bdcmsgcoll-msgv3
v4 = wa_bdcmsgcoll-msgv4
IMPORTING
msg = v_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
WRITE :/ v_msg.
ENDLOOP.
ELSE.
MOVE : c_x TO wa_worklist-pgi_flag.
READ TABLE tt_epit INTO wa_epit WITH KEY epi_id = wa_worklist-epi_id epi_sr = wa_worklist-epi_sr.
IF sy-subrc EQ 0.
MODIFY tt_epit FROM wa_worklist TRANSPORTING pgi_flag WHERE epi_id = wa_worklist-epi_id AND epi_sr = wa_worklist-epi_sr.
ELSE.
APPEND wa_worklist TO tt_epit.
ENDIF.
wa_epit-pgi_flag = c_x.
MODIFY tt_epit FROM wa_epit TRANSPORTING pgi_flag WHERE epi_id = wa_worklist-epi_id AND del_no = wa_created-document_numb .
UPDATE zsd_dt_epit SET pgi_flag = 'X' WHERE epi_id = wa_worklist-epi_id AND del_no = wa_created-document_numb .
IF sy-subrc EQ 0.
ENDIF.
ENDIF.HI,
Please refer this
To perform Post goods issue
PERFORM OPEN_GROUP.
PERFORM BDC_DYNPRO USING 'SAPMV50A' '4004'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LIKP-VBELN'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=WABU_T'.
PERFORM BDC_FIELD USING 'LIKP-VBELN' DELIVERY.
'84000064'.
PERFORM BDC_TRANSACTION USING 'VL02N'.
PERFORM CLOSE_GROUP.
CLEAR : DELIVERY,
T_BSITEM,
T_BSICTL.
ENDIF.
ENDFORM. " DELIVERY -
Problem in creation of BDC for transaction phap_create
Hello Friends,
I am trying to create BDC for PHAP_CREATE.
When you run a transaction a pop up window appears to select the template id.
And in BDC it is selected by cursor position. So once selected, the value of template id cannot be changed.
I want this as a parameter.So that each time I run a BDC I will be able to create different types of Appraisal documents i.e with different template ids.
How to go about it???
Regards,
BhushanHi,
For selecting the id, while doing recording,
record with
CTRL + F ( Where u can give ur id) and proceed further. -
Dear Experts,
I have a module pool program and transaction for shipping advice, where I have given a option that if user enters Sales Order in the selection screen and in the next screen it shows all the related infromation of that order and if needed user can edit few fields in this screen and can take print.
Now for the same report I dont want to show any screen to user after user enters the order and executes directly it should display the dialog box for 'Print' and 'Print Preview'.
I did BDC recording for the transaction of shipping adive report and with that code I have developed other program and if run this program in foreground (Mode "A")it will show all screens with that dialog screen for 'Print' also but if I run in background (Mode "B") it will not show any screen and it will print the document directly.
Now my requirement is I have to show only dialog screen for 'Print' & 'Print Preview'.
Please give me your valuable Ideas on how to achieve this...
Thanks in advance.
Best Regards
VenkatHello,
May be you are not using the full recording or might have some mistake(s) is going on in the completion of recording that is why it is creating problem. And also please check the call transaction code in the BDC program, whether you are performing the accurate t-code with that or not and also perform BDC functions also. If it is right than it would not might have any problem regarding the required output as you want.
Thanks & Regards,
Akg -
What is the Tcodes for Uploading of data using BDC & CATT
PP members:
I was going through the <b>cutover activities</b> , and what I understood is we transfer all the legacy system data into SAP before going live
The data upload follows certain steps (depends on the organizational design load strategies)
First we upload all the master data ( material master, BOM, W/C's & Routings)
Then the transaction data ( Ideally speaking, there should no open orders i.e. WIP as on the day of cutoff )
If the WIP (Work in Process) is unavoidable then the materials consumed shall be treated as <b>materials of the previous stage</b> and necessary adjustments shall be made after cutover day
At this point, I could not able to understand what does the author mean <b>materials of the previous stage</b>
Now comming to the uploading of data into SAP from legacy system, we use tools like LSMW, CATT & BDC
Is it a must to use <b>only LSMW tool</b> to upload master data or any other upload tools are fine
Lastly,. I am not sure about the Tcode of CATT & BDC
Summary of the questions:
1.What does the author mean <b>material of previous stage</b>, for WIP materials during cutover activities
2. Is it mandatory to use only LSMW tool for uploading for master data
3. What are the Tcodes for upload tools CATT & BDC ?
Thanks for your time
Suren RDear,
1.What does the author mean material of previous stage, for WIP materials during cutover activities - as i understood, what is the stage of material..like it must have gone through 2 work centers and other 2 is left. i.e. you need to create Production order with only 2 operation as other 2 is already over. - usually it is done in such a way that we will create Production order and confirm till 2 operations and WIp is calculated so thatb FI will tally the books in SAP and lagacy.
2. Is it mandatory to use only LSMW tool for uploading for master data - no you can use any tool as required and suits yr requirement
3. What are the Tcodes for upload tools CATT & BDC- BDC through a prog in SE38. CATT through - SCEM. -
Unable to capture sy-ucomm in BDC
Hello Everyone,
I have created a BDC for CG3Y everything is working fine after creating a log when sy-subrc eq 0. when user hits SAVE I have given a message stating 'LOG HAS BEEN GENERATED' but when the pop for overwrite appears and I hit NO, it should give a different message for that i am not able to capture SY-UCOMM.
please help.Actually the issue was just had to get the file(Error log) from Application Server to Presentation, Here is the code for it.
data: i_fl_openerror type boolean,
i_os_message(100) type C,
i_flg_continue type boolean.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = 'C:\ERROR_LOG.XLS'
i_file_appl = '/USR/SAP/TMP/FILE3.XLS'
* I_FILE_OVERWRITE = ESP1_FALSE
IMPORTING
E_FLG_OPEN_ERROR = i_fl_openerror
E_OS_MESSAGE = i_os_message
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
IF sy-subrc <> 0.
case sy-subrc.
when 2.
CALL FUNCTION 'C14A_POPUP_ASK_FILE_OVERWRITE'
IMPORTING
E_FLG_CONTINUE = i_flg_continue
if i_flg_continue eq true.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = 'C:\ERROR_LOG.XLS'
i_file_appl = '/USR/SAP/TMP/FILE3.XLS'
I_FILE_OVERWRITE = ESP1_TRUE
IMPORTING
E_FLG_OPEN_ERROR = i_fl_openerror
E_OS_MESSAGE = i_os_message
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
IF sy-subrc <> 0.
write : / 'CANNOT DOWNLOAD' , '/USR/SAP/TMP/FILE3.XLS' .
else.
write : / 'LOG HAS BEEN GENERATED C:\ERROR_LOG.XLS'.
endif.
else.
write : / 'LOG NOT GENERATED'.
endif.
when others .
write : / 'CANNOT DOWNLOAD FILE1', '/USR/SAP/TMP/FILE3.XLS'.
endcase. -
Unable to run BDC due to start-of-selection
Hi Experts,
I am running BDC for ROH type.
The data is in the excel file so I am performing the below operation.
In the BDC recording before perform open group there is "START-OF-SELECTION" and I also have a START-OF-SELECTION for excel uploading now how wud both would go together..
My requirement is to select the file through F4 then choose BDC type session or call transaction
and upload the data
Since I have 2 start-of-selection nothing happens after F8.
Help is really appreciated and rewarded.
Selection-screen begin of block b1 with frame title text-001.
parameter: f_name type rlgrap-filename default 'D:\Cost_element_KS06.xls'.
parameter : p_begcol type i default 1 no-display,
p_begrow type i default 2 no-display,
p_endcol type i default 8 no-display,
p_endrow type i default 46 no-display.
selection-screen end of block b1.
at selection-screen on value-request for f_name.
perform f_get_file using f_name.
start-of-selection.
perform f_xls_itab using f_name changing it_excel.
perform f_move_data.
include bdcrecx1.
start-of-selection.
perform open_group.
loop at t_ks06 to wa.
" Here I have the BDC recording recorderd through SHDB for ROH
endloop.
perform close_group.
Ranjith N.Hi Avinash,
I have made the following modification but stil the same.
report ZNRD_BDC_UPD_COSTELEMENT
no standard page heading line-size 255.
* Declaring work area and internal tables
data : begin of t_ks06 occurs 0,
KOKRS type KOKRS, " Controlling area
KSTAR type KSTAR, " Cost element
DATAB type DATAB, " Valid from date
DATBI type DATBI, " Valid to date
KTEXT type KTEXT, " Name
LTEXT type LTEXT, " Description
KATYP type KATYP, " Cost element cat
KOSTL type KOSTL, " Cost center
end of t_ks06.
data : wa like line of t_ks06.
data : it_excel type alsmex_tabline occurs 0 with header line.
*data : flg_mv(1) type n value 0. " Flag to check data Moved.
selection-screen begin of block b1 with frame title text-001.
parameter: f_name type rlgrap-filename default 'C:\Documents and Settings\Administrator\Desktop\Project_data\Cost_element_KS06.xls'.
parameter : p_begcol type i default 1 no-display,
p_begrow type i default 2 no-display,
p_endcol type i default 8 no-display,
p_endrow type i default 46 no-display.
selection-screen end of block b1.
" Iam performing all subroutines under at selection-screen and under start-of-selection Iam calling the bdc
but still nothing happens. please help
at selection-screen on value-request for f_name.
perform f_get_file using f_name.
perform f_xls_itab using f_name changing it_excel.
perform f_move_data.
*perform f_display_data.
start-of-selection.
perform open_group.
loop at t_ks06 to wa.
perform bdc_dynpro using 'SAPLKMA4' '0200'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KOKRS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'CSKBZ-KOKRS'
wa-KOKRS.
perform bdc_field using 'CSKBZ-KSTAR'
wa-KSTAR.
perform bdc_field using 'CSKBZ-DATAB_ANFO'
wa-DATAB.
perform bdc_field using 'CSKBZ-DATBI_ANFO'
wa-DATBI.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-EIGEN'.
perform bdc_field using 'CSKBZ-KTEXT'
wa-KTEXT.
perform bdc_field using 'CSKBZ-LTEXT'
wa-LTEXT.
perform bdc_field using 'CSKBZ-KATYP'
wa-KATYP.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'=VKON'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KTEXT'.
perform bdc_field using 'CSKBZ-KTEXT'
wa-KTEXT.
perform bdc_field using 'CSKBZ-LTEXT'
wa-LTEXT.
perform bdc_field using 'CSKBZ-KATYP'
wa-KATYP.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KOSTL'.
perform bdc_field using 'CSKBZ-KOSTL'
wa-KOSTL.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KOSTL'.
perform bdc_field using 'CSKBZ-KOSTL'
wa-KOSTL.
perform bdc_transaction using 'KA06'.
endloop.
perform close_group.
include bdcrecx1.
*& Form f_get_file
* text
* -->P_FILE_NAM text
form f_get_file using p_file_nam.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
* FIELD_NAME = ' '
* STATIC = ' '
* MASK = ' '
changing
file_name = f_name
exceptions
mask_too_long = 1
others = 2.
endform. " f_get_file
*& Form f_xls_itab
* text
* -->P_FILE_NAM text
* <--P_IT_EXCEL text
form f_xls_itab using p_file_nam changing p_it_excel.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = f_name
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
tables
intern = it_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
endform. " f_xls_itab
*& Form f_move_data
* text
* --> p1 text
* <-- p2 text
form f_move_data.
data : lv_index type i.
field-symbols <fs>.
* Sorting the internal table
sort it_excel by row col.
clear it_excel.
loop at it_excel.
move it_excel-col to lv_index.
* Assigning each record to the internal table row.
assign component lv_index of structure wa to <fs>.
* Assigning the field value to a field symbol
move it_excel-value to <fs>.
at end of row.
append wa to t_ks06.
* flg_mv = 1.
clear wa.
endat.
endloop.
endform. " f_move_data
*& Form f_display_data
* text
* --> p1 text
* <-- p2 text
form f_display_data.
write:/1 sy-uline(140).
write:/1 sy-vline, 'Cont area', " Controlling area
16 sy-vline, 'Cost ele', " Cost element
31 sy-vline, 'Valid from', " Valid from date
46 sy-vline, 'Valid to ' , " Valid to date
61 sy-vline, 'Name', "Cost element cat
76 sy-vline, 'Description', " Cost center
101 sy-vline, 'Cost ele cat', " Cost element cat
126 sy-vline, 'Cost center', " Cost center
140 sy-vline.
write:/1 sy-uline(140).
skip 1.
clear wa.
loop at t_ks06 into wa.
write:/2 sy-uline(139).
write:/2 sy-vline, wa-KOKRS, " Controlling area
16 sy-vline, wa-KSTAR, " Cost element
31 sy-vline, wa-DATAB, " Valid from date
46 sy-vline, wa-DATBI, " Valid to date
61 sy-vline, wa-KTEXT, " Name
76 sy-vline, wa-LTEXT, " Description
101 sy-vline, wa-KATYP, " Cost element cat
120 sy-vline, wa-KOSTL, " Cost center
140 sy-vline.
endloop.
endform. " f_display_data
Regards,
Ranjith -
Unable to incorporate multiple data in BDC * URGENT*
Hi EveryOne .
See the code. This code can do BDC for a single value of store and bonus buy no., in transaction WPMA
The current requirement is for a given store all bonus buy values should get populated and then executed each time store wise.
Eg
Store bonus buy values
1001 1
1001 2
1001 4
1002 A
1002 L
1003 6
1003 7
1003 H.
See the code below, and tell me the necessary changes required!!
report zwpma1
no standard page heading line-size 255.
type-pools slis.
data: wt_fcat type slis_fieldcat_alv.
data: it_fcat type slis_t_fieldcat_alv.
data: cnt type sy-tabix.
*include bdcrecx1.
types: begin of ty_final,
store(10) type c,
docnum type docnum,
bbynr type bbynr,
end of ty_final.
types: begin of ty_final1,
store(10),
bbynr type bbynr,
end of ty_final1.
data: wa_bonusbuy type zbonusbuy,
it_bonusbuy type standard table of zbonusbuy with header line,
it_bonusbuy1 type standard table of ty_final1 with header line,
it_t001w type standard table of t001w with header line,
it_edidc type standard table of edidc with header line,
it_edid4 type standard table of edid4 with header line,
it_final type standard table of ty_final with header line,
*Work areas:
wa_edidc type edidc,
wa_edid4 type edid4,
wa_final type ty_final.
data : it_bdcmsgcoll like bdcmsgcoll occurs 0 with header line.
data: bdcdata like table of bdcdata with header line.
data: lv_mode(1) value 'N'.
data : mtext(100) type c,
mvar1 like balm-msgv1,
w_msg(200) type c.
data : l_startt type sy-uzeit, " Time before Recording
l_endt type sy-uzeit, " time after recording
l_cdate type sy-datum. " Current date
start-of-selection.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = 100
text = 'Extracting Data....... '.
select werks from t001w into corresponding fields of table it_t001w.
delete adjacent duplicates from it_t001w comparing werks.
if not it_t001w[] is initial.
select store bbynr mmid from zbonusbuy into corresponding fields of table it_bonusbuy for all
entries in it_t001w where store = it_t001w-werks.
if sy-subrc = 0.
sort it_bonusbuy by store.
endif.
endif.
refresh it_t001w.
loop at it_bonusbuy.
move-corresponding it_bonusbuy to it_bonusbuy1.
append it_bonusbuy1.
clear: it_bonusbuy, it_bonusbuy1.
endloop.
l_cdate = sy-datum.
clear l_startt .
l_startt = sy-uzeit.
loop at it_bonusbuy.
*break retaildev.
*perform open_group.
perform bdc_dynpro using 'RWDPOSAN' '1000'.
perform bdc_field using 'BDC_CURSOR'
'SO_BBUY-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'PA_VKORG'
'HB00'.
perform bdc_field using 'PA_VTWEG'
'H2'.
perform bdc_field using 'SO_FISEL-LOW'
'1001'.
it_bonusbuy-store.
LOOP AT it_bonusbuy1 WHERE store = it_bonusbuy-store.
if sy-subrc = 0.
perform bdc_field using 'PA_BBUY'
'X'.
perform bdc_field using 'SO_BBUY-LOW'
'TEST_00035'.
it_bonusbuy1-bbynr.
it_bonusbuy-bbynr.
endif.
clear it_bonusbuy1.
ENDLOOP.
*Refresh: it_bonusbuy1.
clear bdcdata.
call transaction 'WPMA' using bdcdata
mode lv_mode
UPDATE 'S'
messages into it_bdcmsgcoll.
refresh bdcdata.
clear it_bonusbuy.
endloop.
l_endt = sy-uzeit.
break retaildev.
select docnum
direct
credat
cretim
mestyp
idoctp
from edidc into corresponding fields of table it_edidc
where
credat = l_cdate and
( cretim ge l_startt and cretim le l_endt ) and
mestyp = 'WPDBBY' and
idoctp = 'WPDBBY01'. " " l_startt and l_endt and
break retaildev.
if sy-subrc = 0.
select docnum
counter
segnum
segnam
sdata
from edid4 into corresponding fields of table it_edid4 for all entries in it_edidc
where
docnum = it_edidc-docnum.
endif.
*Loop at it_final into wa_final.
loop at it_edid4 into wa_edid4 where segnam = 'E1WPBB01'.
wa_final-store = wa_edid4-sdata(10).
wa_final-docnum = wa_edid4-docnum.
wa_final-bbynr = wa_edid4-sdata+10(12).
append wa_final to it_final.
endloop.
delete adjacent duplicates from it_final comparing docnum store bbynr.
sort it_final by store.
clear: wa_final,wa_edidc, wa_edid4.
refresh : it_edid4, it_edidc.
*ALV OutPut
write :'Following are the Idocs posted successfully Storewise' .
loop at it_final.
write : it_final-store , it_final-docnum , it_final-bbynr .
endloop.
*Break retaildev.
perform top_of_page.
perform alv_layout-settings.
perform zalv_fieldcatpopn using it_fcat.
perform z_reuse_alv_grid_display.Have you tried serialization and sendingas an object using something like Zend AMF?
Please mark this question as answered if this works for you.
-Mr.12 -
Dear All,
We have developed some customized z-transactions related to standard MIGO
transaction for our Barcode Implementation project so that they can
run on Hand held terminals(HHT) as HHT doesnot Support SAP GUI (for ex : table controls, Tab strips etc.,)
The HHT is connected to SAP console via Telnet.
And we have used some BDCs which are developed using recording (SHDB) in these
customised transactions.
Transactions along with BDC's are working absolutely fine when running on SAP GUI (Desktop computers) .
But when we run these transactions on SAP console and while executing BDC's, it shows
the follwing Message and BDC's doesn't work on sap console.
Message Type - A
Message ID - CNDP
Message No - 003
Message - Function DP_PUT_CLIENT_TABLE45A is not available
Message status- TO is not created
regards,
Rahul ShuklaHello
The link you have provided is not working. And Have identical problem in completely different context.
I'm trying to use GUILIB.DLL to command GUI from Visual Basic.
To do it I had to write a DLL whish is changing the call covention to VB one. The DLL is just wrapping all exports.
Everyting works fine with Z-transactions and e.g. VD51 but
in VA01 or VD02, after filling the first screen with data sending the Event I get this error (DP_PUT_CLIENT_TABLE45A not available) after calling It_GetEvent.
DO you know any remedy (my patch level is 57 on 6.20 GUI)
thanks in advance for help
Stefan -
I am new to the bdc .
i have gone to SHDB and created a new recording for the some T-code .
After that i have created a prog (transfer from recording ) .
i got some values in the file in my presenation server.
i got default code generated .
I have to declare the internal table of some time .
may i know of which type should i declare my internal table ??
My code ****************************************************************
report ZRAJESH_BDC
no standard page heading line-size 255.
include bdcrecx1.
start-of-selection.
perform open_group.
*******loop
perform bdc_dynpro using 'SAPMF02K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-D0110'.
perform bdc_field using 'RF02K-LIFNR'
'12345'.
perform bdc_field using 'RF02K-D0110'
'X'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELF2'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-ANRED'
'Mr.'.
perform bdc_field using 'LFA1-NAME1'
'RAJESH'.
perform bdc_field using 'LFA1-SORTL'
'Q'.
perform bdc_field using 'LFA1-LAND1'
'US'.
perform bdc_field using 'LFA1-SPRAS'
'EN'.
perform bdc_field using 'LFA1-TELF2'
'9033558227'.
perform bdc_transaction using 'XK02'.
perform close_group.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.Hi,
I have one simple BDC Program .
Just you have to do recording by using SHDB Transaction Code.
and Copy that program and do some modification by following my Program and upload data to that perticular transaction.
before that u have to prepare data in Text file by using TAB Space .
Below is the Code(I have used MM01 transaction)
******************************************************************************************8
report ZBDCTEST no standard page heading line-size 255.
***DECLARING TABLES.
TABLES : MARA.
**DECLARING INTERNAL TABLE.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
Maktx like makt-maktx,
SPART LIKE MARA-SPART,
END OF ITAB.
DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = 'C:\TEST.TXT'
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
LOOP AT ITAB.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1_REF-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
ITAB-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
'M'.
perform bdc_field using 'RMMG1-MTART'
'FOOD'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP02'.
perform bdc_field using 'MAKT-MAKTX'
'T1003'.
perform bdc_field using 'BDC_CURSOR'
'MARA-MATKL'.
perform bdc_field using 'MARA-MEINS'
'BOX'.
perform bdc_field using 'MARA-MATKL'
ITAB-MATKL.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
'T1003'.
*perform bdc_transaction using 'MM01'.
*perform close_group.
CALL TRANSACTION 'MM01' USING BDCDATA MODE 'A'. "A= all screens ,N= no screens
ENDLOOP.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
if you want further help let me know
Regards,
Jak -
Is it possible to skip the screen in BDC using IF statement.
Hi Friends,
I have written a report using BDC for tcode CO11 thru recording using CALL TRANSACTION.
Case 1:
If I go to transaction CO11 (screen number 100) and give the order number which has more than 1 operations to be partially confirmed and press ENTER a pop-up screen (screen number 140) appears where in I need to select the operation number and after selecting the required operation number it automatically takes me to another screen (screen number 150).
Case 2:
If I go to transaction CO11 (screen number 100) and give the order number which has only 1 operation to be partially confirmed and press ENTER it directly takes me to screen 150 skiping screen 140.
When I enter the order number which has more than 1 operations to be partially confirmed on my selection screen, my code is working fine as needed.
But, when I enter the order number which has 1 operation to be partially confirmed on my selection screen, it is giving me error in my BDCMSGCOLL saying that the screen 140 doesn't exist.
Is there any way, Can I skip screen 140 using IF statement?
My thoughts:
1. calling screen 100.
After calling screen 100, I have put the pop-up operation numbers in an ITAB.
DESCRIBE table lines ITAB <variable>.
At NEW <order-field>.
IF <variable> = 1.
2. calling screen 140. "I need some help here to skip the screen 140
" Will this logic work?
ENDIF.
ENDAT.
3. calling screen 150.
Rest everything is working fine.
Will my above logic works correctly? I would appreciate if someone could help me with this.
Thanks in Advance.Hi,
Try something like this:
1. Call Screen 100.
Check if screen 140 needs to be called depending on your custom logic. Lets say you populate a variable as 'X' if it needs to be called.
Then write:
if valiable = 'X'.
Call screen 140.
Enter Screen 140 details.
endif.
Call screen 150.
Here the 'Call Screen' is nothing but the code you extracted after BDC recording.
Thanks.
Ravi' -
BDC Call Transaction - Doc.No not getting generated in Message Internal tab
Dear All,
I am using BDC Call Transaction method for uploading data for transaction, Iam able to successfully capture the Error messages, sucess messages and the transaction number is also displayed for the bdc run in Mode A, but in case of scheduling the job in background, the Error messages are displayed but the transaction number is not captured in the message Internal table( BDCMSGCOLL).
Kindly look into the matter and revert back for any further info.
Regards
NareshHi,
Please try using the following kind of code in 'CALL TRANSACTION'
opt-dismode = 'E'. " Exclusive mode
opt-defsize = 'X'.
opt-updmode = 'S'.
opt-nobinpt = ' '.
CALL TRANSACTION transaction_code USING ft OPTIONS FROM opt
MESSAGES INTO t_bdcmsgcoll .
Hope this will work.
Thanks,
Leo -
Field not getting updated in BDC while running in background
Hi Friends,
I'm executing a BDC transaction to update the Alternate Tax Classification (VBAK_TAXK1) field in Sales Order. I'm passing value 1 to the field and then saving it directly. While running the BDC in background, the field is not getting updated. On the other hand i checked it running in foreground, the field got updated without any error message.
Can anybody help me advicing why the field is not getting updated in background?
Thanks,
BestinHi ,
Check the the log if you are using a session method and if call transaction then capture the messages for the same,
Because in the foreground the BDC will update the records even if there is a warning message nut in background it will not update. So check the data which you are inserting and try avoid the warning messages also so that it can run smoothly in backfround.
Thanks & Regards
Jyo
Maybe you are looking for
-
HT204053 Can my children and I use the same apple ID with different iPhone iPad and iPod ?
I am having trouble with my new iPhone 5 address book and some updates on the apps store There's some old apple ID that is showing up. I don't even remember this email address What can I do to adjust all this Thanks
-
How do I get my Apple TV Screensaver to play an album other than Photostream?
How do I get my Apple TV Screensaver to play an album other than Photostream?
-
Hi Everyone, I have a .jar file which contains some java packages. How can extract this file to view the package contents. Thanks a lot. Hung
-
Exception text in error segment of the header
Hello All, It is well documented in SDN on how to add trace messages and then raise an runtime exception error that will stop message mapping process. References: /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-m
-
Alternating Row Colors - Interactive Report
Hello All, I'm hoping someone out there can help me out w/this. :) I'm a newbie working w/an Interactive Report and want to have alternating row colors as a default w/out losing the IR advantages. I've tried javascript, but, whenever filters are appl