‎2012 Feb 22 11:29 AM
Dear Friends,
I have done one alv report with checkboxes which displays blocked billing plan line items.
I put a execute button, for selected records it is to be processed and the status get unblocked in dbase.
i have done this using some fm's start with SD_SALES....
at last i am calling bapi_transaction_commit it is working fine..
After that i am using bdc for vf01 and it's working fine and i got the messages into one itab.
But how do i display that data in the screen ?
I have to display the data in the same screen by refresh it.
How do i achieve this...?
My requirement is after click on execute it has display the Billing Numbers which are genarated..
when 'EXECUTE'.
---
----
---
refresh it_bdcdata.
* BDC for Invoice Creation
v_index = v_index + 1. "SY-TABIX.
perform bdc_dynpro using 'SAPMV60A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'KOMFK-VBELN( V_INDEX )'. "'KOMFK-VBELN(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
concatenate 'KOMFK-VBELN(' v_index ')' into v_fnam.
perform bdc_field using v_fnam
wa_process-vbeln. "'40000003'.
clear v_fnam.
perform bdc_dynpro using 'SAPMV60A' '0104'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
call transaction 'VF01' using it_bdcdata mode 'A'
update 'S'
messages into it_msg.
perform bdc_messages.
endloop.
loop at it_error into wa_error. " Here i am getting those billing numbers
write : / wa_error-msg_err.
clear wa_error.
endloop.
‎2012 Feb 22 11:35 AM
Hi Friend,
Can you please explain your requirement more clearly.
Regards,
Praveenkumar T.
‎2012 Feb 22 11:42 AM
Dear Praveen,
I am displaying an alv report with check boxes.
for selecteding records i am unblocking some records(Using fm's- commit work)
for those creating invoice(vf01-BDC).
ALL is well .. i am getting messages into one internal table.
now i want to display that messages in that screen(means after execute).
‎2012 Feb 22 11:57 AM
Hi,
After BDC Process completion r using FORMAT_MESSAGE..
From IT_MSG you can display.
Regards,
Praveen.
‎2012 Feb 22 12:00 PM
HI Friend,
If i have understood your requirement correctly , you have created invoice for the unblocked records and you have to display all the invoice document number created in a screen after clicking on execute.
This can be achieved. Please follow the below process,
As soon as the BDC is over , you can write a SELECT query in VBRK table to fetch the records based on the condition ERDAT EQ sy-datum AND ENNAM EQ sy-uname.
Now you will have all the records created.
If you are going to run the program more than once in a day, then add one more condition ERZET GE lv_uzeit.
This lv_uzeit has to be set at the initialization as given below,
DATA: lv_uzeit TYPE sy-uzeit.
INITIALIZATION.
lv_uzeit = sy-uzeit.
<UNBLOCK>
<BDC>
SELECT VBELN FROM VBRK INTO IT_VBELN
WHERE ERNAM EQ sy-uname
AND ERZET GE lv_uzeit
AND ERDAT EQ sy-datum.Now the table it_vbeln will have all the billing documents created during the execution.
LOOP AT it_vbeln INTO WA_VBELN
WRITE : wa_vbeln-vbeln.
ENDLOOP.
Thus after clicking on execute you will have all the created invoice documents displayed.
"NOTE: Your it_msg table will have all the numbers but it will also have other message as well hence it is better to go with the above approach."
Hope this helps.
Regards,
Praveenkumar T.
‎2012 Feb 22 12:53 PM
Dear All,
I have done the things what you said.
but my requriement is i want to display the invoice numbers(message created) in separate screen.
Here i am getting the message in status bar of lastly created invoice number.
the loop is not displaying in another screen.
Kindly note that it is an interactive report.
Edited by: anurag.radha on Feb 22, 2012 2:23 PM
‎2012 Feb 22 1:24 PM
Hi,
Did you write same select query I have mentioned. and use the write statement as shown in the code?
After select you should write this code as well.
LOOP AT it_vbeln INTO WA_VBELN
WRITE : /n wa_vbeln-vbeln.
ENDLOOP.if that is done i am very sure that it will display the list of invoice number in a different screen.
Regards,
Praveenkumar T.
‎2012 Feb 22 12:06 PM
Hi,
You can simply Loop at it_msg and write the lines.
It will display your messages.
And if you want to display only successful cases then you can -
LOOP AT it_msg INTO wa_msg WHERE msgtyp = 'S'.
ENDLOOP.
Regards,
Harsh Bansal
‎2012 Feb 22 12:23 PM
Hi Anurag,
Please use:
DATA: it_msg LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA : v_msg(255) TYPE c.
LOOP AT IT_MSG WHERE msgtyp = 'S'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = it_msg-msgid
lang = 'E'
no = it_msg-msgnr
v1 = it_msg-msgv1
v2 = it_msg-msgv2
v3 = it_msg-msgv3
v4 = it_msg-msgv4
IMPORTING
msg = v_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
ENDLOOP.
Edited by: Ajoy Chakraborty on Feb 22, 2012 5:54 PM
‎2012 Feb 22 1:39 PM
Hi,
Just use Write statement in Loop to display messages.
Then it will come in a new screen.
Regards,
Harsh Bansal
‎2012 Feb 22 1:54 PM
Dear harsh Bansal,
I tried this but it is not displaying in the new screen.
call transaction 'VF01' using it_bdcdata mode 'N'
update 'S'
messages into it_msg.
select single vbeln from vbrk into wa_vbrk
where ernam eq sy-uname
and erzet ge lv_uzeit
and erdat eq sy-datum
and ernam eq sy-uname.
append wa_vbrk to it_vbrk.
clear wa_vbrk.
endloop.
loop at it_vbrk into wa_vbrk.
write : / wa_vbrk-vbeln color 5.
clear wa_vbrk.
endloop.
‎2012 Feb 22 2:20 PM
Hi,
Write your SELECT query outside the BDC LOOP. If it is inside the loop it will always fetch the same data. since you have used select single.
Also check if the Internal table it_vbrk is not Empty.
you code should look like.
call transaction 'VF01' using it_bdcdata mode 'N'
update 'S'
messages into it_msg.
endloop.
select vbeln from vbrk into table it_vbrk
where ernam eq sy-uname
and erzet ge lv_uzeit
and erdat eq sy-datum.
IF it_vbrk IS NOT INITIAL.
loop at it_vbrk into wa_vbrk.
write : / wa_vbrk-vbeln color 5.
clear wa_vbrk.
endloop..
ENDIF.Please revert if you still face problems.
Regards,
Praveenkumar T.
‎2012 Feb 23 9:48 AM
Dear Praveen,
Still it is not working.
i debugged it it goes to that loop and displaying.
Any way i resolved this by passing this it_vbrk to reuse_alv-grid_display.
it works fine.
Thnak you so much all.
‎2012 Feb 22 2:00 PM
This should work actually.
Did you try debugging it from Select statement onwards??
Regards,
Harsh Bansal