2015 Apr 21 10:35 AM
Hello!
I am trying to create a program that will update vendor confirmation dates in ME22(N).
I need advice on how to replace the new date/quantity on the same sequence number EKES-ETENS.
The options I already tried are to use fld 'BDC_OKCODE' '=NP'. But this will create new lines so if I have 4 lines to update, then it will become 8 lines after saving.
Another option I tried is written below. But this will always update just line 2 (sequence #2).
scr 'SAPLEINB' '0200'.
fld 'RM06E-EEIND(02)' z_updated_date
fld 'EKES-MENGE(02)' t_open_po-qty_new.
fld 'BDC_OKCODE' 'BU'.
I don't think it's possible to replace the position with a variable. Or is it? Because I also tried to write ls_ekes-etens to z_c, then wrote 'RM06E-EEIND'(z_c) but then I get the message that RM06E-EEIND is not in the loop of screen SAPLEINB 0200.
Does anyone have good advice regarding this? Thanks in advance!
Cholen
2015 Apr 21 12:51 PM
Hi Cholen Tuna ,
Try something like this :
Concatenate RM06E-EEIND and position number in a variable and then call bdc_field
DATA: V_SNO TYPE I,
V_LNO(2),
V_FNAME TYPE FNAM_____4.
CONCATENATE 'RM06E-EEIND(' V_LNO ')' INTO V_FNAME.
PERFORM BDC_FIELD USING V_FNAME ''.
Hope this will help you out
Thanx and Regards
Yogendra Bhaskar
2015 Apr 21 11:44 AM
Hello!
You could generate BDC lines using transaction SHDB. It's a batch input recorder. More info: Using the Recording Editor - Technical Operations Manual for mySAP Technology - SAP Library
2015 Apr 21 12:14 PM
You can replace position with variable. But that number: 'RM06E-EEIND(02)' is number of line in ALV. It can be different from EKES-ETENS. Also keep length of number (check SHDB), usually it has 2 or 3 number lenght. Create variable type N (to keep zeroes) of that length.
In some transactions it is best to move cursor in ALV to your specific line (where is correspond ETENS in your case). To do this try find "Search", "Find", "Go to"... function at your screen and record it in SHDB. This way your ALV line will be always (01).
2015 Apr 21 12:51 PM
Hi Cholen Tuna ,
Try something like this :
Concatenate RM06E-EEIND and position number in a variable and then call bdc_field
DATA: V_SNO TYPE I,
V_LNO(2),
V_FNAME TYPE FNAM_____4.
CONCATENATE 'RM06E-EEIND(' V_LNO ')' INTO V_FNAME.
PERFORM BDC_FIELD USING V_FNAME ''.
Hope this will help you out
Thanx and Regards
Yogendra Bhaskar
2015 May 21 2:21 PM
This helps up to the point where the confirmations are sorted by EKES-ETENS. But when dates are updated, SAP sorts the the data in the confirmations tab by delivery date.
I think what I need is to make sure that the data that is updated has the same sequence number - which may be different from the line number in the upload file.
2015 May 21 6:59 PM
Hi Cholen,
What you need to do is select the existing confirmation lines from the EKES table into an itab and make sure that you select and sort the data in the same way that the SAP screen program does. Then match the items that you get from your upload file that must be changed to the index number in that table and use that index number in your BDC field name.
You never specify whether you're writing this BDC for ME22 or ME22N; but you don't want to try BDC on the Enjoy version ME22N - use ME22. Note that this means you're dealing with table control, not with ALV as some have suggested on this thread.
Also keep in mind the possibility of having to scroll within the table control. For example if you need to update the confirmation that is number 30 in the list of confirmations, but the table control only can show maximum of 20 at one time. If that happens, your BDC must scroll down the table control and adjust the index number in the field name from 30 to 10 (approximately) because you have to specify the position of the record in the part of the list that is displayed after scrolling, not in the complete list.
Jim
2015 May 21 7:18 PM
Hi Jim,
This is exactly what I've tried to do and it worked! I found that the SAP screen sorts it by ebelp eindt uzeit etens. Then, I had to loop into the itab where etens matches the sequence number in upload file to get the index number. I have not considered the case when you would have to scroll down the control table though.
Cholen
2015 Apr 21 12:53 PM
Hi,
I faced your problem before and this is the solution :
1- Do a select before performing the recording to know how much lines you will proceed , We will assume its name will be ITAB and it contains 3 lines.
2- For passing multiple lines data correctly create 3 string fields and use them like below :
For example we will take 'RM06E-EEIND(02)'
2015 May 21 2:23 PM
I also tried this. However, when there are LA records for example on line (01), then there will be this line that should not be updated. Thus, this is not in the upload file. If I start the count on my upload / itab with 01, then the first record will not get updated.
2015 Apr 21 1:03 PM
HI Cholen,
i understand that it gets difficult to handle the table control logic in any BDC program.
i have been faced with such scenarios and i have found that ok-code OBSE. can be ued to change the cursor position to the item/component you require.
when you are in the table control screen just manually enter OBSE in the OK code field, it will result in a popup where you can enter values so that the system can point you to the proper line item in the table control.
You can perform the above action in a loop to update/overwrite values in the table control.
do try it out and let me know in case you need any further inputs.
regards,
Vamsi
2015 May 21 2:18 PM
Hi Vamsi,
I tried to put ok-code OBSE in the table where you update the confirmations but I get the error function not found/defined.
Cholen
2015 May 21 2:23 PM
Is there a way to view, or sort, the data in the confirmations tab by sequence number instead of by delivery date?