2010 Sep 22 6:42 AM
Hi team ABAP,
i was scanning the forum, but well, wasnt able to find something appropriate.
I have to do messaging (calling FM Messaging) for some documents (Sales orders or offers).
having a look at how SAP does it in SAPMV45A i duplicated their solution, which works fine.
i do following:
DATA: lt_part TYPE TABLE OF msgpa.
FIELD-SYMBOLS: <nast> TYPE table.
"this is for offers/orders
CALL FUNCTION 'COMMUNICATION_AREA_KOMKBV1'
EXPORTING
msg_trtyp = xtrtyp
msg_vbak = gs_vbak
msg_vbkd = gs_vbkd
msg_vbuk = gs_vbuk
TABLES
tab_part = lt_part
tab_vbpa = gt_vbpa
tab_vbap = gt_vbap.
"process output types finding for document
CALL FUNCTION 'MESSAGING'
EXPORTING
applikation = gs_tvak-kappl
msg_objky = xobjky
schema = gs_tvak-kalsm
* PI_OBJTYPE =
TABLES
msg_part = lt_part
EXCEPTIONS
applikation_nicht_vorhanden = 1
schema_nicht_vorhanden = 2
OTHERS = 3.
ASSIGN ('(SAPLV61B)XNAST[]') TO <nast>. "these are the output types found
IF <nast> IS ASSIGNED.
lt_nast = <nast>.
ENDIF.
adding teh declarations here before you ask:
*** Global data declarations ***
"Global tables
DATA: gt_view TYPE ysdch_dl_prstruc1_tt, "This is the internal table for the table control
gt_vbap TYPE TABLE OF vbapvb, "Needed for messaging
gt_vbpa TYPE TABLE OF vbpavb, "Needed for messaging
gt_vbrp TYPE TABLE OF vbrpvb, "Needed for messaging
gt_lips TYPE TABLE OF lipsvb "Needed for messaging
.
"Global structures/work areas
DATA: gs_view TYPE ysdch_dl_prstruc1, "global work area of output table
gs_preferences TYPE ysdch_dl_cust01, "VKORG based preferences customizing
gs_vbak TYPE vbak, "Needed for messaging
gs_vbuk TYPE vbuk, "Needed for messaging
gs_vbkd TYPE vbkd, "Needed for messaging
gs_tvak TYPE tvak, "Needed for messaging
gs_vbrk TYPE vbrk, "Needed for messaging
gs_tvfk TYPE tvfk, "Needed for messaging
gs_rv50a TYPE rv50a,"Needed for messaging
gs_likp TYPE likp, "Needed for messaging
gs_tvlk TYPE tvlk "Needed for messaging
.
So where is my problem?
Well as long as i can do this from SAPMV45A itself all is fine, since then i can use dirty assign technique to fill GS_VBAP and GS_VBPA from XVBAP and XVBPA.
Everything works fine then.
When i´m calling this from somewhere else (project-maintainance in my case) i just have VBELN and DOCTYPE for given document so i fill those two structures (GS_VBAP & GS_VBPA) by using
SELECT *
FROM vbap
INTO gs_vbap
WHERE vbeln = lv_vbeln.
and
SELECT *
FROM vbpa
INTO gs_vbpa
WHERE vbeln = lv_vbeln.
Well, GS_VBAP is of structure VBAPVB and GS_VBPA of structure VBPAVB, means those structures contain some more fields than plain VBAP or VBPA.
One of those fields seems to be important for messaging, since when i do this SELECT thing it doesnt work out.
Actually teh building of the communication area fails. LT_PART gets returned with just ONE record even GS_VBPA contains 5 partners and i had expected six records in LT_PART then.
Anyone got some idea on this? Unfortunatleley neither FM COMMUNICATION_AREA_KOMKBV1 nor FM MESSAGING has a documentation so i gotta ask the experts here.
regards
Hi team ABAP,
i was scanning the forum, but well, wasnt able to find something appropriate.
I have to do messaging (calling FM Messaging) for some documents (Sales orders or offers).
having a look at how SAP does it in SAPMV45A i duplicated their solution, which works fine.
i do following:
DATA: lt_part TYPE TABLE OF msgpa.
FIELD-SYMBOLS: <nast> TYPE table.
"this is for offers/orders
CALL FUNCTION 'COMMUNICATION_AREA_KOMKBV1'
EXPORTING
msg_trtyp = xtrtyp
msg_vbak = gs_vbak
msg_vbkd = gs_vbkd
msg_vbuk = gs_vbuk
TABLES
tab_part = lt_part
tab_vbpa = gt_vbpa
tab_vbap = gt_vbap.
"process output types finding for document
CALL FUNCTION 'MESSAGING'
EXPORTING
applikation = gs_tvak-kappl
msg_objky = xobjky
schema = gs_tvak-kalsm
* PI_OBJTYPE =
TABLES
msg_part = lt_part
EXCEPTIONS
applikation_nicht_vorhanden = 1
schema_nicht_vorhanden = 2
OTHERS = 3.
ASSIGN ('(SAPLV61B)XNAST[]') TO <nast>. "these are the output types found
IF <nast> IS ASSIGNED.
lt_nast = <nast>.
ENDIF.
adding teh declarations here before you ask:
*** Global data declarations ***
"Global tables
DATA: gt_view TYPE ysdch_dl_prstruc1_tt, "This is the internal table for the table control
gt_vbap TYPE TABLE OF vbapvb, "Needed for messaging
gt_vbpa TYPE TABLE OF vbpavb, "Needed for messaging
gt_vbrp TYPE TABLE OF vbrpvb, "Needed for messaging
gt_lips TYPE TABLE OF lipsvb "Needed for messaging
.
"Global structures/work areas
DATA: gs_view TYPE ysdch_dl_prstruc1, "global work area of output table
gs_preferences TYPE ysdch_dl_cust01, "VKORG based preferences customizing
gs_vbak TYPE vbak, "Needed for messaging
gs_vbuk TYPE vbuk, "Needed for messaging
gs_vbkd TYPE vbkd, "Needed for messaging
gs_tvak TYPE tvak, "Needed for messaging
gs_vbrk TYPE vbrk, "Needed for messaging
gs_tvfk TYPE tvfk, "Needed for messaging
gs_rv50a TYPE rv50a,"Needed for messaging
gs_likp TYPE likp, "Needed for messaging
gs_tvlk TYPE tvlk "Needed for messaging
.
So where is my problem?
Well as long as i can do this from SAPMV45A itself all is fine, since then i can use dirty assign technique to fill GS_VBAP and GS_VBPA from XVBAP and XVBPA.
Everything works fine then.
When i´m calling this from somewhere else (project-maintainance in my case) i just have VBELN and DOCTYPE for given document so i fill those two structures (GS_VBAP & GS_VBPA) by using
SELECT *
FROM vbap
INTO gs_vbap
WHERE vbeln = lv_vbeln.
and
SELECT *
FROM vbpa
INTO gs_vbpa
WHERE vbeln = lv_vbeln.
Well, GS_VBAP is of structure VBAPVB and GS_VBPA of structure VBPAVB, means those structures contain some more fields than plain VBAP or VBPA.
One of those fields seems to be important for messaging, since when i do this SELECT thing it doesnt work out.
Actually teh building of the communication area fails. LT_PART gets returned with just ONE record even GS_VBPA contains 5 partners and i had expected six records in LT_PART then.
Anyone got some idea on this? Unfortunatleley neither FM COMMUNICATION_AREA_KOMKBV1 nor FM MESSAGING has a documentation so i gotta ask the experts here.
regards
2010 Sep 22 7:41 AM
Thanks for reading, Problem is resolved.
Haivng a look into SAPMV45a how they fill XVBPA i found FM 'SD_PARTNER_READ'
adding this in my coding worked out.
CALL FUNCTION 'SD_PARTNER_READ'
EXPORTING
f_vbeln = gs_vbak-vbeln
TABLES
i_xvbadr = lt_vbadr
i_xvbpa = gt_vbpa.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |