Bdc recording of screen having table control
hi all,
how to trap scroll in bdc recording of table control.
regards deepak
Hi..,
<b>I found this program in one of the BDC links !! Hope this helps u !!</b>
Following is a sample code of handling table control in BDC.
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
regards,
sai ramesh
Similar Messages
-
BDC Recording For J1IG with Table Control Scroll bar
Dear Friends,
I am doing BDC program for J1IG Transaction after done recording.
As you knows that, In J1IG transaction max. 11 materials are shows in table control at a time and if more records are there, then we have to scroll down manually so after that, we can see the records.
Now my BDC program runs upto 11 materials but when more than 11 materials, selection is coming on first material only and cursor not showing 12th material.
So i think page down is not working for that issue.
I have seen lots of search forum for that but not getting the proper answer.
Please reply.
Regards,
Shivam.Dear Dinu,
For better understanding please see the code.
So you suggest what should i have to do?.
LOOP AT jtab INTO wb.
LOOP AT itab INTO wa WHERE mblnr EQ wb-mblnr.
CLEAR : flag.
AT NEW mblnr.
flag = 'X'.
CLEAR : cnt, var1, var2.
ENDAT.
cnt = cnt + 1.
IF flag EQ 'X'.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ECAP'.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'T_HEADER-EXDAT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'J_1IEXCHDR-EXGRP'
wa-exgrp.
PERFORM bdc_field USING 'T_HEADER-MBLNR'
wa-mblnr.
PERFORM bdc_field USING 'T_HEADER-MJAHR'
wa-mjahr.
PERFORM bdc_field USING 'T_HEADER-EXNUM'
wa-exnum.
PERFORM bdc_field USING 'T_HEADER-EXDAT'
wa-exdat.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'J_1IEXCHDR-EXGRP'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=DETL'.
ENDIF.
CONCATENATE 'T_ITEM-ZEILE(' cnt ')' INTO var1.
CONCATENATE 'T_ITEM-SELECTION(' cnt ')' INTO var2.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
var1. "'T_ITEM-ZEILE(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=MORE'.
PERFORM bdc_field USING var2 "'T_ITEM-SELECTION(01)'
'X'. "record-selection_01_019.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0400'.
PERFORM bdc_field USING 'BDC_CURSOR'
'T_LOCAL_EXC-EXADDRATE1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'T_LOCAL_EXC-MENGE(01)'
wa-menge.
PERFORM bdc_field USING 'T_LOCAL_EXC-EXBAS(01)'
wa-exbas.
PERFORM bdc_field USING 'T_LOCAL_EXC-EXBED(01)'
wa-exbed.
PERFORM bdc_field USING 'T_LOCAL_EXC-BEDRATE(01)'
wa-bedrate.
PERFORM bdc_field USING 'T_LOCAL_EXC-EXAED(01)'
wa-exaed.
PERFORM bdc_field USING 'T_LOCAL_EXC-AEDRATE(01)'
wa-aedrate.
PERFORM bdc_field USING 'T_LOCAL_EXC-ECS(01)'
wa-ecs.
PERFORM bdc_field USING 'T_LOCAL_EXC-ECSRATE(01)'
wa-ecsrate.
PERFORM bdc_field USING 'T_LOCAL_EXC-EXADDTAX1(01)'
wa-exaddtax1.
PERFORM bdc_field USING 'T_LOCAL_EXC-EXADDRATE1(01)'
wa-exaddrate1.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0400'.
PERFORM bdc_field USING 'BDC_CURSOR'
'T_LOCAL_EXC-RG23ASER(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMJ1IG' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'T_ITEM-DOCNO(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CLEAR opt.
opt-dismode = 'A'.
opt-updmode = 'S'.
* opt-defsize = '12'.
* CLEAR: it_messages[], it_messages.
CALL TRANSACTION 'J1IG' USING it_bdcdata OPTIONS FROM opt
MESSAGES INTO it_messages.
REFRESH it_bdcdata.
ENDLOOP.
CHECK it_messages[] IS NOT INITIAL.
LOOP AT it_messages.
PERFORM fill_messages USING it_messages-msgtyp
it_messages-msgid
it_messages-msgnr
it_messages-msgv1
it_messages-msgv2
it_messages-msgv3
it_messages-msgv4.
ENDLOOP.
PERFORM display_messages TABLES tmsg. -
Record selected in the table control
Hi All,
How do i know the line no of the record selected in the table control.I have declared a table control CONTROLS : t_control1 type tableview using screen 200.But in t_control1-current_line the line no that is stored is always 1.
Thanks,
Rakesh.in table control property window you have to set that suppose you have set itab-mark as the sel field then it will always be X if you select the field ...
regards
shiba dutta -
Record not shown in table control
Hi experts,
I am working on the module pool program with a screen 0100. There is a table control called TABL_MATR in screen 0100.
There is no error while compiling the program. But no record shown when a record added into the table control.
I do not want to use the headerline in the program, because I intented to do it in OO way.
Record shown if I do like this:
DATA: ITAB_TRAY TYPE STANDARD TABLE OF LS_TRAY WITH HEADER LINE.
In PBO
loop at itab_tray " record show in the table control
whereas record not shown if do like this:
DATA: ITAB_TRAY TYPE STANDARD TABLE OF LS_TRAY.
In PBO
loop at itab_tray into wa_tray " no record show in the table control
Can someone guide me how to do it in the right way?
Please help.
Thanks in advance.Hi all,
I have added the below images.
1) http://i566.photobucket.com/albums/ss106/wkw510/pic6.jpg
2) http://i566.photobucket.com/albums/ss106/wkw510/pic7.jpg
3) http://i566.photobucket.com/albums/ss106/wkw510/pic8.jpg
I have also followed what Devendra's suggested, however the same error message I get:
"ITAB_TRAY" is not a structure or internal table with header line.
As such I have changed the statement
module fill_table_control output.
MOVE-CORRESPONDING wa_tray TO itab_tray.
endmodule.
to
module fill_table_control output.
APPEND wa_tray TO itab_tray.
endmodule.
After changed, compiled no error.
But, when I started to use the program I got another error which closed the whole SAP screen.
Therefore I tried to change the TABLE CONTROL setting to
4) http://i566.photobucket.com/albums/ss106/wkw510/pic10.jpg
Now, everything is okay but I only get the latest record shows in the TABLE CONTROL. The record I inserted display more than one time, and filled all the table control.
5) http://i566.photobucket.com/albums/ss106/wkw510/pic11.jpg
I am wondering should we include
MOVE-CORRESPONDING wa_tray TO itab_tray.
or
APPEND wa_tray TO itab_tray.
According from Devendra, the PBO should only has this code
loop at itab_tray into wa_tray
with control tabl_matr
cursor tabl_matr-current_line.
* module fill_table_control. "shoule we exclude this?
endloop.
If I exclude the above code, the table control only show one record, regardless how many records are inserted.
Something is not right here, but just cant find it out.
Please help. -
Hi all
In the component overview screen of CO01 I want to disable all the field in screen of table control.I want to make it as output screen only.
Thanks & Regards,
Rajib.Isn't that just exactly what transaction CO02 does? CO01 is for creating production orders so what sense does it make to have it display mode only?
Maybe your goal is to stop then end user changing the component assignment that is automatically detected by the system. If so, personally I think a better starting point would be PP configuration or user authorizations rather than looking to change the screen by whatever method. As we don't know what you are trying to achieve it's hard to offer much more advice maybe all you need is to change transaction to CO02 -
Screen Resolution Table Control
Dear All,
I have some questions in Module pool and BDC.
1. how to handle Table Control in module pool programming as it's displaying lines in a table control differs from one system to other.
2. How to handle the same situation while uploading the data in table control in BDC.
Kindly let me know.
Many Thanks,
RanjanHi,
It's opening for me.It is available in SDN download Technical Samples ABAP library.
Here is the code.
In the flow logic of the screen 9000, write the following code.
PROCESS BEFORE OUTPUT.
MODULE set_status.
MODULE get_t_ctrl_lines.
LOOP AT i_makt WITH CONTROL t_ctrl CURSOR t_ctrl-current_line.
* Dynamic screen modifications
MODULE set_screen_fields.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT i_makt.
FIELD i_makt-pick MODULE check.
FIELD i_makt-zmatnr MODULE zmatnr .
ENDLOOP.
MODULE user_command_9000.
In the program, write the following code.
PROGRAM SAPMZTC MESSAGE-ID zz.
* Tables Declaration
TABLES: zzz_makt.
* Internal table Declaration
DATA : i_makt TYPE STANDARD TABLE OF zzz_makt WITH HEADER LINE.
* Table control Declaration
CONTROLS: t_ctrl TYPE TABLEVIEW USING SCREEN '9000'.
* Variable Declaration
DATA : flg, "Flag to set the change mode
ln TYPE i. "No. of records
*& Module get_T_CTRL_lines OUTPUT
* Populating data
MODULE get_t_ctrl_lines OUTPUT.
SELECT zmatnr zmaktx
INTO CORRESPONDING FIELDS OF TABLE i_makt
FROM zzz_makt.
DESCRIBE TABLE i_makt LINES ln.
* To make the vertical scroll bar to come on runtime
t_ctrl-lines = ln + 100.
ENDMODULE. " get_T_CTRL_lines OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Triggering event according to the user command
MODULE user_command_9000 INPUT.
DATA :lv_fcode LIKE sy-ucomm, "Function Code
lv_answer(1) type c. "Storing the answer
lv_fcode = sy-ucomm.
CASE lv_fcode.
WHEN 'CHANGE'.
* Setting the flag to make the table control in editable mode[excluding
* primary key].
flg = 'Y'.
WHEN 'DELETE'.
* Setting the flag to make the table control in editable mode after
* deleting the selected line
flg = 'Y'.
* Confirmation of delete
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Confirm'
text_question = 'Are you sure to delete from database?'
TEXT_BUTTON_1 = 'Yes'(001)
TEXT_BUTTON_2 = 'No'(002)
IMPORTING
ANSWER = lv_answer.
if lv_answer eq '1'.
* Updating the database table from the internal table
UPDATE zzz_makt FROM TABLE i_makt.
* Deleting the selected row from the internal table
DELETE i_makt WHERE pick = 'X'.
* Deleting the selected row from the database table
DELETE FROM zzz_makt WHERE pick = 'X'.
MESSAGE s005 WITH 'Deleted Successfully'.
ENDIF.
WHEN 'SAVE'.
* Inserting new record or updating existing record in database table
* from the internal table
MODIFY zzz_makt FROM TABLE i_makt.
MESSAGE s005 WITH 'Saved Successfully'.
WHEN 'BACK'.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANCEL'.
* Leaving the program
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module set_screen_fields OUTPUT
* Setting the screen fields
MODULE set_screen_fields OUTPUT.
LOOP AT SCREEN.
IF flg IS INITIAL.
screen-input = 0.
ELSEIF ( flg EQ 'Y' ).
IF ( ( screen-name = 'I_MAKT-ZMAKTX'
OR screen-name = 'I_MAKT-CHECK1' )
AND t_ctrl-current_line LE ln ) .
* Making the screen fields as editable
screen-input = 1.
ELSEIF ( ( screen-name = 'I_MAKT-ZMATNR' )
AND t_ctrl-current_line LE ln ).
* Making the screen field as uneditable
screen-input = 0.
ENDIF.
ENDIF.
* Modifying the screen after making changes
MODIFY SCREEN.
ENDLOOP.
ENDMODULE. " set_screen_fields OUTPUT
*& Module zmatnr INPUT
* Appending records to the internal table
MODULE zmatnr INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
IF t_ctrl-current_line GT ln.
READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.
IF sy-subrc NE 0.
* Inserting record if it does not exist in database
APPEND i_makt.
ELSE.
MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.
ENDIF.
ENDIF.
ENDMODULE. " zmatnr INPUT
*& Module set_status OUTPUT
* Setting the GUI status
MODULE set_status OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
ENDMODULE. " set_status OUTPUT
*& Module CHECK INPUT
* Modify the internal table using the current line in table control
MODULE check INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
ENDMODULE. " CHECK INPUT -
Screen with table control which works like SM30
Hello,
I have a screen with some parameters in order to obtain some records from
a custom table. In the same screen I must insert a table control which
shows the extracted records.
This table control has to work exactly like transaction SM30, that is the
user can modify, insert, delete or copy a record.
Does anybody know if exists a way (or method) to include this transaction
in the table control ? Or I have to use custom control to obtain this ?
N.B. the user wants a screen with parameter and table control (or custom control)
and not a call function to transaction sm30.
I thank you in advance. Paolo.Hi Rob,
thanks for your interest; no it's not a reason of authorization, but simply
the user wants to modify a report that actually works with some parameters
at the top of the screen and a customer control which shows an Alv_grid
with the extracted record;
Now the user needs to modify this records (insert and delete) directly from
this list. So I don't know if there's a way to obtain this goal without replace
the custom control with a table control.
The screen look like this:
Param.1 XXXXXXX
Param.2 XXXXXXXXXXXX
Custom Contr. with ALV_grid (for extracted record)
Regards.
Paolo. -
How do we capture the record selected in the table control?
Hi,
In the table control when the user selects a record we need to capture that record and pass it to the next screen.how can we do this?
Thanks,
Rakesh.Hello
First of all you need a 'mark' column in your TC structure.This should be char1.
This column has to be put into the TC Attributes as mark column.
Then to get back the info from the TC go the following way:
PAI
loop at <fs_it> . "Field symbol of your table.
MODIFY <fs_it> FROM wa_basic
INDEX tc_maintenance-current_line.
endloop.
Message was edited by:
Werner Gerbert -
BDC program for rebate with table controls
Hi Friends,
Iam Doing bdc program for Rebate(TCODE VBO1) with table controls..
can u give the solutions for table controls...
if anybody having the code..please send me..
Thanks & Advance,
sampathhi,
check this example it may help you.
REPORT ZSR_BDC_TBCTRL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : RF02K,LFA1,LFBK.
DATA : BEGIN OF IT_VEN OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
BANKS(6) TYPE C,
BANKL(17) TYPE C,
BANKN(19) TYPE C,
END OF IT_VEN.
DATA : BEGIN OF BANKS OCCURS 0,
BANKS LIKE LFBK-BANKS,
END OF BANKS,
BEGIN OF BANKL OCCURS 0,
BANKL LIKE LFBK-BANKL,
END OF BANKL,
BEGIN OF BANKN OCCURS 0,
BANKN LIKE LFBK-BANKN,
END OF BANKN.
DATA : FLD(20) TYPE C,
CNT(2) TYPE N.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'Z:\sr.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_VEN
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.
LOOP AT IT_VEN.
REFRESH BDCDATA.
REFRESH : BANKS,BANKL,BANKN..
SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
IT_VEN-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
IT_VEN-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
IT_VEN-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
IT_VEN-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
IT_VEN-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
IT_VEN-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'LFBK-BANKS(01)'
'DE'.
*perform bdc_field using 'LFBK-BANKS(02)'
'DE'.
*perform bdc_field using 'LFBK-BANKL(01)'
'10020030'.
*perform bdc_field using 'LFBK-BANKL(02)'
'67270003'.
*perform bdc_field using 'LFBK-BANKN(01)'
'12345'.
*perform bdc_field using 'LFBK-BANKN(02)'
'66666'.
MOVE 1 TO CNT.
LOOP AT BANKS.
CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKS-BANKS.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKL.
CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKL-BANKL.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKN.
CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKN-BANKN.
CNT = CNT + 1.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
ENDLOOP.
PERFORM CLOSE_GROUP.&----
*& Report ZSR_BDC_TBCTRL
REPORT ZSR_BDC_TBCTRL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : RF02K,LFA1,LFBK.
DATA : BEGIN OF IT_VEN OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
BANKS(6) TYPE C,
BANKL(17) TYPE C,
BANKN(19) TYPE C,
END OF IT_VEN.
DATA : BEGIN OF BANKS OCCURS 0,
BANKS LIKE LFBK-BANKS,
END OF BANKS,
BEGIN OF BANKL OCCURS 0,
BANKL LIKE LFBK-BANKL,
END OF BANKL,
BEGIN OF BANKN OCCURS 0,
BANKN LIKE LFBK-BANKN,
END OF BANKN.
DATA : FLD(20) TYPE C,
CNT(2) TYPE N.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'Z:\sr.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_VEN
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.
LOOP AT IT_VEN.
REFRESH BDCDATA.
REFRESH : BANKS,BANKL,BANKN..
SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
IT_VEN-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
IT_VEN-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
IT_VEN-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
IT_VEN-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
IT_VEN-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
IT_VEN-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'LFBK-BANKS(01)'
'DE'.
*perform bdc_field using 'LFBK-BANKS(02)'
'DE'.
*perform bdc_field using 'LFBK-BANKL(01)'
'10020030'.
*perform bdc_field using 'LFBK-BANKL(02)'
'67270003'.
*perform bdc_field using 'LFBK-BANKN(01)'
'12345'.
*perform bdc_field using 'LFBK-BANKN(02)'
'66666'.
MOVE 1 TO CNT.
LOOP AT BANKS.
CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKS-BANKS.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKL.
CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKL-BANKL.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKN.
CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKN-BANKN.
CNT = CNT + 1.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
ENDLOOP.
PERFORM CLOSE_GROUP. -
Error when displaying a field on Screen with Table Control
Hi,
It is going to 'Dump' when I am trying to display data on the screen with the help of Table Control. From the dump, What I have observed is , there is a field 'ZTSV_FSRDATA-ANZFEHLER'. If this field has negative value, then it is going to 'Dump' saying that the length is not enough. If it has a positive value then it is working fine. But the type of the field in the Internal table & on the screen are same.
Please help me to resolve this error.
I am posting here the Dump message also:
A conversion error occurred while the program was trying todisplay data on the screen.
The ABAP output field and the screen field may not have the same format.
Some field types require more characters on the screen thanin the ABAP program. For example, a date field on a screen needstwo characters more than it would in the program. When attempting to display the date on the screen, an error will occur that triggers the error message.
Thanks,
Sreenivas Reddy Maddi.Hi Sreenivas,
Refer this thread:
how to display negative values in a screen field of a screen
Re: negative values not allowed
Regards,
Sampath -
In BDC'S how to handle Table control
Hi,
I want to know the concept and code for BDC's in Table control steps(MM01,VA01) and coding.Please its very Urgent.Hi Raghavendra,
Go through this program mm01.
rePORT ymmbdcmm01
NO STANDARD PAGE HEADING LINE-SIZE 255.
*& Table Declarations *
TABLES:rmmg1,makt,mara,mvke, marc,mbew,t100.
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
*& Data Declarations *
DATA:
BEGIN OF t_data OCCURS 0,
data TYPE string,
END OF t_data.
DATA:BEGIN OF it_mess OCCURS 0,
msgtyp(5),
lms(200),
msgv1(50),
END OF it_mess.
DATA: BEGIN OF it_itab OCCURS 0,
matnr TYPE rmmg1-matnr,
mbrsh TYPE rmmg1-mbrsh,
mtart TYPE rmmg1-mtart,
werks TYPE rmmg1-werks,
lgort TYPE rmmg1-lgort,
vkorg TYPE rmmg1-vkorg,
vtweg TYPE rmmg1-vtweg,
maktx TYPE makt-maktx,
meins TYPE mara-meins,
matkl TYPE mara-matkl,
spart TYPE mara-spart,
GEWEI TYPE MARA-GEWEI,
dwerk TYPE mvke-dwerk,
versg TYPE mvke-versg,
mtpos TYPE mvke-mtpos,
mtvfp TYPE marc-mtvfp,
tragr TYPE mara-tragr,
ladgr TYPE marc-ladgr,
sernp TYPE marc-sernp,
txline(25), "added
kordb ,
mprof TYPE mara-mprof,
ekgrp TYPE marc-ekgrp,
dismm TYPE marc-dismm,
dispo TYPE marc-dispo,
disls TYPE marc-disls,
mabst(13) TYPE c,
beskz TYPE marc-beskz,
sobsl TYPE marc-sobsl,
lgpro TYPE marc-lgpro,
dzeit TYPE c,
plifz(3) TYPE c,
webaz TYPE c,
fhori TYPE marc-fhori,
eisbe TYPE c,
strgr(2) TYPE c,
vrmod TYPE c,
vint1(3),
vint2(3),
wzeit(3),
sbdkz TYPE marc-sbdkz,
bklas TYPE mbew-bklas,
vprsv TYPE mbew-vprsv,
verpr(11),
peinh TYPE c,
ekalr TYPE mbew-ekalr,
losgr TYPE c,
RGEKZ(1),
fevor(3),
END OF it_itab.
*decl of internal table of table control for BDCDATA & BDCMSGCOLL
DATA : BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA:it_msgtab TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE,
it_msgtab1 TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
DATA : fld(50) TYPE c,
cnt(2) TYPE n,
l_mstring(150).
START-OF-SELECTION.
*& File uploading from xlsheet to sap *
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = 'C:\Documents and Settings\sapthamm\Desktop\mm02.xls'
TABLES
i_tab_converted_data = it_itab
EXCEPTIONS
conversion_failed = 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.
*& Splitting the Internal Table *
LOOP AT t_data.
SPLIT t_data-data AT cl_abap_char_utilities=>horizontal_tab INTO
it_itab-matnr
it_itab-mbrsh
it_itab-mtart
it_itab-werks
it_itab-lgort
it_itab-vkorg
it_itab-vtweg
it_itab-maktx
it_itab-meins
it_itab-matkl
it_itab-spart
it_itab-GEWEI
it_itab-dwerk
it_itab-versg
it_itab-mtpos
it_itab-mtvfp
it_itab-tragr
it_itab-ladgr
it_itab-sernp
it_itab-mprof
it_itab-ekgrp
it_itab-dismm
it_itab-dispo
it_itab-disls
it_itab-mabst
it_itab-beskz
it_itab-sobsl
it_itab-lgpro
it_itab-dzeit
it_itab-plifz
it_itab-webaz
it_itab-fhori
it_itab-eisbe
it_itab-strgr
it_itab-vrmod
it_itab-vint1
it_itab-vint2
it_itab-wzeit
it_itab-sbdkz
it_itab-bklas
it_itab-vprsv
it_itab-peinh
it_itab-ekalr
it_itab-losgr
APPEND it_itab.
CLEAR: it_itab,
t_data-data.
ENDLOOP.
*perform open_dataset using dataset.
*perform open_group.
*do.
*read dataset dataset into it_itab.
*if sy-subrc <> 0. exit. endif.
*& it_itabing of Material Type-HALB *
LOOP AT it_itab.
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'
it_itab-matnr.
PERFORM bdc_field USING 'RMMG1-MBRSH'
it_itab-mbrsh.
PERFORM bdc_field USING 'RMMG1-MTART'
it_itab-mtart.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(17)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(04)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(05)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(06)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(09)'
'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(17)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(09)'.
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_field USING 'MSICHTAUSW-KZSEL(06)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(07)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(09)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0080'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-VTWEG'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'RMMG1-WERKS'
it_itab-werks.
PERFORM bdc_field USING 'RMMG1-LGORT'
it_itab-lgort.
PERFORM bdc_field USING 'RMMG1-VKORG'
it_itab-vkorg.
PERFORM bdc_field USING 'RMMG1-VTWEG'
it_itab-vtweg.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-SPART'.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'MARA-GEWEI'
'kg'.
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'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'MVKE-DWERK'
it_itab-dwerk.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MVKE-SKTOF'
'X'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MG03STEUER-TAXKM(02)'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(01)'
'0'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(02)'
'1'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4200'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MAKT-MAKTX'
it_itab-MAKTX_040.
*perform bdc_field using 'BDC_CURSOR'
'MG03STEUER-TAXKM(05)'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(03)'
'1'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(04)'
'1'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(05)'
'0'.
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'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'MVKE-DWERK'
it_itab-dwerk.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MVKE-SKTOF'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MVKE-MTPOS'.
PERFORM bdc_field USING 'MVKE-VERSG'
it_itab-versg.
PERFORM bdc_field USING 'MVKE-MTPOS'
it_itab-mtpos.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-GEWEI'
'KG'.
PERFORM bdc_field USING 'MARC-MTVFP'
it_itab-mtvfp.
PERFORM bdc_field USING 'MARA-TRAGR'
it_itab-tragr.
PERFORM bdc_field USING 'MARC-LADGR'
it_itab-ladgr.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-SERNP'.
PERFORM bdc_field USING 'MARC-SERNP'
it_itab-sernp.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4040'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=LTEX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TXVB'.
PERFORM bdc_field USING 'RSTXT-TXLINE(02)'
'pcb assembly'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TXBA'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4040'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SP09'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARC-EKGRP'
it_itab-ekgrp.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MARC-KORDB'
'X'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-MPROF'.
PERFORM bdc_field USING 'MARA-MPROF'
it_itab-mprof.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARC-EKGRP'
it_itab-ekgrp.
PERFORM bdc_field USING 'MARC-DISMM'
it_itab-dismm.
PERFORM bdc_field USING 'MARC-DISPO'
it_itab-dispo.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-MABST'.
PERFORM bdc_field USING 'MARC-DISLS'
it_itab-disls.
PERFORM bdc_field USING 'MARC-MABST'
it_itab-mabst.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARC-BESKZ'
it_itab-beskz.
PERFORM bdc_field USING 'MARC-SOBSL'
it_itab-sobsl.
PERFORM bdc_field USING 'MARC-LGPRO'
it_itab-lgpro.
if it_itab-sernp = 'TJSL'.
PERFORM bdc_field USING 'MARC-RGEKZ'
ELSE.
PERFORM bdc_field USING 'MARC-RGEKZ'
'1'.
ENDIF.
PERFORM bdc_field USING 'MARC-DZEIT'
it_itab-dzeit.
PERFORM bdc_field USING 'MARC-PLIFZ'
it_itab-plifz.
PERFORM bdc_field USING 'MARC-WEBAZ'
it_itab-webaz.
PERFORM bdc_field USING 'MARC-FHORI'
it_itab-fhori.
PERFORM bdc_field USING 'MARC-EISBE'
it_itab-eisbe.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARC-PERKZ'
'M'.
PERFORM bdc_field USING 'MARC-STRGR'
it_itab-strgr.
PERFORM bdc_field USING 'MARC-VRMOD'
it_itab-vrmod.
PERFORM bdc_field USING 'MARC-VINT1'
it_itab-vint1.
PERFORM bdc_field USING 'MARC-VINT2'
it_itab-vint2.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-WZEIT'.
PERFORM bdc_field USING 'MARC-MTVFP'
it_itab-mtvfp.
PERFORM bdc_field USING 'MARC-WZEIT'
it_itab-wzeit.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-SBDKZ'.
PERFORM bdc_field USING 'MARC-SBDKZ'
it_itab-sbdkz.
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'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARC-FEVOR'
'001'.
PERFORM bdc_field USING 'MARC-LGPRO'
it_itab-lgpro.
PERFORM bdc_field USING 'MARC-SERNP'
it_itab-sernp.
PERFORM bdc_field USING 'MARC-DZEIT'
it_itab-dzeit.
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'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
*perform bdc_field using 'MARA-IPRKZ'
it_itab-IPRKZ.
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'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-GEWEI'
'KG'.
PERFORM bdc_field USING 'MARC-SERNP'
it_itab-sernp.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'BDC_CURSOR'
'MBEW-VPRSV'.
PERFORM bdc_field USING 'MBEW-BKLAS'
it_itab-bklas.
*perform bdc_field using 'MBEW-EKLAS'
it_itab-EKLAS.
PERFORM bdc_field USING 'MBEW-VPRSV'
'v'.
PERFORM bdc_field USING 'MBEW-PEINH'
'1'.
perform bdc_field using 'MBEW-VERPR'
it_itab-VERPR.
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'
it_itab-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'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MBEW-EKALR'
'X'.
PERFORM bdc_field USING 'MARC-AWSLS'
'000001'.
PERFORM bdc_field USING 'MARC-LOSGR'
'1'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MBEW-ZPLPR'.
*perform bdc_field using 'MBEW-ZPLPR'
'6000'.
PERFORM bdc_field USING 'MBEW-BKLAS'
it_itab-bklas.
PERFORM bdc_field USING 'MBEW-VPRSV'
'V'.
PERFORM bdc_field USING 'MBEW-PEINH'
'1'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'MM01' USING bdcdata MODE 'A'
UPDATE 'S'
MESSAGES INTO it_msgtab.
CLEAR bdcdata[].
CLEAR it_itab.
PERFORM error.
ENDLOOP.
*& Declaration of Error Handling *
i
it_msgtab1-msgv1 = it_msgtab-msgv1.
it_msgtab1-msgv2 = it_msgtab-msgv2.
it_msgtab1-msgv3 = it_msgtab-msgv3.
APPEND it_msgtab1.
ENDLOOP.
download error message to a file by using function module
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'C:\Documents and Settings\sapthamm\Desktop\error.xls'
filetype = 'ASC'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_EOL = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
data_tab = it_mess
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form BDC_DYNPRO
text
-->PROGRAM text
-->DYNPRO text
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF FVAL <> .
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
form error.
LOOP AT it_msgtab.
IF it_msgtab-msgtyp = 'E'.
SELECT SINGLE * FROM t100 WHERE sprsl = it_msgtab-msgspra
AND arbgb = it_msgtab-msgid
AND msgnr = it_msgtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH it_msgtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH it_msgtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH it_msgtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH it_msgtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH it_msgtab-msgv1 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv2 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv3 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
it_mess-msgtyp = it_msgtab-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = it_msgtab-msgv1.
APPEND it_mess.
WRITE: / it_msgtab-msgtyp, l_mstring(150).
ELSE.
WRITE: / it_msgtab.
it_mess-msgtyp = it_msgtab-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = it_msgtab-msgv1.
APPEND it_mess.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
LOOP AT it_msgtab.
Rewords some points.
rgds,
P.Naganjana reddy -
BDC won't work in Table Control...
Hi Guys,
Again, i am stuck in the bdc problem. I am trying to bdc into a table control. I have two items to put into the table control via BDC. The TCODE that i need to bdc is PAKG.
<b>Previously</b>,<i> some of you have given me many advise on this but i just couldn't solve it. Here i am attaching my code for everyone to help me.</i>
Below is the code that i wrote:
DATA: I(2) TYPE N.
I = 1.
LOOP AT TUPLOAD.
IF SY-TABIX > 1.
CLEAR PARA.
PARA = 'Q0221-BETRG'.
CONCATENATE PARA '(' I ')' INTO PARA.
PERFORM BDC_FIELD USING PARA TUPLOAD-AMOUNT.
PERFORM BDC_FIELD USING 'BDC_SUBSCR'
'SUBSCREEN_TC2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' PARA.
CLEAR PARA.
PARA = 'Q0221-LGART'.
CONCATENATE PARA '(' I ')' INTO PARA.
PERFORM BDC_FIELD USING PARA TUPLOAD-WAGT.
CLEAR PARA.
PARA = 'Q0221-TAXAU'.
CONCATENATE PARA '(' I ')' INTO PARA.
PERFORM BDC_FIELD USING PARA TUPLOAD-TAXA.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=INSL'.
I = I + 1.
ENDIF.
ENDDLOOP.
thanks.
WilliamThe PAKG has a sample BDC file.
This mentions how to code for multiple lines.
I am copying it here:
PerNr ChkDt I OCRe TaxA Business No. RsAr QcTx WagT Hours Amount
07070707 31.12.1999 0 BC MC00 2000
/320 40
/322 50
07070707 31.12.1999 1 BC MC00 2200
/320 44
/322 55
Hope this helps,
Bhanu -
Selection-screen pushbutton & Table Control
Hi Everyone
In my program i have a pushbutton in my selection-screen; this button call a screen with a table control, the problem is when i run my report and return to the first screen, the data in the TC is cleared.
It's possible to save the information of my TC if i run my report and return to the first screen??
Thanks & Regards
DavidHi,
Write the logic for putting data from an internal table into table control in the PBO of the called screen & not in the PAI of the calling screen. Also, when you exit that screen, retrieve data into the internal table.
For e.g. if Screen 9002 contains table control then
PBO of Screen 9002:
loop at it_itab into x_itab with control table_control_name.
module put_data.
endloop.
PAI of screen 9002:
loop at it_itab into x_itab.
module get_data.
endloop.
Reward points if the answer is helpful.
Regards,
Mukul -
Dynamic Screen in Table Control
Hello Guys,
I have a problem on screen dynpro. In the screen, i have a table control and i set all the field can be input.
But i have 2 t-code where 1 of the t-code can edited the data and another one only display.
So in screen status, i insert this code.
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 = 'ZKP'.
screen-input = 0.
screen-output = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
but when i execute, the screen still can be input. can anyone help me please...!!!!That coding i put it in "MODULE STATUS 0300." Those are the coding for the screen and the module status.
*************--code for the screen----******************
PROCESS BEFORE OUTPUT.
MODULE STATUS_0300.
*&spwizard: pbo flow logic for tablecontrol 'TBL_KWPP'
module TBL_KWPP_init.
*&spwizard: module TBL_KWPP_change_tc_attr.
*&spwizard: module TBL_KWPP_change_col_attr.
module TBL_KWPP_change_tc_attr.
loop at g_TBL_KWPP_itab
into g_TBL_KWPP_wa
with control TBL_KWPP
cursor TBL_KWPP-current_line.
*&spwizard: module TBL_KWPP_change_field_attr
module TBL_KWPP_move.
module TBL_KWPP_get_lines.
endloop.
module cal_sum2.
PROCESS AFTER INPUT.
MODULE returnexit AT EXIT-COMMAND.
*&spwizard: pai flow logic for tablecontrol 'TBL_KWPP'
loop at g_TBL_KWPP_itab.
chain.
field ZLMDL015A-ZRUMJEN.
field ZLMDL015A-ZRUMFAED.
field ZLMDL015A-ZRUMULA.
field ZLMDL015A-ZRUMAKH.
field ZLMDL015A-ZRUMAMB.
field ZLMDL015A-ZRUMTERIMA.
field ZLMDL015A-ZRUMBAYARAN.
field ZLMDL015A-ZRUMAMNOM.
field G_TBL_KWPP_WA-FLAG
MODULE tab_vot_mark1 ON REQUEST.
MODULE TBL_KWPP_modify ON CHAIN-REQUEST.
endchain.
endloop.
module TBL_KWPP_user_command.
*&spwizard: module TBL_KWPP_change_tc_attr.
*&spwizard: module TBL_KWPP_change_col_attr.
MODULE USER_COMMAND_0300.
*******---code for the module status---**********
MODULE STATUS_0300 OUTPUT.
SET PF-STATUS '0300'.
* SET TITLEBAR 'TITLE3' WITH 'Wujud/Kemaskini'.
* zlmfl030-zlmtkhlaras = w_ztksej.
perform set_tarikh.
* perform find_data.
IF sy-tcode = 'ZDLKWPP1'.
SET TITLEBAR 'TITLE' WITH 'Wujud/Kemaskini'.
SET PF-STATUS '0300'.
ELSE.
SET TITLEBAR 'TITLE' WITH 'Papar'.
SET PF-STATUS '0300' EXCLUDING 'SAVE'.
endif.
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 CS 'ZKP'.
screen-input = 0.
screen-output = 1.
MODIFY SCREEN.
CLEAR SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " STATUS_0300 OUTPUT
and as you can see i try ashavind code, it still not working. -
Add Custom field to standard screen with table control
Hello,
I need to add two custom fields to a standard screen in CAT2 transaction(not using any screen exit).I will be given SSCR key.The standard screen (screen no. 2100) only has a table control.
How can I add the custom field such that it appears as a field on the screen when CAT2 transaction is opened.
Do i need to write any code?
I'm new to ABAP so could you please give a detailed explanation.
Also, do i need to change the 'fixed columns' field in the table control?
Regards,
Monica.hi,
1) find the screen
2) add new fields to the screen
3) program PBO and PAI
regards,
Wojciech
Maybe you are looking for
-
Best Practice for creating Excel report from SSIS.
I have a requirement to create an Excel report on a daily basis which pulls data from SQL. I have attempted to resolve this by creating a stored procedure to save the results in SQL, a template in Excel to hold the graphs & pivot tables and an SSIS p
-
Pricing condition record Scales for width
Hi, Wanted your expertise, as we are trying to implement scale for a pricing condition as below. Please advise which scale type to be used I think we should use D as interval graduated scale, but my query is my width value stored in material master a
-
Skype Problem: Lagging and disconnecting, but inte...
i did same subscription before existing subscription expiry. Money paid thorugh skype but i am unable to use minutes and i have to wait to use newly paid subscription and existing subscription does not have balance...
-
Cannot up service ip for NAC(HANG)
Hi guys, i got this problem after i reboot my NAC. Starting jexec: Starting jexec services[ OK ] pkp_drv: module license 'CAVIUM' taints kernel. Starting perfigo: Starting High-Availability services: [FAILED] heartbeat: 2010/04/19_14:55:47 info:
-
Front Row; Is there a way to play a shuffled slide show of an entire iPhoto
Can't see any way to do this in setting. I guess I could just create a huge album in iPhoto but that would take up too much memory. Maybe a silly venture but it would be cool.