Monday, July 22, 2024

Translation of language in Smart Forms.

 Step by Step process to Translate English language to Spanish language in smart form.

1. Go to T-Code SE63 in command bar and then enter.

2. Now select Other Text which highlighted bellow screen shot.

3. After getting the bellow screen double  click on the highlighted text .

4.Give the smart form name in object name and choose source language EN  and target language ES for Spanish as per bellow screen shot.

5. Now Click on the Edit button like bellow.


6.As per disable text  change the converted language text in editable text as per bellow screen shot and finally save it. 
7. After save login the GUI with required language and open smart form t-code and execute the smart form and get the converted language in result.







Thank You.

Wednesday, April 3, 2024

Base64 Text data upload and download in PNG format.

 


DATALV_BASE64_STRING(10000TYPE C,
      LT_BYTE_TABLE           TYPE TABLE OF SOLIX,
      BINARY_TAB              TYPE TABLE OF SOLIX,
      LW_BINARY_TAB           TYPE SOLIX,
      LV_PNG                  TYPE XSTRING.
DATA GV_STRING  TYPE STRING .
DATALV_FILENAME      TYPE STRING,
      LV_FILENAME_1    TYPE STRING,
      LV_FILE_CONTENTS TYPE STRING,
      LT_FILE_CONTENTS TYPE TABLE OF STRING.
DATA:XSTR_CONTENT TYPE XSTRING.
DATA GT_BINARY TYPE TABLE OF BAPICONTEN.
DATA LT_TAB TYPE TABLE OF SWASTRTAB.
DATA GT_STR TYPE TABLE OF STRING.

PERFORM READ_FILE.
FORM READ_FILE.

DATA LV_XSTRING TYPE XSTRING.
DATA LV_IMAGE TYPE XSTRING.
DATALO_HTTP_CLIENT       TYPE REF TO IF_HTTP_CLIENT,
      LV_URL               TYPE STRING,
      LV_JSON_X            TYPE XSTRING,
      LV_RESPONSE          TYPE STRING,
      LV_RESPONSE_2(10000TYPE C.

LV_FILENAME 'C:\Users\user\Desktop\TESTTTT.txt'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
  FILENAME                LV_FILENAME
IMPORTING
  FILELENGTH              LEN
  HEADER                  XSTR_CONTENT
TABLES
  DATA_TAB                LT_FILE_CONTENTS
EXCEPTIONS
  FILE_OPEN_ERROR         1
  FILE_READ_ERROR         2
  NO_BATCH                3
  GUI_REFUSE_FILETRANSFER 4
  INVALID_TYPE            5
  NO_AUTHORITY            6
  UNKNOWN_ERROR           7
  BAD_DATA_FORMAT         8
  HEADER_NOT_ALLOWED      9
  SEPARATOR_NOT_ALLOWED   10
  HEADER_TOO_LONG         11
  UNKNOWN_DP_ERROR        12
  ACCESS_DENIED           13
  DP_OUT_OF_MEMORY        14
  DISK_FULL               15
  DP_TIMEOUT              16
  OTHERS                  17.

IF SY-SUBRC 0.
  LOOP AT LT_FILE_CONTENTS INTO LV_FILE_CONTENTS.
    CONCATENATE GV_STRING  LV_FILE_CONTENTS INTO GV_STRING.
  ENDLOOP.

  CALL FUNCTION 'SCMS_BASE64_DECODE_STR'
    EXPORTING
      INPUT  GV_STRING
*     UNESCAPE       = 'X'
    IMPORTING
      OUTPUT LV_XSTRING
    EXCEPTIONS
      FAILED 1
      OTHERS 2.

  IF SY-SUBRC 0.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        BUFFER     LV_XSTRING
      TABLES
        BINARY_TAB LT_BYTE_TABLE
      EXCEPTIONS
        FAILED     1
        OTHERS     2.

    IF SY-SUBRC 0.
      LV_FILENAME_1 'C:\Users\user\Desktop\Test.png'
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                LV_FILENAME_1
          FILETYPE                'BIN'
        TABLES
          DATA_TAB                LT_BYTE_TABLE
        EXCEPTIONS
          FILE_WRITE_ERROR        1
          NO_BATCH                2
          GUI_REFUSE_FILETRANSFER 3
          INVALID_TYPE            4
          NO_AUTHORITY            5
          UNKNOWN_ERROR           6
          HEADER_NOT_ALLOWED      7
          SEPARATOR_NOT_ALLOWED   8
          FILESIZE_NOT_ALLOWED    9
          HEADER_TOO_LONG         10
          DP_ERROR_CREATE         11
          DP_ERROR_SEND           12
          DP_ERROR_WRITE          13
          UNKNOWN_DP_ERROR        14
          ACCESS_DENIED           15
          DP_OUT_OF_MEMORY        16
          DISK_FULL               17
          DP_TIMEOUT              18
          FILE_NOT_FOUND          19
          DATAPROVIDER_EXCEPTION  20
          CONTROL_FLUSH_ERROR     21
          OTHERS                  22.
    ENDIF.
  ENDIF.
ENDIF.

ENDFORN.




Sunday, January 28, 2024

Dynamic ALV Report .

REPORT ZSR_DYNAMIC_RPT1.

TABLESCEPCACDOCA.

DATAIT_TABLE TYPE TABLE OF ZTABLE,
      WA_TABLE TYPE   ZTABLE.

TYPESBEGIN OF TY_DATA,
         PRCTR TYPE CEPC-PRCTR,
         KOKRS TYPE CEPC-KOKRS,
       END OF TY_DATA.

TYPESBEGIN OF TY_ACDOCA,
         RACCT TYPE ACDOCA-RACCT,
         PRCTR TYPE ACDOCA-PRCTR,
         DRCRK TYPE ACDOCA-DRCRK,
         TSL   TYPE ACDOCA-TSL,
       END OF TY_ACDOCA.

DATAIT_ACDOCA1 TYPE TABLE OF TY_ACDOCA,
      WA_ACDOCA1 TYPE TY_ACDOCA.

TYPESBEGIN OF TY_ACDOCA2,
         RACCT TYPE ACDOCA-RACCT,
         PRCTR TYPE ACDOCA-PRCTR,
         TSL   TYPE ACDOCA-TSL,
       END OF TY_ACDOCA2.
DATAIT_ACDOCA2 TYPE TABLE OF TY_ACDOCA2,
      WA_ACDOCA2 TYPE TY_ACDOCA2.

DATAIT_ACDOCA3 TYPE TABLE OF TY_ACDOCA2,
      WA_ACDOCA3 TYPE TY_ACDOCA2.

DATA:
  IT_DATA TYPE TABLE OF TY_DATA,
  WA_DATA TYPE TY_DATA.

DATAIT_FCAT TYPE  LVC_T_FCAT,
      WA_FCAT TYPE LVC_S_FCAT,
      LS_LAYO TYPE LVC_S_LAYO.

DATALV_LINES TYPE CHAR2,
      LV_INDEX TYPE CHAR2.

DATALV_POS TYPE I.
DATAFIELDNAME(20)  TYPE C,
      FIELDVALUE(60TYPE C.

FIELD-SYMBOLS <T_DYNTABLE>  TYPE STANDARD TABLE,
                <FS_DYNTABLE> TYPE ANY,
                <FS_DYT>      TYPE ANY,
                <FS1>         TYPE ANY.

FIELD-SYMBOLS <T_DATA>      TYPE TABLE.
FIELD-SYMBOLS:  <FS_FINAL>    TYPE ANY.

DATAT_NEWTABLE TYPE REF TO DATA,
      T_NEWLINE  TYPE REF TO DATA.


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
  SELECT-OPTIONS :
   S_KOKRS FOR CEPC-KOKRS OBLIGATORY.",
*   S_BUDAT FOR CEPC-ERSDA.
SELECTION-SCREEN END OF BLOCK B1.

START-OF-SELECTION.
  PERFORM FETCH_DATA.
  PERFORM DISPLAY.
*&---------------------------------------------------------------------*
*& Form Fetch_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FETCH_DATA .
  REFRESH IT_DATA[].
  SELECT  PRCTRKOKRS FROM CEPC INTO TABLE @IT_DATA
     WHERE KOKRS IN @S_KOKRS.

  IF SY-SUBRC EQ 0.
    SORT IT_DATA ASCENDING BY KOKRS .
    DESCRIBE TABLE IT_DATA LINES LV_LINES.
  ELSE.
    LEAVE LIST-PROCESSING.
  ENDIF.

  REFRESH IT_TABLE[].
  SELECT FROM   ZTABLE INTO TABLE @IT_TABLE.
  IF IT_TABLE IS NOT INITIAL.
    SORT IT_TABLE BY GLNUMBER.

    SELECT RACCT,PRCTR,DRCRK,TSL FROM ACDOCA
                  INTO TABLE @DATA(IT_ACDOCA)
                  FOR ALL ENTRIES IN  @IT_TABLE
                  WHERE RBUKRS IN @S_KOKRS
                    AND RACCT @IT_TABLE-GLNUMBER.

    IF SY-SUBRC EQ 0.
      SORT IT_ACDOCA  ASCENDING BY RACCT.

      LOOP AT IT_ACDOCA INTO DATA(WA_ACDOCA).
        IF WA_ACDOCA-DRCRK 'H'.
          COLLECT WA_ACDOCA INTO IT_ACDOCA1 ASSIGNING FIELD-SYMBOL(<LFS>).
          CLEAR:WA_ACDOCA.
        ELSEIF WA_ACDOCA-DRCRK 'S'.
          COLLECT WA_ACDOCA INTO IT_ACDOCA1 ASSIGNING FIELD-SYMBOL(<LFS1>).
          CLEAR:WA_ACDOCA.
        ENDIF.
      ENDLOOP.

      IF IT_ACDOCA1 IS NOT INITIAL.
        SORT IT_ACDOCA1 ASCENDING BY  RACCT.
        DELETE  IT_ACDOCA1[] WHERE PRCTR IS INITIAL  .

        LOOP AT IT_ACDOCA1 INTO WA_ACDOCA1.
          MOVE-CORRESPONDING WA_ACDOCA1 TO WA_ACDOCA2 .
          COLLECT WA_ACDOCA2 INTO IT_ACDOCA2 .
          CLEARWA_ACDOCA1,WA_ACDOCA2.
          IT_ACDOCA3[] IT_ACDOCA2[].
        ENDLOOP.

      ENDIF.

    ENDIF.

*********************************

    READ TABLE IT_TABLE INTO WA_TABLE INDEX 1.
    WA_FCAT-FIELDNAME 'NAME'.
    WA_FCAT-COLTEXT 'NAME'.
    WA_FCAT-OUTPUTLEN '15'.
    APPEND WA_FCAT TO IT_FCAT.
    CLEAR:WA_FCAT,WA_TABLE.

    LOOP AT IT_ACDOCA2 INTO WA_ACDOCA2.
      READ TABLE IT_DATA INTO WA_DATA WITH KEY PRCTR WA_ACDOCA2-PRCTR.
      WA_FCAT-FIELDNAME WA_DATA-PRCTR.
      CONDENSE WA_FCAT-FIELDNAME NO-GAPS.
      WA_FCAT-COLTEXT WA_DATA-PRCTR.
      WA_FCAT-OUTPUTLEN '10'.
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR:WA_FCAT.
    ENDLOOP.
  ENDIF.

*****CREATE DYNAMIC INTERNAL TABLE

  CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    EXPORTING
      IT_FIELDCATALOG           IT_FCAT
    IMPORTING
      EP_TABLE                  T_NEWTABLE
    EXCEPTIONS
      GENERATE_SUBPOOL_DIR_FULL 1
      OTHERS                    2.
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

  ASSIGN T_NEWTABLE->TO <T_DYNTABLE>.                        "Assign field symbol to dynamic internal table.
  CREATE DATA T_NEWLINE LIKE LINE OF <T_DYNTABLE>.
  ASSIGN T_NEWLINE->TO <FS_DYNTABLE>.                        "Assign field symbol to dynamic work area.

  LOOP AT IT_TABLE INTO WA_TABLE .

    CLEAR:FIELDNAME,FIELDVALUE.
    FIELDNAME  'NAME'.
    FIELDVALUE =  WA_TABLE-NAME.
    CONDENSE FIELDVALUE.
    ASSIGN COMPONENT FIELDNAME  OF STRUCTURE <FS_DYNTABLE> TO <FS1>.
    <FS1> FIELDVALUE.

*    APPEND <FS_DYNTABLE> TO <T_DYNTABLE>.
*    CLEAR:WA_TABLE.
*  ENDLOOP.

    READ TABLE IT_ACDOCA3 INTO WA_ACDOCA3 WITH KEY RACCT WA_TABLE-GLNUMBER.
    READ TABLE  IT_DATA INTO WA_DATA WITH KEY PRCTR WA_ACDOCA3-PRCTR   .
    IF SY-SUBRC EQ 0.
      LOOP AT IT_ACDOCA2 INTO WA_ACDOCA2 WHERE  RACCT WA_TABLE-GLNUMBER ."AND PRCTR = WA_DATA-PRCTR.


        CLEAR:FIELDNAME,FIELDVALUE.
        FIELDNAME WA_DATA-PRCTR.
        CONDENSE FIELDNAME NO-GAPS.

        FIELDVALUE =  WA_ACDOCA2-TSL.
        CONDENSE FIELDVALUE.
        ASSIGN COMPONENT FIELDNAME  OF STRUCTURE <FS_DYNTABLE> TO <FS1>.
        <FS1> FIELDVALUE.


        APPEND <FS_DYNTABLE> TO <T_DYNTABLE>.

        CLEARWA_ACDOCA2,FIELDVALUE,FIELDNAME.
        CLEAR:<FS_DYNTABLE>.
      ENDLOOP.
    ELSE.
      APPEND <FS_DYNTABLE> TO <T_DYNTABLE>.
    ENDIF.
    CLEAR:WA_DATA,WA_TABLE.

  ENDLOOP.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM DISPLAY .
  LS_LAYO-ZEBRA 'X'.
  LS_LAYO-COL_OPT ='X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      I_CALLBACK_PROGRAM 'SY-REPID'
      IS_LAYOUT_LVC      LS_LAYO
      IT_FIELDCAT_LVC    IT_FCAT[]
      I_DEFAULT          'X'
      I_SAVE             'A'
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB           <T_DYNTABLE>
    EXCEPTIONS
      PROGRAM_ERROR      1
      OTHERS             2.
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.




Translation of language in Smart Forms.

  Step by Step process to Translate English language to Spanish language in smart form. 1. Go to T-Code SE63 in command bar and then enter. ...