‎2006 Jan 19 11:14 PM
Hi folks,
I have record the BDC using SHDB for (0028) code is look like,
'Q0028-SBJKT<b>(01)</b>' ' ' ' ',
'Q0028-JNFLD(<b>01</b>)' ' ' ' ',
'Q0028-NMFLD(<b>01</b>)' ' ' ' ',
'Q0028-WTFLD<b>(01</b>)' ' ' ' ',
'Q0028-DTFLD(<b>01)</b>' ' ' ' ',
But this(01) will keep changing on the bases of excel sheet, how can I <b>pass (01) dynamically</b> to BDC code <i>up to (30) </i> .
For example in some cased it could be <b>( 03),(05), or (20) or (30) ,</b>
User will give me a excel sheet like
Pernr subtype result Sbj01 JNF01 NMF01 Wtf01 Dtf01 .up to Sbj30 JNF30 NMF30 Wtf30 Dtf30
Ill appreciate your help.
Thanks
Bye
‎2006 Jan 19 11:31 PM
Hi
You should have an index to do that, for example if tha data file are stored in an internal table and every record is a record for your bdc:
DATA: INDEX(2) TYPE N,
COUNTER TYPE I.
DATA BDC_FIELD(20).
LOOP ....
COUNTER = COUNTER + 1.
IF COUNTER > 30.
COUNTER = 1.
ENDIF.
MOVE COUNTER TO INDEX.
PERFORM BUILD_FIELD_NAME USING: 'Q0028-SBJKT',
'Q0028-SBJKT',
'Q0028-JNFLD',
'Q0028-NMFLD',
'Q0028-WTFLD',
'Q0028-DTFLD'.
ENDLOOP.
FORM BUILD_FIELD_NAME USING FIELDNAME.
CONCATENATE FIELDNAME '(' INDEX ')' INTO BDC_FIELD.
ENDFORM. " BUILD_FIELD_NAME
max
‎2006 Jan 19 11:30 PM
data int1 type I,
n type I.
loop n times.
int1 = sy-index.
concatenate 'Q0028-SBJKT(' int1 ')' into field1.
concatenate 'Q0028-jnfld(' int1 ')' into field2.
concatenate 'Q0028-jnfld(' int1 ')' into field3.
...
...
clear int1.
endloop.
fields field1, field2,... will contain the data.
dynamically the number is increased.
hope this helps you.
Pls do reward points if its helpful to you.
Cheers,
Suresh
Message was edited by: Suresh Deshpande
‎2006 Jan 19 11:31 PM
Hi
You should have an index to do that, for example if tha data file are stored in an internal table and every record is a record for your bdc:
DATA: INDEX(2) TYPE N,
COUNTER TYPE I.
DATA BDC_FIELD(20).
LOOP ....
COUNTER = COUNTER + 1.
IF COUNTER > 30.
COUNTER = 1.
ENDIF.
MOVE COUNTER TO INDEX.
PERFORM BUILD_FIELD_NAME USING: 'Q0028-SBJKT',
'Q0028-SBJKT',
'Q0028-JNFLD',
'Q0028-NMFLD',
'Q0028-WTFLD',
'Q0028-DTFLD'.
ENDLOOP.
FORM BUILD_FIELD_NAME USING FIELDNAME.
CONCATENATE FIELDNAME '(' INDEX ')' INTO BDC_FIELD.
ENDFORM. " BUILD_FIELD_NAME
max
‎2006 Jan 20 3:09 PM
Thanks for the answers. Any other Suggestion out there.
Waiting
Bye
‎2006 Jan 20 3:15 PM
Hi Suleman,
1. There is no other way !
2. The field name which we
pass in the bdc,
-- it is not necessasry
that we have to hardcode it.
3. we can use CONCATENATE and variable
to Dynamically construct the FIELD NAme
and also put Brackets ().
regards,
amit m.
‎2006 Jan 20 11:13 PM
I wrote up the code , and Im coming across another problem now
I wrote logic like
<b>concatenate:'Q0028-SBJKT(' counter ')' into field1,
'Q0028-jnfld(' counter ')' into field2,
'Q0028-jnfld(' counter ')' into field3,
'Q0028-WTFLD(' counter ')' into field4,
'Q0028-DTFLD(' counter ')' into field5.</b>
This fields are coming form excel and these fields are up to 30 .
But when I record IT0028 , <b>It only consider the fields 01 to 06, There is page down up to 30</b> .. fields
<b>These fields are maintain as in tabular form .
01 Degree Input from excel
02 Home Input from excel
03 dd Input from excel
04 dd Input from excel
05 dd Input from excel
06 dd Input from excel
Next page
07 ds Input from excel
08 ee Input from excel
09 ee Input from excel
.
.
.
03 yy Input from excel</b>
Now I have write a code to page down depends upon every 06 fields
<b>if counter GE '06'.
i = 1.
elseif counter GE '12' and counter LE '18'
I = 2
And so on up to 30
Endif.</b>
<b>do i times.
PERFORM sub_bdc_field USING :
'BDC_CURSOR' 'P0028-EXDAT' ' ' ,
'BDC_OKCODE' '=P+' ' '.
enddo.</b>
Now when say we need to upload 8 recorded which is 8th place in tabular but as we page down 1 when I pass 'Q0028-SBJKT(' counter ')' into field1 ( Where counter = 8) .. It pops the message field Q0028-SBJKT(08) does not exist . <b>because tabular is only take care of fields from 01 ..06 </b>
How I can upload the records till 30th where these values are based on subtype 9030 in IT0028..
What do you think guys..
Lets see
Thanks in Advanced...
Bye
‎2006 Jan 20 11:34 PM
Try this. In your screen, when you do 'page-up', see where the next item can be inserted. Typically it will be in the second line. Assuming that it is, your do loop can be eliminated and rewritten as follows.
loop at items.
if sy-tabix = 1.
prepare bdc data with counter 1.
else.
prepare bdc data with counter 2 always.
do a page up.
endif.
endloop
‎2006 Jan 20 11:52 PM
No its not the case I am hitting <b>Page down</b> and values are coming for file for one employee there could be up to 30 entries .. I can only see first 01 ...to 06 fields in IT0028 Sub type = 9030...
But for next field after one <b>'page down'</b> is 07 but technically its field become (01) ....
I hope I made my self clear right?
‎2006 Jan 21 12:31 AM
That is what I am trying to address. Do not try to enter all the lines (7 in this case). You enter one item, then the second, now do page up. This will bring the next empty line to second position. Enter item in the second position. Again press page up, the next empty line will be in the second position.
This way you will always enter constantly in the second position, no matter however many lines you have.
If you code the way you are doing, you will run into the problems that you are facing now and also the number lines available will vary depending on the screen resolution and running it online vs background. So even if you change the counter back to 1 after every seven entries, the number of lines available may be 6 or 9. So you will face a problem there.
So please try this logic.
enter first line with bdc field as field1(01).
enter second line with bdcfield as field2(01).
Bdc okcode = pageup
enter the third item of the itab into second position only.
bdcokcode = pageup.
enter 4th one again in the second position.
bdc okcode = pageup.
....... and so on...
‎2006 Jan 23 4:14 PM
Thanks a lot for your answer...
in my case the value in rows are 'DEFAULT VALUES' based on subtype configuration in SPRO. For subtype '9030' I have 20 'DEFAULT VALUES' so Rows are like 01.....20. Theres no line feed on new line which I have to enter . When Ever Ill click IT = 0028 and subtype = 9030. Ill get 20 values in rows and I have to put date in front of every Row till 20th (In fact Based on excel sheet ).
Any idea
Thanks
Message was edited by: Suleman Javed
‎2006 Jan 23 8:36 PM
Hi Suleman,
From what I understand, the examination areas are defined in T528Z and are fixed values for each subty. ie the order in which you enter them should not matter. In your case for subty 9030, enter the first six entries as 'Q0028-SBJKT(01)' through 'Q0028-SBJKT(06)' page down & and next six entries as 'Q0028-SBJKT(01)' through 'Q0028-SBJKT(06)' and so on..
Regards,
Suresh Datti
‎2006 Jan 23 8:46 PM
Hi Suresh,
Now we are on the same page .. I am trying to do the same but its not working ..like say 1st REC against any employee I get is 'Q0028-SBJKT(01), it will post it successfully , the next record is 20 OK ..Now we need to page down 3 times then we reach to record number '20'
3 * 6 = 18 ...Record will be 'Q0028-SBJKT(02)'....
How I can handle this in code. So far I am trying to do the following but its not working fine .
concatenate:'Q0028-SBJKT(' counter ')' into field1,
'Q0028-jnfld(' counter ')' into field2,
'Q0028-jnfld(' counter ')' into field3,
'Q0028-WTFLD(' counter ')' into field4,
'Q0028-DTFLD(' counter ')' into field5.
concatenate:'Q0028-jnfld(' count ')' into field6.
PERFORM sub_bdc_dynpro USING 'MP002800' '2000'.
PERFORM sub_bdc_field USING :
'P0028-EXDAT' p_rec-a_EXDATE ' ',
'P0028-RESUL' p_rec-a_RES ' ',
'BDC_CURSOR' field6 ' ' ,
'BDC_OKCODE' '=P+' ' ' , "NEXT PAGE
field1 p_rec-a_SBJKT ' ',
field2 p_rec-a_JNFLD ' ',
field3 p_rec-a_NMFLD ' ',
field4 p_rec-a_WTFLD ' ',
field5 p_rec-a_DTFLD ' ',
'BDC_OKCODE' '=UPD' ' '. "SAVE
In my case, subtype is also in excel file. Say for some subtype it will be till 30 or for some it will be till 10 or in some it will be: AL,AC etc....
Thanks For your help...
Bye
‎2006 Jan 23 9:00 PM
Hi Suleman,
Even if the 2nd entry is '20', you don't need to really scroll down to the 20th entry in the table control.. you can enter it in 'Q0028-SBJKT(02)'. this is what I meant when I said the order in which you enter does not matter..
Regards,
Suresh Datti
‎2006 Jan 23 9:09 PM
When I am trying to this for "20" its giving me following <b>error message "Examination area 9030 02 cannot be delete"</b>
Just do it in your SAP system and see how It reacts may be that will clear my question.
Thanks
‎2006 Jan 23 9:45 PM
We don't use this infotype.. will try to do a recording in our sandbox & let u know..
Suresh
‎2006 Jan 23 10:05 PM
HI,
You will get that error if the mode eq 'X' in T578Z for the examination area(SBJKT).. which is why you are getting the error message.. So, pl check the entries in this table for subty '9030'. If the mode is 'X' for all the 20 entries.. you will have to pass empty values in your BDC for the SBJKT that you don't need.. because if you skip them, the system tries to delete & throws up the error.. hope the scenario is clear for you now..
Regards,
Suresh Datti
‎2006 Jan 23 11:07 PM
Hi Suleman/Suresh
I am also facing the Exact same kind of problem, I have tried almost everything.. But its not working ...
Any body out there who can solve it ..
Let me tell you its a real challenging stuff to do ..
Waiting
Bye
‎2006 Jan 23 11:15 PM
Hi,
Did you try what I suggested in my earlier reply.. it should work..
Regards,
Suresh Datti
‎2006 Jan 23 11:30 PM
Suresh
I have tried , I knew there are few tables which contains the entries against subtype , in my case I am validating entries from these tables..
Tables are T578T,T578W,T578X,and the one you just told ..( T578Z)...
For subtype '9030' I can see all the values in table are = 'X'.
Now you are suggesting that if in file we have entries SBJKT = 01,03,15,20.
We have to pass Spaces for all remaining SBJKT in BDC ?
I remember I have done same kind of work in SALES ORDER ( VA02 ) screen but it has the option which will populate the Item number .. but here looks like its going beyond the screen ...
Let me try this and get back to you...
Bye
‎2006 Jan 23 11:37 PM
Saquib
I also tried to see option in Menu bar and also by right clicking on the table but there is no option which pulls up the rows .
I think I am not getting your point guys
I may need a break .
Thanks Saquib and Suresh...
‎2006 Jan 23 11:46 PM
Hi,
>>>We have to pass Spaces for all remaining SBJKT in BDC ?
YES. PL try that & it should work.
Regards,
Suresh Datti
‎2006 Jan 24 4:50 PM
Hey ALL...
I have made up excel file and pass spaces with rest of the fields which done have value .... it works fine for first 6 entries .. After that its start giving message Field "SBJKT(7) doesnt note exist in the program MP002800 screen '2000'....
As I have values for 7,8, and 9 . and lastly for 20...
but It just post first 6 values and after that start giving me messages although I have passed "SPACES TO SBJKT
In my case I have One record for each employee... I dont have several records like Suleman has in his file , as he mentioned earlier in his email ..
I also fill an internal table with values of TABLE "T578Z"... I also spoke to my functional guy ..he said these values are pre-populated/Default and if I wants him to off these it might take him 2 days .... So Heres the latest condition...
Now I have one record per employee which has the values from SBJKT(01)...SBJKT(30)...
My Scenario is little difficult ... What about you Suleman ..?
Suresh wot you think now .. I have also considering an option to use FM "HR_MAINTAIN_MASTERDATA" Wot you think ? But as per my experience if I use this Fm .. That cause a buffer problem .. as this Fm called "Call Dialog"...
Ill appreciate any input /suggestion.
Bye
‎2006 Jan 24 4:57 PM
Hi,
After the 1st 6 entries, you should do a page down 'P+' and start from SBJKT(01) again.. the numbers are 1 thru' 6 on each page of the Table Control..
Regards,
Suresh Datti
‎2006 Jan 24 5:22 PM
Hi Suresh
Thanks a lot for your answer... I knew I have to page down and if you remembered I also post the code in which I am doing this 'P+' after every 1 thru '6' and the re-setting counter.
Logically speaking what ever we r discussing is right. But when you code it, reacts different..
Did you try in your system?
Please bear with me and try it once ... and if it works also tell me the code.. I know its sounds wired and believe me I have coded it the way you told me and also other way around but its not working fine.
If you dont mind code the logic and try at your system so we can close this topic..
I really appreciate your help, time and concern
Saquib,
In your case you might need to define an internal table with 82 fields , as you have four fields combination till 20 that means 4 * 20 + 2 = total fields 82 .
Bundles of Thanks
Message was edited by: Suleman Javed
‎2006 Jan 24 5:39 PM
Hi Suleman,
You have to use
<b>PERFORM sub_bdc_dynpro USING 'MP002800' '2000'</b>.
after every 6 entries & before each page down (p+).
Regards,
Suresh Datti
‎2006 Jan 24 5:44 PM
Here`s the code which I posted two days before ...
'Q0028-jnfld(' counter ')' into field2,
'Q0028-jnfld(' counter ')' into field3,
'Q0028-WTFLD(' counter ')' into field4,
'Q0028-DTFLD(' counter ')' into field5.
concatenate:'Q0028-jnfld(' count ')' into field6.
PERFORM sub_bdc_dynpro USING 'MP002800' '2000'.
PERFORM sub_bdc_field USING :
'P0028-EXDAT' p_rec-a_EXDATE ' ',
'P0028-RESUL' p_rec-a_RES ' ',
'BDC_CURSOR' field6 ' ' ,
'BDC_OKCODE' '=P+' ' ' , "NEXT PAGE
field1 p_rec-a_SBJKT ' ',
field2 p_rec-a_JNFLD ' ',
field3 p_rec-a_NMFLD ' ',
field4 p_rec-a_WTFLD ' ',
field5 p_rec-a_DTFLD ' ',
'BDC_OKCODE' '=UPD' ' '. "SAVE
Thanks
Bye
‎2006 Jan 24 6:57 PM
Hi Suleman,
the following recrding worked perfect on my ststem(47).
report ZTEST0028
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
*** DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
* If it is nessesary to change the data section use the rules:
* 1.) Each definition of a field exists of two lines
* 2.) The first line shows exactly the comment
* '* data element: ' followed with the data element
* which describes the field.
* If you don't have a data element use the
* comment without a data element name
* 3.) The second line shows the fieldname of the
* structure, the fieldname must consist of
* a fieldname and optional the character '_' and
* three numbers and the field length in brackets
* 4.) Each field must be type C.
*
*** Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
* data element: PERNR_D
PERNR_001(038),
* data element: TIMRE
TIMR6_002(001),
* data element: CHOIC
CHOIC_003(035),
* data element: SUBTY
SUBTY_004(004),
* data element: USDAT
EXDAT_005(010),
* data element: NMFLD
NMFLD_01_006(011),
* data element: NMFLD
NMFLD_06_007(011),
* data element: USDAT
EXDAT_008(010),
* data element: NMFLD
NMFLD_02_009(011),
* data element: NMFLD
NMFLD_06_010(011),
* data element: USDAT
EXDAT_011(010),
* data element: NMFLD
NMFLD_03_012(011),
* data element: NMFLD
NMFLD_05_013(011),
* data element: USDAT
EXDAT_014(010),
* data element: NMFLD
NMFLD_02_015(011),
end of record.
*** End generated data section ***
start-of-selection.
perform open_dataset using dataset.
perform open_group.
do.
read dataset dataset into record.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
perform bdc_field using 'RP50G-PERNR'
record-PERNR_001.
perform bdc_field using 'RP50G-TIMR6'
record-TIMR6_002.
perform bdc_field using 'BDC_CURSOR'
'RP50G-SUBTY'.
perform bdc_field using 'RP50G-CHOIC'
record-CHOIC_003.
perform bdc_field using 'RP50G-SUBTY'
record-SUBTY_004.
perform bdc_dynpro using 'MP002800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'Q0028-NMFLD(06)'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_field using 'P0028-EXDAT'
record-EXDAT_005.
perform bdc_field using 'Q0028-NMFLD(01)'
record-NMFLD_01_006.
perform bdc_field using 'Q0028-NMFLD(06)'
record-NMFLD_06_007.
perform bdc_dynpro using 'MP002800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'Q0028-NMFLD(06)'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_field using 'P0028-EXDAT'
record-EXDAT_008.
perform bdc_field using 'Q0028-NMFLD(02)'
record-NMFLD_02_009.
perform bdc_field using 'Q0028-NMFLD(06)'
record-NMFLD_06_010.
perform bdc_dynpro using 'MP002800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'Q0028-NMFLD(05)'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_field using 'P0028-EXDAT'
record-EXDAT_011.
perform bdc_field using 'Q0028-NMFLD(03)'
record-NMFLD_03_012.
perform bdc_field using 'Q0028-NMFLD(05)'
record-NMFLD_05_013.
perform bdc_dynpro using 'MP002800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'Q0028-NMFLD(02)'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0028-EXDAT'
record-EXDAT_014.
perform bdc_field using 'Q0028-NMFLD(02)'
record-NMFLD_02_015.
perform bdc_transaction using 'PA30'.
enddo.
perform close_group.
perform close_dataset using dataset.
Regards,
Suresh Datti
‎2006 Jan 24 9:51 PM
Thanks for posting the BDC session code... I also have the same when I record it thru T-code: SHDB .... Did you just try to upload your excel file which has values from 01----30?
I am sure you havent done it that is why you just post the code... Its not working fine with the logic I explained you ...
Any way thanks a lot for all your help. I might have to work on my own .. I dont see any progress ...
Thanks once again Suresh...
Saquib Please let me know if you find something which makes sense...
Thanks
‎2006 Jan 25 12:39 AM
Hi Suleman,
Yes, I dind't try it with an excel file.. As mentioned earlier, we do not use this infotype.. I had to create SUBTY 9030 for 0028 too..
But, I still cannot understand why it doesn't work.. I will try to create an excel file and do the whole thing tomorrow.. will keep you posted..
Regards,
Suresh Datti
‎2006 Jan 25 5:32 PM
Hi ,
Try to create excel file with one REC per employee and put all the four fields , which are in tab ..
01_S(2),
01_J(1),
01_N(8),
01_W(10),
01_D(8), till 30....
Then see wot happen .. or simply download the file from SE16 ..PA00028.
Waiting .
Bye
Message was edited by: Suleman Javed
‎2006 Jan 26 4:14 PM
HI ,
I am planning to use FM "HR_INFOTYPE_OPERATION' OR FM 'HR_MAINTAIN_MASTERDATA' .. wot do you think , Did you get a chance to test it with excel file ?
Waiting ....
Bye
Message was edited by: Suleman Javed