Skip to Content
-1

TO MAP segment Filed

Feb 19 at 06:50 AM

47

avatar image
Former Member

Hi All Expert ,

I have Requirement for send vendor master data through Idocs, I had created on report , l have send data for few field called lifnr bukrs banka smtp_addr bankl this field have to send , for this i am using cremas02 for idos type and E1LFBIM segment .

In segment have multiple field how i have to map to relevant filed like lifnr to lifnr and bukrs to bukrs .

i had created report by that idocs number is generated but data is not map properly it going to first filed and then second and so on but my all required field in not same order

Please suggest me how to mapped to segment field to required fied.

please see my code .

I wait for all your valuable Responses .

Thansks

types : BEGIN OF ty_lfb1, LIFNR type LFB1-LIFNR, BUKRS TYPE lfb1-BUKRS, AD_HASH TYPE lfb1-AD_HASH, END OF ty_lfb1.

DATA : s_ctrl_rec TYPE edidc, "Idoc Control Record s_zsegment TYPE E1LFA1M. "IDOC Segment

DATA : lt_edidd TYPE TABLE OF edidd, "Data Records

it_temp_edi TYPE TABLE OF edidd, "Data Records

wa_edidd TYPE edidd. "Data Records

DATA : lt_comm_idoc TYPE TABLE OF edidc, "Generated Communication IDOc ls_comm_idoc TYPE edidc.

data : lt_lfb1 TYPE TABLE OF ty_lfb1.

data : ls_lfb1 TYPE ty_lfb1.

data t_lifnr TYPE lifnr.

select-OPTIONS so_lifnr for t_lifnr.

start-OF-SELECTION.

select * FROM lfb1 into CORRESPONDING FIELDS OF TABLE lt_lfb1 where lifnr in so_lifnr.

loop at lt_lfb1 into ls_lfb1.

wa_edidd-SEGNAM = 'E1LFB1M'.

CONCATENATE ls_lfb1-lifnr ls_lfb1-bukrs INTO wa_edidd-SDATA RESPECTING BLANKS.

append wa_edidd to lt_edidd . ENDLOOP.

ls_comm_idoc-SNDPRT = 'LS'.

ls_comm_idoc-SNDPRN = 'PI001'.

ls_comm_idoc-MESTYP = 'CREMAS'.

ls_comm_idoc-IDOCTP = 'CREMAS02'.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

  • EXPORTING MASTER_IDOC_CONTROL = ls_comm_idoc
  • * OBJ_TYPE = ''
  • * CHNUM =
  • '' TABLES COMMUNICATION_IDOC_CONTROL = lt_comm_idoc MASTER_IDOC_DATA = lt_edidd
  • * EXCEPTIONS
  • * ERROR_IN_IDOC_CONTROL =
  • 1 * ERROR_WRITING_IDOC_STATUS =
  • 2 * ERROR_IN_IDOC_DATA =
  • 3 * SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
  • * OTHERS = 5 . IF SY-SUBRC <> 0.
  • * Implement suitable error handling here
  • ENDIF.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers