‎2006 Sep 28 1:07 PM
Hi Wizards,
I have 2 things to clarify:
1) can an internal table have 2 include structures (for header and item) and can the fields be directly accessed for population
ex: begin of it1 occurs xx,
include structure 1,
include structure 2,
end of it1.
now can the fields be directly populated by saying:
it1-field1 = xxx
it1-field2 = yyy
it1-field3 = zzz
2) can 2 bdcs be performed from 1 program? now these are not normal bdcs from a flat file or so. these must fill transaction data from an internal table within the program. if yes, how?
helpful answers will be gratefully rewarded
K
‎2006 Sep 28 1:13 PM
1) can an internal table have 2 include structures (for header and item) and can the fields be directly accessed for population
yes u can do like that
chk this code
REPORT YCHATEST.
TABLES : MARA , MAKT.
DATA :BEGIN OF IT1 OCCURS 0.
INCLUDE STRUCTURE MARA.
INCLUDE STRUCTURE MAKT AS NAME1 RENAMING WITH SUFFIX NAME2.
DATA:END OF IT1.
loop at it1.
write : it1-matnr , IT1-NAME1-MAKTX.
endloop.
‎2006 Sep 28 1:13 PM
1) can an internal table have 2 include structures (for header and item) and can the fields be directly accessed for population
yes u can do like that
chk this code
REPORT YCHATEST.
TABLES : MARA , MAKT.
DATA :BEGIN OF IT1 OCCURS 0.
INCLUDE STRUCTURE MARA.
INCLUDE STRUCTURE MAKT AS NAME1 RENAMING WITH SUFFIX NAME2.
DATA:END OF IT1.
loop at it1.
write : it1-matnr , IT1-NAME1-MAKTX.
endloop.
‎2006 Sep 28 1:16 PM
the answer to your 2nd question is also an yes.. you would do the 2nd BDC similar to how do your 1st one..
~Suresh
‎2006 Sep 28 1:16 PM
Hi karthik,
1. can an internal table have 2 include structures (for header and item) and can the fields be directly accessed for population
Yes, u are absolutely right.
2.
can 2 bdcs be performed from 1 program? now these are not normal bdcs from a flat file or so. these must fill transaction data from an internal table within the program. if yes, how?
If we are using CALL TRANSACTION concept,
then we need to call it twice,
for 2 different tcodes. thats all..
(whatever we do one transction/tcode,
the same has to be done for the other)
regards,
amit m.
‎2006 Sep 28 1:18 PM
If the data has to be taken from internal tables then yes 2 bdcs can be performed in one program.
yes you can have 2 include structures.
Best Regards,
Vibha
*Plz mark useful answers
‎2006 Sep 28 1:19 PM
Yes u can have to structure inside the internal table. But check there is no common fields in both the structure.
Yes u can directly populate like this
it1-field1 = 'xxx'.
it1-field2 = 'yyy'.
it1-field3 = 'zzz'.
Or another option, u can declare a workarea of type itab. then
wa_it1-field1 = 'xxx'.
wa_it1-field2 = 'yyy'.
wa_it1-field3 = 'zzz'.
append wa_it1 to it1. clear wa_it1.
Two BDC can be performed from a single program.
For getting the data from FLAT file use the FM GUI_UPLOAD.
Then loop at that internal table and do the BDC.
Regards,
Prakash.
‎2006 Sep 28 1:21 PM
1) the 2 structures ay have same fields as they are header and ite and they may have some common fields that relate them
2) 2 BDCs from 1 pgm: I am not uploading from a flat file but from an internal table...
‎2006 Sep 28 1:38 PM
Hi again,
1. the 2 structures ay have same fields as they are header and ite and they may have some common fields that relate them
In this case,
it will give syntax error,
bcos the field names in internal table will get duplicated.
2. in such cases, we can do like this.
DATA : BEGIN OF ITAB,
EKKO AS EKKO,
EKPO AS EKPO,
END OF ITAB.
Then we can access using
ITAB-EKKO-EBELN
ITAB-EKPO-EBELN
regards,
amit m.
‎2006 Sep 28 1:57 PM
u r rite amit. it is showing an error. the scenario is: i need to populate a structure and pass it to a class method. that structure(1) contains 2 structures(a&b) for hrader & item. the method accepts only the main structure(1) and not a&b. can u suggest something...
‎2006 Sep 28 1:25 PM
when there are some common fields better idea is to create a structure in your report which will be union of the two structures and then use that for ur internal table.
when you are using data from internal table then it is possible to use two BDCs in single program.
Best regards,
Vibha
*Plz mark useful answers
‎2006 Sep 28 1:37 PM
Hi,
1) you can define two includes inside
internal table and access
DATA: BEGIN OF BDC_TAB OCCURS 10.
INCLUDE STRUCTURE BDCDATA.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF BDC_TAB.
populate fields using
bdc_tab-program = 'test'.
append bdc_tab.
2) yes you can perform 2BDC from same program
but you have to refresh bdcdata for each record
popultae bdc data for mm03
call transaction mm02 using bdcdata messages into
messtab mode 'A'.
refresh bdcdata
populate bdcdata for va01
refresh bdcdata
call transaction va01 using bdcdata messages into
messtab mode 'A'.
Regards
amole