2013 Jun 06 1:48 PM
Hi,
i have done bdc in function module,the values i enter from import parameter gets in my bdc recording,but when i call transaction xd01,
only screen comes the value doesnt get fill,please help,
please in little detail as i am a fresher.
Hi,
i have done bdc in function module,the values i enter from import parameter gets in my bdc recording,but when i call transaction xd01,
only screen comes the value doesnt get fill,please help,
please in little detail as i am a fresher.
2013 Jun 06 2:04 PM
Hi Rohan,
pls describe more precise what object you use or if it is your own code please show the bdc part.
Kind Regards
Robert
2013 Jun 06 3:49 PM
TABLES:- ITAB LIKE (STRUCTURE i HAVE CREATED)
SOURCE CODE:=--
FUNCTION ZXD01.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(BUKRS) LIKE RF02D-BUKRS
*" REFERENCE(VKORG) LIKE RF02D-VKORG
*" REFERENCE(VTWEG) LIKE RF02D-VTWEG
*" REFERENCE(SPART) LIKE RF02D-SPART
*" REFERENCE(KTOKD) LIKE RF02D-KTOKD
*" REFERENCE(ANRED) LIKE KNA1-ANRED
*" REFERENCE(NAME1) LIKE KNA1-NAME1
*" REFERENCE(ORT01) LIKE KNA1-ORT01
*" REFERENCE(PSTLZ) LIKE KNA1-PSTLZ
*" REFERENCE(LAND1) LIKE KNA1-LAND1
*" REFERENCE(SPRAS) LIKE KNA1-SPRAS
*" REFERENCE(AKONT) LIKE KNB1-AKONT
*" REFERENCE(BZIRK) LIKE KNVV-BZIRK
*" REFERENCE(KONDA) LIKE KNVV-KONDA
*" REFERENCE(ZTERM) LIKE KNVV-ZTERM
*" REFERENCE(TAXKD) LIKE KNVI-TAXKD
*" EXPORTING
*" REFERENCE(SUBRC) LIKE SYST-SUBRC
*" TABLES
*" ITAB STRUCTURE ZNEW_STR1
*"----------------------------------------------------------------------
data: bdcdata like bdcdata occurs 0 with header line.
DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_MESG(50).
****
**data: BEGIN OF itab OCCURS 0.
ITAB-BUKRS = BUKRS. "cOMPANY CODE
ITAB-VKORG = VKORG. "Sales Organization.
ITAB-VTWEG = VTWEG. "Distribution Channel.
ITAB-SPART = SPART. "Division
ITAB-KTOKD = KTOKD. "ACCOUNT GROUP.
ITAB-ANRED = ANRED. "TITLE.
ITAB-NAME1 = name1. "name.
ITAB-ORT01 = ort01. "city.
ITAB-LAND1 = land1. "country.
ITAB-SPRAS = spras. "language.
ITAB-PSTLZ = pstlz. "postal code.
ITAB-AKONT = akont. "Reconciliation Account in General Ledger.
ITAB-BZIRK = bzirk. "sales district.
ITAB-KONDA = KONDA. "price group.
ITAB-ZTERM = zterm. "Terms of payment key.
ITAB-TAXKD = TAXKD. " Tax classification for customer.
** data: end of ITAB.
APPEND itab.
***************************************************************
***************************************************************
subrc = 0.
*perform open_group.
LOOP AT ITAB.
perform bdc_dynpro using 'SAPMF02D' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KTOKD'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-BUKRS'
ITAB-BUKRS."'1100'.
perform bdc_field using 'RF02D-VKORG'
ITAB-VKORG."'1000'.
perform bdc_field using 'RF02D-VTWEG'
ITAB-VTWEG."'20'.
perform bdc_field using 'RF02D-SPART'
ITAB-SPART."'10'.
perform bdc_field using 'RF02D-KTOKD'
ITAB-KTOKD."'DEBI'.
perform bdc_dynpro using 'SAPMF02D' '0110'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNA1-ANRED'
ITAB-ANRED."'company'.
perform bdc_field using 'KNA1-NAME1'
ITAB-NAME1."'jk'.
perform bdc_field using 'KNA1-ORT01'
ITAB-ORT01."'pune'.
perform bdc_field using 'KNA1-PSTLZ'
ITAB-PSTLZ."'411015'.
perform bdc_field using 'KNA1-LAND1'
ITAB-LAND1."'in'.
perform bdc_field using 'KNA1-SPRAS'
ITAB-SPRAS."'en'.
perform bdc_dynpro using 'SAPMF02D' '0120'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0125'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-NIELS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
perform bdc_field using 'BDC_CURSOR'
'KNBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02D' '0340'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02D' '0360'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02D' '0210'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNB1-AKONT'
ITAB-AKONT."'233100'.
perform bdc_dynpro using 'SAPMF02D' '0215'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0220'.
perform bdc_field using 'BDC_CURSOR'
'KNB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0230'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-VRSNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0610'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KUNNR'.
perform bdc_dynpro using 'SAPMF02D' '0310'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-KONDA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNVV-BZIRK'
ITAB-BZIRK."'0002'.
perform bdc_field using 'KNVV-AWAHR'
'100'.
perform bdc_field using 'KNVV-WAERS'
'INR'.
perform bdc_field using 'KNVV-KONDA'
ITAB-KONDA."'01'.
perform bdc_field using 'KNVV-KALKS'
'1'.
perform bdc_dynpro using 'SAPMF02D' '0315'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-LPRIO'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNVV-KZAZU'
'X'.
perform bdc_field using 'KNVV-ANTLF'
'9'.
perform bdc_dynpro using 'SAPMF02D' '0320'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNVV-ZTERM'
ITAB-ZTERM."'k000'.
perform bdc_dynpro using 'SAPMF02D' '1350'.
perform bdc_field using 'BDC_CURSOR'
'KNVI-TAXKD(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'KNVI-TAXKD(01)'
ITAB-TAXKD."'1'.
perform bdc_dynpro using 'SAPMF02D' '1350'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02D' '0324'.
perform bdc_field using 'BDC_CURSOR'
'KNVP-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*perform bdc_transaction using 'XD01'.
*perform close_group.
call transaction 'XD01' using bdcdata mode 'E' UPDATE 'A' MESSAGES INTO IT_MESSAGES.
ENDLOOP.
******************
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID "SY-MSGID
LANG = '-D'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = V_MESG
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.
LOOP AT IT_MESSAGES WHERE MSGTYP = 'E'.
WRITE : / 'Message :'(I06) ,V_MESG.
CLEAR IT_MESSAGES.
ENDLOOP.
ENDFUNCTION.
2013 Jun 07 9:15 AM
As a side note, don't use so many single parameters in the interface, rather create a Z-structure with the required fields (or use the existing ZNEW_STR1 if possible) and use that as the only import parameter. This is more flexible when this logic needs to be enhanced in the future (which is usually the case).
TABLES-parameters are obsolete, rather use an EXPORTING parameter with reference to a table type.
Thomas
2013 Jun 07 9:48 AM
SIR,
can u write a few example what ur telling..to write in tables
2013 Jun 07 10:47 AM
Hi,
You can try using mode 'A' in which you can find out easily whether from initial screen itself you have problems.
call transaction 'XD01' using bdcdata mode 'A' UPDATE 'A' MESSAGES INTO IT_MESSAGES.
2013 Jun 07 10:59 AM
Hi!
What he means is , instead of giving this:
BEGIN OF itab OCCURS 0.
ITAB-BUKRS = BUKRS. "cOMPANY CODE
ITAB-VKORG = VKORG. "Sales Organization.
ITAB-VTWEG = VTWEG. "Distribution Channel.
ITAB-SPART = SPART. "Division
ITAB-KTOKD = KTOKD. "ACCOUNT GROUP.
ITAB-ANRED = ANRED. "TITLE.
ITAB-NAME1 = name1. "name.
ITAB-ORT01 = ort01. "city.
ITAB-LAND1 = land1. "country.
ITAB-SPRAS = spras. "language.
ITAB-PSTLZ = pstlz. "postal code.
ITAB-AKONT = akont. "Reconciliation Account in General Ledger.
ITAB-BZIRK = bzirk. "sales district.
ITAB-KONDA = KONDA. "price group.
ITAB-ZTERM = zterm. "Terms of payment key.
ITAB-TAXKD = TAXKD. " Tax classification for customer.
You can go to SE11=> DataType => Structure, create a structure, say zstruct1 and define them as fields in SE11..
So, Fields (BUKRS, VKORG, etc will be your fields in structure)..
Then in SE38, in your program, declare an internal table, like:
DATA: BEGIN OF ITAB OCCURS 0.
INCLUDE STRUCTURE zstruct1.
DATA: END OF ITAB.
Now proceed using ITAB just as you were initially.
Regards,
KS
2013 Jun 07 11:31 AM
i have created a structure. and define in tables ,what else should be their in my fm.
2013 Jun 07 1:46 PM
Im not sure, but try doing this,
FORM dynpro USING dynbegin name value.
IF dynbegin = 'X'.
CLEAR bdc_tab.
MOVE: name TO bdc_tab-program,
value TO bdc_tab-dynpro,
'X' TO bdc_tab-dynbegin.
APPEND bdc_tab.
ELSE.
CLEAR bdc_tab.
MOVE: name TO bdc_tab-fnam,
value TO bdc_tab-fval.
APPEND bdc_tab.
ENDIF.
ENDFORM. " DYNPRO
Regards,
KS
PS: Here, replace bdc_tab with bdcdata.
2013 Jun 07 8:23 PM
IT is giving following error..
| Different number of parameters in FORM and PERFORM (routine: |
| BDC_DYNPRO, number of formal parameters: 3, number of actual |
| parameters: 2). |
2013 Jun 07 8:33 PM
2013 Jun 08 6:18 AM
Try replacing all of "perform bdc_dynpro using 'SAPMF02D' '0100'." with:
PERFROM bdc_dynpro USING 'X' 'SAPMF02D' '0100'.
Regards,
KS
2013 Jun 09 1:18 PM
HI when called in se38 ,
how to link my selection screen parameter to import parameter of fm
2013 Jun 06 2:43 PM
Hi
First thing , no need of FM for BDC .You can do the coding in routine .
When you create a FM - > You should give all screen parmaters in TABLES as all the paramters are internal table types for call trasaction except modes and screens display .
So when you use FM ->Make sure you import the work area to FM and change the BDCDATA tables accrordingly in the FM.
.But try to code in Routine only instead of FM.if its mandatary to use FM you can use the above process to import and export values but all the paramters should be internal table type .
Thanks
Kamesh
2013 Jun 06 3:50 PM
2013 Jun 07 7:16 AM
can you explain little clear,sorry for that i didn't understood.
2013 Jun 07 6:00 AM
Hi Rohan,
Did u clear the work area for bdcdata in the form bdc_dynpro and bdc_field ?
Best Regards
Akhilesh Singh
2013 Jun 07 7:14 AM
I have created in a sub routine..
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
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_CHARACTER.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
** ENDIF.
ENDFORM.
2013 Jun 07 10:24 AM
2013 Jun 07 10:32 AM
Did you create the function module of your own ? Convert your recording directly to Function module from SHDB and then check.
2013 Jun 07 10:39 AM
Press button "function module" to create function module in SHDB instead of program.
2013 Jun 07 11:31 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |