DATA list_tab TYPE TABLE OF abaplist.
DATA : rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab.
DATA: n TYPE i.
DATA: BEGIN OF vlist1 OCCURS 0,
fields1(2048) TYPE c,
END OF vlist1.
DATA: BEGIN OF gs_out,
none TYPE char01,
matnr TYPE matnr,
werks TYPE werks_d,
lgort TYPE lgort_d,
lvorm TYPE char02,
charg TYPE char10,
meins TYPE char03,
labst TYPE char18,
umlme TYPE char18,
insme TYPE char18,
einme TYPE char18,
speme TYPE char18,
retme TYPE char18,
END OF gs_out,
gt_out LIKE TABLE OF gs_out.
rspar_line-selname = 'MATNR'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = '000000000000011241'.
APPEND rspar_line TO rspar_tab.
*MB52'nin programının selection screen ine yukardaki data ları gönderdik. Ve bunun sonucunu memoryye aldık.
SUBMIT rm07mlbs WITH SELECTION-TABLE rspar_tab
EXPORTING LIST TO MEMORY
AND RETURN.
*Memory'den list_tab tablomuza aldık kendi formatında.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
DESCRIBE TABLE list_tab LINES n .
*list_tab internal tablosunu asci formatına çeviriyoruz.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -1
with_line_break = 'X'
TABLES
listasci = vlist1
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
*ASCI'ye çevirdiğimiz internal tablomuzda alanlar '|' ile ayrılmış. Bunu da bizim istediğimiz formata çeviriyoruz.
LOOP AT vlist1.
IF sy-tabix >= 4.
SPLIT vlist1-fields1 AT '|' INTO gs_out-none
gs_out-matnr
gs_out-werks
gs_out-lgort
gs_out-lvorm
gs_out-charg
gs_out-meins
gs_out-labst
gs_out-umlme
gs_out-insme
gs_out-einme
gs_out-speme
gs_out-retme.
APPEND gs_out TO gt_out.
ENDIF.
ENDLOOP.
*CALL FUNCTION 'DISPLAY_LIST'
* EXPORTING
* FULLSCREEN =
* CALLER_HANDLES_EVENTS =
* STARTING_X = 10
* STARTING_Y = 10
* ENDING_X = 60
* ENDING_Y = 20
* IMPORTING
* USER_COMMAND =
TABLES
listobject = list_tab.
* EXCEPTIONS
* EMPTY_LIST = 1
* OTHERS = 2
.
* IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
* CALL FUNCTION 'WRITE_LIST'
* TABLES
* listobject = list_tab.
ENDIF.
DATA : rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab.
DATA: n TYPE i.
DATA: BEGIN OF vlist1 OCCURS 0,
fields1(2048) TYPE c,
END OF vlist1.
DATA: BEGIN OF gs_out,
none TYPE char01,
matnr TYPE matnr,
werks TYPE werks_d,
lgort TYPE lgort_d,
lvorm TYPE char02,
charg TYPE char10,
meins TYPE char03,
labst TYPE char18,
umlme TYPE char18,
insme TYPE char18,
einme TYPE char18,
speme TYPE char18,
retme TYPE char18,
END OF gs_out,
gt_out LIKE TABLE OF gs_out.
rspar_line-selname = 'MATNR'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = '000000000000011241'.
APPEND rspar_line TO rspar_tab.
*MB52'nin programının selection screen ine yukardaki data ları gönderdik. Ve bunun sonucunu memoryye aldık.
SUBMIT rm07mlbs WITH SELECTION-TABLE rspar_tab
EXPORTING LIST TO MEMORY
AND RETURN.
*Memory'den list_tab tablomuza aldık kendi formatında.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
DESCRIBE TABLE list_tab LINES n .
*list_tab internal tablosunu asci formatına çeviriyoruz.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -1
with_line_break = 'X'
TABLES
listasci = vlist1
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
*ASCI'ye çevirdiğimiz internal tablomuzda alanlar '|' ile ayrılmış. Bunu da bizim istediğimiz formata çeviriyoruz.
LOOP AT vlist1.
IF sy-tabix >= 4.
SPLIT vlist1-fields1 AT '|' INTO gs_out-none
gs_out-matnr
gs_out-werks
gs_out-lgort
gs_out-lvorm
gs_out-charg
gs_out-meins
gs_out-labst
gs_out-umlme
gs_out-insme
gs_out-einme
gs_out-speme
gs_out-retme.
APPEND gs_out TO gt_out.
ENDIF.
ENDLOOP.
*CALL FUNCTION 'DISPLAY_LIST'
* EXPORTING
* FULLSCREEN =
* CALLER_HANDLES_EVENTS =
* STARTING_X = 10
* STARTING_Y = 10
* ENDING_X = 60
* ENDING_Y = 20
* IMPORTING
* USER_COMMAND =
TABLES
listobject = list_tab.
* EXCEPTIONS
* EMPTY_LIST = 1
* OTHERS = 2
.
* IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
* CALL FUNCTION 'WRITE_LIST'
* TABLES
* listobject = list_tab.
ENDIF.